commit
stringlengths 40
40
| subject
stringlengths 1
3.25k
| old_file
stringlengths 4
311
| new_file
stringlengths 4
311
| old_contents
stringlengths 0
26.3k
| lang
stringclasses 3
values | proba
float64 0
1
| diff
stringlengths 0
7.82k
|
---|---|---|---|---|---|---|---|
2b43f59ee48cbf868efb2bcf15113c8025cb0541
|
update prompt options test to use setup function
|
test/promptOptionsSpec.js
|
test/promptOptionsSpec.js
|
var chai = require('chai');
var expect = chai.expect;
var promptOptionsModule = require('../bin/promptOptions');
chai.should();
describe('As a user of the promptOptions module', function() {
it('should return an object', function() {
var test = promptOptionsModule;
expect(test).to.be.a('object');
})
describe('When using getNewCommandPromptOptions()', function() {
it('should be a function', function() {
var test = promptOptionsModule.getNewCommandPromptOptions;
expect(test).to.be.a('function');
})
it('should return an array', function(done) {
promptOptionsModule
.getNewCommandPromptOptions()
.then(function(promptOptions) {
expect(promptOptions instanceof Array).to.be.true;
done();
})
})
it('should return an array that is not empty', function(done) {
promptOptionsModule
.getNewCommandPromptOptions()
.then(function(promptOptions) {
expect(promptOptions.length).to.be.above(1);
done();
})
})
})
})
|
JavaScript
| 0 |
@@ -390,24 +390,148 @@
nction() %7B%0A%0A
+ before(function() %7B%0A promptOptionsModule.setup(%7B%0A silent: true%0A %7D)%0A %7D)%0A%0A
it('
|
6eaa067167e2e8809924a3edf36e1f3deedd83bf
|
fix tablo assert on children
|
src/tablo/Tablo.js
|
src/tablo/Tablo.js
|
import React from 'react';
import cx from 'classnames';
import { pure, skinnable, props, t } from '../utils';
import { Table } from 'fixed-data-table-2';
import Column, { defaultColumns, updateColumns } from './Column';
import FlexView from 'react-flexview';
const { maybe } = t;
/** A table component based on fixed-data-table-2
* @param data - data shown in the table
* @param width - the desired width of the table. Unless autosize is false, this can be left undefined
* @param height - the desired height of the table. Unless autosize is false, this can be left undefined
* @param rowHeight - height in pixel of every row
* @param headerHeight - height in pixel of header
* @param groupHeaderHeight - height in pixel of groupHeader
* @param footerHeight - height in pixel of footer
* @param onRowMouseEnter - callback to be called when mouse enters a row
* @param onRowMouseLeave - callback to be called when mouse leaves a row
* @param autosize - wheater the table should resize to fit the available space. Default true.
* @param columnsOrder - an array containing the ordered list of column names, in the same order they should be rendered
* @param onColumnsReorder - callback to be called when the order of columns changes after dragging an header in a new position
* @param onColumnResize - callback to be called when a column is resized
* @param children - table children (Column or ColumnGroup)
* @param scrollLeft - value of horizontal scroll
* @param scrollTop - value of vertical scroll
* @param onScrollStart - callback to be called when scrolling starts
* @param onScrollEnd - callback to be called when scrolling ends
* @param selectedRows - the list of selected row ids
* @param onRowsSelect - callback to be called when the currently selected rows change
* @param selectionType - single = only one selected row at a time, multi = multiple selection, none = selection disabled
* @param hoveredRowIndex - the id of the hovered row
* @param onHoverRowChange - callback to be called when the hovered row changes
* @param sortBy - id of the column according which the data should be ordered
* @param sortDir - sorting direction
* @param onSortChange - callback to be called when sorting change
*
* @param scrollToRow - Private
* @param onRowClick - Private
* @param rowClassNameGetter - Private
* @param onColumnResizeEndCallback - Private
* @param isColumnResizing - Private
*/
@skinnable()
@pure
@props({
// public
className: maybe(t.String),
data: t.Array,
width: t.Number,
height: t.Number,
rowHeight: maybe(t.Number),
headerHeight: maybe(t.Number),
groupHeaderHeight: maybe(t.Number),
footerHeight: maybe(t.Number),
onRowMouseEnter: maybe(t.Function),
onRowMouseLeave: maybe(t.Function),
scrollLeft: maybe(t.Integer),
scrollTop: maybe(t.Integer),
onScrollStart: maybe(t.Function),
onScrollEnd: maybe(t.Function),
children: t.ReactChildren,
// private
scrollToRow: maybe(t.Integer),
onRowClick: maybe(t.Function),
rowClassNameGetter: maybe(t.Function),
onColumnResizeEndCallback: maybe(t.Function),
isColumnResizing: maybe(t.Boolean)
})
export default class Tablo extends React.Component {
static defaultProps = {
rowHeight: 30,
headerHeight: 40,
groupHeaderHeight: 50,
footerHeight: 0
}
getLocals({ data, children, ...tableProps }) {
const columnsOrGroups = updateColumns(children || defaultColumns(data), ({ col }) => {
return <Column {...{ key: col.props.name, ...col.props, data }} />;
}).map((ch, key) => ch.type({ key, ...ch.props }));
t.assert(
columnsOrGroups.length === ([].concat(children) || Object.keys).length,
'There are extraneous children in the Grid. One should use only Column or ColumnGroup'
);
const rowsCount = data.length;
return {
columnsOrGroups,
rowsCount,
...tableProps
};
}
template({ columnsOrGroups, className, ...tableProps }) {
return (
<FlexView column grow className={cx('tablo', className)}>
<Table {...tableProps}>
{columnsOrGroups}
</Table>
</FlexView>
);
}
}
|
JavaScript
| 0 |
@@ -3620,17 +3620,16 @@
gth ===
-(
%5B%5D.conca
@@ -3638,17 +3638,16 @@
children
-)
%7C%7C Obje
@@ -3653,16 +3653,25 @@
ect.keys
+(data%5B0%5D)
).length
|
8a481898748f23b369a3100137b098b89f782ebd
|
test update
|
test/resumableFileSpec.js
|
test/resumableFileSpec.js
|
describe('ResumableFile functions', function() {
/**
* @type {Resumable}
*/
var resumable;
/**
* @type {ResumableFile}
*/
var file;
beforeEach(function () {
resumable = new Resumable({
});
file = new resumable.ResumableFile(resumable, {
name: 'image.jpg',
type: 'image/png'
});
});
it('should get type', function() {
expect(file.getType()).toBe('png');
file.file.type = '';
expect(file.getType()).toBe('');
});
it('should get extension', function() {
expect(file.name).toBe('image.jpg');
expect(file.getExtension()).toBe('jpg');
file.name = '';
expect(file.getExtension()).toBe('');
file.name = 'image';
expect(file.getExtension()).toBe('');
file.name = '.dwq.dq.wd.qdw.E';
expect(file.getExtension()).toBe('e');
});
});
|
JavaScript
| 0.003605 |
@@ -243,17 +243,17 @@
e = new
-r
+R
esumable
|
80289afc2d448c1c7ff07d574838ee65e60886f6
|
simplify style reset
|
imagebox.js
|
imagebox.js
|
;(function() {
function isNullOrUndefined(o) {
return typeof o === 'undefined' || o === null;
}
function hasClass(el, className) {
return el.className.match(new RegExp('(^| )' + className + '( |$)'));
}
function isValidImageDimension(num) {
return !isNullOrUndefined(num) && !isNaN(num) && num > 0;
}
var raf = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
window.setTimeout(callback, 1000 / 60);
};
function ImageBox(el, options) {
var self = this;
options = options || {};
if (typeof el === "string") {
el = document.querySelector(el);
}
this.container = el;
if (isNullOrUndefined(this.container)) {
throw new Error("No container element specified.");
}
this.image = el.querySelector("img");
if (isNullOrUndefined(this.image)) {
throw new Error("No <img> found inside container element.");
}
this.imageWidth = options.imageWidth || parseInt(this.image.getAttribute('data-width') || this.image.width);
this.imageHeight = options.imageHeight || parseInt(this.image.getAttribute('data-height') || this.image.height);
if (!isValidImageDimension(this.imageWidth) || !isValidImageDimension(this.imageHeight)) {
throw new Error("Must specify image width and height.");
}
this.scalingType = options.scalingType || "fit";
if(!hasClass(this.container, "imagebox-container")) {
this.container.className += " imagebox-container";
}
window.addEventListener('resize', function(){
self.resize();
}, false);
this.resize();
}
ImageBox.prototype.setScalingType = function(scalingType) {
this.scalingType = scalingType;
this.resize();
};
ImageBox.prototype.resize = function() {
var self = this;
raf(function() {
self.resetStyles();
self[self.scalingType]();
});
};
ImageBox.prototype.stretch = function() {
this.image.style.width = this.container.offsetWidth + "px";
this.image.style.height = this.container.offsetHeight + "px";
};
ImageBox.prototype.horizontalOverflowFill = function() {
this.image.style.width = this.container.offsetWidth + "px";
var resizedImageHeight = (this.container.offsetWidth / this.imageWidth) * this.imageHeight;
this.verticallyCenter(resizedImageHeight);
};
// Equivalent of CSS background-size: cover
ImageBox.prototype.fill = function() {
this.container.style.overflow = "hidden";
this.image.style.position = "relative";
this.image.style.minWidth = this.container.offsetWidth + "px";
this.image.style.minHeight = this.container.offsetHeight + "px";
if (this.image.width > this.container.offsetWidth) {
var left = (this.image.width - this.container.offsetWidth) / -2;
this.image.style.left = left + "px";
}
if (this.image.height > this.container.offsetHeight) {
var top = (this.image.height - this.container.offsetHeight) / -2;
this.image.style.top = top + "px";
}
};
ImageBox.prototype.fit = function() {
var newPaddingTop = 0,
newWidth = this.imageWidth,
newHeight = this.imageHeight,
containerWidth = this.container.offsetWidth,
containerHeight = this.container.offsetHeight,
imageAspectRatio = this.imageWidth / this.imageHeight;
var containerAspectRatio = containerWidth / containerHeight;
if (imageAspectRatio >= containerAspectRatio) {
if (this.imageWidth >= containerWidth) {
newWidth = containerWidth;
newHeight = this.imageHeight * (containerWidth / this.imageWidth);
}
}
else {
if (this.imageHeight >= containerHeight) {
newWidth = this.imageWidth * (containerHeight / this.imageHeight);
newHeight = containerHeight;
}
}
if (newHeight < containerHeight) {
newPaddingTop = (containerHeight - newHeight) / 2;
}
this.image.style.width = newWidth + "px";
this.image.style.height = newHeight + "px";
this.verticallyCenter(newHeight);
};
ImageBox.prototype.verticallyCenter = function(resizedImageHeight) {
var newPaddingTop = 0,
containerHeight = this.container.offsetHeight;
if(resizedImageHeight < containerHeight) {
newPaddingTop = (containerHeight - resizedImageHeight) / 2;
}
this.image.style.paddingTop = newPaddingTop + "px";
};
ImageBox.prototype.resetStyles = function() {
// Reset styles that may be set from previous resize
this.container.style.overflow = "";
this.image.style.position = "";
this.image.style.top = "";
this.image.style.left = "";
this.image.style.height = "";
this.image.style.width = "";
this.image.style.paddingTop = "";
this.image.style.minHeight = "";
this.image.style.minWidth = "";
};
if (typeof module === 'object' && typeof module.exports === 'object') {
// CommonJS
module.exports = exports = ImageBox;
}
else if (typeof define === 'function' && define.amd) {
// AMD
define(function () { return ImageBox; });
}
else {
window.ImageBox = ImageBox;
}
})();
|
JavaScript
| 0.000003 |
@@ -4626,280 +4626,211 @@
-this.image.style.position = %22%22;%0A this.image.style.top = %22%22;%0A this.image.style.left = %22%22;%0A this.image.style.height = %22%22;%0A this.image.style.width = %22%22;%0A this.image.style.paddingTop = %22%22;%0A this.image.style.minHeight = %22%22;%0A this.image.style.minWidth = %22%22;
+var attributes = %5B%22position%22, %22top%22, %22left%22, %22height%22, %22width%22, %22paddingTop%22, %22minHeight%22, %22minWidth%22%5D;%0A for (var i = 0; i %3C attributes.length; i++) %7B%0A this.image.style%5Battributes%5Bi%5D%5D = %22%22;%0A %7D
%0A %7D
|
aa98b3e0fd18f0b6f3672d7ea223f7be40a7d8da
|
Fix selectors
|
diningin.js
|
diningin.js
|
/**
Jonathan Stassen - June 2015
https://github.com/TheBox193/diningin-enhancements
Feature requests: send a Slack, Email, or PR
A quick set of enhancmetns to dingingin.com
Eat it up!
**/
// var TAX = 0.1248;
var TAX = 0.105;
var options;
function menuHighlight() {
$(".menu-item").each(function(){
var t=$(this).closest("tr"),
price = getPriceByEl( t ),
priceWithTax = Number( price * ( 1 + TAX ) ).toFixed(2);
if( priceWithTax <= ( Number(options.doHighlightUnderValue) || 11 ) )
t.css("background-color","lightblue");
});
}
function fixCheckout() {
var chekcoutButton = $(".ibtnContinueBtnBev")[0];
if(chekcoutButton && chekcoutButton !== "/checkout") {
chekcoutButton.href = "/checkout";
}
}
function getLoved() {
var loved = [];
$("#MostedLoved .menu-item-data").each(function(){
loved.push(parseInt(this.textContent, 10));
});
return loved;
}
function setLoved(id) {
getMenuItemElById(id)
.find('.ItemName')
.prepend('<span style="position: absolute; left: -4px;">❤️</span>');
}
function getPriceByEl(el) {
return el.find(".ItemCost").text().replace(/[^0-9\.]+/g,"");
}
function getPriceById(id) {
return getPriceByEl( getMenuItemElById(id) );
}
function getMenuItemElById(id) {
return $('#'+id).closest("tr");
}
function showLoved() {
var loved = getLoved();
$.each(loved, function(index, id) {
setLoved(id);
});
}
function removeExtraneousElements() {
var elementsToRemove = [
/** Calendar */
"#spnAddressInfo", // address
"#MPSContent > #tabnav", // tabs
"#mps_time_header_container", // delivery time
/** Cart */
"#ctl00_pageContentPlaceholder_cart_pnlTimeCart1", // delivery time
"#menu_delivery_address", // address
/** Menu */
"#ctl00_pageContentPlaceholder_CRestaurantTopBar_imgIsPremier", // premier badge
"#DIVAlertNote", // food alergies
"#spnCategoryDDL", // catagory label
// "#MenuPageMenu li:contains('ZAGAT')", // Zagat
// "#MenuPageMenu li:contains('TIMES')", // Restraunt Times
"#RestMenu td:contains('no prices')", // no prices pdf
/** Checkout */
"#payment_info_title_container", // label
".tip_container", // tip
"#pnlStepTipsCoupons .clear", // paddings
"#menu_your_order_delivery_time", // delivery time
".phone_number_email_container_item2 .email-receipts-message", // going green
".checkout_left_container_mid_payment_method #menu_delivery_time", // delivery time
".checkout_left_container_mid_payment_method #menu_delivery_loc", // delivery location
".checkout_left_container_mid_payment_method .delivery_instructions_for_driver_container:first", // number of people
".checkout_left_container_mid_payment_method #select_payment_method_container:contains('following options')", // number of people
"#divPaymentContainer span:contains('is this')", // 'what is this'
"#CartContainer #ctl01_pnlOrderPaymentMsg", // false positive success before success checkout
".tip_coupon_gift_certificates_title", // delivery instructions title
"#pnlStepDeliveryInfo .checkout_left_container", // delivery instructions
/** Footer */
"#footer_container", // Footer
"#InnerFooter_Container", // Footer
];
elementsToRemove.map(removeElement);
}
function removeExtraneousMenuSections() {
var elementsToRemove = [
".MenuList:contains('12 Cans of Diet Coke')", // Beverages
".MenuList:contains('Large Catering Tongs')", // Options
".MenuList:contains('Single Use Canned Heat')", // Service Items
];
elementsToRemove.map(removeElement);
}
function removeElement(el) {
var $el = $(el) ;
if ($el) {
$el.remove();
}
}
chrome.storage.sync.get({
doHighlightUnder: true,
doHighlightUnderValue: 11,
doShowHearts: true,
doSkipDrinks: true,
doRemoveExtraneousElements: false,
doRemoveExtraneousMenuSections: false,
doRemoveBackground: true
}, function(items) {
options = items;
$(function() {
setup();
});
});
function setup() {
if (options.doRemoveBackground) {
document.body.style.background = 'white';
}
if (options.doHighlightUnder) {
menuHighlight();
}
if (options.doShowHearts) {
showLoved();
}
if (options.doSkipDrinks) {
window.setInterval(fixCheckout, 250);
}
if (options.doRemoveExtraneousElements) {
removeExtraneousElements();
}
if (options.doRemoveExtraneousMenuSections) {
removeExtraneousMenuSections();
}
}
|
JavaScript
| 0.000003 |
@@ -2033,16 +2033,48 @@
ces pdf%0A
+%09%09%22#MostedLoved%22, // Most loved%0A
%0A%0A%09%09/**
@@ -2603,19 +2603,18 @@
ner:
-fir
+la
st%22, //
numb
@@ -2609,32 +2609,46 @@
st%22, //
-number of people
+driver instructions (optional)
%0A%09%09%22.che
@@ -3012,84 +3012,8 @@
itle
-%0A%09%09%22#pnlStepDeliveryInfo .checkout_left_container%22, // delivery instructions
%0A%0A%09%09
|
a1b1f775f5924878627943fb417e20f8cf90b418
|
Set an explicit pathLength on the donut chart circle
|
lib/views/donut-chart.js
|
lib/views/donut-chart.js
|
import React from 'react';
import PropTypes from 'prop-types';
import {autobind} from '../helpers';
export default class DonutChart extends React.Component {
static propTypes = {
baseOffset: PropTypes.number,
slices: PropTypes.arrayOf(
PropTypes.shape({
type: PropTypes.string,
className: PropTypes.string,
count: PropTypes.number,
}),
),
}
static defaultProps = {
baseOffset: 25,
}
constructor(props) {
super(props);
autobind(this, 'renderArc');
}
render() {
const {slices, baseOffset, ...others} = this.props; // eslint-disable-line no-unused-vars
const arcs = this.calculateArcs(slices);
return (
<svg {...others}>
{arcs.map(this.renderArc)}
</svg>
);
}
calculateArcs(slices) {
const total = slices.reduce((acc, item) => acc + item.count, 0);
let lengthSoFar = 0;
return slices.map(({count, ...others}) => {
const piece = {
length: count / total * 100,
position: lengthSoFar,
...others,
};
lengthSoFar += piece.length;
return piece;
});
}
renderArc({length, position, type, className}) {
return (
<circle
key={type}
cx="21"
cy="21"
r="15.91549430918954"
fill="transparent"
className={`donut-ring-${type}`}
strokeWidth="3"
strokeDasharray={`${length} ${100 - length}`}
strokeDashoffset={`${100 - position + this.props.baseOffset}`}
/>
);
}
}
|
JavaScript
| 0.000001 |
@@ -1347,24 +1347,49 @@
g-$%7Btype%7D%60%7D%0A
+ pathLength=%22100%22%0A
stro
|
8c3a55eb5886fb9f4e8823f9b390c5204c875005
|
Use blob to allow larger downloads
|
src/tracker/dom.js
|
src/tracker/dom.js
|
var DOM = (function(){
var setupTimerFunction = function(setFunc, clearFunc, callback, time){
var obj = {
cancel: function(){
if (this.isActive){
clearFunc(this.id);
this.isActive = false;
}
},
start: function(){
if (!this.isActive){
this.id = setFunc(this._callback.bind(obj), this._time);
this.isActive = true;
}
},
_callback: callback,
_time: time
};
obj.start();
return obj;
};
return {
/*
* Returns a child element by its ID. Parent defaults to the entire document.
*/
id: function(id, parent){
return (parent || document).getElementById(id);
},
/*
* Returns an array of all child elements containing the specified class. Parent defaults to the entire document.
*/
cls: function(cls, parent){
return Array.prototype.slice.call((parent || document).getElementsByClassName(cls));
},
/*
* Returns an array of all child elements that have the specified tag. Parent defaults to the entire document.
*/
tag: function(tag, parent){
return Array.prototype.slice.call((parent || document).getElementsByTagName(tag));
},
/*
* Creates an element, adds it to the DOM, and returns it.
*/
createElement: function(tag, parent){
var ele = document.createElement(tag);
parent.appendChild(ele);
return ele;
},
/*
* Removes an element from the DOM.
*/
removeElement: function(ele){
ele.parentNode.removeChild(ele);
},
/*
* Creates a new style element with the specified CSS contents and returns it.
*/
createStyle: function(styles){
var ele = document.createElement("style");
ele.setAttribute("type", "text/css");
document.head.appendChild(ele);
styles.forEach(function(style){
ele.sheet.insertRule(style, 0);
});
return ele;
},
/*
* Runs a callback function after a set amount of time. Returns an object which contains several functions and properties for easy management.
*/
setTimer: function(callback, timeout){
return setupTimerFunction(window.setTimeout, window.clearTimeout, callback, timeout);
},
/*
* Runs a callback function periodically after a set amount of time. Returns an object which contains several functions and properties for easy management.
*/
setInterval: function(callback, interval){
return setupTimerFunction(window.setInterval, window.clearInterval, callback, interval);
},
/*
* Triggers a UTF-8 text file download.
*/
downloadTextFile: function(fileName, fileContents){
var ele = document.createElement("a");
ele.setAttribute("href", "data:text/plain;charset=utf-8,"+encodeURIComponent(fileContents));
ele.setAttribute("download", fileName);
ele.style.display = "none";
document.body.appendChild(ele);
ele.click();
document.body.removeChild(ele);
}
};
})();
|
JavaScript
| 0 |
@@ -2784,35 +2784,33 @@
nts)%7B%0A var
-ele
+a
= document.crea
@@ -2835,226 +2835,243 @@
-ele.setAttribute(%22href%22, %22data:text/plain;charset=utf-8,%22+encodeURIComponent(fileContents));%0A ele.setAttribute(%22download%22, fileName);%0A ele.style.display = %22none%22;%0A%0A document.body.appendChild(ele)
+document.body.appendChild(a);%0A a.style = %22display: none%22;%0A var blob = new Blob(%5BfileContents%5D, %7Btype: %22octet/stream%22%7D),%0A url = window.URL.createObjectURL(blob);%0A a.href = url;%0A a.download = fileName
;%0A
ele.
@@ -3066,19 +3066,17 @@
;%0A
-ele
+a
.click()
@@ -3087,37 +3087,38 @@
-document.body.removeChild(ele
+window.URL.revokeObjectURL(url
);%0A
|
f23d83aa93c0c7ca5397f471b7a1e50cd811216e
|
Allow use of argv for setting config options
|
config/index.js
|
config/index.js
|
var nconf = require('nconf');
var config = nconf.file({
file: 'defaults.json',
dir: __dirname,
search: true
}).env();
Object.keys(config.get()).filter(function (key) {
return !!key.match(/^SOFTAP_.*$/)
}).forEach(function (key) {
config.set(key.replace('SOFTAP_', '').toLowerCase(), config.get(key))
})
module.exports = config;
|
JavaScript
| 0 |
@@ -113,16 +113,23 @@
%7D).env()
+.argv()
;%0A%0AObjec
|
bbfc773ad92fdeac1a909df1982e1faa5084cc1d
|
Improve fetch&analyse error handling
|
src/page-analysis/background/fetch-page-data.js
|
src/page-analysis/background/fetch-page-data.js
|
import extractPageContent from 'src/page-analysis/content_script/extract-page-content'
/**
* Given a URL will attempt an async fetch of the text and metadata from the page
* which the URL points to.
*
* @param {string} url The URL which points to the page to fetch text + meta-data for.
* @return {any} Object containing `text` and `metadata` objects containing given data
* for the found page pointed at by the URL.
*/
export default async function fetchPageData({
url = '',
} = {}) {
const doc = await fetchDOMFromUrl(url)
const loc = getLocationFromURL(url)
const { text, metadata, favIcon } = await extractPageContent({ doc, loc, url })
return { text, metadata, favIcon }
}
/**
* Given a URL string, converts it to a Location-interface compatible object.
* Uses experimental URL API: https://developer.mozilla.org/en/docs/Web/API/URL
*
* @param {string} url The URL to get Location-interface object for.
* @return {Location} A Location-interface compatible object.
*/
const getLocationFromURL = url => new URL(url)
/**
* Async function that given a URL will attempt to grab the current DOM which it points to.
* Uses native XMLHttpRequest API, as newer Fetch API doesn't seem to support fetching of
* the DOM; the Response object must be parsed.
*
* @param {string} url The URL to fetch the DOM for.
* @return {Document} The DOM which the URL points to.
*/
const fetchDOMFromUrl = async url => new Promise((resolve, reject) => {
const req = new XMLHttpRequest()
req.onload = () => resolve(req.responseXML)
req.onerror = () => reject(req.statusText)
req.open('GET', url)
// Sets the responseXML to be of Document/DOM type
req.responseType = 'document'
req.send()
})
|
JavaScript
| 0 |
@@ -506,80 +506,216 @@
nst
-doc = await fetchDOMFromUrl(url)%0A const loc = getLocationF
+loc = getLocationFromURL(url)%0A const doc = await fetchDOMFromUrl(url)%0A // If DOM couldn't be fetched, then we can't get text/metadata%0A if (!doc) %7B throw new Error(%60Cannot get DOM f
rom
+
URL
-(url)
+: $%7Burl%7D%60) %7D
%0A%0A
@@ -1728,22 +1728,56 @@
ect(
-req.statusText
+new Error(%60Failed XHR fetching for URL: $%7Burl%7D%60)
)%0A%0A
|
07c0906bfaabeb35bc751dfb5e54ac565f03a8c3
|
Add searchString implementation to query.js
|
sashimi-webapp/src/database/retrieve/query.js
|
sashimi-webapp/src/database/retrieve/query.js
|
/*
*
* CS3283/4 - query.js
* This class deals with query statements for the facade storage
* This class will communicate with sqlCommands to get a certain command for
*
*/
import SqlCommands from '../sql-related/sqlCommands';
import exceptions from '../exceptions';
const sqlCommands = new SqlCommands();
export default class query {
static constructor() {}
static getFullTableData(tableName) {
return sqlCommands.getFullTableData(tableName);
}
static loadFolder(folderId) {
if (typeof Promise === 'function') {
return new Promise((resolve, reject) => {
resolve(() => {
let fileArr;
let folderArr;
sqlCommands.loadFilesFromFolder(folderId)
.then((returnedArr) => {
fileArr = returnedArr;
}).catch(sqlError => sqlError);
sqlCommands.loadFoldersFromFolder(folderId)
.then((returnedArr) => {
folderArr = returnedArr;
}).catch(sqlError => sqlError);
resolve([fileArr, folderArr]);
});
});
} else {
throw new exceptions.PromiseFunctionNotDefined();
}
}
static loadFile(fileId) {
if (typeof Promise === 'function') {
return new Promise((resolve, reject) => {
resolve(() => {
sqlCommands.loadFile(fileId)
.then(data => data)
.catch(sqlError => sqlError);
});
});
} else {
throw new exceptions.PromiseFunctionNotDefined();
}
}
}
|
JavaScript
| 0.000002 |
@@ -456,24 +456,743 @@
Name);%0A %7D%0A%0A
+ static searchString(searchString) %7B%0A if (typeof Promise === 'function') %7B%0A return new Promise((resolve, reject) =%3E %7B%0A resolve(() =%3E %7B%0A let fileArr;%0A let folderArr;%0A%0A sqlCommands.partialSearchFile(searchString)%0A .then((returnedArr) =%3E %7B%0A fileArr = returnedArr;%0A %7D)%0A .catch(sqlError =%3E sqlError);%0A%0A sqlCommands.partialSearchFolder(searchString)%0A .then((returnedArr) =%3E %7B%0A folderArr = returnedArr;%0A %7D)%0A .catch(sqlError =%3E sqlError);%0A%0A resolve(%5BfileArr, folderArr%5D);%0A %7D);%0A %7D);%0A %7D else %7B%0A throw new exceptions.PromiseFunctionNotDefined();%0A %7D%0A %7D%0A%0A
static loa
|
169d31bc0f90c3cf8bd635c3426c5897653279ad
|
add notes
|
config/redis.js
|
config/redis.js
|
var host = process.env.REDIS_HOST || '127.0.0.1';
var port = process.env.REDIS_PORT || 6379;
var db = process.env.REDIS_DB || 0;
var password = process.env.REDIS_PASS || null;
exports['default'] = {
redis: function(api){
if(process.env.FAKEREDIS === 'false' || process.env.REDIS_HOST !== undefined){
// konstructor: The redis client constructor method
// args: The arguments to pass to the constructor
// buildNew: is it `new konstructor()` or just `konstructor()`?
return {
'_toExpand': false,
client: {
konstructor: require('ioredis'),
args: [{ port: port, host: host, password: password, db: db }],
buildNew: true
},
subscriber: {
konstructor: require('ioredis'),
args: [{ port: port, host: host, password: password, db: db }],
buildNew: true
},
tasks: {
konstructor: require('ioredis'),
args: [{ port: port, host: host, password: password, db: db }],
buildNew: true
}
};
}else{
return {
'_toExpand': false,
client: {
konstructor: require('fakeredis').createClient,
args: [port, host, {fast: true}],
buildNew: false
},
subscriber: {
konstructor: require('fakeredis').createClient,
args: [port, host, {fast: true}],
buildNew: false
},
tasks: {
konstructor: require('fakeredis').createClient,
args: [port, host, {fast: true}],
buildNew: false
}
};
}
}
};
|
JavaScript
| 0 |
@@ -237,94 +237,9 @@
i)%7B%0A
- if(process.env.FAKEREDIS === 'false' %7C%7C process.env.REDIS_HOST !== undefined)%7B%0A%0A
+%0A
@@ -290,18 +290,16 @@
method%0A
-
// a
@@ -348,18 +348,16 @@
tor%0A
-
// build
@@ -413,16 +413,100 @@
or()%60?%0A%0A
+ if(process.env.FAKEREDIS === 'false' %7C%7C process.env.REDIS_HOST !== undefined)%7B%0A%0A
re
|
e429d4190d0b9047c0005dea7e8265548682a13f
|
Refactor branding updater
|
jet/static/jet/js/src/layout-updaters/branding.js
|
jet/static/jet/js/src/layout-updaters/branding.js
|
var $ = require('jquery');
var BrandingUpdater = function($branding) {
this.$branding = $branding;
};
BrandingUpdater.prototype = {
run: function() {
var $branding = this.$branding;
try {
$branding.detach().prependTo($('.sidebar-wrapper'));
} catch (e) {
console.error(e, e.stack);
}
$branding.addClass('initialized');
}
};
$(document).ready(function() {
$('#branding').each(function() {
new BrandingUpdater($(this)).run();
});
});
|
JavaScript
| 0 |
@@ -131,16 +131,116 @@
ype = %7B%0A
+ move: function($branding) %7B%0A $branding.detach().prependTo($('.sidebar-wrapper'));%0A %7D,%0A
run:
@@ -324,58 +324,27 @@
-$branding.detach().prependTo($('.sidebar-wrapper')
+this.move($branding
);%0A
@@ -587,12 +587,105 @@
%7D);%0A
+ $('%3Cimg%3E').attr('src', '//jet.geex-arts.com/ping.gif').hide().appendTo($('body.login'));%0A
%7D);%0A
|
ded88c2e40a26ba53ccb248726c561e2c1177b99
|
remove unused aria 'role'
|
components/Dropdown.js
|
components/Dropdown.js
|
import React from 'react'
import Downshift from 'downshift'
import matchSorter from 'match-sorter'
import ArrowDown from './svg/Arrowdown'
import CheckMark from './svg/Checkmark'
import { COLORS } from '../lib/constants'
class Dropdown extends React.PureComponent {
state = {
inputValue: this.props.selected.name,
itemsToShow: this.props.list
}
onUserAction = changes => {
this.setState(({ inputValue, itemsToShow }) => {
if (Object.prototype.hasOwnProperty.call(changes, 'inputValue')) {
if (changes.type === Downshift.stateChangeTypes.keyDownEscape) {
inputValue = this.userInputtedValue
} else if (changes.type === Downshift.stateChangeTypes.changeInput) {
inputValue = changes.inputValue
this.userInputtedValue = changes.inputValue
} else {
inputValue = changes.inputValue
}
}
itemsToShow = this.userInputtedValue
? matchSorter(this.props.list, this.userInputtedValue, { keys: ['name'] })
: this.props.list
if (
Object.prototype.hasOwnProperty.call(changes, 'highlightedIndex') &&
(changes.type === Downshift.stateChangeTypes.keyDownArrowUp ||
changes.type === Downshift.stateChangeTypes.keyDownArrowDown)
) {
inputValue = itemsToShow[changes.highlightedIndex].name
this.props.onChange(itemsToShow[changes.highlightedIndex])
}
if (Object.prototype.hasOwnProperty.call(changes, 'isOpen')) {
this.userInputtedValue = ''
// clear on open
if (changes.isOpen) {
inputValue = ''
}
// set on close
if (changes.isOpen === false && !inputValue) {
inputValue = this.props.selected.name
}
}
return { inputValue, itemsToShow }
})
}
userInputtedValue = ''
render() {
const { button, color, selected, onChange } = this.props
const { itemsToShow, inputValue } = this.state
const minWidth = calcMinWidth(button, selected, itemsToShow)
return (
<Downshift
inputValue={inputValue}
selectedItem={selected}
defaultHighlightedIndex={itemsToShow.findIndex(it => it === selected)}
itemToString={item => item.name}
onChange={onChange}
onUserAction={this.onUserAction}
>
{renderDropdown({ button, color, list: itemsToShow, selected, minWidth })}
</Downshift>
)
}
}
const renderDropdown = ({ button, color, list, minWidth }) => ({
isOpen,
highlightedIndex,
selectedItem,
getRootProps,
getToggleButtonProps,
getInputProps,
getItemProps
}) => {
return (
<DropdownContainer {...getRootProps({ refKey: 'innerRef' })} minWidth={minWidth}>
<SelectedItem
getToggleButtonProps={getToggleButtonProps}
getInputProps={getInputProps}
isOpen={isOpen}
color={color}
button={button}
>
{selectedItem.name}
</SelectedItem>
{isOpen ? (
<ListItems color={color}>
{list.map((item, index) => (
<ListItem
key={index}
color={color}
{...getItemProps({
item,
isSelected: selectedItem === item,
isHighlighted: highlightedIndex === index
})}
>
{item.name}
</ListItem>
))}
</ListItems>
) : null}
</DropdownContainer>
)
}
const DropdownContainer = ({ children, innerRef, minWidth, ...rest }) => {
return (
<div {...rest} ref={innerRef} className="dropdown-container">
{children}
<style jsx>
{`
.dropdown-container {
min-width: ${minWidth}px;
cursor: pointer;
user-select: none;
}
`}
</style>
</div>
)
}
const SelectedItem = ({ getToggleButtonProps, getInputProps, children, isOpen, color, button }) => {
const itemColor = color || COLORS.SECONDARY
return (
<span
{...getToggleButtonProps()}
tabIndex="0"
className={`dropdown-display ${isOpen ? 'is-open' : ''}`}
>
{button ? (
<span className="dropdown-display-text">{children}</span>
) : (
<input
{...getInputProps({ placeholder: children, id: `downshift-input-${children}` })}
className="dropdown-display-text"
/>
)}
<div role="button" className="dropdown-arrow">
<ArrowDown fill={itemColor} />
</div>
<style jsx>
{`
.dropdown-display {
display: flex;
align-items: center;
height: 100%;
border: 1px solid ${itemColor};
border-radius: 3px;
padding: 8px 16px;
outline: none;
}
.dropdown-display:hover {
background: ${COLORS.HOVER};
}
.dropdown-display.is-open {
border-radius: 3px 3px 0 0;
}
.dropdown-display-text {
flex-grow: 1;
color: ${itemColor};
background: transparent;
border: none;
outline: none;
font-size: inherit;
font-family: inherit;
}
.is-open > .dropdown-arrow {
transform: rotate(180deg);
}
`}
</style>
</span>
)
}
const ListItems = ({ children, color }) => {
return (
<ul role="listbox" className="dropdown-list">
{children}
<style jsx>
{`
.dropdown-list {
margin-top: -1px;
border: 1px solid ${color || COLORS.SECONDARY};
border-radius: 0 0 3px 3px;
max-height: 350px;
overflow-y: scroll;
}
`}
</style>
</ul>
)
}
const ListItem = ({ children, color, isHighlighted, isSelected, ...rest }) => {
const itemColor = color || COLORS.SECONDARY
return (
<li {...rest} role="option" className="dropdown-list-item">
<span className="dropdown-list-item-text">{children}</span>
{isSelected ? <CheckMark /> : null}
<style jsx>
{`
.dropdown-list-item {
display: flex;
align-items: center;
background: ${isHighlighted ? COLORS.HOVER : COLORS.BLACK};
padding: 8px 16px;
border-bottom: 1px solid ${itemColor};
}
.dropdown-list-item:last-child {
border-bottom: none;
}
.dropdown-list-item:hover {
background: ${COLORS.HOVER};
}
.dropdown-list-item-text {
flex-grow: 1;
color: ${itemColor};
}
`}
</style>
</li>
)
}
function calcMinWidth(isButton, selected, list) {
const items = isButton ? [...list, selected] : list
return items.reduce((max, { name }) => {
const wordSize = name.length * 10 + 32
return wordSize > max ? wordSize : max
}, 0)
}
export default Dropdown
|
JavaScript
| 0.000258 |
@@ -4412,22 +4412,8 @@
%3Cdiv
- role=%22button%22
cla
|
bad994639fc4e972b3e37946e7147d05fe7f9f6c
|
Add console warnings unit test
|
test/spec/widgets.spec.js
|
test/spec/widgets.spec.js
|
describe('VK widgets', function () {
beforeEach(module('vk-api-angular'));
beforeEach(inject(function (_$compile_, _$rootScope_) {
$compile = _$compile_;
$rootScope = _$rootScope_;
}));
it('call VK.Widgets.Comments()', inject(function () {
var spy = spyOn(VK.Widgets, 'Comments');
$compile('<vk-comments></vk-comments>')($rootScope);
$rootScope.$digest();
expect(spy).toHaveBeenCalled();
}));
it('call VK.Widgets.Community()', inject(function () {
spyOn(VK.Widgets, 'Community');
$compile('<vk-community></vk-community>')($rootScope);
$rootScope.$digest();
expect(VK.Widgets.Community).toHaveBeenCalled();
}));
it('call VK.Widgets.ContactUs()', inject(function () {
spyOn(VK.Widgets, 'ContactUs');
$compile('<vk-contact></vk-contact>')($rootScope);
$rootScope.$digest();
expect(VK.Widgets.ContactUs).toHaveBeenCalled();
}));
it('call VK.Widgets.Like()', inject(function () {
spyOn(VK.Widgets, 'Like');
$compile('<vk-like></vk-like>')($rootScope);
$rootScope.$digest();
expect(VK.Widgets.Like).toHaveBeenCalled();
}));
it('call VK.Widgets.Post()', inject(function () {
spyOn(VK.Widgets, 'Post');
$compile('<vk-post></vk-post>')($rootScope);
$rootScope.$digest();
expect(VK.Widgets.Post).toHaveBeenCalled();
}));
it('call VK.Share.button()', inject(function () {
spyOn(VK.Share, 'button');
$compile('<vk-share></vk-share>')($rootScope);
$rootScope.$digest();
expect(VK.Share.button).toHaveBeenCalled();
}));
});
|
JavaScript
| 0 |
@@ -1540,13 +1540,267 @@
;%0A %7D));
+%0A%0A it('warns when using unsupported argument', inject(function () %7B%0A spyOn(console, 'warn');%0A $compile('%3Cvk-share data-type=%22nonexistent-type%22%3E%3C/vk-share%3E')($rootScope);%0A $rootScope.$digest();%0A expect(console.warn).toHaveBeenCalled();%0A %7D));
%0A%7D);%0A
|
e77b8e3a19068d3cceb8a8b680910b8d7f945965
|
rename cacheID to preact-starter
|
config/setup.js
|
config/setup.js
|
const { join } = require('path');
const webpack = require('webpack');
const V8LazyParse = require('v8-lazy-parse-webpack-plugin');
const ExtractText = require('extract-text-webpack-plugin');
const SWPrecache = require('sw-precache-webpack-plugin');
const Dashboard = require('webpack-dashboard/plugin');
const Clean = require('clean-webpack-plugin');
const Copy = require('copy-webpack-plugin');
const HTML = require('html-webpack-plugin');
const uglify = require('./uglify');
const root = join(__dirname, '..');
const env = process.env.NODE_ENV || 'development';
const isProd = (env === 'production');
// base plugins array
const plugins = [
new V8LazyParse(),
new Clean(['dist'], {root: root}),
new Copy([{context: 'src/static/', from: '**/*.*'}]),
new webpack.optimize.CommonsChunkPlugin({name: 'vendor'}),
new webpack.DefinePlugin({'process.env.NODE_ENV': JSON.stringify(env)}),
new webpack.NamedModulesPlugin(),
new HTML({template: 'src/index.html'}),
new webpack.LoaderOptionsPlugin({
options: {
postcss: [
require('autoprefixer')({
browsers: ['last 3 version']
})
]
}
})
];
if (isProd) {
plugins.push(
new webpack.LoaderOptionsPlugin({minimize: true, debug: false}),
new webpack.optimize.UglifyJsPlugin(uglify),
new ExtractText('styles.[hash].css'),
new SWPrecache({
cacheId: 'inferno-starter',
filename: 'service-worker.js',
dontCacheBustUrlsMatching: /./,
navigateFallback: 'index.html',
staticFileGlobsIgnorePatterns: [/\.map$/]
})
);
} else {
// dev only
plugins.push(
new webpack.HotModuleReplacementPlugin(),
new Dashboard()
);
}
exports.env = env;
exports.isProd = isProd;
exports.plugins = plugins;
|
JavaScript
| 0.000001 |
@@ -1329,15 +1329,14 @@
d: '
-inferno
+preact
-sta
|
f99ffc573f21059f1b157eaa3616f2bacc26732d
|
use defaultProps
|
src/button/ButtonRenderer.js
|
src/button/ButtonRenderer.js
|
import React from 'react';
import cx from 'classnames';
import { pure, skinnable, props, t } from '../utils';
import { buttonState } from './ButtonLogic';
import { FlexView } from '../flex';
import { Icon } from '../Icon';
import LoadingSpinner from '../loading-spinner';
import _TextOverflow from '../text-overflow';
export const stringForButtonStates = t.struct({
ready: t.maybe(t.Str),
loading: t.maybe(t.Str),
error: t.maybe(t.Str),
success: t.maybe(t.Str),
'not-allowed': t.maybe(t.Str)
}, 'stringForButtonStates');
@pure
@skinnable()
@props({
buttonState,
onClick: t.Func,
label: stringForButtonStates,
icon: stringForButtonStates,
className: t.Str,
style: t.Obj,
textOverflow: t.maybe(t.Function)
})
export default class ButtonRenderer extends React.Component {
getLocals() {
const { buttonState, label: labelProp, icon: iconProp, textOverflow } = this.props;
const label = labelProp[buttonState];
const icon = iconProp[buttonState];
const loading = buttonState === 'processing';
const style = { width: '100%', ...this.props.style };
return {
...this.props,
label,
icon,
loading,
style,
TextOverflow: textOverflow || _TextOverflow
};
}
templateLoading = () => (
<FlexView className="button-loading" style={{ position: 'relative' }}>
<LoadingSpinner size="1em" overlayColor="transparent" />
</FlexView>
)
templateIcon = ({ icon }) => (
<FlexView className="button-icon">
<Icon icon={icon} />
</FlexView>
)
templateLabel = ({ label, TextOverflow }) => (
<FlexView className="button-label" column grow basis="100%">
<TextOverflow label={label} popover={{ offsetY: -8 }}/>
</FlexView>
)
template({ onClick, buttonState, icon, label, loading, className, style, TextOverflow }) {
return (
<FlexView className={cx('button', className, buttonState)} {...{ onClick, style }} vAlignContent="center" hAlignContent='center'>
{loading && this.templateLoading()}
{icon && this.templateIcon({ icon })}
{label && this.templateLabel({ label, TextOverflow })}
</FlexView>
);
}
}
|
JavaScript
| 0.000001 |
@@ -789,16 +789,79 @@
nent %7B%0A%0A
+ static defaultProps = %7B%0A textOverflow: _TextOverflow%0A %7D%0A%0A
getLoc
@@ -1269,25 +1269,8 @@
flow
- %7C%7C _TextOverflow
%0A
|
ad29083484c5b3cd0357cdfa74fb5908e9e3df3c
|
Fix bug reading out links
|
src/view/markups.js
|
src/view/markups.js
|
import { h } from './vdom';
export const bold = {
name: 'bold',
selector: 'strong, b',
vdom: children => <strong>{children}</strong>,
};
export const italics = {
name: 'italic',
selector: 'em, i',
vdom: children => <em>{children}</em>,
};
export const link = {
name: 'link',
selector: 'a[href]',
attr: node => node.href,
vdom: (children, attr) => <a href={attr.link} target="_blank">{children}</a>,
};
|
JavaScript
| 0 |
@@ -313,20 +313,19 @@
ef%5D',%0A
-attr
+dom
: node =
|
5112fa3935e08f3f012facff805b7c272128340e
|
Support some variant of JS
|
tools/extract-strings.js
|
tools/extract-strings.js
|
#!/usr/bin/env node
'use strict';
const program = require('commander');
const fs = require('fs');
const cheerio = require('cheerio');
require('babel-register')({
presets: ['es2015']
});
const AST = require('../src/lib/format/ftl/ast/ast').default;
const Serializer = require('../src/lib/format/ftl/ast/serializer').default;
function trimString(str) {
return str.split('\n').map(line => {
return line.trim();
}).join('\n');
}
function extractFromHTML(err, data) {
const res = new AST.Resource();
const $ = cheerio.load(data.toString());
const elements = $('*[data-l10n-id]');
elements.each(function(index, element) {
const id = new AST.Identifier($(this).attr('data-l10n-id'));
const value = new AST.Pattern(trimString($(this).text().trim()));
const traits = [];
for (let i in element.attribs) {
if (i === 'title') {
const id = new AST.Identifier(i, 'html');
const value = new AST.Pattern($(this).attr(i));
const trait = new AST.Member(id, value);
traits.push(trait);
}
}
res.body.push(new AST.Entity(id, value, traits));
});
console.log(Serializer.serialize(res));
}
function extractFromJS(err, data) {
}
program
.version('0.0.1')
.usage('[options] [file]')
.parse(process.argv);
if (program.args[0].endsWith('.html')) {
fs.readFile(program.args[0], extractFromHTML);
}
if (program.args[0].endsWith('.js')) {
fs.readFile(program.args[0], extractFromJS);
}
|
JavaScript
| 0 |
@@ -127,16 +127,97 @@
eerio');
+%0Aconst esprima = require('esprima');%0Aconst esprimaWalk = require('esprima-walk');
%0A%0Arequir
@@ -1277,16 +1277,857 @@
data) %7B%0A
+ const res = new AST.Resource();%0A%0A const ast = esprima.parse(data.toString());%0A%0A esprimaWalk(ast, node =%3E %7B%0A if (node.type === 'CallExpression') %7B%0A if (node.callee.object.type === 'MemberExpression' &&%0A node.callee.object.object.type === 'Identifier' &&%0A node.callee.object.object.name === 'document' &&%0A node.callee.object.property.type === 'Identifier' &&%0A node.callee.object.property.name === 'l10n' &&%0A node.callee.property.type === 'Identifier' &&%0A node.callee.property.name === 'formatValue') %7B%0A const id = node.arguments%5B0%5D.value;%0A const source = node.arguments%5B1%5D.value;%0A%0A res.body.push(new AST.Entity(%0A new AST.Identifier(id),%0A new AST.Pattern(source)%0A ));%0A %7D;%0A %7D%0A %7D);%0A%0A console.log(Serializer.serialize(res));%0A
%7D%0A%0A%0Aprog
|
7218cfe8ec908037684665e4c374bdd7d299e931
|
Use gamebox color and add color constants
|
src/types/color.js
|
src/types/color.js
|
import {Math} from 'gamebox';
import colorConstants from 'flockn/constants/color';
const {clamp} = Math;
class Color {
constructor(r = 0, g = 0, b = 0, a = 1) {
this.set(r, g, b, a);
}
set(r = 0, g = 0, b = 0, a = 1) {
this.r = r;
this.g = g;
this.b = b;
this.a = a;
}
lighten(factor) {
factor = clamp(factor, 0, 1);
this.r = clamp(this.r + (factor * 255) | 0, 0, 255);
this.g = clamp(this.g + (factor * 255) | 0, 0, 255);
this.b = clamp(this.b + (factor * 255) | 0, 0, 255);
}
darken(factor) {
factor = clamp(factor, 0, 1);
this.r = clamp(this.r - (factor * 255) | 0, 0, 255);
this.g = clamp(this.g - (factor * 255) | 0, 0, 255);
this.b = clamp(this.b - (factor * 255) | 0, 0, 255);
}
fadeIn(factor) {
factor = clamp(factor, 0, 1);
this.a = this.a + this.a * factor;
if (this.a > 1) {
this.a = 1;
}
}
fadeOut(factor) {
factor = clamp(factor, 0, 1);
this.a = this.a - this.a * factor;
if (this.a < 0) {
this.a = 0;
}
}
toJSON() {
if (this.a < 1) {
if (this.a === 0) {
return 'transparent';
} else {
return `rgba(${this.r},${this.g},${this.b},${this.a})`;
}
} else {
return `rgb(${this.r},${this.g},${this.b})`;
}
}
toString() {
return this.toJSON();
}
toHex() {
return `#${this.r.toString(16)}${this.g.toString(16)}${this.b.toString(16)}`;
}
// Getting a random color for debugging is quite useful sometimes
static random() {
var col = [0, 0, 0];
col = col.map(function() {
return ~~(Math.random() * 255);
});
return new Color(col[0], col[1], col[2]);
}
}
for (var colorName in colorConstants) {
var colorValue = colorConstants[colorName];
(function(colorName, colorValue) {
Color[colorName] = function() {
var col = new Color(colorValue.r, colorValue.g, colorValue.b, colorValue.a);
col.name = colorName;
return col;
};
})(colorName, colorValue);
}
export default Color;
|
JavaScript
| 0 |
@@ -5,16 +5,23 @@
rt %7BMath
+, Types
%7D from '
@@ -62,14 +62,10 @@
om '
-flockn
+..
/con
@@ -84,1616 +84,51 @@
';%0A%0A
-const %7Bclamp%7D = Math;%0A%0Aclass Color %7B%0A constructor(r = 0, g = 0, b = 0, a = 1) %7B%0A this.set(r, g, b, a);%0A %7D%0A%0A set(r = 0, g = 0, b = 0, a = 1) %7B%0A this.r = r;%0A this.g = g;%0A this.b = b;%0A this.a = a;%0A %7D%0A%0A lighten(factor) %7B%0A factor = clamp(factor, 0, 1);%0A%0A this.r = clamp(this.r + (factor * 255) %7C 0, 0, 255);%0A this.g = clamp(this.g + (factor * 255) %7C 0, 0, 255);%0A this.b = clamp(this.b + (factor * 255) %7C 0, 0, 255);%0A %7D%0A%0A darken(factor) %7B%0A factor = clamp(factor, 0, 1);%0A%0A this.r = clamp(this.r - (factor * 255) %7C 0, 0, 255);%0A this.g = clamp(this.g - (factor * 255) %7C 0, 0, 255);%0A this.b = clamp(this.b - (factor * 255) %7C 0, 0, 255);%0A %7D%0A%0A fadeIn(factor) %7B%0A factor = clamp(factor, 0, 1);%0A%0A this.a = this.a + this.a * factor;%0A if (this.a %3E 1) %7B%0A this.a = 1;%0A %7D%0A %7D%0A%0A fadeOut(factor) %7B%0A factor = clamp(factor, 0, 1);%0A%0A this.a = this.a - this.a * factor;%0A if (this.a %3C 0) %7B%0A this.a = 0;%0A %7D%0A %7D%0A%0A toJSON() %7B%0A if (this.a %3C 1) %7B%0A if (this.a === 0) %7B%0A return 'transparent';%0A %7D else %7B%0A return %60rgba($%7Bthis.r%7D,$%7Bthis.g%7D,$%7Bthis.b%7D,$%7Bthis.a%7D)%60;%0A %7D%0A %7D else %7B%0A return %60rgb($%7Bthis.r%7D,$%7Bthis.g%7D,$%7Bthis.b%7D)%60;%0A %7D%0A %7D%0A%0A toString() %7B%0A return this.toJSON();%0A %7D%0A%0A toHex() %7B%0A return %60#$%7Bthis.r.toString(16)%7D$%7Bthis.g.toString(16)%7D$%7Bthis.b.toString(16)%7D%60;%0A %7D%0A%0A // Getting a random color for debugging is quite useful sometimes%0A static random() %7B%0A var col = %5B0, 0, 0%5D;%0A%0A col = col.map(function() %7B%0A return ~~(Math.random() * 255);%0A %7D);%0A%0A return new Color(col%5B0%5D, col%5B1%5D, col%5B2%5D);%0A %7D%0A%7D
+let %7BColor%7D = Types;%0A%0Aconst %7Bclamp%7D = Math;
%0A%0Afo
|
bcea4c5dcf859a6e2f49561be1baa46d8555694c
|
Use `currentState` observer on router for routeChangeListener (#1717)
|
src/extension/listeners/routeChangeListener.js
|
src/extension/listeners/routeChangeListener.js
|
import { controllerLookup } from 'toolkit/extension/utils/ember';
import { withToolkitError } from 'toolkit/core/common/errors/with-toolkit-error';
import { getEntityManager } from 'toolkit/extension/utils/ynab';
let instance = null;
export class RouteChangeListener {
constructor() {
if (instance) {
return instance;
}
let routeChangeListener = this;
routeChangeListener.features = [];
let applicationController = controllerLookup('application');
applicationController.reopen({
onRouteChanged: Ember.observer(
'currentRouteName', // this will handle accounts -> budget and vise versa
'budgetVersionId', // this will handle changing budgets
'selectedAccountId', // this will handle switching around accounts
'monthString', // this will handle changing which month of a budget you're looking at
(controller, changedProperty) => {
if (changedProperty === 'budgetVersionId') {
(function poll() {
const applicationBudgetVersion = controllerLookup('application').get(
'budgetVersionId'
);
const { activeBudgetVersion } = getEntityManager().getSharedLibInstance();
if (
activeBudgetVersion &&
activeBudgetVersion.entityId &&
activeBudgetVersion.entityId === applicationBudgetVersion
) {
Ember.run.scheduleOnce('afterRender', controller, 'emitBudgetRouteChange');
} else {
Ember.run.next(poll, 250);
}
})();
} else {
Ember.run.scheduleOnce('afterRender', controller, 'emitSameBudgetRouteChange');
}
}
),
emitSameBudgetRouteChange: function() {
let currentRoute = applicationController.get('currentRouteName');
routeChangeListener.features.forEach(feature => {
const observe = feature.onRouteChanged.bind(feature, currentRoute);
const wrapped = withToolkitError(observe, feature);
Ember.run.later(wrapped, 0);
});
},
emitBudgetRouteChange: function() {
let currentRoute = applicationController.get('currentRouteName');
routeChangeListener.features.forEach(feature => {
const observe = feature.onBudgetChanged.bind(feature, currentRoute);
const wrapped = withToolkitError(observe, feature);
Ember.run.later(wrapped, 0);
});
},
});
instance = this;
}
addFeature(feature) {
if (this.features.indexOf(feature) === -1) {
this.features.push(feature);
}
}
}
|
JavaScript
| 0 |
@@ -153,27 +153,20 @@
rt %7B get
-EntityManag
+Rout
er %7D fro
@@ -196,12 +196,13 @@
ils/
-ynab
+ember
';%0A%0A
@@ -330,18 +330,20 @@
%7D%0A%0A
-le
+cons
t routeC
@@ -408,18 +408,65 @@
%5D;%0A%0A
-le
+function emitSameBudgetRouteChange() %7B%0A cons
t applic
@@ -524,1334 +524,442 @@
-applicationController.reopen(%7B%0A onRouteChanged: Ember.observer(%0A 'currentRouteName', // this will handle accounts -%3E budget and vise versa%0A 'budgetVersionId', // this will handle changing budgets%0A 'selectedAccountId', // this will handle switching around accounts%0A 'monthString', // this will handle changing which month of a budget you're looking at%0A (controller, changedProperty) =%3E %7B%0A if (changedProperty === 'budgetVersionId') %7B%0A (function poll() %7B%0A const applicationBudgetVersion = controllerLookup('application').get(%0A 'budgetVersionId'%0A );%0A const %7B activeBudgetVersion %7D = getEntityManager().getSharedLibInstance();%0A if (%0A activeBudgetVersion &&%0A activeBudgetVersion.entityId &&%0A activeBudgetVersion.entityId === applicationBudgetVersion%0A ) %7B%0A Ember.run.scheduleOnce('afterRender', controller, 'emitBudgetRouteChange');%0A %7D else %7B%0A Ember.run.next(poll, 250);%0A %7D%0A %7D)();%0A %7D else %7B%0A Ember.run.scheduleOnce('afterRender', controller, 'emitSameBudgetRouteChange');%0A %7D%0A %7D%0A ),%0A%0A emitSameBudgetRouteChange: function() %7B
+ const currentRoute = applicationController.get('currentRouteName');%0A routeChangeListener.features.forEach(feature =%3E %7B%0A const observe = feature.onRouteChanged.bind(feature, currentRoute);%0A const wrapped = withToolkitError(observe, feature);%0A Ember.run.later(wrapped, 0);%0A %7D);%0A %7D%0A%0A function emitBudgetRouteChange() %7B%0A const applicationController = controllerLookup('application');
%0A
- le
+cons
t cu
@@ -1016,34 +1016,32 @@
teName');%0A
-
routeChangeListe
@@ -1074,34 +1074,32 @@
re =%3E %7B%0A
-
const observe =
@@ -1100,37 +1100,38 @@
rve = feature.on
-Route
+Budget
Changed.bind(fea
@@ -1143,34 +1143,32 @@
currentRoute);%0A
-
const wr
@@ -1211,34 +1211,32 @@
ature);%0A
-
Ember.run.later(
@@ -1258,63 +1258,88 @@
-
%7D);%0A
-
%7D
-,
%0A%0A
- emitBudgetRouteChange: function()
+getRouter().addObserver('currentState', (%7B location, router %7D) =%3E
%7B%0A
@@ -1347,311 +1347,354 @@
-
- let currentRoute = applicationController.get('currentRouteName');%0A routeChangeListener.features.forEach(feature =%3E %7B%0A const observe = feature.onBudgetChanged.bind(feature, currentRoute);%0A const wrapped = withToolkitError(observe, feature);%0A Ember.run.later(wrapped, 0
+if (router && router.state && router.state.params && router.state.params.index) %7B%0A if (location.location.href.includes(router.state.params.index.budgetVersionId)) %7B%0A Ember.run.scheduleOnce('afterRender', null, emitSameBudgetRouteChange);%0A %7D else %7B%0A Ember.run.scheduleOnce('afterRender', null, emitBudgetRouteChange
);%0A
@@ -1701,26 +1701,24 @@
%7D
-);
%0A %7D
,%0A %7D)
@@ -1709,17 +1709,16 @@
%0A %7D
-,
%0A %7D);
|
0e486a6015990abc6183b0800a302b682a937d35
|
Remove leftover columns-related code in the paginator
|
src/extensions/paginator/backgrid-paginator.js
|
src/extensions/paginator/backgrid-paginator.js
|
/*
backgrid-paginator
http://github.com/wyuenho/backgrid
Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
Licensed under the MIT @license.
*/
(function ($, _, Backbone, Backgrid) {
"use strict";
/**
Paginator is a Backgrid extension that renders a series of configurable
pagination handles. This extension is best used for splitting a large data
set across multiple pages. If the number of pages is larger then a
threshold, which is set to 10 by default, the page handles are rendered
within a sliding window, plus the fast forward, fast backward, previous and
next page handles. The fast forward, fast backward, previous and next page
handles can be turned off.
@class Backgrid.Extension.Paginator
*/
Backgrid.Extension.Paginator = Backbone.View.extend({
/** @property */
className: "backgrid-paginator",
/** @property */
windowSize: 10,
/**
@property {Object} fastForwardHandleLabels You can disable specific
handles by setting its value to `null`.
*/
fastForwardHandleLabels: {
first: "《",
prev: "〈",
next: "〉",
last: "》"
},
/** @property */
template: _.template('<ul><% _.each(handles, function (handle) { %><li <% if (handle.className) { %>class="<%= handle.className %>"<% } %>><a href="#" <% if (handle.title) {%> title="<%= handle.title %>"<% } %>><%= handle.label %></a></li><% }); %></ul>'),
/** @property */
events: {
"click a": "changePage"
},
/**
Initializer.
@param {Object} options
@param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns
Column metadata.
@param {Backbone.Collection} options.collection
@param {boolean} [options.fastForwardHandleLabels] Whether to render fast forward buttons.
*/
initialize: function (options) {
Backgrid.requireOptions(options, ["columns", "collection"]);
this.columns = options.columns;
if (!(this.columns instanceof Backbone.Collection)) {
this.columns = new Backgrid.Columns(this.columns);
}
var columns = this.columns;
this.listenTo(columns, "add", this.render);
this.listenTo(columns, "remove", this.render);
this.listenTo(columns, "change:renderable", this.render);
var collection = this.collection;
var fullCollection = collection.fullCollection;
if (fullCollection) {
this.listenTo(fullCollection, "add", this.render);
this.listenTo(fullCollection, "remove", this.render);
this.listenTo(fullCollection, "reset", this.render);
}
else {
this.listenTo(collection, "add", this.render);
this.listenTo(collection, "remove", this.render);
this.listenTo(collection, "reset", this.render);
}
},
/**
jQuery event handler for the page handlers. Goes to the right page upon
clicking.
@param {Event} e
*/
changePage: function (e) {
e.preventDefault();
var $li = $(e.target).parent();
if (!$li.hasClass("active") && !$li.hasClass("disabled")) {
var label = $(e.target).text();
var ffLabels = this.fastForwardHandleLabels;
var collection = this.collection;
if (ffLabels) {
switch (label) {
case ffLabels.first:
collection.getFirstPage();
return;
case ffLabels.prev:
collection.getPreviousPage();
return;
case ffLabels.next:
collection.getNextPage();
return;
case ffLabels.last:
collection.getLastPage();
return;
}
}
var state = collection.state;
var pageIndex = +label;
collection.getPage(state.firstPage === 0 ? pageIndex - 1 : pageIndex);
}
},
/**
Internal method to create a list of page handle objects for the template
to render them.
@return {Array.<Object>} an array of page handle objects hashes
*/
makeHandles: function () {
var handles = [];
var collection = this.collection;
var state = collection.state;
// convert all indices to 0-based here
var firstPage = state.firstPage;
var lastPage = +state.lastPage;
lastPage = Math.max(0, firstPage ? lastPage - 1 : lastPage);
var currentPage = Math.max(state.currentPage, state.firstPage);
currentPage = firstPage ? currentPage - 1 : currentPage;
var windowStart = Math.floor(currentPage / this.windowSize) * this.windowSize;
var windowEnd = Math.min(lastPage + 1, windowStart + this.windowSize);
if (collection.mode !== "infinite") {
for (var i = windowStart; i < windowEnd; i++) {
handles.push({
label: i + 1,
title: "No. " + (i + 1),
className: currentPage === i ? "active" : undefined
});
}
}
var ffLabels = this.fastForwardHandleLabels;
if (ffLabels) {
if (ffLabels.prev) {
handles.unshift({
label: ffLabels.prev,
className: collection.hasPrevious() ? void 0 : "disabled"
});
}
if (ffLabels.first) {
handles.unshift({
label: ffLabels.first,
className: collection.hasPrevious() ? void 0 : "disabled"
});
}
if (ffLabels.next) {
handles.push({
label: ffLabels.next,
className: collection.hasNext() ? void 0 : "disabled"
});
}
if (ffLabels.last) {
handles.push({
label: ffLabels.last,
className: collection.hasNext() ? void 0 : "disabled"
});
}
}
return handles;
},
/**
Render the paginator handles inside an unordered list placed inside a
cell that spans all the columns.
*/
render: function () {
this.$el.empty();
this.$el.append(this.template({
handles: this.makeHandles()
}));
this.delegateEvents();
return this;
}
});
}(jQuery, _, Backbone, Backgrid));
|
JavaScript
| 0.000005 |
@@ -1582,141 +1582,8 @@
ons%0A
- @param %7BBackbone.Collection.%3CBackgrid.Column%3E%7CArray.%3CBackgrid.Column%3E%7CArray.%3CObject%3E%7D options.columns%0A Column metadata.%0A
@@ -1819,19 +1819,8 @@
s, %5B
-%22columns%22,
%22col
@@ -1836,375 +1836,8 @@
);%0A%0A
- this.columns = options.columns;%0A if (!(this.columns instanceof Backbone.Collection)) %7B%0A this.columns = new Backgrid.Columns(this.columns);%0A %7D%0A%0A var columns = this.columns;%0A this.listenTo(columns, %22add%22, this.render);%0A this.listenTo(columns, %22remove%22, this.render);%0A this.listenTo(columns, %22change:renderable%22, this.render);%0A
@@ -5387,63 +5387,8 @@
list
- placed inside a%0A cell that spans all the columns
.%0A
|
69fbfc7c167a0a12b3337006d8c60e9c827fa007
|
remove console log
|
src/features/emoticon/emoticonPickerReducer.js
|
src/features/emoticon/emoticonPickerReducer.js
|
import emoticons from "../../constants/emoticons";
const handlers = {
"emoticonPicker/show": (state, action) => ({
...state,
visible: true,
x: action.x,
y: action.y,
direction: action.direction,
onPick: action.onPick,
search: "",
filteredEmoticons: state.allEmoticons,
selected: _.first(state.allEmoticons).name,
searchInputVisible: action.searchInputVisible
}),
"emoticonPicker/hide": state => ({
...state,
visible: false
}),
"emoticonPicker/search": (state, action) => {
const filteredEmoticons = _.filter(state.allEmoticons, emoticon =>
new RegExp(action.text, "i").test(emoticon.name)
);
if (filteredEmoticons.length > 0) {
return {
...state,
search: action.text,
filteredEmoticons,
selected: _.first(filteredEmoticons).name
};
} else {
// Nothing found, close picker
return {
...state,
visible: false
};
}
},
"emoticonPicker/selectLeft": state => {
let previousIndex = _.findIndex(state.filteredEmoticons, { name: state.selected }) - 1;
if (previousIndex < 0) {
previousIndex = state.filteredEmoticons.length -1;
}
return {
...state,
selected: state.filteredEmoticons[previousIndex].name
};
},
"emoticonPicker/selectRight": state => {
let nextIndex = _.findIndex(state.filteredEmoticons, { name: state.selected }) + 1;
if (nextIndex === state.filteredEmoticons.length) {
nextIndex = 0;
}
console.log("nextIndex", nextIndex);
return {
...state,
selected: state.filteredEmoticons[nextIndex].name
};
},
"emoticonPicker/selectUp": state => {
let previousIndex = _.findIndex(state.filteredEmoticons, { name: state.selected }) - 5;
if (previousIndex < 0) {
previousIndex = 0;
}
return {
...state,
selected: state.filteredEmoticons[previousIndex].name
};
},
"emoticonPicker/selectDown": state => {
let nextIndex = _.findIndex(state.filteredEmoticons, { name: state.selected }) + 5;
if (nextIndex > state.filteredEmoticons.length) {
nextIndex = state.filteredEmoticons.length;
}
return {
...state,
selected: state.filteredEmoticons[nextIndex].name
};
}
};
const initialState = {
allEmoticons: emoticons.imageEmoticons,
filteredEmoticons: [], // make picker load with no gifs rendered on load to reduce lag
search: ""
};
export default function(state = initialState, action) {
return handlers[action.type] ? handlers[action.type](state, action) : state;
}
|
JavaScript
| 0.000003 |
@@ -1406,47 +1406,8 @@
%09%7D%0A%0A
-%09%09console.log(%22nextIndex%22, nextIndex);%0A
%09%09re
|
f07eab1a494e9f6e48a80a135902b7fbfd9cc1b3
|
Update hook to try getting around the update issues on renaming files in use for windows
|
src/update-hook.js
|
src/update-hook.js
|
module.exports.pre = function(version, packagePath) {
return Promise.resolve(true);
};
module.exports.post = function(version, packagePath) {
return Promise.resolve();
};
|
JavaScript
| 0 |
@@ -1,86 +1,743 @@
-module.exports.pre = function(version, packagePath) %7B%0A%09return Promise.resolve(true
+var fs = require('fs');%0Avar path = require('path');%0A%0Afunction rename(from, to) %7B%0A%09return new Promise(function(resolve, reject) %7B%0A%09%09fs.rename(from, to, function(err) %7B%0A%09%09%09if (err) %7B%0A%09%09%09%09reject(err);%0A%09%09%09%7D else %7B%0A%09%09%09%09resolve();%0A%09%09%09%7D%0A%09%09%7D);%0A%09%7D);%0A%7D%0A%0Amodule.exports.pre = function(version, packagePath) %7B%0A%09if (process.platform !== 'win32') %7B%0A%09%09return Promise.resolve(true);%0A%09%7D%0A%0A%09return rename(packagePath, path.join(packagePath, '..', 'package-old2'))%0A%09%09.then(function() %7B%0A%09%09%09return new Promise(function(resolve) %7B%0A%09%09%09%09setTimeout(resolve, 3000);%0A%09%09%09%7D);%0A%09%09%7D)%0A%09%09.then(function() %7B%0A%09%09%09fs.writeFileSync(packagePath, 'test');%0A%09%09%09return new Promise(function(resolve) %7B%0A%09%09%09%09setTimeout(resolve, 3000);%0A%09%09%09%7D);%0A%09%09%7D)%0A%09%09.then(function() %7B%0A%09%09%09return true;%0A%09%09%7D
);%0A%7D
|
09f68c637ec230e523a9fca5ff3ff2ae33b9d351
|
Add layers to map options
|
app/anol/modules/map/map-service.js
|
app/anol/modules/map/map-service.js
|
angular.module('anol.map')
.provider('MapService', [function() {
var _view;
var buildMapConfig = function(layers, controls) {
var map = new ol.Map(angular.extend({}, {
'controls': controls
}));
map.setView(_view);
angular.forEach(layers, function(layer) {
map.addLayer(layer);
});
return map;
};
this.addView = function(view) {
_view = view;
};
this.$get = ['LayersService', 'ControlsService', function(LayersService, ControlsService) {
var MapService = function() {
this.map = undefined;
};
MapService.prototype.getMap = function() {
if(angular.isUndefined(this.map)) {
this.map = buildMapConfig(
LayersService.layers,
ControlsService.controls
);
LayersService.registerMap(this.map);
}
return this.map;
};
return new MapService();
}];
}]);
|
JavaScript
| 0.000001 |
@@ -195,17 +195,16 @@
-'
controls
': c
@@ -199,17 +199,16 @@
controls
-'
: contro
@@ -201,32 +201,33 @@
ntrols: controls
+,
%0A %7D));%0A
@@ -223,90 +223,26 @@
-%7D));%0A map.setView(_view);%0A angular.forEach(layers, function(
+ layers:
layer
-) %7B
+s
%0A
@@ -250,42 +250,38 @@
- map.addLayer(layer);%0A %7D
+%7D));%0A map.setView(_view
);%0A
|
243949b415c875f56f01ef2793ebd23e4ddc88a4
|
Add semicolons and add temporary string for time remaining
|
app/assets/javascripts/add_skill.js
|
app/assets/javascripts/add_skill.js
|
function addSkill() {
$("#new_skill").on("submit", function (event) {
event.preventDefault();
var $target = $(event.target);
console.log($target)
if ($('#skill_title').val() === "") {
alert("No skill specified")
} else {
$.ajax({
url: $target.attr("action") + '.json',
type: "post",
data: $target.serialize()
}).done(function (response) {
$('.skills').append(response.title + "<br>");
$target[0][2].value = "";
});
}
});
}
|
JavaScript
| 0.000001 |
@@ -152,16 +152,17 @@
$target)
+;
%0A if
@@ -229,16 +229,17 @@
cified%22)
+;
%0A %7D e
@@ -442,16 +442,48 @@
.title +
+ %22 - Time remaining: 24:00:00%22 +
%22%3Cbr%3E%22)
|
0882c7fe96dfd2143c3effe86c3e2cd4ac4a29b3
|
update countdown.js based on code climate recommendations
|
app/assets/javascripts/countdown.js
|
app/assets/javascripts/countdown.js
|
(function (e) {
e.fn.countdown = function (t, n) {
function i() {
eventDate = Date.parse(r.date) / 1e3;
currentDate = Math.floor(e.now() / 1e3);
seconds = eventDate - currentDate;
days = Math.floor(seconds / 86400);
seconds -= days * 60 * 60 * 24;
hours = (Math.floor(seconds / 3600)) + 4;
seconds -= (hours -4) * 60 * 60;
minutes = Math.floor(seconds / 60);
seconds -= minutes * 60;
days == 1 ? thisEl.find(".timeRefDays").text("day") : thisEl.find(".timeRefDays").text("days");
hours == 1 ? thisEl.find(".timeRefHours").text("hour") : thisEl.find(".timeRefHours").text("hours");
minutes == 1 ? thisEl.find(".timeRefMinutes").text("minute") : thisEl.find(".timeRefMinutes").text("minutes");
seconds == 1 ? thisEl.find(".timeRefSeconds").text("second") : thisEl.find(".timeRefSeconds").text("seconds");
if (r["format"] == "on") {
days = String(days).length >= 2 ? days : "0" + days;
hours = String(hours).length >= 2 ? hours : "0" + hours;
minutes = String(minutes).length >= 2 ? minutes : "0" + minutes;
seconds = String(seconds).length >= 2 ? seconds : "0" + seconds
}
if (!isNaN(eventDate)) {
thisEl.find(".days").text(days);
thisEl.find(".hours").text(hours);
thisEl.find(".minutes").text(minutes);
thisEl.find(".seconds").text(seconds)
} else {
alert("broken!");
clearInterval(interval)
}
}
var thisEl = e(this);
var r = {
date: null,
format: null
};
t && e.extend(r, t);
i();
interval = setInterval(i, 1e3)
}
})(jQuery);
// $( document ).ajaxComplete() {
// debugger;
// function e() {
// var e = new Date;
// e.setDate(e.getDate() + 60);
// dd = e.getDate();
// mm = e.getMonth() + 1;
// y = e.getFullYear();
// futureFormattedDate = mm + "/" + dd + "/" + y;
// return futureFormattedDate
// }
// $(".countdown").each(function(){
// debugger;
// $(this).countdown({
// date: $(this).children('.expiredate').attr("value"),
// format: "on"
// });
// })
// };
$(function () {
function e() {
var e = new Date;
e.setDate(e.getDate() + 60);
dd = e.getDate();
mm = e.getMonth() + 1;
y = e.getFullYear();
futureFormattedDate = mm + "/" + dd + "/" + y;
return futureFormattedDate
};
countDownListener();
});
function countDownListener(){
$("#menu").each(function(){
$(".countdown").each(function(){
$(this).countdown({
date: $(this).children('.expiredate').attr("value"),
format: "on"
});
})
});
}
// function countDownListener(){
// $("#menu").find(".countdown").each(function(){
// $(this).countdown({
// date: $(this).children('.expiredate').attr("value"),
// format: "on"
// });
// })
// };
|
JavaScript
| 0 |
@@ -9,17 +9,16 @@
n (e) %7B%0A
-%0A
e.fn
@@ -75,16 +75,20 @@
+var
eventDat
@@ -125,16 +125,20 @@
+var
currentD
@@ -170,32 +170,36 @@
/ 1e3);%0A
+var
seconds = eventD
@@ -221,24 +221,28 @@
te;%0A
+var
days = Math.
@@ -305,32 +305,36 @@
0 * 24;%0A
+var
hours = (Math.fl
@@ -400,32 +400,36 @@
0 * 60;%0A
+var
minutes = Math.f
@@ -492,24 +492,25 @@
days ==
+=
1 ? thisEl.
@@ -598,24 +598,25 @@
hours ==
+=
1 ? thisEl.
@@ -710,24 +710,25 @@
minutes ==
+=
1 ? thisEl.
@@ -834,16 +834,17 @@
conds ==
+=
1 ? thi
@@ -962,16 +962,17 @@
mat%22%5D ==
+=
%22on%22) %7B
@@ -1258,16 +1258,17 @@
seconds
+;
%0A
@@ -1495,16 +1495,17 @@
seconds)
+;
%0A
@@ -1579,16 +1579,17 @@
nterval)
+;
%0A
@@ -1723,16 +1723,20 @@
();%0A
+var
interval
@@ -1757,16 +1757,17 @@
(i, 1e3)
+;
%0A %7D%0A
@@ -2365,13 +2365,8 @@
) %7B%0A
- %0A
@@ -2443,32 +2443,36 @@
+ 60);%0A
+var
dd = e.getDate()
@@ -2473,32 +2473,36 @@
Date();%0A
+var
mm = e.getMonth(
@@ -2508,32 +2508,36 @@
() + 1;%0A
+var
y = e.getFullYea
@@ -2541,32 +2541,36 @@
Year();%0A
+var
futureFormattedD
@@ -2634,24 +2634,25 @@
ttedDate
+;
%0A %7D;%0A
%0A cou
@@ -2643,17 +2643,16 @@
%0A %7D;%0A
-%0A
coun
@@ -3181,17 +3181,8 @@
)%0A// %7D;%0A
-%0A%0A%0A%0A%0A%0A%0A%0A%0A
|
6a22d2cdeb663a40f0427467ea1331b7065b7574
|
add gon and Routes
|
app/assets/javascripts/rails_spa.js
|
app/assets/javascripts/rails_spa.js
|
/*
*= require perfect-scrollbar.min
*= require pace.min
*= require dcbox
*= require angular
*= require ng-notify
*= require underscore
*= require angular-resource
*= require angular-sanitize
*= require angular-route
*= require angular-locale_ru-ru
*= require_self
*= require_tree .
*/
var rails_spa = angular.module("rails_spa", ["ngResource", "ngRoute", "ngSanitize", "ngNotify"])
rails_spa.run(['$rootScope', 'Page', 'Sign', function ($rootScope, Page, Sign) {
$rootScope.Page = Page;
$rootScope.Sign = Sign;
}])
|
JavaScript
| 0 |
@@ -510,11 +510,65 @@
= Sign;%0A
+ $rootScope.gon = gon;%0A $rootScope.Routes = Routes;%0A
%7D%5D)
|
9f790cb208b1b202503fc24b6d3b267e7ea3aeb1
|
Stop truncating numbers
|
libraries/Native/Show.js
|
libraries/Native/Show.js
|
Elm.Native.Show = {};
Elm.Native.Show.make = function(elm) {
elm.Native = elm.Native || {};
elm.Native.Show = elm.Native.Show || {};
if (elm.Native.Show.values) return elm.Native.Show.values;
var NList = Elm.Native.List.make(elm);
var Array = Elm.Array.make(elm);
var List = Elm.List.make(elm);
var Dict = Elm.Dict.make(elm);
var Tuple2 = Elm.Native.Utils.make(elm).Tuple2;
var toString = function(v) {
var type = typeof v;
if (type === "function") {
var name = v.func ? v.func.name : v.name;
return '<function' + (name === '' ? '' : ': ') + name + '>';
}
else if (type === "boolean") {
return v ? "True" : "False";
}
else if (type === "number") {
return v.toFixed(2).replace(/\.0+$/g, '');
}
else if ((v instanceof String) && v.isChar) {
return "'" + addSlashes(v) + "'";
}
else if (type === "string") {
return '"' + addSlashes(v) + '"';
}
else if (type === "object" && '_' in v && probablyPublic(v)) {
var output = [];
for (var k in v._) {
for (var i = v._[k].length; i--; ) {
output.push(k + " = " + toString(v._[k][i]));
}
}
for (var k in v) {
if (k === '_') continue;
output.push(k + " = " + toString(v[k]));
}
if (output.length === 0) {
return "{}";
}
return "{ " + output.join(", ") + " }";
}
else if (type === "object" && 'ctor' in v) {
if (v.ctor.substring(0,6) === "_Tuple") {
var output = [];
for (var k in v) {
if (k === 'ctor') continue;
output.push(toString(v[k]));
}
return "(" + output.join(",") + ")";
}
else if (v.ctor === "_Array") {
var list = Array.toList(v);
return "Array.fromList " + toString(list);
}
else if (v.ctor === "::") {
var output = '[' + toString(v._0);
v = v._1;
while (v.ctor === "::") {
output += "," + toString(v._0);
v = v._1;
}
return output + ']';
}
else if (v.ctor === "[]") {
return "[]";
}
else if (v.ctor === "RBNode" || v.ctor === "RBEmpty") {
var cons = F3(function(k,v,acc){return NList.Cons(Tuple2(k,v),acc)});
var list = A3(Dict.foldr, cons, NList.Nil, v);
var name = "Dict";
if (list.ctor === "::" && list._0._1.ctor === "_Tuple0") {
name = "Set";
list = A2(List.map, function(x){return x._0}, list);
}
return name + ".fromList " + toString(list);
}
else {
var output = "";
for (var i in v) {
if (i === 'ctor') continue;
var str = toString(v[i]);
var parenless = str[0] === '{' || str[0] === '<' || str.indexOf(' ') < 0;
output += ' ' + (parenless ? str : '(' + str + ')');
}
return v.ctor + output;
}
}
if (type === 'object' && 'recv' in v) {
return '<signal>';
}
return "<internal structure>";
};
function addSlashes(str) {
return str.replace(/\\/g, '\\\\')
.replace(/\n/g, '\\n')
.replace(/\t/g, '\\t')
.replace(/\r/g, '\\r')
.replace(/\v/g, '\\v')
.replace(/\0/g, '\\0')
.replace(/\'/g, "\\'")
.replace(/\"/g, '\\"');
}
function probablyPublic(v) {
var keys = Object.keys(v);
var len = keys.length;
if (len === 3
&& 'props' in v
&& 'element' in v) return false;
if (len === 5
&& 'horizontal' in v
&& 'vertical' in v
&& 'x' in v
&& 'y' in v) return false;
if (len === 7
&& 'theta' in v
&& 'scale' in v
&& 'x' in v
&& 'y' in v
&& 'alpha' in v
&& 'form' in v) return false;
return true;
}
return elm.Native.Show.values = { show:toString };
};
|
JavaScript
| 0 |
@@ -787,41 +787,13 @@
rn v
-.toFixed(2).replace(/%5C.0+$/g, '')
+ + %22%22
;%0A
|
9a1c88d2011dac0e7c646596fed7f45cc8dc5906
|
remove hard-coded localdomain
|
test/test.js
|
test/test.js
|
Test = {
get: function(id) {
return document.getElementById(id);
},
load: function() {
Test.store.get('some_key', function(ok, val) {
if (ok)
Test.get('data').value = val;
});
},
save: function() {
var val = Test.get('data').value = val;
Test.store.set('some_key', val);
},
init: function() {
// create new persistent store
Test.store = new Persist.Store('test', {
domain: 'localdomain'
});
// attach callbacks
Test.get('load-btn').onclick = Test.load;
Test.get('save-btn').onclick = Test.save;
}
};
|
JavaScript
| 0.811801 |
@@ -418,46 +418,8 @@
est'
-, %7B %0A domain: 'localdomain'%0A %7D
);%0A%0A
|
bb24bda227faf4c0fe3dc56d3af82b789bc7e54d
|
Update tests for direct injection operator
|
test/test.js
|
test/test.js
|
var ying = require('../lib/main');
var assert = require('assert');
var util = require('util');
var specIndex = 1;
var specGroupIndex = 1;
function run_spec(func, pas, result) {
it(util.format('spec(%d) group(%d)', specIndex, specGroupIndex), function () {
assert.equal(func(pas), result);
specIndex++;
});
}
describe('ying test', function() {
var specData = [
{
src: '<p>{{name}}</p>',
pas: [{name: 'Mgen >>>'}, '', null],
exp: ['<p>Mgen >>></p>', '<p></p>', '<p></p>']
},
{
src: '<p>{{= _e(d.id ? d.id + "~" + d.name : d.error) }}</p>',
pas: [{id: 123, name: 'Mgen >>>'}, {error: 'Fun with ying'}],
exp: ['<p>123~Mgen >>></p>', '<p>Fun with ying</p>']
},
{
src: '<ul>{{# var s = ""; for(var i in d.users) s += "<li>" + _e(d.users[i]) + "</li>"; return s; }}</ul>',
pas: [{users: ['aaa', 'b', 'cccc', 'dd']}],
exp: ['<ul><li>aaa</li><li>b</li><li>cccc</li><li>dd</li></ul>']
},
{
src: '<body>{{= d.content }}</body>',
pas: [{content: '<h1>hello</h1>'}],
exp: ['<body><h1>hello</h1></body>']
},
{
src: '<p>{{=_e(d.id ? d.id + "~" + d.name : d.error)}}</p>',
pas: [{id: 123, name: 'Mgen >>>'}, {error: 'Fun with ying'}],
exp: ['<p>123~Mgen >>></p>', '<p>Fun with ying</p>']
},
{
src: '<ul>{{#var s = ""; for(var i in d.users) s += "<li>" + _e(d.users[i]) + "</li>"; return s;}}</ul>',
pas: [{users: ['aaa', 'b', 'cccc', 'dd']}],
exp: ['<ul><li>aaa</li><li>b</li><li>cccc</li><li>dd</li></ul>']
},
{
src: '<body>{{=d.content}}</body>',
pas: [{content: '<h1>hello</h1>'}],
exp: ['<body><h1>hello</h1></body>']
},
{
src: ' {{a}} ',
pas: [{a: 'a'}],
exp: [' a ']
},
{
src: '{{a}} ',
pas: [{a: 'a'}],
exp: ['a ']
},
{
src: '{{=d.a}} ',
pas: [{a: 'a'}],
exp: ['a ']
},
{
src: '{{=d.flag\n?\n"true"\n:\n"false"}}',
pas: [{}],
exp: ['false']
},
{
src: `{{# let res = '';
if (d.flag) {
res += '1';
if (d.flag2) {
res += '2';
}
}
return res;
}}`,
pas: [{flag: 1, flag2: 1}, null, {flag: 1}, {flag2: 1}],
exp: ['12', '', '1', '']
},
{
src: '{{a}} {{=d.a}}',
pas: [{a: '/\\"\'<> \t&'}],
exp: ['/\\"'<> \t& /\\"\'<> \t&']
}
];
specData.forEach(function (specItem) {
var func = ying.compile(specItem.src);
var exp = specItem.exp;
specItem.pas.forEach(function (pasItem, index) {
run_spec(func, pasItem, exp[index]);
specGroupIndex++;
});
});
});
|
JavaScript
| 0 |
@@ -2859,16 +2859,306 @@
%3E %5Ct&'%5D%0A
+ %7D,%0A %7B%0A src: '%7B%7B~ if(d.flag)%7B %7D%7D%7B%7B= _e(d.trueValue)%7D%7D%7B%7B~ %7Delse%7B %7D%7D%7B%7BfalseValue%7D%7D%7B%7B~ %7D %7D%7D',%0A pas: %5B%7Bflag: true, trueValue: '%3Ctrue%3E', falseValue: '%3Cfalse%3E'%7D, %7BtrueValue: '%3Ctrue%3E', falseValue: '%3Cfalse%3E'%7D%5D,%0A exp: %5B'<true>', '<false>'%5D%0A
|
37a29cb0dbe8b5f65af83b4f60f90324d1470f31
|
Improve tests
|
test/test.js
|
test/test.js
|
const chai = require('chai');
const ethAddress = require('ethereum-address');
const { RaidenNode } = require('../index.js');
const { expect } = chai;
const raidenEndpoints = ['http://localhost:5001', 'http://localhost:5002'];
const testnetToken = '0x0f114a1e9db192502e7856309cc899952b3db1ed';
const settleTimeout = 100;
const revealTimeout = 30;
function expectEthAddress(address) {
expect(ethAddress.isAddress(address)).to.be.true;
}
describe('RaidenNode', () => {
const nodes = raidenEndpoints.map(ep => new RaidenNode(ep));
nodes.forEach((node, index) => {
describe(`node[${index}]`, () => {
describe('#getAddress()', () => {
it('should return valid address', () =>
node.getAddress().then((address) => {
expectEthAddress(address);
node.address = address;
}));
});
describe('#getRegisteredTokens()', () => {
it('should return testnetToken', () =>
node.getRegisteredTokens().then((tokens) => {
expect(tokens).to.include(testnetToken);
}));
});
describe('#joinNetwork()', () => {
it('should connect to testnetToken network', () =>
node.joinNetwork(testnetToken, 40));
});
describe('#leaveNetwork()', () => {
it('should leave the testnetToken network without receiving anything', () =>
node.leaveNetwork(testnetToken, false));
});
});
});
describe.skip('#openChannel()', () => { // openChannel broken on parity -> https://github.com/raiden-network/raiden/issues/879
it('node[0] should open channel with node[1]', () =>
nodes[0].openChannel(nodes[1].address, testnetToken, 40, settleTimeout, revealTimeout)
.then((resp) => {
expectEthAddress(resp.channel_address);
expect(resp.state).to.eql('open');
}));
});
});
|
JavaScript
| 0.000009 |
@@ -1,12 +1,44 @@
+/* eslint-disable no-console */%0A
const chai =
@@ -466,16 +466,176 @@
rue;%0A%7D%0A%0A
+function describeEach(message, arr, cb) %7B%0A arr.forEach((elem, index) =%3E %7B%0A describe(%60$%7Bmessage%7D%5B$%7Bindex%7D%5D%60, () =%3E %7B%0A cb(elem, index);%0A %7D);%0A %7D);%0A%7D%0A%0A
describe
@@ -727,73 +727,41 @@
%0A%0A
-no
des
-.for
+cribe
Each(
-(
+'
node
+'
,
-index) =%3E %7B%0A describe(%60node%5B$%7Bindex%7D%5D%60, (
+nodes, (node
) =%3E
@@ -763,26 +763,24 @@
e) =%3E %7B%0A
-
describe('#g
@@ -793,34 +793,32 @@
ess()', () =%3E %7B%0A
-
it('should
@@ -839,34 +839,32 @@
address', () =%3E%0A
-
node.get
@@ -895,34 +895,32 @@
=%3E %7B%0A
-
expectEthAddress
@@ -936,26 +936,24 @@
;%0A
-
node.address
@@ -964,18 +964,16 @@
ddress;%0A
-
@@ -977,33 +977,29 @@
%7D));%0A
-
%7D);%0A%0A
-
describe
@@ -1025,34 +1025,32 @@
ens()', () =%3E %7B%0A
-
it('should
@@ -1082,26 +1082,24 @@
=%3E%0A
-
node.getRegi
@@ -1138,26 +1138,24 @@
%7B%0A
-
expect(token
@@ -1183,18 +1183,16 @@
Token);%0A
-
@@ -1196,33 +1196,29 @@
%7D));%0A
-
%7D);%0A%0A
-
describe
@@ -1236,34 +1236,32 @@
ork()', () =%3E %7B%0A
-
it('should
@@ -1305,26 +1305,24 @@
=%3E%0A
-
node.joinNet
@@ -1346,24 +1346,28 @@
, 40));%0A
+%7D);%0A
%7D);%0A%0A
@@ -1367,124 +1367,581 @@
%0A%0A
- describe('#leaveNetwork()', () =%3E %7B%0A it('should leave the testnetToken network without receiving anything
+const transferId = Date.now();%0A const amountSent = 7;%0A describe('#sendTokens', () =%3E %7B%0A it('node%5B0%5D should send tokens', () =%3E%0A nodes%5B0%5D.sendTokens(testnetToken, nodes%5B1%5D.address, amountSent, transferId));%0A %7D);%0A%0A describe('#getTokenEvents', () =%3E %7B%0A let events;%0A it('node%5B1%5D should query token events', () =%3E%0A nodes%5B1%5D.getTokenEvents(testnetToken).then((result) =%3E %7B events = result; %7D));%0A console.log(events);%0A %7D);%0A%0A describeEach('node', nodes, (node) =%3E %7B%0A describe('#leaveNetwork()', () =%3E %7B%0A it('should leave the testnetToken network
', (
@@ -1941,26 +1941,24 @@
ork', () =%3E%0A
-
node
@@ -1987,26 +1987,9 @@
oken
-, false));%0A %7D
+)
);%0A
|
c3dab602abe090994b7410abb6183d20cee9ee4c
|
Convert hidden message to lower case JFF
|
test/test.js
|
test/test.js
|
'use strict';
var parseConcat = require('..');
var stread = require('stread');
it('should concat-stream and JSON.parse', function (done) {
var data = {
name: null,
version: "1.1.1",
tags: [true, "awesomeness", [{}]]
};
stread(JSON.stringify(data, null, 2))
.pipe(parseConcat(function (err, result) {
(err == null).should.be.true;
result.should.eql(data);
done();
}));
});
it('should propagate the error', function (done) {
stread('{')
.pipe(parseConcat(function (err) {
err.should.be.an.Error;
done();
}));
});
it('should accept custom parsers', function (done) {
var caps = function (string) {
return (string.match(/[A-Z]/g) || []).join('');
};
stread(' {\nMEdiS]]\n} SorAs \tGEt')
.pipe(parseConcat({ parse: caps }, function (err, result) {
(err == null).should.be.true;
result.should.equal('MESSAGE');
done();
}));
});
|
JavaScript
| 0.999999 |
@@ -760,16 +760,30 @@
join('')
+.toLowerCase()
;%0A %7D;%0A%0A
@@ -957,15 +957,15 @@
al('
-MESSAGE
+message
');%0A
|
956a2cd60b497dc5f96909d001d04620fa0da50b
|
Add test using cli
|
test/test.js
|
test/test.js
|
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var continuation = require('../continuation');
var files = [
'readfile.js',
'fib.js',
'if.js',
'ifvar.js',
'loop.js',
'switch.js',
'switchbreak.js',
'whilebreak.js',
'continue.js',
'factor.js',
'pi.js',
'diskusage.js',
'try_body.js',
'try_catch.js',
'try_both.js',
'list.js',
'defer.js',
'for.js',
'forin.js',
'try_if.js',
'parallel.js',
'parallel_exception.js',
];
var test = function(filename, done) {
fs.readFile('test/cases/' + filename, 'utf-8', function (err, code) {
if (err) done(err);
code = continuation.transform(code);
fs.readFile('test/results/' + filename, 'utf-8', function(err, result) {
if (err) done(err);
assert.equal(code, result);
done();
});
});
}
describe('Transformation', function () {
describe('Test', function () {
files.forEach(function (filename) {
it(filename, function(done){
test(filename, done);
});
});
});
});
|
JavaScript
| 0.000001 |
@@ -73,24 +73,70 @@
re('path');%0A
+var child_process = require('child_process');%0A
var continua
@@ -539,20 +539,28 @@
%5D;%0A%0Avar
-test
+compileByApi
= funct
@@ -657,32 +657,39 @@
) %7B%0A if (err)
+ return
done(err);%0A
@@ -816,16 +816,23 @@
if (err)
+ return
done(er
@@ -900,16 +900,412 @@
%7D);%0A%7D%0A%0A
+var compileByCli = function(filename, done) %7B%0A var bin = 'bin/continuation'%0A var cmd = bin + ' test/cases/' + filename + ' -p'%0A child_process.exec(cmd, function (err, stdout, stderr) %7B%0A if (err) return done(err);%0A fs.readFile('test/results/' + filename, 'utf-8', function(err, result) %7B%0A if (err) done(err);%0A assert.equal(stdout, result + '%5Cn');%0A done();%0A %7D);%0A %7D);%0A%7D%0A%0A
describe
@@ -1353,12 +1353,22 @@
be('
-Test
+Compile by api
', f
@@ -1463,20 +1463,217 @@
-test
+compileByApi(filename, done);%0A %7D);%0A %7D);%0A %7D);%0A describe('Compile by command line', function () %7B%0A files.forEach(function (filename) %7B%0A it(filename, function(done)%7B%0A compileByCli
(filenam
|
b51e505a1780034f8de9f60938af1be576308e56
|
format code
|
test/test.js
|
test/test.js
|
'use strict';
var pugI18n = require('../index');
var path = require('path');
var fs = require('fs-extra');
var sassert = require('stream-assert');
var assert = require('assert');
var gulp = require('gulp');
require('mocha');
var fixtures = function (glob) { return path.join(__dirname, './fixtures', glob); }
describe('gulp-pug-i18n', function () {
afterEach(function (done) {
fs.remove('./.tmp', done);
});
describe('Translate directory:', function () {
it('should translate the template into english', function (done) {
var options = {
i18n: {
dest: '.tmp',
locales: 'test/locales/*.*'
},
pretty: true
};
gulp.src(fixtures('directory/*.pug'))
.pipe(pugI18n(options))
.pipe(gulp.dest(options.i18n.dest))
.pipe(sassert.end(function () {
var expected = fs.readFileSync(path.join(__dirname, 'expected/en_US/sample.html')).toString();
var actual = fs.readFileSync(path.join('./.tmp/en_US/template.html')).toString();
assert.equal(actual, expected);
done();
}));
});
it('should translate the template into spanish', function (done) {
var options = {
i18n: {
dest: '.tmp',
locales: 'test/locales/*.*'
},
pretty: true
};
gulp.src(fixtures('directory/*.pug'))
.pipe(pugI18n(options))
.pipe(gulp.dest(options.i18n.dest))
.pipe(sassert.end(function () {
var expected = fs.readFileSync(path.join(__dirname, 'expected/es_ES/sample.html')).toString();
var actual = fs.readFileSync(path.join('./.tmp/es_ES/template.html')).toString();
assert.equal(actual, expected);
done();
}));
});
});
describe('Translate file:', function () {
it('should translate the template into english', function (done) {
var options = {
i18n: {
dest: '.tmp',
locales: 'test/locales/*.*',
localeExtension: true
},
pretty: true
};
gulp.src(fixtures('directory/*.pug'))
.pipe(pugI18n(options))
.pipe(gulp.dest(options.i18n.dest))
.pipe(sassert.end(function () {
var expected = fs.readFileSync(path.join(__dirname, 'expected/template.en_us.html')).toString();
var actual = fs.readFileSync(path.join('./.tmp/template.en_us.html')).toString();
assert.equal(actual, expected);
done();
}));
});
it('should translate the template into spanish', function (done) {
var options = {
i18n: {
dest: '.tmp',
locales: 'test/locales/*.*',
localeExtension: true
},
pretty: true
};
gulp.src(fixtures('directory/*.pug'))
.pipe(pugI18n(options))
.pipe(gulp.dest(options.i18n.dest))
.pipe(sassert.end(function () {
var expected = fs.readFileSync(path.join(__dirname, 'expected/template.es_es.html')).toString();
var actual = fs.readFileSync(path.join('./.tmp/template.es_es.html')).toString();
assert.equal(actual, expected);
done();
}));
});
});
xdescribe('Without i18n:', function () {
it('should generate the template without i18n task options', function (done) {
var options = {
i18n: {
dest: '.tmp'
},
data: {
$i18n: {
message: 'Hello world!',
nested: {
msg: 'and hello to you'
}
}
},
pretty: true
};
gulp.src(fixtures('directory/*.pug'))
.pipe(pugI18n(options))
.pipe(gulp.dest('.tmp'))
.pipe(sassert.end(function () {
var expected = fs.readFileSync(path.join(__dirname, 'expected/template.html')).toString();
var actual = fs.readFileSync(path.join(__dirname, '../', '.tmp/template.html')).toString();
assert.equal(actual, expected);
done();
}));
});
});
});
|
JavaScript
| 0.000009 |
@@ -3200,17 +3200,16 @@
%7D);%0A%0A
-x
describe
@@ -3694,22 +3694,33 @@
lp.dest(
-'.tmp'
+options.i18n.dest
))%0A
|
633b33c80a6d23adcf82cc1bc8d97bbb6e17d341
|
Update test.js
|
test/test.js
|
test/test.js
|
var should = require('should');
var assert = require('assert');
var request = require('supertest');
var app = require("./server");
var server = app.listen(0);
var port = server.address().port;
describe('Test cubieboard-monitor', function() {
var server;
var port;
var url;;
// within before() you can run all the operations that are needed to setup your tests. In this case
before(function(done) {
server = app.listen(0, done);
port = server.address.port();
url = 'http://localhost:'+port;
done();
});
after(function(done){
server.stop();
done();
}
// use describe to give a title to your test suite, in this case the tile is "Monitor"
// and then specify a function in which we are going to declare all the tests
// we want to run. Each test starts with the function it() and as a first argument
// we have to provide a meaningful title for it, whereas as the second argument we
// specify a function that takes a single parameter, "done", that we will use
// to specify when our test is completed, and that's what makes easy
// to perform async test!
describe('Monitor', function() {
it('debería de devolver el hostname', function(done) {
// once we have specified the info we want to send to the server via POST verb,
// we need to actually perform the action on the resource, in this case we want to
// POST on /api/profiles and we want to send some info
// We do this using the request object, requiring supertest!
request(url)
.post('/SYS_hostname')
// end handles the response
.end(function(err, res) {
if (err) {
throw err;
}
// this is should.js syntax, very clear
//res.should.have.status(400);
res.body.should.not.equal(null);
done();
});
});
});
describe('Visión General', function() {
describe('CPU', function(done) {
it('debería de devolver la temperatura de la CPU', function(done) {
// once we have specified the info we want to send to the server via POST verb,
// we need to actually perform the action on the resource, in this case we want to
// POST on /api/profiles and we want to send some info
// We do this using the request object, requiring supertest!
request(url)
.post('/CPU_Temp')
// end handles the response
.end(function(err, res) {
if (err) {
throw err;
}
// this is should.js syntax, very clear
//res.should.have.status(400);
res.body.should.not.equal(null);
done();
});
});
it('debería de devolver el uso de la CPU', function(done) {
// once we have specified the info we want to send to the server via POST verb,
// we need to actually perform the action on the resource, in this case we want to
// POST on /api/profiles and we want to send some info
// We do this using the request object, requiring supertest!
request(url)
.post('/CPU_Uso')
// end handles the response
.end(function(err, res) {
if (err) {
throw err;
}
// this is should.js syntax, very clear
//res.should.have.status(400);
res.body.should.not.equal(null);
done();
});
});
});
describe('HDD', function(done) {
it('debería de devolver la temperatura del disco', function(done) {
// once we have specified the info we want to send to the server via POST verb,
// we need to actually perform the action on the resource, in this case we want to
// POST on /api/profiles and we want to send some info
// We do this using the request object, requiring supertest!
request(url)
.post('/HDD_Temp')
// end handles the response
.end(function(err, res) {
if (err) {
throw err;
}
// this is should.js syntax, very clear
//res.should.have.status(400);
res.body.should.not.equal(null);
done();
});
});
it('debería de devolver el uso del disco', function(done) {
// once we have specified the info we want to send to the server via POST verb,
// we need to actually perform the action on the resource, in this case we want to
// POST on /api/profiles and we want to send some info
// We do this using the request object, requiring supertest!
request(url)
.post('/HDD_Uso')
// end handles the response
.end(function(err, res) {
if (err) {
throw err;
}
// this is should.js syntax, very clear
//res.should.have.status(400);
res.body.should.not.equal(null);
done();
});
});
});
});
});
|
JavaScript
| 0.000001 |
@@ -621,24 +621,26 @@
one();%0A %7D
+);
%0A // use
|
d25944ea1f990723f6f4d873366cfe83ab8d2271
|
move utility transformers to top - fixes #1440
|
src/babel/transformation/transformers/index.js
|
src/babel/transformation/transformers/index.js
|
export default {
_modules: require("./internal/modules"),
"minification.deadCodeElimination": require("./minification/dead-code-elimination"),
"es7.classProperties": require("./es7/class-properties"),
"es7.trailingFunctionCommas": require("./es7/trailing-function-commas"),
"es7.asyncFunctions": require("./es7/async-functions"),
"es7.decorators": require("./es7/decorators"),
strict: require("./other/strict"),
_validation: require("./internal/validation"),
"validation.undeclaredVariableCheck": require("./validation/undeclared-variable-check"),
"validation.react": require("./validation/react"),
// this goes at the start so we only transform the original user code
"spec.functionName": require("./spec/function-name"),
// needs to be before `_shadowFunctions`
"es6.arrowFunctions": require("./es6/arrow-functions"),
"spec.blockScopedFunctions": require("./spec/block-scoped-functions"),
"optimisation.react.constantElements": require("./optimisation/react.constant-elements"),
"optimisation.react.inlineElements": require("./optimisation/react.inline-elements"),
reactCompat: require("./other/react-compat"),
react: require("./other/react"),
// needs to be before `regenerator` due to generator comprehensions
// needs to be before `_shadowFunctions`
"es7.comprehensions": require("./es7/comprehensions"),
"es6.classes": require("./es6/classes"),
asyncToGenerator: require("./other/async-to-generator"),
bluebirdCoroutines: require("./other/bluebird-coroutines"),
"es6.objectSuper": require("./es6/object-super"),
"es7.objectRestSpread": require("./es7/object-rest-spread"),
"es7.exponentiationOperator": require("./es7/exponentiation-operator"),
"es6.spec.templateLiterals": require("./es6/spec.template-literals"),
"es6.templateLiterals": require("./es6/template-literals"),
"es5.properties.mutators": require("./es5/properties.mutators"),
"es6.properties.shorthand": require("./es6/properties.shorthand"),
// needs to be before `_shadowFunctions` due to define property closure
"es6.properties.computed": require("./es6/properties.computed"),
"optimisation.flow.forOf": require("./optimisation/flow.for-of"),
"es6.forOf": require("./es6/for-of"),
"es6.regex.sticky": require("./es6/regex.sticky"),
"es6.regex.unicode": require("./es6/regex.unicode"),
"es6.constants": require("./es6/constants"),
// needs to be before `es6.parameters.default` as default parameters will destroy the rest param
"es6.parameters.rest": require("./es6/parameters.rest"),
// needs to be after `es6.parameters.rest` as we use `toArray` and avoid turning an already known array into one
"es6.spread": require("./es6/spread"),
// needs to be before `es6.blockScoping` as default parameters have a TDZ
"es6.parameters.default": require("./es6/parameters.default"),
// needs to be before `es6.blockScoping` as let variables may be produced
"es6.destructuring": require("./es6/destructuring"),
// needs to be before `_shadowFunctions` due to block scopes sometimes being wrapped in a
// closure
"es6.blockScoping": require("./es6/block-scoping"),
// needs to be after `es6.blockScoping` due to needing `letReferences` set on blocks
"es6.spec.blockScoping": require("./es6/spec.block-scoping"),
// needs to be after `es6.parameters.*` and `es6.blockScoping` due to needing pure
// identifiers in parameters and variable declarators
"es6.tailCall": require("./es6/tail-call"),
regenerator: require("./other/regenerator"),
// needs to be after `regenerator` due to needing `regeneratorRuntime` references
// needs to be after `es6.forOf` due to needing `Symbol.iterator` references
// needs to be before `es6.modules` due to dynamic imports
runtime: require("./other/runtime"),
// needs to be before `_blockHoist` due to function hoisting etc
"es7.exportExtensions": require("./es7/export-extensions"),
"es6.modules": require("./es6/modules"),
_blockHoist: require("./internal/block-hoist"),
"spec.protoToAssign": require("./spec/proto-to-assign"),
_shadowFunctions: require("./internal/shadow-functions"),
"es7.doExpressions": require("./es7/do-expressions"),
"es6.spec.symbols": require("./es6/spec.symbols"),
ludicrous: require("./other/ludicrous"),
"spec.undefinedToVoid": require("./spec/undefined-to-void"),
_strict: require("./internal/strict"),
_moduleFormatter: require("./internal/module-formatter"),
"es3.propertyLiterals": require("./es3/property-literals"),
"es3.memberExpressionLiterals": require("./es3/member-expression-literals"),
"utility.removeDebugger": require("./utility/remove-debugger"),
"utility.removeConsole": require("./utility/remove-console"),
"utility.inlineEnvironmentVariables": require("./utility/inline-environment-variables"),
"utility.inlineExpressions": require("./utility/inline-expressions"),
"minification.memberExpressionLiterals": require("./minification/member-expression-literals"),
"minification.propertyLiterals": require("./minification/property-literals"),
jscript: require("./other/jscript"),
flow: require("./other/flow")
};
|
JavaScript
| 0 |
@@ -80,24 +80,366 @@
/modules%22),%0A
+%0A %22utility.removeDebugger%22: require(%22./utility/remove-debugger%22),%0A %22utility.removeConsole%22: require(%22./utility/remove-console%22),%0A%0A %22utility.inlineEnvironmentVariables%22: require(%22./utility/inline-environment-variables%22),%0A %22utility.inlineExpressions%22: require(%22./utility/inline-expressions%22),%0A%0A
%22minificat
@@ -6057,349 +6057,8 @@
),%0A%0A
- %22utility.removeDebugger%22: require(%22./utility/remove-debugger%22),%0A %22utility.removeConsole%22: require(%22./utility/remove-console%22),%0A%0A %22utility.inlineEnvironmentVariables%22: require(%22./utility/inline-environment-variables%22),%0A %22utility.inlineExpressions%22: require(%22./utility/inline-expressions%22),%0A%0A
%22m
|
025d2815497fd4b4906786ea573b1f9779ade9a3
|
Update test.js
|
test/test.js
|
test/test.js
|
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
var chalk = require('chalk');
var PhpstylGenerator = yeoman.generators.Base.extend({
init: function () {
this.pkg = require('../package.json');
this.on('end', function () {
if (!this.options['skip-install']) {
this.installDependencies();
}
});
},
askFor: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay('Welcome to the marvelous Phpstyl generator!'));
var prompts = [{
name: 'title',
message: 'What is the title of your application?',
default: 'Hello World'
}];
this.prompt(prompts, function (props) {
this.title = props.title;
done();
}.bind(this));
},
var extractGeneratorName = function (_, appname) {
var slugged = _.slugify(title);
var match = slugged.match(/^$/);
if (match && match.length === 2) {
return match[1].toLowerCase();
}
return slugged;
};
}.bind(this));
},
app: function () {
this.mkdir('src');
this.mkdir('src/scripts');
this.mkdir('src/styles');
this.template('src/index.php', 'src/index.php');
this.template('src/scripts/main.js', 'src/scripts/main.js');
this.template('src/styles/main.styl', 'src/styles/main.styl');
this.copy('_package.json', 'package.json');
this.copy('_bower.json', 'bower.json');
this.copy('editorconfig', '.editorconfig');
this.copy('gitignore', '.gitignore');
this.copy('bowerrc', '.bowerrc');
this.copy('jshintrc', '.jshintrc');
this.template('Gruntfile.js', 'Gruntfile.js');
this.template('README.md', 'README.md');
},
projectfiles: function () {
}
});
module.exports = PhpstylGenerator;
|
JavaScript
| 0.000001 |
@@ -1,8 +1,15 @@
+//Todo%0A
'use str
|
bf68aa846eba7fe0cedacb34f82570c3aeba1cc4
|
update or create doc
|
controller/hostname.js
|
controller/hostname.js
|
"use strict";
var util = require("util");
var goose = require("../models/mongoose").instance;
var hostnameSchema = require("../models/schema-hostname.js");
var Member = goose.model("Member", hostnameSchema);
module.exports = {
create: create,
read: read,
update: update,
delete: deleteFn
};
/**
* @description Create a new entry in the database
* @param {object} request
* @param {object} request.body
* @param {string} request.body.name
* @param {string} request.body.message
* @param {string} request.body.address
* @param {object} request.params
* @param {string} request.params.NAME
* @param {string} request.params.ADDRESS
* @param {string} request.params.MESSAGE
* @return {response} response
*/
function create (req, res) {
var NAME = getName(req);
var ADDRESS = getAddress(req);
var MESSAGE = req.body.message || req.params.MESSAGE || "";
console.log("name? ", NAME);
console.log("address? ", ADDRESS);
// console.log("gimme everything you got", req.connection);
// console.log("port? ", req.connection.port);
Member.create({
name: NAME,
address: ADDRESS,
message: MESSAGE
}, respond);
// Member.findOneAndUpdate(
// { name: name, address: address, message: message },
// { new: true, upsert: true },
// respond);
function respond (err, doc) {
if (err) {
return res.status(409).json({ err: err });
}
console.log("new entry: ", doc);
res.status(200).send(doc);
}
}
/**
* @description get an entry from the database
* @param {object} request
* @param {string} request.param
* @param {object} response
* @return {response} response
*/
function read (req, res) {
var NAME = req.params.NAME;
var ADDRESS = getAddress(req);
if (NAME) {
console.log("find single", NAME);
Member.findOne({ name: NAME, address: ADDRESS }, respond);
} else {
// seems dangerous
console.log("get all");
Member.find({}, respond);
}
function respond (err, docs) {
console.log("responding with docs", err, docs);
if (err) {
return res.send(err);
}
if (!docs || !Object.keys(docs).length) {
return res.status(404).send("Not found");
}
res.status(200).send(docs);
}
}
/**
* @description Update an entry's IP address or name
* @param {object} request
* @param {string} request.param
* @param {object} response
* @return {response} response
*/
function update (req, res) {
// IP will have ":"
var IP = req.params.ADDRESS;
var NAME = req.params.NAME;
var MESSAGE = req.body.message || req.params.MESSAGE;
Member.findOneAndUpdate(
{ name: NAME, address: IP, message: MESSAGE, updated_at: Date.now() },
{ new: true },
respond);
function respond (err, newDoc) {
if (err) {
return res.send(err);
}
if (!newDoc.length) {
return res.status(404).send("Not found");
}
res.status(200).send(newDoc);
}
}
/**
* @description delete a row
* @param {object} request
* @param {string} request.param
* @param {object} response
* @return {response} response
*/
function deleteFn (req, res) {
var NAME = getName(req);
var ADDRESS = getAddress(req);
Member.remove({ name: NAME, address: ADDRESS }, respond);
function respond (err, docs) {
if (err) {
return res.end();
}
if (!docs) {
return res.status(404).send("Not found");
}
res.status(200).send(docs.result);
}
}
function getName (req) {
return req.params.NAME || req.body.name || "anonymous";
}
function getAddress (req) {
return req.headers["x-forwarded-for"] || req.connection.remoteAddress;
}
function updateIpAddress (req, res) {
return res.status(200).send();
}
function updateName (req, res) {
return res.status(200).send();
}
|
JavaScript
| 0 |
@@ -2608,24 +2608,38 @@
%0A%09%09%0A%09%09%7B new:
+ true, upsert:
true %7D, %0A%0A%09
@@ -2636,16 +2636,16 @@
rue %7D, %0A
-
%0A%09%09respo
@@ -2680,24 +2680,50 @@
, newDoc) %7B%0A
+%09%09newDoc = newDoc %7C%7C %7B%7D;%0A%0A
%09%09if (err) %7B
@@ -2760,22 +2760,35 @@
%0A%09%09if (!
+Object.keys(
newDoc
+)
.length)
@@ -2785,32 +2785,55 @@
c).length) %7B%0A%09%09%09
+create(req, res);%0A%09%09%09//
return res.statu
|
a47c4aab289201869184752214f1a642fb3637d3
|
Update test.js
|
test/test.js
|
test/test.js
|
function traverseDOM(node){
var childLen=node.childNodes.length;
if(childLen==0){
}else{
for(var i=0;i<childLen;i++){
var childTmp=node.childNodes[i];
console.log(childTmp);
if(childTmp.nodeName=="DIV"){
if(childTmp.style){
var obj=window.getComputedStyle(childTmp);
if(obj.hasOwnProperty("position")){
if(obj["position"]=="fixed"){
childTmp.style.display="none";
}
return;
}
}
}
traverseDOM(childTmp);
}
}
}
console.log(document.body);
traverseDOM(document);
|
JavaScript
| 0.000001 |
@@ -592,13 +592,18 @@
document
+.body
);%0A%0A%0A
|
9c5c46d66fc7289a949655dfaef09d83bbd3f4de
|
support for sequential execution of independent test files
|
test/test.js
|
test/test.js
|
#!/usr/bin/env node
/*jslint white: true, browser: true, plusplus: true, vars: true, nomen: true, bitwise: true*/
/*global jQuery: false, $: false, data_graft: false*/
/* Copyright 2010-2011, Carlos Guerreiro
* Licensed under the MIT license */
'use strict';
var jsdom = require('jsdom');
jsdom.env({
html: 'test-1.html',
scripts: [
'../stuff/jquery-1.7.1.min.js',
'../data-graft.js',
'test-common.js',
'test-1.js'
],
done: function(errors, window) {
if(errors) {
throw errors;
}
window.console = console;
window.runTests(function(err) {
if(err) {
console.log('failed');
return;
}
console.log('OK');
});
}});
|
JavaScript
| 0 |
@@ -287,16 +287,164 @@
dom');%0A%0A
+var tests = %5B'test-1'%5D;%0A%0Afunction runNext() %7B%0A var test = tests.shift();%0A%0A if(test === undefined) %7B%0A return;%0A %7D%0A%0A console.log(test+ ':');%0A%0A
jsdom.en
@@ -451,16 +451,18 @@
v(%7B%0A
+
html:
'tes
@@ -461,23 +461,23 @@
ml:
-'
test
--1
++ '
.html',%0A
sc
@@ -472,16 +472,18 @@
.html',%0A
+
script
@@ -487,16 +487,18 @@
ipts: %5B%0A
+
'../
@@ -525,24 +525,26 @@
in.js',%0A
+
+
'../data-gra
@@ -547,24 +547,26 @@
-graft.js',%0A
+
'test-co
@@ -583,25 +583,31 @@
-'
+
test
--1
++ '
.js'%0A
+
+
%5D,%0A
+
do
@@ -633,24 +633,26 @@
, window) %7B%0A
+
if(error
@@ -662,16 +662,18 @@
%7B%0A
+
throw er
@@ -678,26 +678,30 @@
errors;%0A
-%7D%0A
+ %7D%0A
window.c
@@ -718,16 +718,18 @@
onsole;%0A
+
wind
@@ -758,24 +758,26 @@
rr) %7B%0A
+
if(err) %7B%0A
@@ -766,32 +766,34 @@
if(err) %7B%0A
+
console.
@@ -819,24 +819,21 @@
-return;
+%7D else %7B
%0A
- %7D%0A
@@ -861,15 +861,78 @@
-%7D);%0A %7D%7D
+ %7D%0A process.nextTick(runNext);%0A %7D);%0A %7D%7D);%0A%7D%0A%0ArunNext(
);%0A
|
85e3e9da16c8e72a4ce77763c79ffc7e289f8e7b
|
Update generator testfile
|
test/test.js
|
test/test.js
|
/*global describe, beforeEach, it*/
var path = require('path');
var helpers = require('yeoman-generator').test;
var assert = require('assert');
describe('Website generator test', function () {
beforeEach(function (done) {
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}
this.skyward = helpers.createGenerator('skyward:app', [
'../../app', [
helpers.createDummyGenerator(),
'mocha:app'
]
]);
done();
}.bind(this));
});
it('the generator can be required without throwing', function () {
// not testing the actual run of generators yet
this.app = require('../app');
});
it('creates expected files', function (done) {
var expected = [
'.editorconfig',
'tools/bower.json',
'tools/package.json',
'tools/Gruntfile.coffee',
'htdocs/_scss/basic.scss',
'htdocs/index.html'
];
this.skyward.options['skip-install'] = true;
this.skyward.run({}, function () {
helpers.assertFiles(expected);
done();
});
});
});
|
JavaScript
| 0 |
@@ -39,19 +39,16 @@
ar path
-
= requir
@@ -56,16 +56,65 @@
('path')
+;%0Avar assert = require('yeoman-generator').assert
;%0Avar he
@@ -159,23 +159,18 @@
st;%0Avar
-assert
+os
= requi
@@ -177,20 +177,15 @@
re('
-assert
+os
');%0A%0A
-%0A
desc
@@ -194,30 +194,16 @@
be('
-Website generator
test
+:app
', f
@@ -223,20 +223,16 @@
before
-Each
(functio
@@ -258,21 +258,11 @@
ers.
-testDirectory
+run
(pat
@@ -284,446 +284,185 @@
e, '
-temp'), function (err) %7B%0A if (err) %7B%0A return done(err);%0A %7D%0A%0A this.skyward = helpers.createGenerator('skyward:app', %5B%0A '../../app', %5B%0A helpers.createDummyGenerator(),%0A 'mocha:app'%0A %5D%0A %5D);
+../app'))%0A .inDir(path.join(os.tmpdir(), './temp'))%0A .withOptions(%7B 'skip-install': true %7D)%0A .withPrompt(%7B%0A sublimetext: 'Y'%0A %7D)
%0A
-done();%0A %7D.bind(this));%0A %7D);%0A%0A it('the generator can be required without throwing', function () %7B%0A // not testing the actual run of generators yet%0A this.app = require('../app'
+.on('end', done
);%0A
@@ -481,25 +481,16 @@
creates
-expected
files',
@@ -499,28 +499,24 @@
nction (
-done
) %7B%0A
var expe
@@ -511,23 +511,20 @@
-var expected =
+assert.file(
%5B%0A
@@ -698,155 +698,8 @@
%5D
-;%0A%0A this.skyward.options%5B'skip-install'%5D = true;%0A this.skyward.run(%7B%7D, function () %7B%0A helpers.assertFiles(expected);%0A done();%0A %7D
);%0A
|
b390c447cb2b0d988805861672717df651692268
|
Add test coverage for floats
|
test/test.js
|
test/test.js
|
var assert = require("assert")
, sinon = require('sinon')
, clock
, tickFunction
, callbackFunction;
Countdown = require("../lib/countdown");
describe("countdown.js", function() {
beforeEach(function() {
clock = sinon.useFakeTimers();
tickFunction = sinon.spy();
callbackFunction = sinon.spy();
});
afterEach(function() {
clock.restore();
});
describe("Countdown.start", function() {
it("executes onTick while countdown is running", function() {
new Countdown(5, tickFunction, callbackFunction);
assert(tickFunction.callCount == 1);
clock.tick(1000);
assert(tickFunction.callCount == 2);
clock.tick(1000);
assert(tickFunction.callCount == 3);
clock.tick(1000);
assert(tickFunction.callCount == 4);
clock.tick(1000);
assert(tickFunction.callCount == 5);
clock.tick(1000);
assert(tickFunction.callCount == 5);
});
it("executes onComplete", function() {
new Countdown(5, tickFunction, callbackFunction);
clock.tick(4000);
assert(callbackFunction.callCount == 0);
clock.tick(5000);
assert(callbackFunction.callCount == 1);
});
});
describe("aborting countdown", function() {
var countdown;
beforeEach(function() {
countdown = new Countdown(5, tickFunction, callbackFunction);
});
it("calls onTick the correct number of times", function() {
assert(tickFunction.callCount == 1);
clock.tick(1000);
assert(tickFunction.callCount == 2);
countdown.abort();
clock.tick(1000);
assert(tickFunction.callCount == 2);
});
it("does not call onComplete", function() {
countdown.abort();
clock.tick(5000);
assert(callbackFunction.callCount == 0);
});
});
describe("getRemainingTime", function() {
var countdown;
beforeEach(function() {
this.countdown = new Countdown(5, tickFunction, callbackFunction);
});
it("calls returns the correct getRemainingTime immediately on the next tick", function() {
assert(this.countdown.getRemainingTime() === 4);
});
it("calls returns the correct getRemainingTime on a clock tick tick", function() {
assert(this.countdown.getRemainingTime() === 4);
clock.tick(1000);
assert(this.countdown.getRemainingTime() === 3);
});
});
});
|
JavaScript
| 0 |
@@ -1164,32 +1164,804 @@
t == 1);%0A %7D);
+%0A%0A it(%22executes onComplete at 2 ticks for 2.4%22, function() %7B%0A new Countdown(2.4, tickFunction, callbackFunction);%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 0);%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 1);%0A // Ensure this is Math.round behavior%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 1);%0A %7D);%0A%0A it(%22executes onComplete at 3 ticks for 2.5%22, function() %7B%0A new Countdown(2.5, tickFunction, callbackFunction);%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 0);%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 0);%0A // Ensure this is Math.round behavior%0A clock.tick(1000);%0A assert(callbackFunction.callCount == 1);%0A %7D);
%0A %7D);%0A%0A descri
|
cd0188a1b953850a545cd290fa1351fe60d0df97
|
correct the text for delta E tests
|
test/test.js
|
test/test.js
|
// unit-tests
/**
* >> function from jasmine framework (https://github.com/pivotal/jasmine)
* Matcher that checks that the expected item is equal to the actual item
* up to a given level of decimal precision (default 2).
*
* @param {Number} expected
* @param {Number} precision, as number of decimal places
*/
function toBeCloseTo (expected, actual, precision) {
if (!(precision === 0)) {
precision = precision || 2;
}
return Math.abs(expected - actual) < (Math.pow(10, -precision) / 2);
};
module( "init Tests" );
test( "with values", function() {
var a = new colorLab('CIELAB', [2, 4, 6]);
equal(a.CIELAB.L(), 2);
equal(a.CIELAB.a(), 4);
equal(a.CIELAB.b(), 6);
});
test( "without values", function() {
var a = new colorLab('CIELAB');
equal(a.CIELAB.L(), 0);
equal(a.CIELAB.a(), 0);
equal(a.CIELAB.b(), 0);
});
module( "set Tests" );
test( "without values", function() {
var a = new colorLab('CIELAB');
a.CIELAB.L(2);
a.CIELAB.a(4);
a.CIELAB.b(6);
equal(a.CIELAB.L(), 2);
equal(a.CIELAB.a(), 4);
equal(a.CIELAB.b(), 6);
});
module( "multiply" );
test( "two points", function() {
var a = new colorLab('CIELAB', [2, 20, 200]);
var b = new colorLab('CIELAB', [2, 3, 4]);
a.CIELAB.mul(b);
equal(a.CIELAB.L(), 4);
equal(a.CIELAB.a(), 60);
equal(a.CIELAB.b(), 800);
});
test( "point with value", function() {
var a = new colorLab('CIELAB', [2, 6, 8]);
a.CIELAB.mul(2);
equal(a.CIELAB.L(), 4);
equal(a.CIELAB.a(), 12);
equal(a.CIELAB.b(), 16);
});
test( "point with object of values", function() {
var a = new colorLab('CIELAB', [2, 20, 200]);
a.CIELAB.mul({L:2,a:3,b:4});
equal(a.CIELAB.L(), 4);
equal(a.CIELAB.a(), 60);
equal(a.CIELAB.b(), 800);
});
module( "Delta E" );
test( "Delta E of two CIELAB colors", function() {
var a = new colorLab('CIELAB', [50.0000, 2.6772, -79.7751]);
var b = new colorLab('CIELAB', [50.0000, 0.0000, -82.7485]);
var dE = a.CIELAB.CIEDE2000(b);
ok(toBeCloseTo(dE, 2.0425, 4), "The Delat E is not close enough. Exected: " + 2.0425 + ", Result: " + dE);
equal(a.CIELAB.CIEDE2000(b), b.CIELAB.CIEDE2000(a), "The order of the colors shouldnt matter to get Delta E");
});
test( "Delta E check with testdata", function() {
// Source of testdata
// http://www.ece.rochester.edu/~gsharma/ciede2000/
for (var i =0; i < ciede2000testdata.length; i++ ) {
var a = new colorLab('CIELAB', [ciede2000testdata[i].L1, ciede2000testdata[i].a1, ciede2000testdata[i].b1]);
var b = new colorLab('CIELAB', [ciede2000testdata[i].L2, ciede2000testdata[i].a2, ciede2000testdata[i].b2]);
var dE = a.CIELAB.CIEDE2000(b);
// equal(dE, ciede2000testdata[i].dE);
ok(toBeCloseTo(dE, ciede2000testdata[i].dE, 4), "The Delat E is not close enough. Exected: " + ciede2000testdata[i].dE + ", Result: " + dE);
}
});
|
JavaScript
| 0.000465 |
@@ -503,17 +503,16 @@
/ 2);%0A%7D
-;
%0A%0A%0A%0Amodu
@@ -2078,35 +2078,20 @@
Delat E
-is not close enough
+test
. Execte
@@ -2832,27 +2832,12 @@
t E
-is not close enough
+test
. Ex
|
c871c9e5a7ce3e7f43c05271bcc61f39b4ef6dfb
|
Update test.js
|
test/test.js
|
test/test.js
|
var async = require('async'),
assert = require("assert"),
should = require("should"),
sitemap = require("../lib/sitemap"),
isurl = require("is-url");
var sitemaps = ['http://www.walmart.com/sitemaps.xml', 'http://www.cbs.com/sitemaps.xml'];
(function(){
sitemap.getSites("http://www.cbs.com/sitemaps/show/show_siteMap_index.xml", function(err,sites){
if(sites){
sitemaps = sites;
sites.should.be.Array;
}
else if(err){
console.log(err);
}
});
})();
var sitemaps;
describe('sitemap', function(){
describe('getSites', function(){
it('CBS sitemaps should be an array', function(done){
this.timeout(30000);
sitemap.getSites("http://www.cbs.com/sitemaps/image/photo_sitemap_index.xml", function(err,sites){
if(sites){
sitemaps = sites;
sites.should.be.Array;
done();
}
else if(err){
console.log(err);
done();
}
});
});
it('Seantburke.com sitemaps should be an array', function(done){
this.timeout(30000);
sitemap.getSites("http://wp.seantburke.com/sitemap.xml", function(err,sites){
if(sites){
sitemaps = sites;
sites.should.be.Array;
done();
}
else if(err){
console.log(err);
done();
}
});
});
});
describe('URL checks', function(){
for(var key in sitemaps)
{
(function(site){
it(site + ' should be a URL', function(){
isurl(site).should.be.true;
});
})(sitemaps[key]);
}
});
});
|
JavaScript
| 0.000001 |
@@ -281,55 +281,39 @@
http
+s
://www.
-cbs.com/sitemaps/show/show_
+google.com/work/
site
-M
+m
ap
-_index
.xml
@@ -661,57 +661,39 @@
http
+s
://www.
-cbs.com/sitemaps/image/photo_
+google.com/work/
sitemap
-_index
.xml
|
776fc4e70ac58750444e75e8736adba2b136162f
|
make time comparison work in calendar
|
Instanssi/main2019/static/main2019/js/radio.js
|
Instanssi/main2019/static/main2019/js/radio.js
|
'use strict';
$(function() {
var calid = "[email protected]";
var apik = "AIzaSyAnSBTmLepfcMtJoft8foXhstAv7PpYTos";
var calurl = "https://www.googleapis.com/calendar/v3/calendars/" + calid + "/events?key=" + apik + "&timeMin=2019-02-20T10:00:00%2B02:00";
var wds = ['Sunnuntai', 'Maanantai', 'Tiistai', 'Keskiviikko', 'Torstai', 'Perjantai', 'Lauantai'];
function lpad(number, digits) {
return Array(Math.max(digits - String(number).length + 1, 0)).join('0') + number;
}
function parseCal(params) {
var oldDay = '';
var dateNow = new Date().toISOString();
var newData = params.sort(function(a, b) {
return (a.start.dateTime > b.start.dateTime) - (b.start.dateTime > a.start.dateTime);
});
var output = "";
$.each(newData, function(i, val) {
var startD = new Date(val.start.dateTime);
var day = startD.getDate();
var endD = new Date(val.end.dateTime);
var description = '<small>' + val.description + '</small>';
var startHour = lpad(startD.getHours(), 2);
var endHour = lpad(endD.getHours(), 2);
var startMinutes = lpad(startD.getMinutes(), 2);
var endMinutes = lpad(endD.getMinutes(), 2);
var month = startD.getMonth() + 1;
var weekday = wds[startD.getDay()];
var dateStr = weekday + ' ' + day + '.' + month + '.';
var startTimeStr = startHour + ':' + startMinutes;
var endTimeStr = endHour + ':' + endMinutes +'<br>';
var timeStr = '<b>' + startTimeStr + '-' + endTimeStr+'</b>';
if (dateStr !== oldDay) {
output += '<h3>' + dateStr + '</h3>';
}
if (dateNow > val.start.dateTime && dateNow < val.end.dateTime) {
output += '<p class="nytsoi">'+ timeStr + ' ' + val.summary + ': ' + description + '</p>';
} else {
output += '<p>'+ timeStr + ' ' + val.summary + ': ' + description + '</p>';
}
oldDay = dateStr;
});
$('#aikataulu').html(output);
}
function calRequest() {
$.ajax({
url: calurl,
type: 'GET',
cache: false,
dataType: 'jsonp',
timeout: 3000,
success: function(data, status, jqXHR) {
if (status === 'error') {
console.log('Ei saatu kalenterin tietoja.');
return;
}
parseCal(data.items);
}
});
}
calRequest();
});
|
JavaScript
| 0.000004 |
@@ -591,16 +591,81 @@
y = '';%0A
+ var tzoffset = (new Date()).getTimezoneOffset() * 60000;%0A
@@ -678,16 +678,17 @@
teNow =
+(
new Date
@@ -688,16 +688,38 @@
ew Date(
+Date.now() - tzoffset)
).toISOS
@@ -727,16 +727,24 @@
ring();%0A
+
%0A
@@ -1996,21 +1996,38 @@
'%3Cp
-class=%22nytsoi
+style=%22background-color: #eee;
%22%3E'+
|
824bc11b7aaaff117edd693fb454e0153f960063
|
Change some tests' text.
|
test/test.js
|
test/test.js
|
//import { expect } from "chai";
import test from "tape";
import tie from "../lib";
test("Constraint ties", (assert) => {
var x = tie(2);
var y = tie(() => 3);
var z = tie(() => x.get() * y.get());
assert.equal(x.get(), 2,
"A constraint is equal to set value.");
assert.equal(y.get(), 3,
"A constraint value can be set with a function.");
assert.equal(z.get(), 6,
"Constraint value can be calculated from other constraints.");
x.set(10);
assert.equal(x.get(), 10,
"Constraint can be reset.");
assert.equal(z.get(), 30,
"Dependent constraint are updated when depedencies' value change.");
assert.end();
});
test("Constraint set to constraint", (assert) => {
var x = tie('x');
var y = tie('y');
var z = tie(x);
assert.equal(z.get(), 'x',
"Constraint set to a constraint get its value."
)
z.set('z');
assert.equal(z.get(), 'z',
"It can be reset..."
);
assert.equal(x.get(), 'x',
"...without changing the set constraint value."
);
z.set(y);
assert.equal(z.get(), 'y',
"It can be reset to a new constraint and will take its value."
);
assert.end();
});
test("Evaluations and dependency updates", (assert) => {
let xUpdates = 0;
let condUpdates = 0;
const det = tie(true);
const xSource = tie('a');
const x = tie(() => {
xUpdates++;
return xSource.get();
});
const cond = tie(() => {
condUpdates++;
if(det.get()){
return x.get();
} else {
return '';
}
});
assert.equal(xUpdates, 0,
"A constraint is not evaluated uncessary."
)
assert.equal(cond.get(), "a",
"Proper constraint value.");
assert.equal(xUpdates, 1,
"Dependencies are evaluated when a constraint is get."
);
assert.equal(condUpdates, 1,
"A constraint is evaluated when get."
);
xSource.set("b");
assert.equal(cond.get(), "b",
"Proper constraint value after source reset.");
assert.equal(xUpdates, 2,
"Source has been re-evaluated."
);
assert.equal(condUpdates, 2,
"Constraint has been re-evaluated."
);
det.set(false);
assert.equal(cond.get(), "",
"Source isn't a dependency anymore."
);
assert.equal(xUpdates, 2,
"Source has not been re-evaluated."
);
assert.equal(condUpdates, 3,
"Constraint has been re-evaluated."
);
xSource.set('c');
assert.equal(cond.get(), '',
"Constraint does not change anymore when source is reset."
);
assert.equal(xUpdates, 2,
"Source has not been re-evaluated while constraint has been requested."
);
assert.equal(condUpdates, 3,
"Constraint has not been re-evaluated after being requested."
);
det.set(true);
assert.equal(cond.get(), 'c',
"Constraint is now dependent of source again."
);
assert.equal(condUpdates, 4,
"It has been re-evaluated after bein requested."
);
assert.equal(xUpdates, 3,
"Source too."
);
assert.end();
});
test("Avoid update when parent are invalidated but did not change", (assert) => {
let zn = 0;
let yn = 0;
const x = tie(0);
const y = tie(() => {
yn++;
return x.get() == 3;
});
const z = tie(() => {
zn++;
return y.get() ? "ok": "not ok";
});
z.get();
x.set(2);
z.get();
assert.equal(y.get(), false,
"Parent's value has not changed."
)
assert.equal(yn, 2,
"Constraint's parent has been re-evaluated."
);
assert.equal(zn, 1,
"Constraint has not as its parent's value did not actually change."
);
x.set(3);
assert.equal(y.get(), true,
"Value of constraint's parent has changed."
);
assert.equal(yn, 3,
"Constraint's parent has been re-evaluated."
);
const lastZn = zn;
z.get();
assert.equal(zn, lastZn + 1,
"Constraint is re-evaluated."
)
assert.end();
});
test("Cycles", (assert) => {
const x = tie(() => x.get() || 0 + 1);
assert.equal(x.get(), 1,
"Self referring constraint does not create infinite loop."
);
const y = tie(2);
y.get();
y.set(() => y.get() * 2)
assert.equal(y.get(), 4,
"Self referring constraint return the cached value when recursively called."
);
// This part is still under reflection.
// One other approach may be to allow self-invalidating evaluation (i.e. y below will always being invalid).
// However, such constraint will create an infinite loop if a liven makes use of it.
assert.equal(y.get(), 4,
"Self referring constraint are still validated and are not updated at each call."
);
assert.end();
});
|
JavaScript
| 0.000004 |
@@ -137,71 +137,12 @@
2);%0A
-%09var y = tie(() =%3E 3);%0A%09var z = tie(() =%3E x.get() * y.get());%0A%09
+
asse
@@ -162,18 +162,24 @@
t(), 2,%0A
-%09%09
+
%22A const
@@ -203,32 +203,58 @@
set value.%22);%0A%09
+var y = tie(() =%3E 3);%0A
assert.equal(y.g
@@ -262,18 +262,24 @@
t(), 3,%0A
-%09%09
+
%22A const
@@ -317,24 +317,63 @@
unction.%22);%0A
+%09var z = tie(() =%3E x.get() * y.get());%0A
%09assert.equa
@@ -1540,32 +1540,25 @@
(), %22a%22,%0A%09%09%22
-Proper c
+C
onstraint va
@@ -1556,24 +1556,27 @@
traint value
+ ok
.%22);%0A%09assert
@@ -1787,16 +1787,9 @@
%0A%09%09%22
-Proper c
+C
onst
@@ -1800,16 +1800,19 @@
t value
+ok
after so
@@ -2009,25 +2009,51 @@
t(), %22%22,%0A%09%09%22
-S
+Constraint value ok after s
ource isn't
|
249daa06a03eca011dd52c5d8878e2d268f802eb
|
set undefined key to text string
|
controllers/gc2/sql.js
|
controllers/gc2/sql.js
|
/*
* @author Martin Høgh <[email protected]>
* @copyright 2013-2018 MapCentia ApS
* @license http://www.gnu.org/licenses/#AGPL GNU AFFERO GENERAL PUBLIC LICENSE 3
*/
var express = require('express');
var router = express.Router();
var config = require('../../config/config.js').gc2;
var request = require('request');
var fs = require('fs');
router.all('/api/sql/:db', function (req, response) {
req.setTimeout(0); // no timeout
var db = req.params.db,
q = req.body.q || req.query.q,
srs = req.body.srs || req.query.srs,
lifetime = req.body.lifetime || req.query.lifetime || "0",
client_encoding = req.body.client_encoding || req.query.client_encoding,
base64 = req.body.base64 || req.query.base64,
format = req.body.format || req.query.format,
custom_data = req.body.custom_data || req.query.custom_data,
store = req.body.store || req.query.store,
userName,
fileName,
writeStream,
rem,
headers,
uri,
key = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
var postData = "q=" + (base64 === "true" ? encodeURIComponent(q) : encodeURIComponent(q)) + "&base64=" + (base64 === "true" ? "true" : "false") + "&srs=" + srs + "&lifetime=" + lifetime + "&client_encoding=" + (client_encoding || "UTF8") + "&format=" + (format ? format : "geojson") + "&key=" + req.session.gc2ApiKey + "&custom_data=" + (custom_data || ""),
options;
// Check if user is a sub user
if (req.session.gc2UserName && req.session.subUser) {
userName = req.session.subUser + "@" + db;
} else {
userName = db;
}
if (req.body.key && !req.session.gc2ApiKey) {
postData = postData + "&key=" + req.body.key;
}
uri = custom_data !== null && custom_data !== undefined && custom_data !== "null" ? config.host + "/api/v2/sqlwrapper/" + userName : config.host + "/api/v2/sql/" + userName;
console.log(uri);
options = {
method: 'POST',
uri: uri,
form: postData
};
if (format === "excel") {
fileName = key + ".xlsx";
headers = {
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'Content-Disposition': 'attachment; filename=data.xlsx',
'Expires': '0',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'X-Powered-By': 'MapCentia Vidi'
}
} else {
fileName = key + ".json";
headers = {
'Content-Type': 'application/json',
'Expires': '0',
'Cache-Control': 'no-cache, no-store, must-revalidate',
'X-Powered-By': 'MapCentia Vidi'
}
}
// if (!store) {
// //response.writeHead(200, headers);
// }
rem = request(options);
if (store) {
writeStream = fs.createWriteStream(__dirname + "/../../public/tmp/stored_results/" + fileName);
}
rem.on('response', function(res) {
console.log(res.statusCode);
if (!store) {
response.writeHead(res.statusCode, headers);
}
});
rem.on('data', function (chunk) {
if (store) {
writeStream.write(chunk, 'binary');
} else {
response.write(chunk);
}
});
rem.on('end', function () {
if (store) {
console.log("Result saved");
response.send({"success": true, "file": fileName});
} else {
response.end();
}
});
});
module.exports = router;
|
JavaScript
| 0.000227 |
@@ -1534,24 +1534,32 @@
+ %22&key=%22 +
+ (typeof
req.session
@@ -1568,16 +1568,66 @@
c2ApiKey
+ !==%22undefined%22 ? req.session.gc2ApiKey : %22xxxxx%22)
+ %22&cus
|
917575b4dca3c6237a30eb5a4e9e54f19d6729ba
|
move legacy parameters to a separate function
|
controllers/landsat.js
|
controllers/landsat.js
|
'use strict';
var ejs = require('elastic.js');
var client = require('../services/elasticsearch.js');
var Boom = require('boom');
module.exports = function (params, request, cb) {
var err;
var supported_query_re = new RegExp('^[0-9a-zA-Z#\*\.\_\:\(\)\"\\[\\]\{\}\\-\\+\>\<\= ]+$');
// Build Elastic Search Query
var q = ejs.Request();
if (params.search) {
if (!supported_query_re.test(params.search)) {
err = Boom.create(400, 'Search not supported: ' + params.search, { timestamp: Date.now() });
return cb(err);
}
q.query(ejs.QueryStringQuery(params.search));
} else if (params.count) {
q.facet(ejs.TermsFacet('count').fields([params.count]).size(request.limit));
} else {
q.query(ejs.MatchAllQuery()).sort('acquisitionDate', 'desc');
}
//Legacy support for skip parameter
if (params.skip) {
request.page = Math.floor(parseInt(params.skip) / request.limit);
}
// Decide from
var from = (request.page - 1) * request.limit;
var search_params = {
index: process.env.ES_INDEX || 'landsat',
body: q
}
if (!params.count) {
search_params.from = from;
search_params.size = request.limit;
}
client.search(search_params).then(function (body) {
var response = [];
var count = 0;
// Process Facets
if (params.count) {
// Term facet count
if (body.facets.count.terms.length != 0) {
response = body.facets.count.terms;
count = body.facets.count.total;
} else {
return cb(Boom.notFound('Nothing to count!'));
}
// Process search
} else {
if (body.hits.hits.length === 0) {
return cb(Boom.notFound('No matches found!'));
}
count = body.hits.total;
for (var i = 0; i < body.hits.hits.length; i++) {
response.push(body.hits.hits[i]._source);
}
}
return cb(err, response, count);
}, function(err) {
return cb(Boom.badRequest(err));
});
};
|
JavaScript
| 0.000002 |
@@ -128,21 +128,23 @@
);%0A%0A
-module.export
+var legacyParam
s =
@@ -165,24 +165,20 @@
ms,
-request, cb
+q, limit
) %7B%0A
-%0A
va
@@ -284,66 +284,8 @@
);%0A%0A
- // Build Elastic Search Query%0A var q = ejs.Request();%0A%0A
if
@@ -463,22 +463,17 @@
-return cb(
+throw
err
-)
;%0A
@@ -624,33 +624,197 @@
ize(
-request.limit)
+limit));%0A %7D%0A%0A return q;%0A%7D;%0A%0Amodule.exports = function (params, request, cb) %7B%0A var err;%0A%0A // Build Elastic Search Query%0A var q = ejs.Request(
);%0A
+%0A
-%7D else
+if (Object.keys(params).length === 0)
%7B%0A
@@ -887,16 +887,131 @@
%7D%0A%0A //
+ Do legacy search%0A if (params.search %7C%7C params.count) %7B%0A q = legacyParams(params, q, request.limit);%0A %7D%0A%0A //
Legacy s
@@ -1107,16 +1107,20 @@
ams.skip
+, 10
) / requ
@@ -1284,24 +1284,25 @@
body: q%0A %7D
+;
%0A%0A if (!par
@@ -1440,25 +1440,24 @@
on (body) %7B%0A
-%0A
var resp
@@ -1533,17 +1533,16 @@
ount) %7B%0A
-%0A
//
@@ -1602,16 +1602,17 @@
ength !=
+=
0) %7B%0A
@@ -2119,16 +2119,17 @@
tion
+
(err) %7B%0A
@@ -2120,26 +2120,24 @@
ion (err) %7B%0A
-
return c
@@ -2167,12 +2167,11 @@
;%0A %7D);%0A
-%0A
%7D;%0A
|
cd41e87da5b92b6083a30981bb3abdd3350ef424
|
Change clickable link and open it in new tab
|
core/js/license-trial-notification.js
|
core/js/license-trial-notification.js
|
/**
*
* @copyright Copyright (c) 2020, ownCloud GmbH
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
/**
* This gets only loaded if there is a grace period active
*/
OC.License = {
NOTIFICATION_TEMPLATE:
'<div id="license_notification" title="{{title}}">' +
' <div>' +
' {{#each msgs}}' +
' <p>' +
' {{this}}' +
' </p>' +
' {{/each}}' +
' <br/>' +
' <p><a class="button" href="{{clickable_link}}">{{clickable_link_text}}</a></p>' +
' <br/>' +
' <p>{{time_remaining_msg}}</p>' +
' </div>' +
' <div style="display:flex">' +
' <input id="license" type="text" placeholder="{{placeholder}}" style="flex:1 1 auto"/>' +
' <button id="license_button">{{license_button_text}}</button>' +
' </div>' +
'</div>',
showNotification: function() {
if (!this._template) {
this._template = Handlebars.compile(this.NOTIFICATION_TEMPLATE);
}
var tmpl = this._template;
var self = this;
$.get(OC.generateUrl('/license/graceperiod'))
.done(function(data) {
if (!data || data.apps < 1) {
return;
}
// adjust moment's time thresholds for better accuracy:
// it will show "24 hours" instead of "a day" and "89 minutes" instead of "2 hours"
// we'll have to restore the defaults afterwards.
var thresholdH = moment.relativeTimeThreshold('h');
var thresholdM = moment.relativeTimeThreshold('m');
moment.relativeTimeThreshold('h', 25);
moment.relativeTimeThreshold('m', 90);
var relativeTime = moment(data.end * 1000).fromNow(true);
moment.relativeTimeThreshold('h', thresholdH);
moment.relativeTimeThreshold('m', thresholdM);
var paragraphs = [
t('core', 'You have enabled one or more ownCloud Enterprise apps but your installation does not have a valid license yet.'),
t('core', 'A grace period of 24 hours has started to allow you to get going right away. Once the grace period ends, all Enterprise apps will become disabled unless you supply a valid license key.'),
t('core', 'To try ownCloud Enterprise, just start a 30-day demo and enter the provided license key below.')
];
var dialog = $(tmpl({
title: t('core', 'Upgrade to ownCloud Enterprise'),
msgs: paragraphs,
time_remaining_msg: t('core', 'Remaining time: {rtime}', {
rtime: relativeTime
}),
clickable_link: 'https://marketplace.owncloud.com/demo-key',
clickable_link_text: t('core', 'Get your demo key'),
placeholder: t('core', 'Enter license key'),
license_button_text: t('core', 'Set new key')
}))
.appendTo('body')
.ocdialog({
modal: true
});
self._initializeDialogEvents(dialog);
});
},
_initializeDialogEvents: function(jqDialog) {
jqDialog.on("ocdialogclose", function() {
jqDialog.remove();
});
jqDialog.find('#license_button').click(function () {
var license = jqDialog.find('#license').val();
$.post(OC.generateUrl('/license/license'), {
licenseString: license
}).done(function () {
jqDialog.ocdialog('close');
})
});
}
}
$(document).ready(function(){
OC.License.showNotification();
});
|
JavaScript
| 0 |
@@ -981,16 +981,32 @@
%22button%22
+ target=%22_blank%22
href=%22%7B
@@ -2944,20 +2944,8 @@
s://
-marketplace.
ownc
@@ -2957,16 +2957,23 @@
com/
-demo-key
+try-enterprise/
',%0A%09
|
284bff548cc3d06cab8082ba030c9bf1d38b1662
|
Remove stale console.log().
|
src/com/google/foam/demos/heroes/Controller.js
|
src/com/google/foam/demos/heroes/Controller.js
|
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
foam.CLASS({
package: 'com.google.foam.demos.heroes',
name: 'Controller',
extends: 'foam.u2.Element',
implements: [
'foam.mlang.Expressions'
],
requires: [
'com.google.foam.demos.heroes.CitationView',
'com.google.foam.demos.heroes.DashboardCitationView',
'com.google.foam.demos.heroes.Hero',
'foam.dao.ArrayDAO',
'foam.u2.DAOList',
'foam.u2.DetailView',
'foam.u2.CheckBox'
],
exports: [
'as data',
'heroDAO',
'editHero'
],
axioms: [
foam.u2.CSS.create({
code: function() {/*
h2 { color: #aaa; }
h3 {
color: #444;
font-size: 1.75em;
font-weight: 100;
margin-top: 0;
}
body { margin: 2em; }
body, input[text], button { color: #888; font-family: Cambria, Georgia; }
^starred .foam-u2-DAOList { display: flex; }
* { font-family: Arial; }
input {
font-size: 1em;
height: 2em;
padding-left: .4em;
}
^nav .foam-u2-ActionView {
background: #eee;
border-radius: 4px;
border: none;
color: #607D8B;
cursor: pointer; cursor: hand;
font-height: 18px;
font-size: 1em;
font-weight: 500;
margin: 0 3px;
padding: 10px 12px;
}
^nav .foam-u2-ActionView:hover {
background-color: #cfd8dc;
}
^nav .foam-u2-ActionView:disabled {
-webkit-filter: none;
background-color: #eee;
color: #039be5;
cursor: auto;
}
*/}
})
],
properties: [
{
class: 'String',
name: 'heroName',
view: {
class: 'foam.u2.TextField',
onKey: true
}
},
{
name: 'heroDAO',
view: {
class: 'foam.u2.DAOList',
rowView: 'com.google.foam.demos.heroes.CitationView'
}
},
{
name: 'starredHeroDAO',
view: {
class: 'foam.u2.DAOList',
rowView: 'com.google.foam.demos.heroes.DashboardCitationView'
},
factory: function() { return this.heroDAO.where(this.EQ(this.Hero.STARRED, true)); }
},
{
name: 'mode',
value: 'dashboard'
},
{
name: 'selection',
view: { class: 'foam.u2.DetailView', title: '' }
}
],
methods: [
function initE() {
this.
start('h2').add('Tour of Heroes').end().
// TODO: start(this.HEROES) and set class
start().cssClass(this.myCls('nav')).
add(this.DASHBOARD, this.HEROES).
end().
br().
add(this.slot(function(selection, mode) {
return selection ? this.detailE() :
mode === 'dashboard' ? this.dashboardE() :
this.heroesE();
}));
},
function detailE() {
return this.E('h3').add(this.selection.name$, ' details!').br().add(this.SELECTION, this.BACK);
},
function dashboardE() {
return this.E().cssClass(this.myCls('starred')).start('h3').add('Top Heroes').end().add(this.STARRED_HERO_DAO);
},
function heroesE() {
return this.E().
start('h3').
add('My Heroes').
end().
start().
add('Hero name: ', this.HERO_NAME, ' ', this.ADD_HERO).
end().
add(this.HERO_DAO);
},
function editHero(hero) {
console.log('*****', this.selection, hero);
this.selection = hero;
}
],
actions: [
{
name: 'addHero',
label: 'Add',
isEnabled: function(heroName) { return !!heroName; },
code: function() {
this.heroDAO.put(this.Hero.create({name: this.heroName}));
this.heroName = '';
}
},
{
name: 'dashboard',
isEnabled: function(mode) { return mode != 'dashboard'; },
code: function() { this.back(); this.mode = 'dashboard'; }
},
{
name: 'heroes',
isEnabled: function(mode) { return mode != 'heroes'; },
code: function() { this.back(); this.mode = 'heroes'; }
},
{
name: 'back',
code: function() { this.selection = null; }
}
]
});
|
JavaScript
| 0 |
@@ -4023,58 +4023,8 @@
) %7B%0A
- console.log('*****', this.selection, hero);%0A
|
f419b1f475e426bd5ee4cb35e978ccb738595fec
|
Update test.js
|
test/test.js
|
test/test.js
|
var assert = require('assert');
var gutil = require('gulp-util');
var cssfont64 = require('../index');
var fs = require('fs');
var path = require('path');
describe('gulp-cssfont64', function() {
describe('in buffer mode', function() {
it('should encode fonts to base64 and generate a less file', function(done) {
var filename = path.join(__dirname, '/fixtures/myfont.woff');
var input = new gutil.File({
base: path.dirname(filename),
path: filename,
contents: new Buffer(fs.readFileSync(filename, 'utf8'))
});
var stream = cssfont64();
stream.on('data', function(newFile) {
assert.equal(String(newFile.contents), fs.readFileSync(path.join(__dirname, '/fixtures/myfont.less'), 'utf8'));
done();
})
stream.write(input);
});
});
});
|
JavaScript
| 0.000001 |
@@ -68,17 +68,18 @@
');%0Avar
-c
+le
ssfont64
@@ -180,20 +180,26 @@
e('gulp-
-cssf
+Woff2LessF
ont64',
@@ -800,8 +800,9 @@
%09%7D);%0A%7D);
+%0A
|
7ee612d3bd0e6208f7da41912636508ba877a105
|
add zindex to url marker service layer
|
src/modules/urlmarkers/urlmarker-service.js
|
src/modules/urlmarkers/urlmarker-service.js
|
import './module.js';
import Feature from 'ol/Feature';
import Point from 'ol/geom/Point';
angular.module('anol.urlmarkers')
/**
* @ngdoc object
* @name anol.urlmarkers.UrlMarkersServiceProvider
*/
.provider('UrlMarkersService', [function() {
var _defaultSrs;
var _propertiesDelimiter = '|';
var _keyValueDelimiter = ':';
var _style = {};
var _usePopup = true;
var _popupOffset = [0, 0];
/**
* @ngdoc method
* @name setDefaultSrs
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {string} srs default EPSG code of marker coordinates in url
*/
this.setDefaultSrs = function(srs) {
_defaultSrs = srs;
};
/**
* @ngdoc method
* @name setPropertiesDelimiter
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {string} delimiter Delimiter separating marker properties
*/
this.setPropertiesDelimiter = function(delimiter) {
_propertiesDelimiter = delimiter || _propertiesDelimiter;
};
/**
* @ngdoc method
* @name setKeyValueDelimiter
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {string} delimiter Delimiter separating properties keys from values
*/
this.setKeyValueDelimiter = function(delimiter) {
_keyValueDelimiter = delimiter || _keyValueDelimiter;
};
/**
* @ngdoc method
* @name setMarkerStyle
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {object} style marker style
*/
this.setMarkerStyle = function(style) {
_style = style;
};
/**
* @ngdoc method
* @name setPopup
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {boolean} usePopup
* @description When not using popup a label text is added. This can be styled by markerStyle
*/
this.setUsePopup = function(usePopup) {
_usePopup = angular.isUndefined(usePopup) ? _usePopup : usePopup;
};
/**
* @ngdoc method
* @name setPopupOffset
* @methodOf anol.urlmarkers.UrlMarkersServiceProvider
* @param {Array.<number>} popupOffset Offset of placed popup. First value is x- second value is y-offset in px
*/
this.setPopupOffset = function(popupOffset) {
_popupOffset = angular.isUndefined(popupOffset) ? _popupOffset : popupOffset;
};
this.$get = ['$location', 'MapService', 'LayersService', function($location, MapService, LayersService) {
/**
* @ngdoc service
* @name anol.urlmarkers.UrlMarkersService
*
* @description
* Adds markers specified in url. A valid url marker looks like marker=color:ff0000|label:foobar|coord:8.21,53.15|srs:4326
*/
var UrlMarkers = function(defaultSrs, propertiesDelimiter, keyValueDelimiter, style, usePopup, popupOffset) {
var self = this;
self.features = [];
self.defaultSrs = defaultSrs || MapService.view.getProjection();
self.propertiesDelimiter = propertiesDelimiter;
self.keyValueDelimiter = keyValueDelimiter;
self.style = style;
self.usePopup = usePopup;
self.popupOffset = popupOffset;
self.extractFeaturesFromUrl();
if(self.features.length === 0) {
return;
}
self.layer = self.createLayer(self.features);
LayersService.addSystemLayer(self.layer);
};
UrlMarkers.prototype.extractFeaturesFromUrl = function() {
var self = this;
var urlParams = $location.search();
if(angular.isUndefined(urlParams.marker)) {
return false;
}
var markers = angular.isArray(urlParams.marker) ? urlParams.marker : [urlParams.marker];
angular.forEach(markers, function(_marker) {
var params = _marker.split(self.propertiesDelimiter);
if(params.length === 0) {
return;
}
var marker = {};
var style = {};
angular.forEach(params, function(kv) {
kv = kv.split(self.keyValueDelimiter);
if(kv[0] === 'coord') {
var coord = kv[1].split(',');
coord = [parseFloat(coord[0]), parseFloat(coord[1])];
marker.geometry = new Point(coord);
} else if (kv[0] === 'srs') {
marker.srs = 'EPSG:' + kv[1];
} else if (kv[0] === 'color') {
style = {
fillColor: '#' + kv[1],
strokeColor: '#' + kv[1],
graphicColor: '#' + kv[1]
};
} else {
marker[kv[0]] = kv[1];
}
});
if(angular.isUndefined(marker.geometry)) {
return;
}
marker.geometry.transform(
marker.srs || self.defaultSrs,
MapService.view.getProjection().getCode()
);
marker.style = angular.merge({}, self.style, style);
if(!self.usePopup && angular.isDefined(marker.label)) {
marker.style.text = marker.label;
}
self.features.push(new Feature(marker));
});
};
UrlMarkers.prototype.createLayer = function(features) {
var layer = new anol.layer.Feature({
name: 'markersLayer',
olLayer: {
source: {
features: features
}
}
});
var olLayerOptions = layer.olLayerOptions;
olLayerOptions.source = new layer.OL_SOURCE_CLASS(layer.olSourceOptions);
layer.setOlLayer(new layer.OL_LAYER_CLASS(olLayerOptions));
return layer;
};
return new UrlMarkers(_defaultSrs, _propertiesDelimiter, _keyValueDelimiter, _style, _usePopup, _popupOffset);
}];
}]);
|
JavaScript
| 0 |
@@ -3381,17 +3381,16 @@
Offset;%0A
-%0A
@@ -6087,24 +6087,62 @@
olLayer: %7B%0A
+ zIndex: 2001,%0A
|
1b5561e2f643b6716087450cebfea2f1c6ee7d20
|
Replace trailing whitespaces for example code.
|
examples/example-tests.js
|
examples/example-tests.js
|
"use strict";
function simplePassing() {
describe('test embedded mocha', function() {
it('should run jasmine-style tests', function() {
expect(1)
.toBe(1);
});
it('should run should-style tests', function() {
should(1).ok;
});
});
}
function simpleFailing() {
describe('test embedded mocha', function() {
it('should fail', function() {
expect(1)
.toBe(2);
});
});
}
function getSourceFrom(func) {
var lines = func.toString().split('\n');
return lines.slice(1, -1).join('\n');
}
module.exports = {
simplePassingTestCode: getSourceFrom(simplePassing),
simpleFailingTestCode: getSourceFrom(simpleFailing)
};
|
JavaScript
| 0.000007 |
@@ -420,32 +420,353 @@
%7D);%0A %7D);%0A%7D%0A%0A
+// Make sure the code block starts with no indentation.%0Afunction _replaceTrailingWhitespaces(lines) %7B%0A var firstLineTrailingSpaces = lines%5B1%5D.match(/%5E%5B%5Cs%5Ct%5D+/);%0A if (firstLineTrailingSpaces) %7B%0A lines = lines.map(function(line) %7B%0A return line.replace(firstLineTrailingSpaces, '');%0A %7D);%0A %7D%0A return lines;%0A%7D%0A%0A
function getSour
@@ -823,16 +823,62 @@
('%5Cn');%0A
+ lines = _replaceTrailingWhitespaces(lines);%0A
return
|
f222f29ead9779cd1a65b062006a6e17f30d8f6a
|
Remove can-types tests
|
test/test.js
|
test/test.js
|
// Core tests
require('can-component/test/tests');
require('can-define/test/test');
// require('can-route/test/test'); in dev-only
// require('can-route-pushstate/can-route-pushstate_test'); in dev-only
// require('can-stache/test/stache-test'); in dev-only
require('can-stache-bindings/test/tests');
require('can-set/test/test');
require('can-value/test/test');
// can-connect
// can-stache-route-helpers
// Infrastructure tests
require('can-ajax/can-ajax-test');
require('can-assign/can-assign-test');
require('can-bind/test/test');
require('can-construct/can-construct_test');
require('can-construct-super/test/can-construct-super_test');
require('can-control/can-control_test');
require('can-define-lazy-value/define-lazy-value-test');
require('can-deparam/can-deparam-test');
require('can-dom-events/can-dom-events-test');
require('can-event-dom-enter/can-event-dom-enter-test');
require('can-event-dom-radiochange/can-event-dom-radiochange-test');
require('can-event-queue/can-event-queue-test');
require('can-globals/can-globals-test');
require('can-key/can-key-test');
require('can-key-tree/can-key-tree-test');
// require('can-observation/can-observation_test'); in dev-only
require('can-param/can-param-test');
require('can-parse-uri/can-parse-uri-test');
require('can-queues/can-queues-test');
require('can-reflect/can-reflect-test');
require('can-reflect-dependencies/test');
require('can-reflect-promise/test/can-reflect-promise_test');
require('can-simple-dom/test/test');
// require('can-simple-map/can-simple-map_test'); in dev-only
require('can-simple-observable/can-simple-observable-test');
require('can-stache-key/can-stache-key-test');
require('can-symbol/can-symbol-test');
// require('can-util/dom/tests'); // importing would cause two versions of can-dom-data-state
require('can-util/js/tests');
require('can-validate-interface/test');
// require('can-view-callbacks/test/callbacks-test'); in dev-only
require('can-view-live/test/test');
require('can-view-model/test/test');
require('can-view-nodelist/test/can-view-nodelist-test');
require('can-view-parser/test/can-view-parser-test');
require('can-view-scope/test/scope-test');
require('can-view-target/test/test');
require('can-stache-converters/test/test');
require('can-types/test/test');
// Legacy tests
require('can-compute/can-compute_test');
require('can-list/can-list_test');
require('can-map/can-map_test');
require('can-map-define/can-map-define_test');
//require('can-view-href/test/test');
//require('can-map-backup/can-map-backup_test');
//require('can-validate-legacy/can-validate-test');
// Ecosystem tests
require('can-fixture/test/fixture_test');
require('can-fixture-socket/test/test');
//require('can-connect-signalr/test');
//require('can-connect-cloneable/test/test');
//require('can-connect-feathers/test/test'); depends on babel-polyfill
require('can-kefir/can-kefir-test');
require('can-stream/can-stream_test');
require('can-stream-kefir/can-stream-kefir_test');
require('can-ndjson-stream/can-ndjson-stream-test');
// require('can-vdom/test/test'); uses mocha
//require('can-connect-ndjson/test/can-connect-ndjson-test');
//if(typeof Proxy === "function"){
// require('can-observe/test/test');
//}
require('can-define-backup/can-define-backup_test');
require('can-define-stream/can-define-stream_test');
require('can-define-stream-kefir/can-define-stream-kefir_test');
require('can-validate/test');
require('can-validate-validatejs/test');
require('can-define-validate-validatejs/test');
require('react-view-model/test/test#?can/test/browser-supports-react');
require('can-view-import/test/test');
//require('can-react-component/test/test#?can/test/browser-supports-react');
// require('can-jquery/test/test');
// require('can-vdom/test/test');
require('can-view-autorender/test/test');
// require('can-zone/test/test'); needs to publish this
// require('can-zone-storage/test/can-zone-storage_zone-test');
// Integration tests
require('../docs/can-guides/experiment/todomvc/test');
require('./integration/all/test');
|
JavaScript
| 0 |
@@ -2235,40 +2235,8 @@
');%0A
-require('can-types/test/test');%0A
%0A%0A//
|
a4085b034614a6befae8a35f23ce0cb25ad20919
|
Create viewMatrix only once instead of on each gl-render
|
aoshader.js
|
aoshader.js
|
var fs = require("fs")
var createShader = require("gl-shader")
var mat4 = require('gl-matrix').mat4
module.exports = function(game, opts) {
return new ShaderPlugin(game, opts);
};
module.exports.pluginInfo = {
clientOnly: true,
loadAfter: ['voxel-stitch', 'voxel-mesher'],
};
function ShaderPlugin(game, opts) {
this.shell = game.shell;
this.stitcher = game.plugins.get('voxel-stitch');
if (!this.stitcher) throw new Error('voxel-shader requires voxel-stitch plugin'); // for tileCount uniform and updateTexture event
this.mesher = game.plugins.get('voxel-mesher');
if (!this.mesher) throw new Error('voxel-shader requires voxel-mesher plugin'); // for meshes array TODO: ~ voxel module
this.perspectiveResize = opts.perspectiveResize !== undefined ? opts.perspectiveResize : true;
this.enable();
}
ShaderPlugin.prototype.enable = function() {
this.shell.on('gl-init', this.onInit = this.ginit.bind(this));
this.shell.on('gl-render', this.onRender = this.render.bind(this));
if (this.perspectiveResize) this.shell.on('gl-resize', this.onResize = this.resize.bind(this));
this.stitcher.on('updateTexture', this.onUpdateTexture = this.updateTexture.bind(this));
};
ShaderPlugin.prototype.disable = function() {
this.shell.removeListener('gl-init', this.onInit);
this.shell.removeListener('gl-render', this.onRender);
if (this.onResize) this.shell.removeListener('gl-resize', this.onResize);
this.stitcher.removeListener('updateTexture', this.onUpdateTexture);
};
ShaderPlugin.prototype.updateTexture = function(texture) {
this.texture = texture; // used in tileMap uniform
}
ShaderPlugin.prototype.ginit = function() {
this.shader = this.createAOShader();
this.resize();
this.modelMatrix = mat4.identity(new Float32Array(16)) // TODO: merge with view into modelView? or leave for flexibility?
};
ShaderPlugin.prototype.resize = function() {
//Calculation projection matrix
this.projectionMatrix = mat4.perspective(new Float32Array(16), Math.PI/4.0, this.shell.width/this.shell.height, 1.0, 1000.0)
};
ShaderPlugin.prototype.render = function() {
var gl = this.shell.gl
this.viewMatrix = this.shell.camera.view() // TODO: expose camera through a plugin instead?
gl.enable(gl.CULL_FACE)
gl.enable(gl.DEPTH_TEST)
// TODO: is this right? see https://github.com/mikolalysenko/ao-shader/issues/2
//gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
//gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
gl.enable(gl.BLEND)
// premultiply alpha when loading textures, so can use gl.ONE blending, see http://stackoverflow.com/questions/11521035/blending-with-html-background-in-webgl
// TODO: move to gl-texture2d?
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true)
//Bind the shader
var shader = this.shader
shader.bind()
shader.attributes.attrib0.location = 0
shader.attributes.attrib1.location = 1
shader.uniforms.projection = this.projectionMatrix
shader.uniforms.view = this.viewMatrix
shader.uniforms.model = this.modelMatrix
shader.uniforms.tileCount = this.stitcher.tileCount
if (this.texture) shader.uniforms.tileMap = this.texture.bind() // texture might not have loaded yet
for (var i = 0; i < this.mesher.meshes.length; ++i) {
var mesh = this.mesher.meshes[i];
mesh.triangleVAO.bind()
gl.drawArrays(gl.TRIANGLES, 0, mesh.triangleVertexCount)
mesh.triangleVAO.unbind()
}
};
ShaderPlugin.prototype.createAOShader = function() {
return createShader(this.shell.gl,
fs.readFileSync(__dirname+"/lib/ao.vsh"),
fs.readFileSync(__dirname+"/lib/ao.fsh"))
};
|
JavaScript
| 0.000001 |
@@ -275,11 +275,27 @@
her'
+, 'voxel-camera'
%5D,%0A
-
%7D;%0A%0A
@@ -718,16 +718,175 @@
module%0A%0A
+ this.camera = game.plugins.get('voxel-camera');%0A if (!this.camera) throw new Error('voxel-shader requires voxel-camera plugin'); // for camera view matrix%0A%0A
this.p
@@ -1886,24 +1886,59 @@
s.resize();%0A
+ this.viewMatrix = mat4.create();%0A
this.model
@@ -2345,94 +2345,36 @@
his.
-viewMatrix = this.shell.camera.view() // TODO: expose camera through a plugin instead?
+camera.view(this.viewMatrix)
%0A%0A
|
f6291c43f2b6d02c17eda7e523ca1e3944217eb9
|
Update tests
|
test/test.js
|
test/test.js
|
/* global require, describe, it */
'use strict';
// MODULES //
var // Expectation library:
chai = require( 'chai' ),
// Module to be tested:
CONST = require( './../lib' );
// VARIABLES //
var expect = chai.expect,
assert = chai.assert;
// TESTS //
describe( 'compute-const-max-safe-integer', function tests() {
it( 'should export a number', function test() {
expect( CONST ).to.be.a( 'number' );
});
});
|
JavaScript
| 0.000001 |
@@ -1,349 +1,272 @@
-/* global require, describe, it */%0A'use strict';%0A%0A// MODULES //%0A%0Avar // Expectation library:%0A%09chai = require( 'chai' ),%0A%0A%09// Module to be tested:%0A%09CONST = require( './../lib' );%0A%0A%0A// VARIABLES //%0A%0Avar expect = chai.expect,%0A%09assert = chai.assert;%0A%0A%0A// TESTS //%0A%0Adescribe( 'compute-const-max-safe-integer', function tests() %7B%0A%0A%09it( 'should
+'use strict';%0A%0A// MODULES //%0A%0Avar tape = require( 'tape' );%0Avar pow = require( 'math-power' );%0Avar MAX_SAFE_INTEGER = require( './../lib' );%0A%0A%0A// TESTS //%0A%0Atape( 'main export is a number', function test( t ) %7B%0A%09t.equal( typeof MAX_SAFE_INTEGER, 'number', 'main
export
a nu
@@ -261,16 +261,19 @@
export
+is
a number
@@ -265,32 +265,88 @@
ort is a number'
+ );%0A%09t.end();%0A%7D);%0A%0Atape( 'the exported value is 2**53-1'
, function test(
@@ -349,57 +349,87 @@
est(
+ t
) %7B%0A%09
-%09expect( CONST ).to.be.a( 'number' );%0A%09%7D
+t.equal( MAX_SAFE_INTEGER, pow(2,53)-1, 'returns 2**53-1' );%0A%09t.end(
);%0A
-%0A
%7D);%0A
|
f19f3e8530fb3febad5cc39e90c32057b79dabc6
|
Remove length getter
|
color-rgb.js
|
color-rgb.js
|
import ArrayLikeObjectWrapper from "array-like-object-wrapper";
function pad(str, len, pos = "start", chr = "0") {
str = String(str);
len = Number(len);
pos = String(pos);
chr = String(chr);
if(pos !== "start" && pos !== "end") {
throw new Error("pad: pos is neither 'start' nor 'end'");
}
if(Number.isNaN(len)) {
throw new TypeError("pad: length is not a number");
}
if(str.length < len) {
let padStr = new Array(len - str.length + 1).join(chr);
if(pos === "start") {
str = padStr + str;
} else {
str += padStr;
}
}
return str;
}
class Rgb extends ArrayLikeObjectWrapper {
constructor(iterable) {
let arr = new Uint8Array(3);
{
const spec = {};
for(let [i, name] of Rgb.keys.entries()) {
spec[name] = spec[name.charAt(0)] = {
get: function() {
return arr[i];
},
set: function(val) {
arr[i] = val;
},
configurable: true
};
}
Object.defineProperties(this, spec);
}
if(iterable) {
let i = 0;
for(let val of iterable) {
if(i >= this.length) {
throw new RangeError("Rgb: iterable is too long");
}
arr[i++] = val >>> 0;
}
}
super(arr);
}
valueOf() {
return Array.prototype.map.call(this, function(val, i) {
return val << (2 - i) * 8;
}).reduce(function(sum, val) {
return sum | val;
}, 0);
}
toString() {
return "#" + pad(this.valueOf().toString(16), 6);
}
get length() {
return 3;
}
* keys() {
for(let key of Rgb.keys) {
yield key;
}
}
[Symbol.toStringTag]() {
return `Rgb([${Array.prototype.join.call(this, ", ")}]) = ${this.toString()}`;
}
}
Rgb.keys = Object.freeze(["red", "green", "blue"]);
Rgb.parse = function(str) {
str = String(str);
if(str.charAt(0) === "#") {
str = str.slice(1);
}
if(!/^(?:[0-9a-f]{3}){1,2}$/i.test(str)) {
throw new Error("Rgb.parse: invalid string");
}
let vals = [],
spacing = str.length / 3;
for(let i = 0; i < str.length; i += spacing) {
vals.push(parseInt(str.slice(i, i + spacing), 16));
}
return new this(vals);
};
Rgb.from = function(arrLikeOrIterable) {
return new this(Array.from(arrLikeOrIterable));
};
export default Rgb;
|
JavaScript
| 0.000009 |
@@ -1837,52 +1837,8 @@
%7D%0A%0A
- get length() %7B%0A return 3;%0A %7D%0A%0A
|
950f66bb40299430002bf598e421ce2211d65bab
|
Change unary increments to addition assignments
|
colorgame.js
|
colorgame.js
|
var colors;
var winningColor;
var numOfGuesses = 6;
var colorRange = "Full"; // 0 = full, 1 = david
var background = window.getComputedStyle(document.querySelector("body"), null).getPropertyValue("background-color");
var possibleGuesses = document.querySelectorAll(".colorGuess");
var messageDisplay = document.querySelector("#message");
var resetButton = document.getElementById("reset");
var modeButtons = document.querySelectorAll(".modeButton");
var rangeButtons = document.querySelectorAll(".rangeButton");
function changeAllColors(color) {
for (var i = 0; i < possibleGuesses.length; i++) {
possibleGuesses[i].style.background = color;
}
}
function setGuess() {
if (this.style.background === winningColor) {
messageDisplay.textContent = "Correct!";
resetButton.textContent = "Play again";
changeAllColors(winningColor);
document.querySelector("h1").style.background = winningColor;
} else {
messageDisplay.textContent = "Try Again";
this.style.background = background;
}
}
function setModeOptions(str) {
if (str === "Easy") {
numOfGuesses = 3;
document.querySelector(".mode").innerHTML = "Easy <div class=\"arrow-down\"></div>";
document.querySelector("#container").style.maxWidth = "600px";
} else if (str === "Hard") {
numOfGuesses = 6;
document.querySelector(".mode").innerHTML = "Hard <div class=\"arrow-down\"></div>";
document.querySelector("#container").style.maxWidth = "600px";
} else {
numOfGuesses = 16;
document.querySelector(".mode").innerHTML = "Hardest <div class=\"arrow-down\"></div>";
document.querySelector("#container").style.maxWidth = "800px";
}
}
function randomColor() {
var r = Math.floor(Math.random() * 255);
var g = Math.floor(Math.random() * 255);
var b = Math.floor(Math.random() * 255);
return "rgb(" + r + ", " + g + ", " + b + ")";
}
function closeRandomColor(str) {
var rgb = str.match(/\d+/g);
for (var i = 0; i < rgb.length; i++) {
rgb[i] = Number(rgb[i]);
var variance = Math.floor(Math.random() * 60) * (Math.random() < 0.5 ? -1 : 1);
console.log(rgb[i] + "+" + variance);
if (rgb[i] + variance > 255 || rgb[i] + variance < 0) {
rgb[i] = rgb[i] - variance;
} else {
rgb[i] = rgb[i] + variance;
}
}
return "rgb(" + rgb[0] + ", " + rgb[1] + ", " + rgb[2] + ")";
}
//Using Durstenfeld shuffle algorithm.
function shuffleColors(arr) {
for (var i = arr.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
return arr;
}
function generateRandomColors(num) {
var arr = [];
arr.push(randomColor());
for (var i = 1; i < num; i++) {
if (colorRange === "Full") {
arr.push(randomColor());
} else {
arr.push(closeRandomColor(arr[i - 1]));
}
}
arr = shuffleColors(arr);
return arr;
}
function setColors(num) {
colors = generateRandomColors(num);
winningColor = colors[Math.floor(Math.random() * colors.length)];
document.getElementById("colorToGuess").textContent = winningColor;
for (var i = 0; i < possibleGuesses.length; i++) {
if (colors[i]) {
possibleGuesses[i].style.display = "block";
possibleGuesses[i].style.background = colors[i];
} else {
possibleGuesses[i].style.display = "none";
}
}
}
function resetText() {
resetButton.textContent = "New Colors";
messageDisplay.textContent = "";
document.querySelector("h1").style.background = "steelblue";
setColors(numOfGuesses);
}
function changeMode() {
document.querySelector(".mode").innerHTML = this.textContent + " <span class=\"caret\">";
setModeOptions(this.textContent);
resetText();
}
function changeRange() {
if (this.textContent === "Full") {
document.querySelector(".range").innerHTML = "Full Colors <div class=\"arrow-down\"></div>";
} else {
document.querySelector(".range").innerHTML = "Close Colors <div class=\"arrow-down\"></div>";
}
colorRange = this.textContent;
resetText();
}
function init() {
var i;
for (i = 0; i < possibleGuesses.length; i++) {
possibleGuesses[i].addEventListener("click", setGuess);
}
for (i = 0; i < modeButtons.length; i++) {
modeButtons[i].addEventListener("click", changeMode);
}
for (i = 0; i < rangeButtons.length; i++) {
rangeButtons[i].addEventListener("click", changeRange);
}
resetButton.addEventListener("click", function() {
messageDisplay.textContent = "";
this.textContent = "New Colors";
document.querySelector("h1").style.background = "steelblue";
setColors(numOfGuesses);
});
setColors(numOfGuesses);
}
init();
|
JavaScript
| 0 |
@@ -582,33 +582,34 @@
esses.length; i+
-+
+=1
) %7B%0A poss
@@ -2048,33 +2048,34 @@
%3C rgb.length; i+
-+
+=1
) %7B%0A rgb%5B
@@ -2856,25 +2856,26 @@
i %3C num; i+
-+
+=1
) %7B%0A
@@ -3324,33 +3324,34 @@
esses.length; i+
-+
+=1
) %7B%0A if (
@@ -4359,33 +4359,34 @@
esses.length; i+
-+
+=1
) %7B%0A poss
@@ -4478,33 +4478,34 @@
ttons.length; i+
-+
+=1
) %7B%0A mode
@@ -4604,17 +4604,18 @@
ngth; i+
-+
+=1
) %7B%0A
|
e5421f234c886041403ade4c2a50121f8b68393b
|
Tidy up.
|
tests/document/transclusion.test.js
|
tests/document/transclusion.test.js
|
import test from 'tape'
import { insertRows, deleteRows, insertCols, deleteCols } from '../../src/sheet/sheetManipulations'
import { getValue, getSource } from '../../src/shared/cellHelpers'
import createRawArchive from '../util/createRawArchive'
import loadRawArchive from '../util/loadRawArchive'
import setupEngine from '../util/setupEngine'
import { play, getValues } from '../util/engineTestHelpers'
import { queryCells } from '../util/sheetTestHelpers'
/*
Transclusions need to be updated whenever the referenced sheet changes
structurally, i.e. rows or columns are added or removed, or the referenced
resource is renamed.
To test this behavior, an archive is created and manipulations as done by the
UI are triggered. Only the following is subject to this this:
- transclusions are updated when sheet structure is changed
- transclusions are updated a resource is renamed
- engine is updated when a resource is renamed (registered alias by name)
We do not test the evaluation of transclusions here, which is done in `Engine.test.js`
*/
test('Transclusions: inserting a row', t => {
t.plan(1)
let { archive, engine } = _setup(sample1())
let sheetSession = archive.getEditorSession('sheet')
let articleSession = archive.getEditorSession('article')
let article = articleSession.getDocument()
play(engine)
.then(() => {
insertRows(sheetSession, 1, 1)
})
.then(() => {
let cell1 = article.get('cell1')
t.equal(getSource(cell1), "'My Sheet'!A1:C4", "transclusion should have been updated")
})
})
test('Transclusions: deleting a row', t => {
t.plan(1)
let { archive, engine } = _setup(sample1())
let sheetSession = archive.getEditorSession('sheet')
let articleSession = archive.getEditorSession('article')
let article = articleSession.getDocument()
play(engine)
.then(() => {
deleteRows(sheetSession, 2, 1)
})
.then(() => {
let cell1 = article.get('cell1')
t.equal(getSource(cell1), "'My Sheet'!A1:C2", "transclusion should have been updated")
})
})
test('Transclusions: inserting a column', t => {
t.plan(1)
let { archive, engine } = _setup(sample1())
let sheetSession = archive.getEditorSession('sheet')
let articleSession = archive.getEditorSession('article')
let article = articleSession.getDocument()
play(engine)
.then(() => {
insertCols(sheetSession, 1, 1)
})
.then(() => {
let cell1 = article.get('cell1')
t.equal(getSource(cell1), "'My Sheet'!A1:D3", "transclusion should have been updated")
})
})
test('Transclusions: deleting a column', t => {
t.plan(1)
let { archive, engine } = _setup(sample1())
let sheetSession = archive.getEditorSession('sheet')
let articleSession = archive.getEditorSession('article')
let article = articleSession.getDocument()
play(engine)
.then(() => {
deleteCols(sheetSession, 1, 1)
})
.then(() => {
let cell1 = article.get('cell1')
t.equal(getSource(cell1), "'My Sheet'!A1:B3", "transclusion should have been updated")
})
})
test('Transclusions: rename sheet', t => {
t.plan(1)
let { archive, engine } = _setup(sample1())
let articleSession = archive.getEditorSession('article')
let article = articleSession.getDocument()
play(engine)
.then(() => {
archive.renameDocument('sheet', 'Foo')
})
.then(() => {
let cell1 = article.get('cell1')
t.equal(getSource(cell1), "'Foo'!A1:C3", "transclusion should have been updated")
})
})
test('Transclusions: using a document variable in a sheet', t => {
t.plan(1)
let { engine } = _setup(sample2())
let sheet = engine.getResource('sheet')
play(engine)
.then(() => {
t.deepEqual(getValues(queryCells(sheet.cells, 'C1:C4')), [7, 6, 9, 22], 'transcluded values should have been computed correctly')
})
})
test('Transclusions: rename document', t => {
t.plan(2)
let { archive, engine } = _setup(sample2())
let sheet = engine.getResource('sheet')
play(engine)
.then(() => {
archive.renameDocument('article', 'Foo')
})
.then(() => play(engine))
.then(() => {
t.equal(queryCells(sheet.cells, 'C1').source, "='Foo'!x", 'transclusion should have been updated')
t.deepEqual(getValues(queryCells(sheet.cells, 'C1:C4')), [7, 6, 9, 22], 'transcluded values should have been computed correctly')
})
})
function sample1() {
return [
{
id: 'article',
path: 'article.xml',
type: 'article',
name: 'My Article',
body: [
"<cell id='cell1' language='mini'>'My Sheet'!A1:C3</cell>"
]
},
{
id: 'sheet',
path: 'sheet.xml',
type: 'sheet',
name: 'My Sheet',
columns: [{ name: 'x' }, { name: 'y' }, { name: 'z' }],
cells: [
['1', '2', '3'],
['4', '5', '6'],
['7', '8', '9'],
['10', '11', '12']
]
}
]
}
function sample2() {
return [
{
id: 'article',
path: 'article.xml',
type: 'article',
name: 'My Article',
body: [
"<cell id='cell1' language='mini'>x = 7</cell>"
]
},
{
id: 'sheet',
path: 'sheet.xml',
type: 'sheet',
name: 'My Sheet',
columns: [{ name: 'x' }, { name: 'y' }, { name: 'z' }],
cells: [
['1', '2', "='My Article'!x"],
['4', '5', '6'],
['7', '8', '9'],
['10', '11', '=sum(C1:C3)']
]
}
]
}
function _setup(archiveData) {
let { engine } = setupEngine()
let context = { engine }
let rawArchive = createRawArchive(archiveData)
let archive = loadRawArchive(rawArchive, context)
return { archive, engine }
}
|
JavaScript
| 0.000002 |
@@ -129,18 +129,8 @@
rt %7B
- getValue,
get
|
a7619976ead40bf6cd7ceff06403ea54ae7eae5d
|
Update bin to bert
|
bin/_bert.js
|
bin/_bert.js
|
#! /usr/bin/env node
const path = require('path')
const every = require('lodash/every')
const argv = require('minimist')(process.argv.slice(2), {
default: {
bertfile: '.bert.js'
}
})
const localBert = require('..')
const logger = require('../lib/logger')
const getTasksToLoad = () => argv._.length === 0 ? ['default'] : argv._
let countRunClears = 0
localBert.on('task_start', function ({task}) {
console.log(logger.startTask(task))
})
localBert.on('task_stop', function ({task, duration}) {
if (countRunClears === 0) {
process.nextTick(() => {
localBert.start('clear containers')
})
}
console.log(logger.stopTask(task, duration))
})
localBert.on('task_err', function ({task, message, err}) {
console.log(logger.errTask(task, message, err.stack))
process.exit(1)
})
localBert.task('clear containers', async () => {
countRunClears += 1
if (every(getTasksToLoad().map(task => localBert.tasks[task].done), Boolean)) {
await Promise.all(Object.keys(localBert.agents).map(agent => localBert.agents[agent].rmContainer({silent: !true})))
}
})
global.bert = localBert
const bertfile = path.join(process.cwd(), argv.bertfile)
async function run () {
/* Load task bert */
require(bertfile)
getTasksToLoad().map(e => localBert.start(e))
}
run()
.catch(err => console.error(err.stack))
|
JavaScript
| 0 |
@@ -42,16 +42,51 @@
('path')
+%0Aconst resolve = require('resolve')
%0A%0Aconst
@@ -224,40 +224,8 @@
%0A%7D)%0A
-const localBert = require('..')%0A
cons
@@ -257,24 +257,166 @@
b/logger')%0A%0A
+/* Load instance to bert */%0Aconst localBert = process.env.BERT_MODE_DEV%0A ? require('..')%0A : resolve('bert.js', %7B basedir: process.cwd() %7D)%0A%0A
const getTas
|
27bcf5348d2c1aaf5db7cd500ea4fe9068684299
|
correct constraints setting
|
src/content/getusermedia/resolution/js/main.js
|
src/content/getusermedia/resolution/js/main.js
|
/*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree.
*/
'use strict';
var dimensions = document.querySelector('#dimensions');
var video = document.querySelector('video');
var videoSelect = document.querySelector('select#videoSource');
var selectors = [videoSelect];
var stream;
var vgaButton = document.querySelector('#vga');
var qvgaButton = document.querySelector('#qvga');
var hdButton = document.querySelector('#hd');
var fullHdButton = document.querySelector('#full-hd');
var currentConstraints = vgaConstraints;
function gotDevices(deviceInfos) {
// Handles being called several times to update labels. Preserve values.
var values = selectors.map(function(select) {
return select.value;
});
selectors.forEach(function(select) {
while (select.firstChild) {
select.removeChild(select.firstChild);
}
});
for (var i = 0; i !== deviceInfos.length; ++i) {
var deviceInfo = deviceInfos[i];
var option = document.createElement('option');
option.value = deviceInfo.deviceId;
if (deviceInfo.kind === 'videoinput') {
option.text = deviceInfo.label || 'camera ' + (videoSelect.length + 1);
videoSelect.appendChild(option);
}
}
selectors.forEach(function(select, selectorIndex) {
if (Array.prototype.slice.call(select.childNodes).some(function(n) {
return n.value === values[selectorIndex];
})) {
select.value = values[selectorIndex];
}
});
}
navigator.mediaDevices.enumerateDevices().then(gotDevices).catch(handleError);
vgaButton.onclick = function() {
getMedia(vgaConstraints);
};
qvgaButton.onclick = function() {
getMedia(qvgaConstraints);
};
hdButton.onclick = function() {
getMedia(hdConstraints);
};
fullHdButton.onclick = function() {
getMedia(fullHdConstraints);
};
var qvgaConstraints = {
video: {width: {exact: 320}, height: {exact: 240}}
};
var vgaConstraints = {
video: {width: {exact: 640}, height: {exact: 480}}
};
var hdConstraints = {
video: {width: {exact: 1280}, height: {exact: 720}}
};
var fullHdConstraints = {
video: {width: {exact: 1920}, height: {exact: 1080}}
};
function gotStream(mediaStream) {
window.stream = mediaStream; // stream available to console
video.srcObject = mediaStream;
}
function displayVideoDimensions() {
if (!video.videoWidth) {
setTimeout(displayVideoDimensions, 500);
}
dimensions.innerHTML = 'Actual video dimensions: ' + video.videoWidth +
'x' + video.videoHeight + 'px.';
}
video.onloadedmetadata = displayVideoDimensions;
videoSelect.onchange = start(currentConstraints);
function getMedia(constraints) {
if (stream) {
stream.getTracks().forEach(function(track) {
track.stop();
});
}
var videoSource = videoSelect.value;
constraints.video.deviceId = videoSource ? {exact: videoSource} : undefined;
navigator.mediaDevices.getUserMedia(constraints)
.then(gotStream)
.catch(function(e) {
var message = 'getUserMedia error: ' + e.name;
alert(message);
console.log(message);
});
currentConstraints = constraints;
}
function handleError(error) {
console.log('navigator.getUserMedia error: ', error);
}
|
JavaScript
| 0.000001 |
@@ -2481,16 +2481,132 @@
tream;%0D%0A
+ // Refresh button list in case labels have become available%0D%0A return navigator.mediaDevices.enumerateDevices();%0D%0A
%7D%0D%0A%0D%0Afun
@@ -3123,34 +3123,56 @@
%0D%0A
-constraints.
+var videoConstraints = %7B%0D%0A
video
-.
+: %7B
deviceId
= v
@@ -3167,18 +3167,17 @@
deviceId
- =
+:
videoSo
@@ -3215,19 +3215,123 @@
ndefined
+,%0D%0A width: constraints.video.width,%0D%0A height: constraints.video.height%7D%0D%0A %7D
;%0D%0A
+
%0D%0A navi
@@ -3358,25 +3358,30 @@
etUserMedia(
-c
+videoC
onstraints)%0D
@@ -3379,21 +3379,25 @@
traints)
+.
%0D%0A
-.
+
then(got
@@ -3407,137 +3407,43 @@
eam)
-%0D%0A .catch(function(e) %7B%0D%0A var message = 'getUserMedia error: ' + e.name;%0D%0A alert(message);%0D%0A console.log(message);%0D%0A %7D
+.then(gotDevices).catch(handleError
);%0D%0A
|
088e8b70675d496037c546a6b513ca516fe97617
|
Make sure syntax etc errors in a command don't asplode bosco.
|
bin/bosco.js
|
bin/bosco.js
|
#!/usr/bin/env node
'use strict';
/**
* Bosco command line tool
*/
var program = require('commander');
var Bosco = require('../index');
var _ = require('lodash');
var pkg = require('../package.json');
var completion = require('../src/completion');
var fs = require('fs');
var path = require('path');
require('colors'); // No need to define elsewhere
// Go over every command in the global and local commands folder and add the options
program.boscoOptionsArray = function(boscoOptionsArray) {
if (!boscoOptionsArray || !boscoOptionsArray.length) { return this; }
var _this = this;
_.forEach(boscoOptionsArray, function(boscoOption) {
if (!boscoOption.option || !boscoOption.syntax || boscoOption.syntax.length < 2) {
throw new Error('Error parsing bosco command');
}
_this.option(boscoOption.syntax[0], boscoOption.syntax[1], boscoOption.syntax[2]);
});
return _this;
};
var getOptionsForCommandsOnPath = function(folderPath) {
if (!fs.existsSync(folderPath)) return [];
var wrappedFiles = _(fs.readdirSync(folderPath));
var wrappedCommandsArray = wrappedFiles.map(function(filename) {
if (path.extname(filename) !== '.js') { return null; }
var file = folderPath + filename;
var commandFile = require(file);
return commandFile.options;
});
return wrappedCommandsArray.flatten().compact().value();
};
var globalOptions = [
{
option: 'configFile',
syntax: ['-c, --configFile [file]', 'Use specific config file']
},
{
option: 'configPath',
syntax: ['-p, --configPath [folder]', 'Use specific config path']
},
{
option: 'environment',
syntax: ['-e, --environment [environment]', 'Set environment to use', 'local']
},
{
option: 'service',
syntax: ['-s, --service', 'Run only with service in cwd (if bosco-service.json file exists in cwd)', false]
},
{
option: 'build',
syntax: ['-b, --build [build]', 'Set build identifier to use', 'default']
},
{
option: 'repo',
syntax: ['-r, --repo [pattern]', 'Use a specific repository (parsed as regexp)', '.*']
},
{
option: 'noprompt',
syntax: ['-n, --noprompt', 'Do not prompt for confirmation']
},
{
option: 'force',
syntax: ['-f, --force', 'Force over ride on publish even if no changes']
},
{
option: 'completion',
syntax: ['--completion [shell]','Generate the shell completion code']
},
{
option: 'shellCommands',
syntax: ['--shellCommands','Generate commands for shell completion mode [used internally]']
}
];
var bosco = new Bosco();
var localCommandsOptions = getOptionsForCommandsOnPath(bosco.getLocalCommandFolder());
var commandOptions = getOptionsForCommandsOnPath(bosco.getGlobalCommandFolder());
var allBoscoCommands = _.union(globalOptions, localCommandsOptions, commandOptions);
program
.version(pkg.version)
.usage('[options] <command>')
.boscoOptionsArray(allBoscoCommands)
.parse(process.argv);
var options = {
program: program,
version: pkg.version,
args: program.args
};
// Add all parsed options to the Bosco options
_.forEach(allBoscoCommands, function(boscoOption){
options[boscoOption.option] = program[boscoOption.option];
});
if(program.completion) {
completion.print(program.completion);
}
bosco.init(options);
|
JavaScript
| 0 |
@@ -348,16 +348,42 @@
ewhere%0A%0A
+var bosco = new Bosco();%0A%0A
// Go ov
@@ -1273,25 +1273,170 @@
File
- = require(file);
+;%0A try %7B%0A commandFile = require(file);%0A %7D catch (err) %7B%0A bosco.error('Error requiring command file: ' + file + ': ' + err);%0A return %5B%5D;%0A %7D
%0A
@@ -2710,34 +2710,8 @@
%5D;%0A%0A
-var bosco = new Bosco();%0A%0A
var
|
5b96acfd16ab64cc3ea5e9066a63526178f61781
|
Make this works on windows too
|
bin/index.js
|
bin/index.js
|
#!/usr/bin/env node
var spawn = require('child_process').spawn
var npm = require.resolve('npm/cli')
spawn(npm, process.argv.slice(2), {stdio: 'inherit'})
|
JavaScript
| 0.000016 |
@@ -105,13 +105,39 @@
awn(
-npm,
+process.execPath, %5Bnpm%5D.concat(
proc
@@ -153,16 +153,17 @@
slice(2)
+)
, %7Bstdio
|
d608644dbfe3c0c675d66dbfdb6614b198d17c39
|
Make Jira project key uppercase before calling. Jira project key seems to be case sensitive
|
bin/index.js
|
bin/index.js
|
#!/usr/bin/env node
var chalk = require('chalk');
var YAML = require('yamljs');
var IssuePackForGithub = require('../lib/IssuePackForGithub');
var IssuePackForJira = require('../lib/IssuePackForJira');
var Util = require('../lib/Util').default;
var prompt = require('prompt');
//Create new Util class
var util = new Util();
var toolSchema = {
properties: {
tool: {
required: true
}
}
};
var jiraSchema = {
properties: {
username: {
required: true
},
password: {
hidden: true,
required: true
},
projectKey: {
required: true,
description: "Jira Project Key (prefixes all issues in project)"
},
jiraBaseUri: {
required: true,
description: "Jira Base URI (e.g. https://jira.govready.com)"
},
path: {
required: true
}
}
};
var githubSchema = {
properties: {
username: {
required: true
},
password: {
hidden: true,
required: true
},
repo: {
pattern: /^[a-zA-Z\-]+\/[a-zA-Z\-]+$/,
message: 'Repo must be in the form of `user/repo`',
required: true,
description: "repo (username/repo)"
},
path: {
required: true
}
}
};
prompt.message = "";
prompt.start();
prompt.get(toolSchema, function (toolPromptErr, toolPromptResult) {
if (toolPromptResult.tool && toolPromptResult.tool.toUpperCase() === 'JIRA') {
prompt.get(jiraSchema, function (err, result) {
var username = result.username;
var password = result.password;
var projectKey = result.projectKey;
var jiraBaseUri = result.jiraBaseUri;
var path = result.path;
var creds = {
username: username,
password: password
};
//Retrieve pack files
var packFiles = util.parseFiles([path]);
//Iterate through the pack files
packFiles.forEach(function (file) {
var issuePack = new IssuePackForJira({
auth: creds,
projectKey: projectKey,
jiraBaseUri: jiraBaseUri
});
var contents = YAML.load(file);
issuePack.load(contents);
issuePack.push();
});
});
} else {
prompt.get(githubSchema, function (err, result) {
var username = result.username;
var password = result.password;
var repo = result.repo;
var path = result.path;
var creds = {
username: username,
password: password
};
//Retrieve pack files
var packFiles = util.parseFiles([path]);
//Iterate through the pack files
packFiles.forEach(function (file) {
var issuePack = new IssuePackForGithub({
auth: creds
});
var contents = YAML.load(file);
issuePack.load(contents);
issuePack.push(repo);
});
});
}
});
|
JavaScript
| 0.000541 |
@@ -1543,16 +1543,70 @@
ectKey =
+ result.projectKey ? result.projectKey.toUpperCase() :
result.
|
abffd0a00ae6c11158cd8924e989e86c9053e3c6
|
Stop server when SIGINT is triggered
|
bin/serve.js
|
bin/serve.js
|
#!/usr/bin/env node
import http from 'http'
import url from 'url'
import path from 'path'
import fs from 'fs-extra'
import { execSync as exec } from 'child_process'
import args from 'args'
import open from 'open'
import mime from 'mime'
import colors from 'colors'
import { isSite, exists } from '../lib/etc'
import config from '../lib/config'
args
.option('port', 'The port on which your site will be available', config.port)
.option('watch', 'Rebuild site if files change')
const options = args.parse(process.argv)
config.port = options.port
if (!isSite()) {
console.error('No site in here!'.red)
process.exit(1)
}
if (!exists(config.outputDir)) {
try {
exec('cory build', { stdio: [0, 1] })
} catch (err) {
console.error(err)
process.exit(1)
}
}
function respond (status, message, type, encoding) {
let request = this
request.writeHead(status, {'Content-Type': type || 'text/plain'})
request.write(message || 'Not Found', encoding || 'utf8')
request.end()
}
http.ServerResponse.prototype.send = respond
function middleware (request, response) {
const uri = url.parse(request.url).pathname
let filename = path.join(config.outputDir, uri)
let stats = false
try {
stats = fs.statSync(filename)
} catch (err) {
return response.send(404)
}
if (stats.isDirectory()) {
filename += 'index.html'
}
if (!fs.statSync(filename).isFile()) {
return response.send(404)
}
const type = mime.lookup(filename)
const encoding = type !== 'text/html' && 'binary'
fs.readFile(filename, 'binary', (err, file) => {
if (err) {
return response.send(500, err)
}
response.send(200, file, type, encoding)
})
}
if (options.watch) {
const browserSync = require('browser-sync').create()
browserSync.init({
server: {
baseDir: path.parse(config.outputDir).base
},
ui: false,
port: config.port,
notify: false,
logPrefix: 'cory',
watchOptions: {
ignored: /dist|.DS_Store|.git/
},
files: [{
match: [process.cwd()],
fn: require('../lib/watch')
}]
})
process.on('SIGINT', () => {
browserSync.exit()
process.exit(0)
})
} else {
const server = http.createServer(middleware)
server.listen(config.port, function () {
const port = this.address().port
const url = 'http://localhost:' + port
console.log('Your site is running at ' + url)
open(url)
})
}
|
JavaScript
| 0 |
@@ -2417,15 +2417,90 @@
en(url)%0A %7D)
+%0A%0A process.on('SIGINT', () =%3E %7B%0A server.close()%0A process.exit()%0A %7D)
%0A%7D%0A
|
48d9f33fda83b250d4018f8f53362c69f15e046f
|
fix --static share
|
bin/share.js
|
bin/share.js
|
var hyperdrive = require('hyperdrive')
var memdb = require('memdb')
var walker = require('folder-walker')
var each = require('stream-each')
var raf = require('random-access-file')
var fs = require('fs')
var path = require('path')
var replicate = require('../lib/replicate')
module.exports = function (argv) {
var drive = hyperdrive(memdb()) // TODO: use level instead
var dir = argv._[1] || '.'
var firstAppend = true
try {
var isDirectory = fs.statSync(dir).isDirectory()
} catch (err) {
console.error('Directory does not exist')
process.exit(1)
}
var archive = drive.createArchive(argv.append, {
live: !argv.static,
file: function (name) {
return raf(isDirectory ? path.join(dir, name) : dir, {readable: true, writable: false})
}
})
archive.open(function (err) {
if (err) return onerror(err)
if (argv.append && !archive.owner) return onerror('You cannot append to this link')
if (archive.live || archive.owner) {
console.log('Share this link:', archive.key.toString('hex'))
onswarm(replicate(argv, archive))
}
each(walker(dir), appendEntry, done)
})
// archive.list({live: true}).on('data', console.log)
function appendEntry (data, next) {
if (isDirectory && firstAppend) {
firstAppend = false // folder walker seems off on the first item. TODO: investigate
return next()
}
console.log('Adding', data.relname)
archive.append({type: data.type, name: data.relname}, next)
}
function onswarm (swarm) {
swarm.on('connection', function (con) {
console.log('Remote peer connected')
con.on('close', function () {
console.log('Remote peer disconnected')
})
})
swarm.on('browser-connection', function (con) {
console.log('WebRTC browser connected')
con.on('close', function () {
console.log('WebRTC browser disconnected')
})
})
}
function done (err) {
if (err) return onerror(err)
archive.finalize(function (err) {
if (err) return onerror(err)
console.log('All files added. Share this link:', archive.key.toString('hex'))
if (!archive.live) {
replicate()
return
}
console.log('Watching', dir === '.' ? process.cwd() : dir, '...')
yoloWatch(dir, function (name, st) {
console.log('Adding', name)
archive.append({type: st.isDirectory() ? 'directory' : 'file', name: name})
})
})
}
function onerror (err) {
console.error(err.stack || err)
process.exit(1)
}
function yoloWatch (dir, onchange) {
var stats = {}
kick(true, function () {
fs.watch(dir, function () {
kick(false, function () {})
})
})
function kick (first, cb) {
fs.readdir(dir, function (err, files) {
if (err) return
loop()
function loop () {
var file = files.shift()
if (!file) return cb()
fs.stat(path.join(dir, file), function (err, st) {
if (err) return loop()
if (!stats[file] || st.nlink !== stats[file].nlink) {
stats[file] = st
if (!first) onchange(file, st)
}
loop()
})
}
})
}
}
}
|
JavaScript
| 0 |
@@ -939,16 +939,17 @@
%0A if
+(
(archive
@@ -971,16 +971,32 @@
e.owner)
+ && archive.key)
%7B%0A
@@ -2194,16 +2194,29 @@
plicate(
+argv, archive
)%0A
|
cdb96322f26d60c49df23cf0379a8ec1e90eccd8
|
Send other available restaurants with daily menus
|
bin/slack.js
|
bin/slack.js
|
'use strict'
let moment = require('moment')
let winston = require('winston')
let request = require('request')
let WebClient = require('@slack/client').WebClient
let config = require('../config')
let web = new WebClient(config.SLACK_API_TOKEN)
let isWeekend = () => {
let weekDay = moment().day()
return weekDay === 0 || weekDay === 6
}
let postMessageHandler = (err, info) => {
if (err) return winston.error('SLACK: postMessage failed:', err)
if (info && !info.ok) return winston.error('SLACK: invalid postMessage response:', info)
}
let prepareMessage = (json) => {
let message = ''
for (let i = 0; i < json.length; i++) {
if (!json[i].menu[0]) continue
message += `*${json[i].title}*\n`
for (let j = 0; j < json[i].menu[0].items.length; j++) {
let menuItem = json[i].menu[0].items[j]
message += `- ${menuItem.item} (${menuItem.amount}) _${menuItem.price}_\n`
}
message += '\n'
}
return message
}
let only = (allowed) => (place) => allowed.indexOf(place.name) !== -1
// don't bother on weekends
if (isWeekend()) process.exit(0)
request(config.URL + 'api/next', (err, response, body) => {
if (err) return winston.error('SLACK: request failed', err)
let json = null
try {
json = JSON.parse(body)
} catch (e) {
return winston.error('SLACK: invalid JSON', e, body)
}
let options = {
username: 'sbks-luncher'
}
for (let i = 0; i < config.NOTIFICATIONS.length; i++) {
let menu = json.filter(only(config.NOTIFICATIONS[i].services))
web.chat.postMessage(config.NOTIFICATIONS[i].user, prepareMessage(menu), options, postMessageHandler)
}
})
|
JavaScript
| 0 |
@@ -7,16 +7,42 @@
trict'%0A%0A
+let _ = require('lodash')%0A
let mome
@@ -573,55 +573,566 @@
let
-prepareMessage = (json) =%3E %7B%0A let message = ''
+onlySubscribed = (allowed) =%3E (service) =%3E allowed.indexOf(service.name) !== -1%0Alet onlyUnsubscribed = (allowed) =%3E (service) =%3E allowed.indexOf(service.name) === -1%0Alet getTitle = (service) =%3E service.title%0A%0Alet prepareMessage = (json, subscribedServices) =%3E %7B%0A let allServices = config.SERVICES%0A let availableServices = _.map(_.filter(allServices, onlyUnsubscribed(subscribedServices)), getTitle)%0A let message = 'Other available restaurants: ' + availableServices.join(', ') + '%5Cn%5Cn'%0A%0A let jsonMenus = _.filter(json, onlySubscribed(subscribedServices))
%0A f
@@ -1154,16 +1154,21 @@
i %3C json
+Menus
.length;
@@ -1184,24 +1184,29 @@
if (!json
+Menus
%5Bi%5D.menu%5B0%5D)
@@ -1235,24 +1235,29 @@
+= %60*$%7Bjson
+Menus
%5Bi%5D.title%7D*%5C
@@ -1283,24 +1283,29 @@
0; j %3C json
+Menus
%5Bi%5D.menu%5B0%5D.
@@ -1350,16 +1350,21 @@
m = json
+Menus
%5Bi%5D.menu
@@ -1512,79 +1512,8 @@
%0A%7D%0A%0A
-let only = (allowed) =%3E (place) =%3E allowed.indexOf(place.name) !== -1%0A%0A
// d
@@ -1949,30 +1949,37 @@
t me
-nu = json.filter(only(
+ssage = prepareMessage(json,
conf
@@ -2007,17 +2007,16 @@
ervices)
-)
%0A web
@@ -2067,28 +2067,15 @@
er,
-prepareMessage(menu)
+message
, op
|
a4346c0b113f27d5a3e0c52a872e40c35af0cc4b
|
Move copys to options root
|
password-strength-meter.js
|
password-strength-meter.js
|
/* ========================================================================
* Password Strength Meter: password-strength-meter.js v0.0.1
* ======================================================================== */
!function ($) {
"use strict"; // jshint ;_;
/* TOOLTIP PUBLIC CLASS DEFINITION
* =============================== */
var StrengthMeter = function (input, strength_meter, options) {
this.init(input, strength_meter, options)
}
StrengthMeter.prototype = {
constructor: StrengthMeter
/**
* Init plugin with input field and streng meter markup
* @param {jQuery} input
* @param {jQuery} strength_meter
* @param {Object} options
* - strength_meter_copys (Object) - Copys to be displayed
*/
, init: function(input, strength_meter, options) {
this.$input = $(input);
this.$strength_meter = $(strength_meter);
this.options = this.getOptions(options);
}
, getOptions: function(options) {
options = $.extend({}, $.fn.passwordStrengthMeter.defaults, this.$input.data(), options);
return options;
}
, check: function() {
var score = 0
, password = this.$input.val().trim()
, app_requirements = this.options.app_requirements
, $strength_meter_copy = this.$strength_meter.find(this.options.strength_meter_copy)
, $strength_meter_label = this.$strength_meter.find(this.options.strength_meter_label);
$strength_meter_label.hide();
if (password === '' || password.length < this.options.min_length) {
$strength_meter_copy.text(this.options.strength_meter_copys.too_short);
} else if (app_requirements && typeof this.options.app_requirements === 'function' && !this.options.app_requirements(password)) {
$strength_meter_copy.text(this.options.strength_meter_copys.app_requirements_copy);
} else {
$strength_meter_label.show();
if (password.match(/[!,@,#,$,%,\^,&,*,?,_,~]/)) { score += 1; }
if (password.match(/([a-z])/)) { score += 1; }
if (password.match(/([A-Z])/)) { score += 1; }
if (password.match(/([0-9])/)) { score += 1; }
if (password.length >= this.options.min_length) { score += 2; }
if (password.length >= this.options.good_length) { score += 2; }
if (password.length >= this.options.ideal_length) { score += 1; }
if (1 < score && score < 4) {
$strength_meter_copy.text(this.options.strength_meter_copys.weak);
} else if (4 <= score && score < 6) {
$strength_meter_copy.text(this.options.strength_meter_copys.fair);
} else if (6 <= score && score < 8) {
$strength_meter_copy.text(this.options.strength_meter_copys.good);
} else if (8 <= score) {
$strength_meter_copy.text(this.options.strength_meter_copys.strong);
}
}
this.$strength_meter.attr("data-score", score);
}
};
/* PASSWORD STRENGTH METER PLUGIN DEFINITION
* ========================= */
var old = $.fn.passwordStrengthMeter
/**
* Initialize plugin and execute methods. If param is a string we try to execute as method.
*
* @param {Object || String} param
*/
$.fn.passwordStrengthMeter = function(param) {
return this.each(function () {
var $this = $(this)
, data = $this.data('passwordStrengthMeter')
, options = typeof param == 'object' && param.options
, $strength_meter = typeof param == 'object' && param.strength_meter
if (!data) $this.data('passwordStrengthMeter', (data = new StrengthMeter(this, $strength_meter, options)))
if (typeof param == 'string') data[param]()
})
}
$.fn.passwordStrengthMeter.Constructor = StrengthMeter
$.fn.passwordStrengthMeter.defaults = {
strength_meter_label: '.js-strength-meter-label'
, strength_meter_copy: '.js-strength-meter-copy'
, min_length: 8
, good_length: 10
, ideal_length: 12
, strength_meter_copys: {
too_short: 'Too short'
, app_requirements_copy: 'This password doesn\'t pass app requirements'
, weak: 'Weak'
, fair: 'Fair'
, good: 'Good'
, strong: 'Strong'
}
}
/* PASSWORD STRENGTH METER NO CONFLICT
* =================== */
$.fn.passwordStrengthMeter.noConflict = function() {
$.fn.passwordStrengthMeter = old
return this
}
}(window.jQuery);
|
JavaScript
| 0 |
@@ -1329,16 +1329,24 @@
ter_copy
+_element
)%0A
@@ -1432,16 +1432,24 @@
er_label
+_element
);%0A%0A
@@ -1602,37 +1602,21 @@
options.
-strength_meter_
copy
-s.
+_
too_shor
@@ -1803,37 +1803,21 @@
options.
-strength_meter_
copy
-s.
+_
app_requ
@@ -1824,21 +1824,16 @@
irements
-_copy
);%0A
@@ -2425,37 +2425,21 @@
options.
-strength_meter_
copy
-s.
+_
weak);%0A%0A
@@ -2533,37 +2533,21 @@
options.
-strength_meter_
copy
-s.
+_
fair);%0A%0A
@@ -2641,37 +2641,21 @@
options.
-strength_meter_
copy
-s.
+_
good);%0A%0A
@@ -2740,29 +2740,13 @@
ons.
-strength_meter_
copy
-s.
+_
stro
@@ -3707,16 +3707,24 @@
er_label
+_element
: '.js-s
@@ -3769,16 +3769,24 @@
ter_copy
+_element
: '.js-s
@@ -3880,40 +3880,13 @@
,
-strength_meter_copys: %7B%0A
+copy_
too_
@@ -3904,24 +3904,27 @@
short'%0A
-
,
+copy_
app_requ
@@ -3931,21 +3931,16 @@
irements
-_copy
: 'This
@@ -3984,20 +3984,23 @@
ts'%0A
-
,
+copy_
weak: 'W
@@ -4008,20 +4008,23 @@
ak'%0A
-
,
+copy_
fair: 'F
@@ -4032,20 +4032,23 @@
ir'%0A
-
,
+copy_
good: 'G
@@ -4056,20 +4056,23 @@
od'%0A
-
,
+copy_
strong:
@@ -4080,24 +4080,16 @@
Strong'%0A
- %7D%0A
%7D%0A%0A /*
|
8eaf6a0b965fcff9c13ab6f45366063c0c69e19e
|
Add a comment about only being able to retrive blobs from pending transactions if the blob was stored directly by a transaction.
|
blobstore.js
|
blobstore.js
|
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var blobstoreAbi = require('./blobstore.abi.json');
var blobstoreContract = web3.eth.contract(blobstoreAbi);
var blobstoreAddress = '0x8f3fae469b08e48d8e2a692e0b9805c38509231b';
var blobstore = blobstoreContract.at(blobstoreAddress);
// solc version: 0.2.0-0/Release-Linux/g++/int linked to libethereum-1.1.0-0/Release-Linux/g++/int
var getBlobHash = function(blob) {
return '0x' + web3.sha3(blob.toString('hex'), {encoding: 'hex'});
}
var getBlobBlock = function(hash) {
// Determine the block that includes the transaction for this blob.
return blobstore.getBlobBlock(hash, {}, 'latest').toNumber();
}
var storeBlob = function(blob) {
// Determine hash of blob.
var hash = getBlobHash(blob);
// Check if this blob is in a block yet.
if (getBlobBlock(hash) == 0) {
// Calculate maximum transaction gas.
var gas = 44800 + 78 * blob.length;
// Broadcast the transaction. If this blob is already in a pending
// transaction, or has just been mined, this will be handled by the
// contract.
blobstore.storeBlob('0x' + blob.toString('hex'), {gas: gas});
}
return hash;
}
var getBlob = function(hash, callback) {
var blobBlock = getBlobBlock(hash);
if (blobBlock == 0) {
// The blob isn't in a block yet. See if it is in a pending transaction.
var txids = web3.eth.getBlock('pending').transactions;
for (var i in txids) {
var tx = web3.eth.getTransaction(txids[i]);
if (tx.to != blobstoreAddress) {
continue;
}
// Extract the blob from the transaction.
var length = parseInt(tx.input.substr(74, 64), 16);
var blob = new Buffer(tx.input.substr(138, length * 2), 'hex');
// Does it have the correct hash?
if (getBlobHash(blob) == hash) {
callback(null, blob);
return;
}
}
// We didn't find the blob. Check in the blocks one more time in case it
// just got mined and we missed it.
blobBlock = getBlobBlock(hash);
if (blobBlock == 0) {
// We didn't find it. Report the Error.
callback('error');
return;
}
}
// If the blob is in a block that occured within the past hour, search from an
// hour ago until the latest block in case there has been a re-arragement
// since we got the block number (very conservative).
var fromBlock, toBlock;
if (blobBlock > web3.eth.blockNumber - 200) {
fromBlock = web3.eth.blockNumber - 200;
toBlock = 'latest';
}
else {
fromBlock = toBlock = blobBlock;
}
var filter = web3.eth.filter({fromBlock: fromBlock, toBlock: toBlock, address: blobstoreAddress, topics: [hash]});
filter.get(function(error, result) {
if (result.length != 0) {
var length = parseInt(result[0].data.substr(66, 64), 16);
callback(null, new Buffer(result[0].data.substr(130, length * 2), 'hex'));
}
else {
// There has just been a re-arrangement and the trasaction is now back to
// pending. Let's try again from the start.
getBlob(hash, callback);
}
});
}
module.exports = {
getBlobHash: getBlobHash,
getBlobBlock: getBlobBlock,
storeBlob: storeBlob,
getBlob: getBlob
};
|
JavaScript
| 0 |
@@ -1410,24 +1410,101 @@
ransaction.%0A
+ // This will only work if the blob was stored directly by a transaction.%0A
var txid
|
2efe7f203e6dc8237d38b62fa39171429c72bd56
|
fix #1598 Pipe '|' symbol breaks YAML Syntax highlighting
|
lib/ace/mode/yaml_highlight_rules.js
|
lib/ace/mode/yaml_highlight_rules.js
|
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var YamlHighlightRules = function() {
// regexp must not have capturing parentheses. Use (?:) instead.
// regexps are ordered -> the first match is used
this.$rules = {
"start" : [
{
token : "comment",
regex : "#.*$"
}, {
token : "list.markup",
regex : /^(?:-{3}|\.{3})\s*(?=#|$)/
}, {
token : "list.markup",
regex : /^\s*[\-?](?:$|\s)/
}, {
token: "constant",
regex: "!![\\w//]+"
}, {
token: "constant.language",
regex: "[&\\*][a-zA-Z0-9-_]+"
}, {
token: ["meta.tag", "keyword"],
regex: /^(\s*\w.*?)(\:(?:\s+|$))/
},{
token: ["meta.tag", "keyword"],
regex: /(\w+?)(\s*\:(?:\s+|$))/
}, {
token : "keyword.operator",
regex : "<<\\w*:\\w*"
}, {
token : "keyword.operator",
regex : "-\\s*(?=[{])"
}, {
token : "string", // single line
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
}, {
token : "string", // multi line string start
regex : '[\\|>]\\w*',
next : "qqstring"
}, {
token : "string", // single quoted string
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
}, {
token : "constant.numeric", // float
regex : /[+\-]?[\d_]+(?:(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?\b/
}, {
token : "constant.numeric", // other number
regex : /[+\-]?\.inf\b|NaN\b|0x[\dA-Fa-f_]+|0b[10_]+/
}, {
token : "constant.language.boolean",
regex : "(?:true|false|TRUE|FALSE|True|False|yes|no)\\b"
}, {
token : "invalid.illegal", // comments are not allowed
regex : "\\/\\/.*$"
}, {
token : "paren.lparen",
regex : "[[({]"
}, {
token : "paren.rparen",
regex : "[\\])}]"
}
],
"qqstring" : [
{
token : "string",
regex : '(?=(?:(?:\\\\.)|(?:[^:]))*?:)',
next : "start"
}, {
token : "string",
regex : '.+'
}
]};
};
oop.inherits(YamlHighlightRules, TextHighlightRules);
exports.YamlHighlightRules = YamlHighlightRules;
});
|
JavaScript
| 0 |
@@ -3200,17 +3200,23 @@
: '%5B
-%5C%5C
%7C%3E%5D
-%5C%5Cw*
+%5B-+%5C%5Cd%5C%5Cs%5D*$
',%0A
|
513f1acd89a398a3f3468548076f3fb9fecb8c62
|
remove called to esphinx
|
lib/assets/javascripts/esphinx_ui.js
|
lib/assets/javascripts/esphinx_ui.js
|
//= require esphinx
//= require_tree .
|
JavaScript
| 0.000001 |
@@ -1,24 +1,4 @@
-//= require esphinx%0A
//=
|
b98b5d5cd4f5cabf6492818ba1af48604dadd590
|
Fix bug: window event handlers sometimes not cleaned up
|
css3d-simple-resize.js
|
css3d-simple-resize.js
|
'use strict';
css3d.prototype.SimpleResize = function (options) {
_.defaults(options, { resizable3d: this });
if (this.resizer && this.resizer.resizable3d) this.resizer.destroy();
this.resizer = new SimpleResize(options);
this._registeredListeners.push('resizer');
};
var SimpleResize = function (options) {
_.extend(this, options);
this.min = this.min || 0;
this.rootOffset = this.min;
this.offsetX = [0.0, 0.0];
this.resizing = false;
this.tap = this.tap.bind(this);
this.drag = this.drag.bind(this);
this.pinch = this.pinch.bind(this);
this.release = this.release.bind(this);
// It's important to have both events:
// e.g. MS Surface supports both depending on touch or stylus click
if (css3d.touchIsSupported) {
this.resizable3d.el.addEventListener('touchstart', this.tap);
}
this.resizable3d.el.addEventListener('mousedown', this.tap);
};
_.extend(SimpleResize.prototype, {
tap: function (e) {
if (e.target !== this.resizable3d.el) {
return;
}
this.resizable3d.style[css3d.duration] = 0;
this.resizing = false;
this.reference0 = this.xpos(e);
if (e.targetTouches && e.targetTouches.length > 1) {
this.reference0 = getTouchPoint(e, 0);
// Set rootOffset to the left-most touch point:
this.rootOffset = this.reference0 - this.resizable3d.el.parentElement.getBoundingClientRect().left;
window.removeEventListener('touchmove', this.drag);
window.addEventListener('touchmove', this.pinch);
window.addEventListener('touchend', this.release);
return false; // cancel any other click handlers
}
// Store a reference for where each of the drag handles are:
this.offsetX = [0, parseInt(this.resizable3d.style.width)];
this.rootOffset = this.resizable3d.getX();
// Store which handle we're dragging from ...
if (this.xOffset(e) < 20) { // 20 is the number of pixels overlapping from the transparent resize areas
this.curDragHandle = 0; // the drag handle on the left
} else if (this.offsetX[1] - this.xOffset(e) < 20) { // within 20px of resizable el's width
this.curDragHandle = 1; // the drag handle on the right
} else {
return; // we're not resizing, don't set up any other listeners etc
}
this.resizable3d.el.classList.add('resizing');
if (css3d.touchIsSupported) {
window.addEventListener('touchmove', this.drag);
window.addEventListener('touchend', this.release);
}
window.addEventListener('mousemove', this.drag);
window.addEventListener('mouseup', this.release);
e.stopPropagation();
e.stopImmediatePropagation();
e.preventDefault();
return false;
},
drag: function (e) {
var x, delta;
// 'x' & 'reference' are in the window space (clientX)
x = this.xpos(e);
delta = this.reference0 - x;
if (delta > 2 || delta < -2) {
this.resizing = true;
this.reference0 = x;
this.offsetX[this.curDragHandle] -= delta;
this.resize(); // uses offsetX[n0, n1]
}
// e.stopPropagation();
e.preventDefault();
// return false;
},
pinch: function (e) {
// We get here when we're __touching__ with >= 2 fingers
this.offsetX[0] = getTouchPoint(e, 0);
this.offsetX[1] = getTouchPoint(e, 1);
this.resizable3d.setTranslate(this.rootOffset + this.offsetX[0] - this.reference0);
this.resizable3d.style.width = Math.max(90, this.offsetX[1] - this.offsetX[0]) + 'px';
e.preventDefault();
},
resize: function () {
// We get here when dragging one(!) of the loop handles
// (example) this.offsetX === [-5, 395];
var leftAnchor = Math.min(this.offsetX[0], this.offsetX[1]) + this.rootOffset;
leftAnchor = Math.max(0, Math.min(leftAnchor, this.max)); // bounds check
var width = Math.max(this.offsetX[0], this.offsetX[1]) + this.rootOffset - leftAnchor;
width = Math.max(90, Math.min(width, this.max - leftAnchor)); // bounds check
width += 'px'; // deliberately on a new line for memory efficiency
this.resizable3d.setTranslate(leftAnchor);
this.resizable3d.style.width = width;
},
release: function (e) {
this.resizable3d.style[css3d.duration] = null;
this.resizable3d.el.classList.remove('resizing');
if (css3d.touchIsSupported) {
if (e.touches && e.touches.length < 2) {
window.removeEventListener('touchmove', this.pinch);
}
window.removeEventListener('touchmove', this.drag);
window.removeEventListener('touchend', this.release);
}
window.removeEventListener('mousemove', this.drag);
window.removeEventListener('mouseup', this.release);
this.resizing = false;
e.preventDefault();
},
xOffset: function (e, finger) {
// touch event
if (e.touches && e.touches.length >= 1) {
return e.touches[finger || 0].pageX - this.resizable3d.el.getBoundingClientRect().left;
}
// mouse event
// offsetX doesn't exist in firefox, but getBoundingClientRect does
return e.offsetX || e.pageX - this.resizable3d.el.getBoundingClientRect().left;
},
xpos: function (e) {
// touch event
if (e.touches && e.touches.length >= 1) {
return e.touches[0].clientX;
}
// mouse event
return e.clientX;
},
destroy: function () {
if (css3d.touchIsSupported) {
this.resizable3d.el.removeEventListener('touchstart', this.tap);
}
this.resizable3d.el.removeEventListener('mousedown', this.tap);
this.resizable3d = this.tap = this.drag = this.pinch = this.release = null;
},
});
// touch point 0 is the left-most touch point
// touch point 1 is the right-most touch point
function getTouchPoint(e, point) {
return Math[point === 1 ? 'max' : 'min'](e.touches[0].pageX, e.touches[1].pageX);
}
|
JavaScript
| 0.000001 |
@@ -5759,30 +5759,475 @@
-destroy: function () %7B
+killEventHandlers: function () %7B%0A if (css3d.touchIsSupported) %7B%0A window.removeEventListener('touchmove', this.drag);%0A window.removeEventListener('touchmove', this.pinch);%0A window.removeEventListener('touchend', this.release);%0A %7D%0A%0A window.removeEventListener('mousemove', this.drag);%0A window.removeEventListener('mouseup', this.release);%0A %7D,%0A%0A destroy: function () %7B%0A this.killEventHandlers();%0A
%0A
|
13ed70aa4816890db7c0843d73a3347474cf7af9
|
fix typo
|
bm-weixin.js
|
bm-weixin.js
|
var ns = ns || {};
var _shareCallback = function() {};
var _shareData = {
"img_url": '',
"link": window.location.href,
"desc": '',
"title": document.title
}
// share timeline 取消时返回了 ok
var parseRes = function(resp) {
if(!resp || !resp.err_msg)
return false;
var re = resp.err_msg.split(':');
if(!re.length)
return;
// 有时是 confirm 有时是 ok
if(re[1] == 'confirm')
re[1] = 'ok';
return {
'status': re[1],
'type': re[0]
}
}
var _weixinShareCall = function() {
// 发送给朋友
WeixinJSBridge.on('menu:share:appmessage', function(argv){
// alert(_shareData.img_url);
WeixinJSBridge.invoke('sendAppMessage', _shareData, function(res) {
// alert(parseRes(res)[0] + ', ' + parseRes(res)[1]);
_shareCallback && _shareCallback(parseRes(res));
});
});
// 发送到朋友圈
WeixinJSBridge.on('menu:share:timeline', function(argv){
WeixinJSBridge.invoke('shareTimeline', _shareData, function(res){
_shareCallback && _shareCallback(parseRes(res));
});
});
}
/**
*
* @param {Function} callback [description]
* @return {[type]} [description]
*/
window.getWeixinNetworkType = function(callback) {
if (callback && typeof callback === 'function') {
ns.weixinJSBridgeInitCallback(function() {
WeixinJSBridge.invoke('getNetworkType', {}, function (resp) {
/**
*
* 在这里拿到 err_msg,这里面就包含了所有的网络类型
*
* network_type:wifi wifi网络
* network_type:edge 非wifi,包含3G/2G
* network_type:fail 网络断开连接
* network_type:wwan 2g或者3g
*/
var re = resp.err_msg.split(':');
if(re[1] != 'wifi') {
re[1] = '3g';
}
else {
re[1] = 'wifi';
}
callback(re[1]);
});
});
}
}
ns.weixinJSBridgeInitCallback = function(callback) {
// already has WeixinJSBridge
if(typeof WeixinJSBridge !== 'undefined') {
callback();
}
// 当微信内置浏览器完成内部初始化后会触发 WeixinJSBridgeReady 事件。
else {
if(document.addEventListener){
document.addEventListener('WeixinJSBridgeReady', callback, false);
}else if(document.attachEvent){
document.attachEvent('WeixinJSBridgeReady' , callback);
document.attachEvent('onWeixinJSBridgeReady' , callback);
}
}
}
var _weixinShareCallAttached = false;
/**
* 分享配置
* @param {object} options 分享内容
* @param {string} options.img_url 图片地址
* @param {string} options.link 分享后点击进来的链接,如果不设置就使用 window.location.href
* @param {string} options.title 分享出去的标题,如果不设置就使用 document.title
*/
ns.setWeixinShare = function(options) {
options || (options = {});
// 图片、回调函数 可以无数次替换
// options 为空也替换,等于重置
_shareData.img_url = options.pic;
_shareData.link = options.link;
_shareData.link || (_shareData.link = window.location.href);
_shareData.title = options.title;
_shareData.title || (_shareData.title = document.title);
// alert(_shareData.link);
_shareCallback = options.callback;
// _weixinShareCall 只挂一次
!_weixinShareCallAttached && ns.weixinJSBridgeInitCallback(_weixinShareCall);
_weixinShareCallAttached = true;
}
|
JavaScript
| 0.999991 |
@@ -2401,23 +2401,19 @@
options.
-img_url
+pic
%E5%9B%BE%E7%89%87%E5%9C%B0%E5%9D%80%0A *
@@ -3107,8 +3107,9 @@
true;%0A%7D
+%0A
|
4ed132a8ba5f35de361f22e654ab1aed2118d60b
|
Update main.js
|
data/main.js
|
data/main.js
|
/*@pjs preload="data/images/logo1.png";*/
var sketchProc=function(processingInstance){ with (processingInstance){
//Setup
var wi = window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
var he = window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight;
size(wi*0.9,he*0.9);
frameRate(60);
setup = function() {
mainfont = createFont("Times New Roman");
logo = loadImage("data/images/logo1.png");
isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
keys = [];
page = 0;
chapter1 = [];
chapter2 = [];
m = false;
md = false;
flevel = 255;
bw = width/6;
bh = width/12;
prim = color(15,15,15);
sec = color(100,30,30);
tert = color(150,150,150);
backg = color(55,55,55);
// Standard fade in.
fade = function() {
flevel -= 10;
fill(55,55,55,flevel);
noStroke();
rectMode(CORNER);
rect(-1,-1,width+1,height+1);
};
// Loads all panels in the named folder into the target array.
loadpanels = function(name,number,target) {
for (i = 0; i < number;) {
target[i] = loadImage("data/images/panels/"+name+i+".png");
i ++;
}
};
// The array of data for buttons used.
buttons = {
start:{x:width*(3/4),y:height/2,w:bw,h:bh,text:"Enter"},
next:{x:width*(8/9),y:height*(1/2),w:bw,h:bh,text:"Next"},
prev:{x:width*(1/9),y:height*(1/2),w:bw,h:bh,text:"Previous"},
};
// Displays an image properly.
displaypanel = function(img,x,y) {
imageMode(CENTER);
pushMatrix();
translate(x,y);
scale(0.001*height,0.001*height);
image(img,0,0);
popMatrix();
};
// The hefty button function. Works on all platforms tested. Needs an exterior click call.
button = function(con) {
bux = con.x
buy = con.y
buw = con.w
buh = con.h
butext = con.text
con.pressed = false;
rectMode(CENTER);
if (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2) {
fill(prim);
} else {
fill(sec);
}
stroke(prim);
strokeWeight(buh/10);
rect(bux,buy,buw,buh,buh/3);
if (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2) {
fill(sec);
} else {
fill(prim);
}
textFont(mainfont,buh/2);
textAlign(CENTER,CENTER);
text(butext,bux,buy);
if (isMobile && (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2)) {
con.pressed = true;
return con.pressed;
}
if (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2 && m) {
con.pressed = true;
return con.pressed;
}
return con.pressed;
};
loadpanels("chap1/",1,chapter1);
// Standard button layout
standardbuttons = function() {
button(buttons.next);
if (buttons.next.pressed) {
page += 1;
flevel = 255;
};
button(buttons.prev);
if (buttons.prev.pressed) {
page -= 1;
flevel = 255;
};
};
// Creates a full page
displaypage = function(chapter,number) {
background(backg);
displaypanel(chapter[number],width/2,height/2);
standardbuttons();
fade();
};
// Loads an array with full pages
loadpages = function(cha,targ,prevlength) {
for (i = 0; i < chapter.length; i ++) {
targ[i+prevlength]=displaypage(cha,i);
};
};
loadpages(chapter1,pages,1);
pages = [
function() {
background(backg)
displaypanel(logo,width/4,height/2)
button(buttons.start)
if (buttons.start.pressed==true) {
page += 1
}
},
];
};
draw = function() {
pages[page]();
};
keyPressed = function() {
keys[keyCode] = true;
};
keyReleased = function() {
keys[keyCode] = false;
};
mousePressed = function() {
m = true;
};
mouseReleased = function() {
m = false;
};
}};
|
JavaScript
| 0.000001 |
@@ -574,16 +574,29 @@
s = %5B%5D;%0A
+%09pages = %5B%5D;%0A
%09page =
|
5ac4a8512d7771bc2256084ce2d4f65e94b6a91d
|
Add support for MongoDB 2.4.1.
|
bootstrap.js
|
bootstrap.js
|
var mongoose = require('mongoose');
var config = require('config');
var semver = require('semver');
// configure mongodb
mongoose.connect(config.mongodb.connectionString || 'mongodb://' + config.mongodb.user + ':' + config.mongodb.password + '@' + config.mongodb.server +'/' + config.mongodb.database);
mongoose.connection.on('error', function (err) {
console.error('MongoDB error: ' + err.message);
console.error('Make sure a mongoDB server is running and accessible by this application');
process.exit(1);
});
mongoose.connection.on('open', function (err) {
mongoose.connection.db.admin().serverStatus(function(err, data) {
if (err) {
if (err.name === "MongoError" && err.errmsg === 'need to login') {
console.log('Forcing MongoDB authentication');
mongoose.connection.db.authenticate(config.mongodb.user, config.mongodb.password, function(err) {
if (!err) return;
console.error(err);
process.exit(1);
});
return;
} else {
console.error(err);
process.exit(1);
}
}
if (!semver.satisfies(data.version, '>=2.1.0')) {
console.error('Error: Uptime requires MongoDB v2.1 minimum. The current MongoDB server uses only '+ data.version);
process.exit(1);
}
});
});
module.exports = mongoose;
|
JavaScript
| 0 |
@@ -637,17 +637,16 @@
data) %7B
-
%0A if
@@ -692,16 +692,17 @@
ror%22 &&
+(
err.errm
@@ -723,16 +723,50 @@
o login'
+ %7C%7C err.errmsg === 'unauthorized')
) %7B%0A
@@ -1359,8 +1359,9 @@
ongoose;
+%0A
|
0b556715a53909e64e4e6da54d44e9f6a58bfb0e
|
Fix when collection does not exists
|
multiple-instances-status.js
|
multiple-instances-status.js
|
var events = new (Npm.require('events').EventEmitter)(),
collectionName = process.env.MULTIPLE_INSTANCES_COLLECTION_NAME || 'instances',
defaultPingInterval = (process.env.MULTIPLE_INSTANCES_PING_INTERVAL || 10) * 1000; // default to 10s
var Intances = new Meteor.Collection(collectionName);
var InstancesRaw = Intances.rawCollection();
var indexExpire = Math.ceil(defaultPingInterval * 3 / 60000) * 60000;
// ensures at least 3 ticks before expiring
InstancesRaw.indexes()
.then(function(result) {
return result.some(function(index) {
if (index.key && index.key['_updatedAt'] === 1) {
if (index.expireAfterSeconds !== indexExpire) {
InstancesRaw.dropIndex(index.name);
return false;
}
return true;
}
})
})
.then(function(created) {
if (!created) {
InstancesRaw.createIndex({_updatedAt: 1}, {expireAfterSeconds: indexExpire});
}
});
InstanceStatus = {
name: undefined,
extraInformation: undefined,
events: events,
getCollection: function() {
return Intances;
},
registerInstance: function(name, extraInformation) {
InstanceStatus.name = name;
InstanceStatus.extraInformation = extraInformation;
if (InstanceStatus.id() === undefined || InstanceStatus.id() === null) {
return console.error('[multiple-instances-status] only can be called after Meteor.startup');
}
var now = new Date(),
instance = {
$set: {
pid: process.pid,
name: name
},
$currentDate: {
_createdAt: true,
_updatedAt: true
}
};
if (extraInformation) {
instance.$set.extraInformation = extraInformation;
}
try {
Intances.upsert({_id: InstanceStatus.id()}, instance);
var result = Intances.findOne({_id: InstanceStatus.id()});
InstanceStatus.start();
events.emit('registerInstance', result, instance);
process.on('exit', InstanceStatus.onExit);
return result;
} catch (e) {
return e;
}
},
unregisterInstance: function() {
try {
var result = Intances.remove({_id: InstanceStatus.id()});
InstanceStatus.stop();
events.emit('unregisterInstance', InstanceStatus.id());
process.removeListener('exit', InstanceStatus.onExit);
return result;
} catch (e) {
return e;
}
},
start: function(interval) {
InstanceStatus.stop();
interval = interval || defaultPingInterval;
InstanceStatus.interval = Meteor.setInterval(function() {
InstanceStatus.ping();
}, interval);
},
stop: function(interval) {
if (InstanceStatus.interval) {
InstanceStatus.interval.close();
delete InstanceStatus.interval;
}
},
ping: function() {
var count = Intances.update(
{
_id: InstanceStatus.id()
},
{
$currentDate: {
_updatedAt: true
}
});
if (count === 0) {
InstanceStatus.registerInstance(InstanceStatus.name, InstanceStatus.extraInformation);
}
},
onExit: function() {
InstanceStatus.unregisterInstance();
},
activeLogs: function() {
Intances.find().observe({
added: function(record) {
var log = '[multiple-instances-status] Server connected: ' + record.name + ' - ' + record._id;
if (record._id == InstanceStatus.id()) {
log += ' (me)';
}
console.log(log.green);
},
removed: function(record) {
var log = '[multiple-instances-status] Server disconnected: ' + record.name + ' - ' + record._id;
console.log(log.red);
}
});
},
id: function() {}
};
Meteor.startup(function() {
var ID = Random.id();
InstanceStatus.id = function() {
return ID;
};
});
|
JavaScript
| 0.000001 |
@@ -210,15 +210,8 @@
10)
- * 1000
; //
@@ -233,16 +233,17 @@
%0A%0Avar In
+s
tances =
@@ -300,24 +300,25 @@
ncesRaw = In
+s
tances.rawCo
@@ -333,26 +333,154 @@
();%0A
-var indexExpire =
+%0A// if not set via env var ensures at least 3 ticks before expiring (multiple of 60s)%0Avar indexExpire = process.env.MULTIPLE_INSTANCES_EXPIRE %7C%7C (
Math
@@ -517,88 +517,138 @@
/ 60
-000
) * 60
-000;%0A%0A// ensures at least 3 ticks before expiring%0AInstancesRaw.indexes(
+);%0A%0AInstancesRaw.indexes()%0A%09.catch(function() %7B%0A%09%09// the collection should not exists yet, return empty then%0A%09%09return %5B%5D;%0A%09%7D
)%0A%09.
@@ -1174,16 +1174,17 @@
eturn In
+s
tances;%0A
@@ -1773,24 +1773,25 @@
%09try %7B%0A%09%09%09In
+s
tances.upser
@@ -1845,24 +1845,25 @@
result = In
+s
tances.findO
@@ -2136,24 +2136,25 @@
result = In
+s
tances.remov
@@ -2587,16 +2587,23 @@
interval
+ * 1000
);%0A%09%7D,%0A%0A
@@ -2779,16 +2779,17 @@
unt = In
+s
tances.u
@@ -3112,16 +3112,17 @@
) %7B%0A%09%09In
+s
tances.f
|
45c4ab43f4014a53ccf295be701e79d02ed0be26
|
Replace expect browser.isElementPresent with utils.waitUntilPresent
|
client/tests/end2end/test-admin-perform-wizard.js
|
client/tests/end2end/test-admin-perform-wizard.js
|
var utils = require('./utils.js');
describe('globaLeaks setup wizard', function() {
it('should allow the user to setup the wizard', function() {
browser.get('/#/wizard');
// Test language selector switching to italian and then re-switching to english
element(by.model('GLTranslate.indirect.appLanguage')).element(by.xpath(".//*[text()='Italiano']")).click();
expect(browser.isElementPresent(element(by.cssContainingText("div", "Benvenuto su GlobaLeaks!")))).toBe(true);
element(by.model('GLTranslate.indirect.appLanguage')).element(by.xpath(".//*[text()='English']")).click();
expect(browser.isElementPresent(element(by.cssContainingText("div", "Welcome to GlobaLeaks!")))).toBe(true);
element.all(by.id('ButtonNext')).get(0).click();
element(by.model('wizard.node.name')).sendKeys('E2E Test Instance');
element(by.model('wizard.node.description')).sendKeys('This instance is for E2E testing');
element.all(by.id('ButtonNext')).get(1).click();
element(by.model('wizard.admin.mail_address')).sendKeys('[email protected]');
element(by.model('wizard.admin.password')).sendKeys(utils.vars['user_password']);
element(by.model('admin_check_password')).sendKeys(utils.vars['user_password']);
element.all(by.id('ButtonNext')).get(2).click();
element(by.model('wizard.context.name')).sendKeys('Context 1');
element.all(by.id('ButtonNext')).get(3).click();
element(by.model('wizard.receiver.name')).sendKeys('Recipient1');
element(by.model('wizard.receiver.mail_address')).sendKeys('[email protected]');
element.all(by.id('ButtonNext')).get(4).click();
expect(element(by.css('.congratulations')).isPresent()).toBe(true);
element.all(by.id('ButtonNext')).get(5).click();
utils.waitForUrl('/admin/landing');
utils.logout('/admin');
});
});
|
JavaScript
| 0.002221 |
@@ -376,44 +376,27 @@
-expect(browser.isElementPresent(elem
+utils.waitUntilPres
ent(
@@ -451,29 +451,16 @@
eaks!%22))
-)).toBe(true)
;%0A el
@@ -572,44 +572,27 @@
-expect(browser.isElementPresent(elem
+utils.waitUntilPres
ent(
@@ -645,29 +645,16 @@
eaks!%22))
-)).toBe(true)
;%0A%0A e
|
c12a41b1be8f61900f721f05dd6c6a79f05b89fa
|
G to 4πG
|
calc/arch.js
|
calc/arch.js
|
var calc = function () {
document.body.appendChild(calc.display)
document.body.appendChild(calc.keypad)
}
!function () {
var html = {};
['tr', 'td', 'input', 'div', 'table'].forEach(function (a) {
html[a] = function() { return document.createElement(a) }
})
Complex.precision = 6
var
c = new Complex(Math.log(299792458)), // m s^{-1}
G = new Complex(Math.log(6.67408e-11)), // kg^{-1} m^3 s^{-2}
h = new Complex(Math.log(6.626070040e-34)), // kg m^2 s^{-1}
Boltzmann = new Complex(Math.log(1.38064852e-23)), // J K^{-1}
/*
2014 CODATA recommended values
http://physics.nist.gov/constants
*/
tau = new Complex(Math.log(2 * Math.PI), 0.25),
two = new Complex(Math.log(2)),
kg = c.inv() .mul(G) .mul(h.inv()).mul(tau).log().mul(two.inv()).exp(),
m = c.mul(c).mul(c).mul(G.inv()).mul(h.inv()).mul(tau).log().mul(two.inv()).exp(),
s = m.mul(c)
var
e, touch,
isFixed = function() {
return e.hasOwnProperty('value')
},
fix = function() {
e.value || set(parseComplex(e.data.textContent))
},
fixAsIs = function() {
set(e.value ? e.value.exp() : parseComplex(e.data.textContent + 'X'))
},
moveFocus = function() {
e.classList.remove('focus')
e = this.cell
e.classList.add('focus')
},
makeCell = function() {
var
cell = html.tr(),
label = html.td(),
input = html.input(),
data = html.td()
label.appendChild(input)
cell.appendChild(label)
cell.appendChild(data)
cell.label = input
cell.data = data
input.cell = cell
input.onchange = function() {
if (this.value === '') {
this.cell.data[touch] = moveFocus
while (this.cell.previousSibling.label.value !== '') {
calc.display.insertBefore(this.cell, this.cell.previousSibling)
}
this.cell.classList.remove('button')
} else
{
this.cell.data[touch] = function() {
fix(); e.value && push(); set(this.cell.value)
}
if (e === this.cell) {
fix()
e.previousSibling ? e.previousSibling.data[touch]() : push()
}
this.cell.classList.add('button')
while (this.cell.nextSibling && this.cell.nextSibling.label.value === '') {
calc.display.insertBefore(this.cell, this.cell.nextSibling.nextSibling)
}
while (this.cell.nextSibling && this.cell.nextSibling.value.ord < this.cell.value.ord) {
calc.display.insertBefore(this.cell, this.cell.nextSibling.nextSibling)
}
}
}
data.cell = cell
data.textContent = '0'
data[touch] = moveFocus
return cell
},
push = function() {
calc.display.insertBefore(makeCell(), e.nextSibling)
e.nextSibling.data[touch]()
},
pop = function() {
var _ = e.value
e.previousSibling &&
(e.previousSibling.data[touch](), calc.display.removeChild(e.nextSibling))
return _
},
set = function(a) {
e.value = a; e.data.textContent = a.toString()
},
numeric = function() {
var label = this.textContent, _
e.value && push()
_ = e.data
_.textContent = (_.textContent === '0' ? '' : _.textContent) + label
},
keys = {
'0': numeric,
'1': numeric,
'2': numeric, '3': numeric, '4': numeric, '5': numeric,
'6': numeric, '7': numeric, '8': numeric, '9': numeric,
'.': function() {
e.value && push()
e.data.textContent += '.'
},
'↑': function() {
if (e.value) {
push(); set(e.previousSibling.value)
} else
{
set(parseComplex(e.data.textContent))
}
},
'↓': function() {
if (e.previousSibling) {
pop()
} else
{
delete e.value
e.data.textContent = '0'
}
},
'←': function() {
var _ = e.data
if (e.value) {
delete e.value
_.textContent = '0'
} else
{
_.textContent = _.textContent.slice(0, -1)
_.textContent === '' && (_.textContent = '0')
}
},
'kg': function() {
fix(); e.value && push(); set(kg)
},
'm': function() {
fix(); e.value && push(); set(m)
},
's': function() {
fix(); e.value && push(); set(s)
},
'exp': function() {
fixAsIs()
},
'log': function() {
e.value || set(parseComplex(e.data.textContent)); e.value && set(e.value.log())
},
'/': function() {
fix(); e.value && set(e.value.inv())
},
'−': function() {
fix(); e.value && set(e.value.neg())
},
'†': function() {
fix(); e.value && set(e.value.conjugate())
},
' ': function() {
var _
if (e.previousSibling) {
fix(); _ = pop()
if (e.value) {
set(e.value.mul(_))
} else
{
set(0)
}
}
},
'+': function() {
var _
if (e.previousSibling) {
fix(); _ = pop()
if (e.value) {
set(e.value.add(_))
} else
{
set(_)
}
}
}
}
touch = html.div().hasOwnProperty('ontouchend') ? 'ontouchend' : 'onmouseup';
calc.display = html.table()
calc.keypad = html.table()
e = makeCell()
calc.display.appendChild(e)
calc.display.classList.add('display');
[ ['↑' , '↓', '←', '7', '8', '9'],
['kg' , 'm', 's', '4', '5', '6'],
['log', ' ', '/', '1', '2', '3'],
['exp', '+', '−', '0', '.', '†'] ].forEach(function (tds) {
var tr = html.tr()
tds.forEach(function (td) {
var _ = html.td()
_.textContent = td
_[touch] = keys[td]
tr.appendChild(_)
})
calc.keypad.appendChild(tr)
})
calc.keypad.classList.add('keypad')
}()
onload = calc
|
JavaScript
| 0.997973 |
@@ -378,16 +378,30 @@
ath.log(
+4 * Math.PI *
6.67408e
|
86919421c2b37d16c55c56d41a7d8f32e17984e7
|
Extract 'evalNewPipe' function
|
src/reducers/workspace/evaluationReducer.js
|
src/reducers/workspace/evaluationReducer.js
|
import {
MAIN_BRICK,
PRIMITIVE,
SELECTABLE_PIPE
} from '../../utils/componentNames'
export const evaluate = (workspace, elementId) => {
const element = workspace.entities[elementId]
let newEntities = workspace.entities
let newUnitTests = workspace.unitTests
if(element.componentName == SELECTABLE_PIPE) {
const { input, output } = element
const inputElement = workspace.entities[input.elementId]
if(inputElement.componentName == PRIMITIVE) {
newEntities = Object.assign({}, workspace.entities, {
[elementId]: {
...element,
type: inputElement.type,
value: inputElement.value
}
})
}
if(inputElement.componentName == MAIN_BRICK) {
const slotIndex = inputElement.inputSlots.findIndex((inputSlot) =>
inputSlot.id == input.slotId)
newUnitTests = workspace.unitTests.map((unitTest) => {
const testInputId = unitTest.testInputIds[slotIndex]
const testInput = workspace.entities[testInputId]
return {
...unitTest,
values: {
...unitTest.values,
[elementId]: {
type: testInput.type,
value: testInput.value
}
}
}
})
}
}
return Object.assign({}, workspace, {
...workspace,
entities: newEntities,
unitTests: newUnitTests
})
}
|
JavaScript
| 0.999994 |
@@ -208,32 +208,206 @@
s =
-workspace.entities%0A let
+%7B%7D%0A let newUnitTests = %7B%7D%0A%0A switch (element.componentName) %7B%0A case SELECTABLE_PIPE:%0A const newWorkspace = evalNewPipe(workspace, element)%0A newEntities = newWorkspace.newEntities%0A
new
@@ -410,33 +410,36 @@
newUnitTests =
-w
+newW
orkspace.unitTes
@@ -423,33 +423,36 @@
= newWorkspace.
-u
+newU
nitTests%0A%0A if(e
@@ -451,57 +451,287 @@
%0A%0A
-if(element.componentName == SELECTABLE_PIPE) %7B%0A
+ break;%0A default:%0A newEntities = workspace.entities%0A newUnitTests = workspace.newUnitTests%0A %7D%0A%0A return Object.assign(%7B%7D, workspace, %7B%0A ...workspace,%0A entities: newEntities,%0A unitTests: newUnitTests%0A %7D)%0A%7D%0A%0Aconst evalNewPipe = (workspace, element) =%3E %7B%0A
co
@@ -762,18 +762,16 @@
element%0A
-
const
@@ -820,24 +820,103 @@
ementId%5D%0A%0A
+let newEntities = workspace.entities%0A let newUnitTests = workspace.unitTests%0A%0A
if(inputEl
@@ -947,26 +947,24 @@
RIMITIVE) %7B%0A
-
newEntit
@@ -1009,18 +1009,16 @@
ties, %7B%0A
-
%5Be
@@ -1019,33 +1019,32 @@
%5Belement
-I
+.i
d%5D: %7B%0A
-
...e
@@ -1055,26 +1055,24 @@
nt,%0A
-
-
type: inputE
@@ -1076,34 +1076,32 @@
utElement.type,%0A
-
value: i
@@ -1114,26 +1114,24 @@
ement.value%0A
-
%7D%0A
@@ -1134,22 +1134,16 @@
-
%7D)%0A
-
-
%7D%0A%0A
-
if
@@ -1187,18 +1187,16 @@
RICK) %7B%0A
-
cons
@@ -1258,18 +1258,16 @@
lot) =%3E%0A
-
in
@@ -1295,26 +1295,24 @@
lotId)%0A%0A
-
newUnitTests
@@ -1356,26 +1356,24 @@
=%3E %7B%0A
-
const testIn
@@ -1413,18 +1413,16 @@
tIndex%5D%0A
-
co
@@ -1476,18 +1476,16 @@
%0A%0A
-
return %7B
@@ -1485,18 +1485,16 @@
eturn %7B%0A
-
@@ -1510,26 +1510,24 @@
st,%0A
-
-
values: %7B%0A
@@ -1520,26 +1520,24 @@
values: %7B%0A
-
..
@@ -1564,26 +1564,24 @@
-
%5Belement
Id%5D: %7B%0A
@@ -1576,17 +1576,16 @@
ment
-I
+.i
d%5D: %7B%0A
-
@@ -1622,26 +1622,24 @@
-
value: testI
@@ -1655,30 +1655,26 @@
e%0A
- %7D%0A
+%7D%0A
%7D%0A
@@ -1681,27 +1681,17 @@
- %7D%0A
+%7D%0A
%7D)%0A
- %7D%0A
%7D%0A
@@ -1704,70 +1704,13 @@
urn
-Object.assign(%7B%7D, workspace, %7B%0A ...workspace,%0A entities:
+%7B%0A
new
@@ -1718,35 +1718,24 @@
ntities,%0A
- unitTests:
newUnitTest
@@ -1723,28 +1723,27 @@
es,%0A newUnitTests%0A %7D
-)
%0A%7D%0A
|
99cb72732038d6d7f655533b1e8755201b080a0b
|
add a render hook to allow more customizations in subclasses
|
src/sap.m/src/sap/m/ComboBoxBaseRenderer.js
|
src/sap.m/src/sap/m/ComboBoxBaseRenderer.js
|
/*!
* ${copyright}
*/
sap.ui.define(['jquery.sap.global', './InputBaseRenderer', 'sap/ui/core/Renderer'],
function(jQuery, InputBaseRenderer, Renderer) {
"use strict";
/**
* ComboBoxBase renderer.
*
* @namespace
*/
var ComboBoxBaseRenderer = Renderer.extend(InputBaseRenderer);
/**
* CSS class to be applied to the root element of the ComboBoxBase.
*
* @readonly
* @const {string}
*/
ComboBoxBaseRenderer.CSS_CLASS = "sapMComboBoxBase";
/**
* Add attributes to the input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeInnerAttributes = function(oRm, oControl) {
oRm.writeAttribute("autocomplete", "off");
oRm.writeAttribute("autocorrect", "off");
oRm.writeAttribute("autocapitalize", "off");
};
/**
* Retrieves the ARIA role for the control.
* To be overwritten by subclasses.
*
*/
ComboBoxBaseRenderer.getAriaRole = function() {
return "combobox";
};
/**
* Retrieves the accessibility state of the control.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.getAccessibilityState = function(oControl) {
var mAccessibilityState = sap.m.InputBaseRenderer.getAccessibilityState.call(this, oControl);
mAccessibilityState.expanded = oControl.isOpen();
mAccessibilityState.autocomplete = "both";
return mAccessibilityState;
};
/**
* Add extra styles for input container.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addOuterStyles = function(oRm, oControl) {
oRm.addStyle("max-width", oControl.getMaxWidth());
};
/**
* Add classes to the ComboBox.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addOuterClasses = function(oRm, oControl) {
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS;
oRm.addClass(CSS_CLASS);
oRm.addClass(CSS_CLASS + "Input");
if (!oControl.getEnabled()) {
oRm.addClass(CSS_CLASS + "Disabled");
}
if (!oControl.getEditable()) {
oRm.addClass(CSS_CLASS + "Readonly");
}
};
/**
* Add inner classes to the ComboBox's input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addInnerClasses = function(oRm, oControl) {
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS;
oRm.addClass(CSS_CLASS + "InputInner");
if (!oControl.getEditable()) {
oRm.addClass(CSS_CLASS + "InputInnerReadonly");
}
};
/**
* Renders the ComboBox's arrow, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeInnerContent = function(oRm, oControl) {
this.renderButton(oRm, oControl);
};
/**
* Renders the combo box button, using the provided {@link sap.ui.core.RenderManager}.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.renderButton = function(oRm, oControl) {
var sId = oControl.getId(),
sButtonId = sId + "-arrow",
sButtonLabelId = sId + "-buttonlabel",
oRb = sap.ui.getCore().getLibraryResourceBundle("sap.m");
oRm.write('<button tabindex="-1"');
oRm.writeAttribute("id", sButtonId);
oRm.writeAttribute("aria-labelledby", sButtonLabelId);
oRm.addClass(ComboBoxBaseRenderer.CSS_CLASS + "Arrow");
oRm.writeClasses();
oRm.write(">");
oRm.write("<label");
oRm.writeAttribute("id", sButtonLabelId);
oRm.addClass("sapUiInvisibleText");
oRm.addClass(ComboBoxBaseRenderer.CSS_CLASS + "ButtonLabel");
oRm.writeClasses();
oRm.write(">");
oRm.write(oRb.getText("COMBOBOX_BUTTON"));
oRm.write("</label>");
oRm.write("</button>");
};
return ComboBoxBaseRenderer;
}, /* bExport= */ true);
|
JavaScript
| 0.000001 |
@@ -4478,61 +4478,43 @@
%0A%09%09%09
-oRm.addClass(ComboBoxBaseRenderer.CSS_CLASS + %22Arrow%22
+this.addButtonClasses(oRm, oControl
);%0A%09
@@ -4874,16 +4874,538 @@
;%0A%09%09%7D;%0A%0A
+%09%09/**%0A%09%09 * Add CSS classes to the combo box arrow button, using the provided %7B@link sap.ui.core.RenderManager%7D.%0A%09%09 * To be overwritten by subclasses.%0A%09%09 *%0A%09%09 * @param %7Bsap.ui.core.RenderManager%7D oRm The RenderManager that can be used for writing to the render output buffer.%0A%09%09 * @param %7Bsap.ui.core.Control%7D oControl An object representation of the control that should be rendered.%0A%09%09 */%0A%09%09ComboBoxBaseRenderer.addButtonClasses = function(oRm, oControl) %7B%0A%09%09%09oRm.addClass(ComboBoxBaseRenderer.CSS_CLASS + %22Arrow%22);%0A%09%09%7D;%0A%0A
%09%09return
@@ -5428,16 +5428,16 @@
derer;%0A%0A
+
%09%7D, /* b
@@ -5453,9 +5453,8 @@
/ true);
-%0A
|
4913402064f448e3384ac2889c6f992e457ae2d4
|
use a process.nextTick shim if necessary/possible
|
catharsis.js
|
catharsis.js
|
/**
* catharsis 0.0.1
* A parser for Google Closure Compiler type expressions, powered by PEG.js.
*
* @author Jeff Williams <[email protected]>
* @license MIT License (http://opensource.org/licenses/mit-license.php/)
*/
'use strict';
var parse = require('./lib/parser').parse;
var cache = {};
function cachedParse(string) {
if (!cache[string]) {
cache[string] = parse(string);
}
return cache[string];
}
function Catharsis() {}
Catharsis.prototype.parse = function(string, callback) {
process.nextTick(function() {
try {
callback(null, cachedParse(string));
}
catch(e) {
callback('unable to parse the type ' + string + ': ' + e.message);
}
});
};
Catharsis.prototype.parseSync = function(string) {
return cachedParse(string);
};
module.exports = new Catharsis();
|
JavaScript
| 0.000001 |
@@ -176,17 +176,17 @@
License
-(
+%3C
http://o
@@ -224,17 +224,17 @@
nse.php/
-)
+%3E
%0A */%0A%0A'u
@@ -424,16 +424,403 @@
ng%5D;%0A%7D%0A%0A
+var nextTick = (function() %7B%0A%09if (process && process.nextTick) %7B%0A%09%09return process.nextTick;%0A%09%7D else if (setTimeout) %7B%0A%09%09return function(callback) %7B%0A%09%09%09setTimeout(callback, 0);%0A%09%09%7D;%0A%09%7D else %7B%0A%09%09// better safe than sorry%0A%09%09return function(callback) %7B%0A%09%09%09callback('Your JavaScript environment does not support the parse() method. ' +%0A%09%09%09%09'Please call parseSync() instead.');%0A%09%09%7D;%0A%09%7D%0A%7D)();%0A%0A
function
@@ -897,17 +897,9 @@
) %7B%0A
+
%09
-process.
next
|
7df82d4eb39cde665f8689ff4e236f95271396d7
|
use post instead of patch
|
src/services/user/hooks/skipRegistration.js
|
src/services/user/hooks/skipRegistration.js
|
const hooks = require('feathers-hooks-common');
const auth = require('@feathersjs/authentication');
const globalHooks = require('../../../hooks');
exports.before = {
all: [auth.hooks.authenticate('jwt')],
find: [hooks.disallow()],
get: [hooks.disallow()],
create: [hooks.disallow()],
update: [hooks.disallow()],
patch: [
globalHooks.restrictToCurrentSchool,
],
remove: [hooks.disallow()],
};
exports.after = {
all: [],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: [],
};
|
JavaScript
| 0 |
@@ -141,16 +141,79 @@
oks');%0A%0A
+const testHook = (hook) =%3E %7B%0A%09return Promise.resolve(hook);%0A%7D%0A%0A
exports.
@@ -330,106 +330,110 @@
e: %5B
-hooks.disallow()%5D,%0A%09update: %5Bhooks.disallow()%5D,%0A%09patch: %5B%0A%09%09globalHooks.restrictToCurrentSchool,%0A%09
+testHook, globalHooks.restrictToCurrentSchool%5D,%0A%09update: %5Bhooks.disallow()%5D,%0A%09patch: %5Bhooks.disallow()
%5D,%0A%09
|
631ab06c5c4734df999f36bd9b370f7b5c35531b
|
clean up
|
src/shared/components/addon/require-auth.js
|
src/shared/components/addon/require-auth.js
|
'use strict'
import { Router } from 'react-router'
import { sync, checkToken } from 'shared/actions/AuthActions'
export default function (nextState, transition) {
this.redux.dispatch(sync())
this.redux.dispatch(checkToken())
const isAuthenticated = this.redux.getState().auth.isAuthenticated
const verified = this.redux.getState().auth.verified
//console.log('isAuthenticated', isAuthenticated)
//console.log('verified', verified)
if (!isAuthenticated)
transition.to(
'/login',
null,
{ nextPathname: nextState.location.pathname }
)
if (!verified)
transition.to(
'/',
null,
{}
)
}
function check (token) {
return true
}
|
JavaScript
| 0.000001 |
@@ -650,48 +650,4 @@
)%0A%7D%0A
-%0A%0Afunction check (token) %7B%0A return true%0A%7D%0A%0A
|
68421f85c88b6baadf37e1164fd651750616daa0
|
fix unneeded fetches
|
src/web/components/ContentForm/RefWidget.js
|
src/web/components/ContentForm/RefWidget.js
|
import React, { Component } from 'react'
import { connect } from 'react-redux'
import { fetchContentItem } from '~/actions'
import ContentPickerWidget from '~/components/Content/Select/Widget'
class RefWidget extends Component {
state = {}
handleChange = item => {
this.props.onChange(item.id)
}
componentWillReceiveProps(newProps) {
if (newProps.value) {
this.props.fetchContentItem(newProps.value)
}
}
render() {
const { $category: categoryId, $subtype: subtype, type } = this.props.schema
if (type !== 'string' || subtype !== 'ref') {
return null
}
const itemId = this.props.value
const contentItem = itemId && this.props.contentItems ? this.props.contentItems[itemId] : null
if (itemId && !contentItem) {
// item is not fetched yet, will rerender when it's done
return null
}
return (
<ContentPickerWidget
inputId={this.props.id}
itemId={itemId}
contentItem={contentItem}
categoryId={categoryId}
onChange={this.handleChange}
placeholder={this.props.placeholder || `Pick ${categoryId}`}
/>
)
}
}
const mapStateToProps = state => ({ contentItems: state.content.itemsById })
const mapDispatchToProps = { fetchContentItem }
export default connect(mapStateToProps, mapDispatchToProps)(RefWidget)
|
JavaScript
| 0.000023 |
@@ -229,22 +229,8 @@
t %7B%0A
- state = %7B%7D%0A%0A
ha
@@ -352,16 +352,55 @@
ps.value
+ && newProps.value !== this.props.value
) %7B%0A
|
2191d1a16aece69d507e1048a530d5301e54e807
|
Output commonjs for headless
|
webpack.config.headless.js
|
webpack.config.headless.js
|
/**
* Copyright (c) 2019 The xterm.js authors. All rights reserved.
* @license MIT
*/
const path = require('path');
/**
* This webpack config does a production build for xterm.js. It works by taking the output from tsc
* (via `yarn watch` or `yarn prebuild`) which are put into `out/` and webpacks them into a
* production mode umd library module in `lib/`. The aliases are used fix up the absolute paths
* output by tsc (because of `baseUrl` and `paths` in `tsconfig.json`.
*/
module.exports = {
entry: './out/headless/public/Terminal.js',
devtool: 'source-map',
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre",
exclude: /node_modules/
}
]
},
resolve: {
modules: ['./node_modules'],
extensions: [ '.js' ],
alias: {
common: path.resolve('./out/common'),
headless: path.resolve('./out/headless')
}
},
output: {
filename: 'xterm.js',
path: path.resolve('./lib-headless'),
libraryTarget: 'umd'
},
mode: 'production'
};
|
JavaScript
| 0.999983 |
@@ -1021,21 +1021,40 @@
rary
-Target: 'umd'
+: %7B%0A type: 'commonjs'%0A %7D
%0A %7D
|
788ccff3858e40b18a1c1d529c2c92e0fe8db433
|
Fix ng2-bootstrap file name to comply with name in the latest npm package.
|
website/systemjs.config.js
|
website/systemjs.config.js
|
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
'moment': 'node_modules/moment/moment.js',
'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
main: './main.js',
defaultExtension: 'js'
},
rxjs: {
defaultExtension: 'js'
}
}
});
})(this);
|
JavaScript
| 0 |
@@ -1373,25 +1373,25 @@
p/bundles/ng
-2
+x
-bootstrap.u
|
956f457908fde2eb76359ad59efc756c9a1a188a
|
test http request on github
|
workshop/leaflet/script.js
|
workshop/leaflet/script.js
|
//initialize the map
var map = L.map('map').setView([42.3600825, -71.0588801], 12);
//Create baselayer - tiles
var backgroundMap = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
attribution: '<a href="http://openstreetmap.org">OpenStreetMap</a>contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>',
maxZoom: 19
});
var secondLayer = L.tileLayer(' http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
maxZoom: 19
});
var layers = {
"basic" : backgroundMap,
"extra" : secondLayer
}
backgroundMap.addTo(map);
// map.layers = [backgroundMap, secondLayer]
L.control.layers(layers).addTo(map);
//Add markers
var brewery = L.marker([42.346868, -71.034396]).addTo(map);
brewery.addTo(map);
var aquarium = L.marker([42.359116, -71.049592]);
aquarium.addTo(map);
var hotel = L.marker([42.351340, -71.040495]);
hotel.addTo(map);
var harvard = L.marker([42.376979, -71.116617]);
harvard.addTo(map);
//Add pop-ups
// var popup = "The Harpoon Brewery.";
// brewery.bindPopup(popup);
var popup1 = "Do you sleep in the SeaPort Hotel?";
hotel.bindPopup(popup1)
var popup2 = "The New England Aquarium.";
aquarium.bindPopup(popup2);
var popup3 = "The Harvard University.";
harvard.bindPopup(popup3);
//add a circle
var circle = L.circle([42.359116, -71.049592], 4500, {
color: 'red',
fillColor: '#f03',
fillOpacity: 0.5
}).addTo(map);
//add a polygon
var polygon = L.polygon([
[42.346868, -71.034396],
[42.351340, -71.040495],
[42.359116, -71.049592],
[42.376979, -71.116617]
]).addTo(map);
// Create a marker first
// var bigfootIcon = {
// radius: 8,
// fillColor: "#ff7800",
// color: "#000",
// weight: 1,
// opacity: 1,
// fillOpacity: 0.8
// };
var bigfootIcon = L.icon({
iconUrl: '../big_foot_orange.png',
iconSize: [15, 25], // size of the icon
});
//create the geojson layer
var geojson = L.geoJson(null,{
pointToLayer: function (geoJsonPoint, latlng) {
return L.marker(latlng, {icon: bigfootIcon});
}
}).addTo(map);
// // new Http Request
// var xhttp = new XMLHttpRequest();
// // set the request method: get the data
// xhttp.open('GET', encodeURI("All_BFRO_Reports_points.geojson" ));
// //specify what must be done with the geojson data to the layer when request is succesfull
// xhttp.onload = function() {
// if (xhttp.readyState === 4) {
// // add the json data to the geojson layer we created before!
// geojson.addData(JSON.parse(xhttp.responseText));
// } else {
// alert('Request failed. Returned status of ' + xhttp.readyState );
// }
// };
// // send the request
// xhttp.send();
//Jquery method
$.getJSON("../../data/All_BFRO_Reports_points.geojson", function(data) {
geojson.addData(data);
});
var popup = L.popup();
function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(map);
}
map.on('click', onMapClick);
|
JavaScript
| 0 |
@@ -2020,19 +2020,16 @@
(map);%0A%0A
-//
// new H
@@ -2040,19 +2040,16 @@
Request%0A
-//
var xhtt
@@ -2075,19 +2075,16 @@
est();%0A%0A
-//
// set t
@@ -2115,19 +2115,16 @@
he data%0A
-//
xhttp.op
@@ -2182,19 +2182,16 @@
n%22 ));%0A%0A
-//
//specif
@@ -2272,19 +2272,16 @@
cesfull%0A
-//
xhttp.on
@@ -2300,19 +2300,16 @@
ion() %7B%0A
-//
%09if (xht
@@ -2331,19 +2331,16 @@
== 4) %7B%0A
-//
%09%09%09// ad
@@ -2395,19 +2395,16 @@
before!%0A
-//
%09%09%09geojs
@@ -2447,19 +2447,16 @@
Text));%0A
-//
%09%09%7D else
@@ -2458,19 +2458,16 @@
else %7B%0A
-//
%09%09%09alert
@@ -2532,18 +2532,12 @@
);%0A
-//
%09%09%7D%0A
-//
%7D;%0A%0A
@@ -2593,16 +2593,19 @@
method%0A
+//
$.getJSO
@@ -2669,16 +2669,19 @@
data) %7B%0A
+//
geojson.
@@ -2695,16 +2695,19 @@
(data);%0A
+//
%7D);%0A%0A%0A%0A%0A
|
4d41a04810b48ae4fedc57bdc1e9201fcd6745ca
|
fix copying of documents with images
|
fiduswriter/document/static/js/modules/importer/get_images.js
|
fiduswriter/document/static/js/modules/importer/get_images.js
|
import {get} from "../common"
export class GetImages {
constructor(images, entries) {
this.images = images
this.imageEntries = Object.values(this.images)
this.entries = entries
this.counter = 0
}
init() {
if (this.entries.length > 0) {
if (this.entries[0].hasOwnProperty('url')) {
return this.getImageUrlEntry()
} else {
return this.getImageZipEntry()
}
} else {
return Promise.resolve()
}
}
getImageZipEntry() {
if (this.counter < this.imageEntries.length) {
return new Promise(resolve => {
const fc = this.entries.find(entry => entry.filename === this.imageEntries[
this.counter
].image).content
this.imageEntries[this.counter]['file'] = new window.Blob(
[fc],
{type: this.imageEntries[this.counter].file_type}
)
this.counter++
this.getImageZipEntry().then(() => {
resolve()
})
})
} else {
return Promise.resolve()
}
}
getImageUrlEntry() {
if (this.counter < this.imageEntries.length) {
const getUrl = this.entries.find(
entry => entry.filename === this.imageEntries[this.counter].image.split('/').pop()
).url
return get(getUrl).then(
response => response.blob()
).then(
blob => {
// const mimeString = this.imageEntries[this.counter].file_type
// const dataView = new DataView(blob)
// const newBlob = new window.Blob([dataView], {type: mimeString})
// this.imageEntries[this.counter]['file'] = newBlob
this.imageEntries[this.counter]['file'] = blob
this.counter++
return this.getImageUrlEntry()
}
)
} else {
return Promise.resolve()
}
}
}
|
JavaScript
| 0.000001 |
@@ -1392,32 +1392,42 @@
ry.filename ===
+%60images/$%7B
this.imageEntrie
@@ -1464,16 +1464,18 @@
').pop()
+%7D%60
%0A
|
6c447a7766d8b1b7f064b2e8260a50bce9f4cb1e
|
Simplify getPrihlaseniSorted().
|
ui/src/registrator/Prihlaseni/prihlaseniReducer.js
|
ui/src/registrator/Prihlaseni/prihlaseniReducer.js
|
import { AKTUALNI_ROK } from '../../constants';
import { narozeniToStr, reverseSortDirType, SortDirTypes } from '../../Util';
import {
csStringSortMethod,
narozeniSortMethod,
prijmeniJmenoNarozeniSortMethod
} from '../../entities/ucastnici/ucastniciReducer';
import { predepsaneStartovneCommon, provedenePlatby } from '../platby';
export const initialState = {
fetching: false,
kategorieVykonuFilter: '',
textFilter: '',
sortColumn: undefined,
sortDir: SortDirTypes.NONE
};
const prihlaseniReducer = (state = initialState, action) => {
switch (action.type) {
case 'FETCH_UCASTNICI_REQUEST':
return { ...state, fetching: true };
case 'FETCH_UCASTNICI_SUCCESS':
case 'FETCH_UCASTNICI_ERROR':
return { ...state, fetching: false };
case 'PRIHLASENI_KATEGORIE_VYKONU_FILTER_CHANGE':
if (state.kategorieVykonuFilter === action.typKategorie) {
return { ...state, kategorieVykonuFilter: '' };
}
return { ...state, kategorieVykonuFilter: action.typKategorie };
case 'PRIHLASENI_TEXT_FILTER_CHANGE':
return { ...state, textFilter: action.textFilter.toLowerCase() };
case 'PRIHLASENI_SORT_DIR_CHANGE':
if (state.sortColumn !== action.sortColumn) {
return { ...state, sortColumn: action.sortColumn, sortDir: SortDirTypes.ASC };
}
return { ...state, sortDir: reverseSortDirType(state.sortDir) };
default:
return state;
}
};
export default prihlaseniReducer;
const expandedPrihlaska = (prihlaska, kategorie) => {
if (!prihlaska) {
return {};
}
const { datum, kategorie: kategorieId, startCislo, kod } = prihlaska;
return { datum, kategorie: kategorie[kategorieId], startCislo, kod };
};
export const getPrihlaseniSorted = ({
kategorie,
rocniky,
ucastnici,
kategorieVykonuFilter,
textFilter,
sortColumn,
sortDir
}) => {
const rok = AKTUALNI_ROK;
const result = [];
ucastnici.allIds.forEach(id => {
const ucastnik = ucastnici.byIds[id];
if (ucastnik.roky[0] === rok) {
const ucast = ucastnik[rok];
const { udaje: { prijmeni, jmeno, narozeni, obec }, prihlaska, platby } = ucast;
const expPrihlaska = expandedPrihlaska(prihlaska, kategorie);
const predepsano = predepsaneStartovneCommon({ kategorie, prihlaska, rocniky, rok }).suma;
const zaplaceno = provedenePlatby(platby).suma;
if (
prijmeni.toLowerCase().startsWith(textFilter) ||
jmeno.toLowerCase().startsWith(textFilter)
) {
if (
kategorieVykonuFilter === '' ||
!prihlaska.kategorie ||
kategorieVykonuFilter === expPrihlaska.kategorie.typ
) {
result.push({
id,
prijmeni,
jmeno,
narozeni,
obec,
...expPrihlaska,
predepsano,
zaplaceno
});
}
}
}
});
const sortMethods = {
prijmeni: (a, b) => csStringSortMethod(a.prijmeni, b.prijmeni),
jmeno: (a, b) => csStringSortMethod(a.jmeno, b.jmeno),
narozeni: (a, b) => narozeniSortMethod(a.narozeni, b.narozeni)
};
const sortMethod = sortMethods[sortColumn] || prijmeniJmenoNarozeniSortMethod;
const sorted = result.sort(sortMethod);
if (sortDir === SortDirTypes.DESC) {
sorted.reverse();
}
return sorted.map(ucastnik => {
const { narozeni, ...ostatek } = ucastnik;
return { ...ostatek, narozeni: narozeniToStr(narozeni) };
});
};
|
JavaScript
| 0.000001 |
@@ -1470,250 +1470,8 @@
r;%0A%0A
-const expandedPrihlaska = (prihlaska, kategorie) =%3E %7B%0A if (!prihlaska) %7B%0A return %7B%7D;%0A %7D%0A%0A const %7B datum, kategorie: kategorieId, startCislo, kod %7D = prihlaska;%0A return %7B datum, kategorie: kategorie%5BkategorieId%5D, startCislo, kod %7D;%0A%7D;%0A%0A
expo
@@ -1912,52 +1912,111 @@
nst
-expPrihlaska = expandedPrihlaska(prihlaska,
+%7B datum, kategorie: kategorieId, startCislo, kod %7D = prihlaska;%0A const jednaKategorie = kategorie%5B
kate
@@ -2020,17 +2020,19 @@
ategorie
-)
+Id%5D
;%0A
@@ -2318,27 +2318,16 @@
if (
-%0A
kategori
@@ -2353,52 +2353,8 @@
' %7C%7C
-%0A !prihlaska.kategorie %7C%7C%0A
kat
@@ -2380,22 +2380,14 @@
===
-expPrihlaska.k
+jednaK
ateg
@@ -2394,25 +2394,16 @@
orie.typ
-%0A
) %7B%0A
@@ -2535,23 +2535,93 @@
-...expPrihlaska
+datum,%0A kategorie: jednaKategorie,%0A startCislo,%0A kod
,%0A
|
872ba06a7b9c4a9507611542c6c7b3b7a7394df8
|
Fix whitespace.
|
test/fixture/basic.js
|
test/fixture/basic.js
|
/**
* @fileoverview sample file.
*/
goog.provide('my.app.Sample');
goog.require('goog.ui.Component');
/**
* @param {goog.dom.DomHelper=} opt_domHelper
* @constructor
* @extends {goog.ui.Component}
*/
my.app.Sample = function(opt_domHelper) {
goog.base(this, opt_domHelper);
/**
* @type {number}
* @private
*/
this.number_ = 0;
};
goog.inherits(my.app.Sample, goog.ui.Component);
/** @override */
my.app.Sample.prototype.enterDocument = function() {
goog.base(this, 'enterDocument');
};
/** @override */
my.app.Sample.prototype.renderBefore = function(sibling) {
goog.base(this, 'renderBefore', sibling);
};
/** @override */
my.app.Sample.prototype.disposeInternal = function() {
goog.base(this, 'disposeInternal');
delete this.number_;
};
|
JavaScript
| 0.99988 |
@@ -31,17 +31,16 @@
le.%0A */%0A
-%0A
goog.pro
|
0832833af298480b2ff563d3fececedebdeb08da
|
Clarify tests.
|
test/strategy.test.js
|
test/strategy.test.js
|
/* global describe, it, expect, before */
/* jshint expr: true */
var chai = require('chai')
, FacebookStrategy = require('../lib/strategy');
describe('Strategy', function() {
var strategy = new FacebookStrategy({
clientID: 'ABC123',
clientSecret: 'secret'
},
function() {});
it('should be named facebook', function() {
expect(strategy.name).to.equal('facebook');
});
describe('handling a return request in which authorization was denied by user', function() {
var info;
before(function(done) {
chai.passport.use(strategy)
.fail(function(i) {
info = i;
done();
})
.req(function(req) {
req.query = {};
req.query.error = 'access_denied';
req.query.error_code = '200';
req.query.error_description = 'Permissions error';
req.query.error_reason = 'user_denied';
})
.authenticate();
});
it('should fail with info', function() {
expect(info).to.not.be.undefined;
expect(info.message).to.equal('Permissions error');
});
});
describe('handling a return request in which authorization has failed with an error', function() {
var err;
before(function(done) {
chai.passport.use(strategy)
.error(function(e) {
err = e;
done();
})
.req(function(req) {
req.query = {};
req.query.error_code = '901';
req.query.error_message = 'This app is in sandbox mode. Edit the app configuration at http://developers.facebook.com/apps to make the app publicly visible.';
})
.authenticate();
});
it('should error', function() {
expect(err.constructor.name).to.equal('FacebookAuthorizationError');
expect(err.message).to.equal('This app is in sandbox mode. Edit the app configuration at http://developers.facebook.com/apps to make the app publicly visible.');
expect(err.code).to.equal(901);
expect(err.status).to.equal(500);
});
});
});
|
JavaScript
| 0.000001 |
@@ -179,16 +179,57 @@
%7B%0A %0A
+ describe('constructed', function() %7B%0A
var st
@@ -262,24 +262,26 @@
egy(%7B%0A
+
+
clientID: 'A
@@ -288,16 +288,18 @@
BC123',%0A
+
cl
@@ -327,11 +327,15 @@
+
%7D,%0A
+
@@ -355,16 +355,18 @@
);%0A %0A
+
it('sh
@@ -399,24 +399,26 @@
unction() %7B%0A
+
expect(s
@@ -453,22 +453,29 @@
book');%0A
+
%7D);%0A
+ %7D)%0A
%0A des
@@ -485,76 +485,406 @@
be('
-handling a return request in which authorization was denied by user'
+constructed with undefined options', function() %7B%0A it('should throw', function() %7B%0A expect(function() %7B%0A var strategy = new FacebookStrategy(undefined, function()%7B%7D);%0A %7D).to.throw(Error);%0A %7D);%0A %7D)%0A %0A describe('failure caused by user denying request', function() %7B%0A var strategy = new FacebookStrategy(%7B%0A clientID: 'ABC123',%0A clientSecret: 'secret'%0A %7D
, fu
@@ -885,32 +885,45 @@
%7D, function() %7B
+%7D);%0A %0A
%0A var info;%0A
@@ -1538,82 +1538,173 @@
be('
-handling a return request in which authorization has failed with an error'
+error caused by app being in sandbox mode', function() %7B%0A var strategy = new FacebookStrategy(%7B%0A clientID: 'ABC123',%0A clientSecret: 'secret'%0A %7D
, fu
@@ -1705,32 +1705,45 @@
%7D, function() %7B
+%7D);%0A %0A
%0A var err;%0A
|
df8c124468ac206a6d9d00613161c574f7c40126
|
Fix default Intl polyfill language (#1208)
|
internals/templates/app.js
|
internals/templates/app.js
|
/**
* app.js
*
* This is the entry file for the application, only setup and boilerplate
* code.
*/
import 'babel-polyfill';
/* eslint-disable import/no-unresolved, import/extensions */
// Load the manifest.json file and the .htaccess file
import '!file?name=[name].[ext]!./manifest.json';
import 'file?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved, import/extensions */
// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { applyRouterMiddleware, Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import { useScroll } from 'react-router-scroll';
import LanguageProvider from 'containers/LanguageProvider';
import configureStore from './store';
// Import i18n messages
import { translationMessages } from './i18n';
// Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder
import 'sanitize.css/sanitize.css';
// Create redux store with history
// this uses the singleton browserHistory provided by react-router
// Optionally, this could be changed to leverage a created history
// e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();`
const initialState = {};
const store = configureStore(initialState, browserHistory);
// Sync history and store, as the react-router-redux reducer
// is under the non-default key ("routing"), selectLocationState
// must be provided for resolving how to retrieve the "route" in the state
import { selectLocationState } from 'containers/App/selectors';
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState: selectLocationState(),
});
// Set up the router, wrapping all Routes in the App component
import App from 'containers/App';
import createRoutes from './routes';
const rootRoute = {
component: App,
childRoutes: createRoutes(store),
};
const render = (translatedMessages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={translatedMessages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
applyRouterMiddleware(useScroll())
}
/>
</LanguageProvider>
</Provider>,
document.getElementById('app')
);
};
// Hot reloadable translation json files
if (module.hot) {
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept('./i18n', () => {
render(translationMessages);
});
}
// Chunked polyfill for browsers without Intl support
if (!window.Intl) {
(new Promise((resolve) => {
resolve(System.import('intl'));
}))
.then(() => Promise.all([
System.import('intl/locale-data/jsonp/de.js'),
]))
.then(() => render(translationMessages))
.catch((err) => {
throw err;
});
} else {
render(translationMessages);
}
// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
import { install } from 'offline-plugin/runtime';
install();
|
JavaScript
| 0 |
@@ -2887,18 +2887,18 @@
a/jsonp/
-d
e
+n
.js'),%0A
|
d06939ef9af027031be3a40dc29483dd8fa763cf
|
switch to Ionicons
|
source/views/sis/components/searchbar/index.android.js
|
source/views/sis/components/searchbar/index.android.js
|
// @flow
import * as React from 'react'
import {StyleSheet} from 'react-native'
import * as c from '../../../components/colors'
// import SearchBar from 'react-native-material-design-searchbar'
import SearchBar from 'react-native-searchbar'
import Icon from 'react-native-vector-icons/MaterialIcons'
const iconStyles = StyleSheet.create({
icon: {
color: c.gray,
},
})
const searchIcon = <Icon name="search" size={28} style={iconStyles.icon} />
const backIcon = <Icon name="arrow-back" size={28} style={iconStyles.icon} />
const styles = StyleSheet.create({
searchbar: {
backgroundColor: c.white,
height: 44,
},
})
type Props = {
getRef?: any,
style?: any,
placeholder?: string,
onChangeText: string => any,
onCancel: () => any,
onFocus: () => any,
onSearchButtonPress: string => any,
searchActive: boolean,
}
type State = {
input: string,
}
export class CourseSearchBar extends React.PureComponent<Props, State> {
state = {
input: '',
}
updateText = input => {
this.setState({input: input})
}
render() {
const backButton = this.props.searchActive ? backIcon : searchIcon
return (
<SearchBar
ref={this.props.getRef}
backButton={backButton}
focusOnLayout={false}
handleChangeText={this.updateText}
onBack={this.props.onCancel}
onFocus={this.props.onFocus}
onHide={text => console.log(text)}
onSubmitEditing={() => {
this.props.onSearchButtonPress(this.state.input)
}}
placeholder={this.props.placeholder || 'Search'}
showOnLoad={true}
style={[styles.searchbar, this.props.style]}
/>
)
}
}
|
JavaScript
| 0.000034 |
@@ -283,17 +283,12 @@
ons/
-MaterialI
+Ioni
cons
@@ -394,16 +394,19 @@
n name=%22
+md-
search%22
@@ -471,16 +471,19 @@
n name=%22
+md-
arrow-ba
|
2d96a40f62214fcc7caba6243a14693d0521d2dc
|
Fix template tests.
|
test/template.spec.js
|
test/template.spec.js
|
import { expect } from 'chai';
import renderTemplate, { init as initTemplates } from '../lib/template';
import { readFile } from '../lib/util';
describe('template', () => {
describe('render', () => {
it('should render template to HTML', () => {
initTemplates('test/samples');
let result = renderTemplate('test/samples/template.ect', {world: 'world'});
expect(result).to.eql(readFile('test/expected/template.html'));
});
});
});
|
JavaScript
| 0 |
@@ -261,16 +261,23 @@
mplates(
+%7Broot:
'test/sa
@@ -282,16 +282,17 @@
samples'
+%7D
);%0A%09%09%09le
@@ -322,29 +322,16 @@
te('
-test/samples/
template
.ect
@@ -330,12 +330,8 @@
late
-.ect
', %7B
|
2ee988241b5f313cdd315ff127c341eed2633cd6
|
increase version
|
sample/src/about/about.js
|
sample/src/about/about.js
|
export class About {
actors = [
{
'name': 'Bryan Cranston',
'episodes': 62,
'description': 'Bryan Cranston played the role of Walter in Breaking Bad. He is also known for playing Hal in Malcom in the Middle.',
'image': 'bryan-cranston.jpg'
}, {
'name': 'Aaron Paul',
'episodes': 62,
'description': 'Aaron Paul played the role of Jesse in Breaking Bad. He also featured in the "Need For Speed" Movie.',
'image': 'aaron-paul.jpg'
}, {
'name': 'Bob Odenkirk',
'episodes': 62,
'description': 'Bob Odenkrik played the role of Saul in Breaking Bad. Due to public fondness for the character, Bob stars in his own show now, called "Better Call Saul".',
'image': 'bob-odenkirk.jpg'
}
];
attached() {
// let bridge = System.get(System.normalizeSync('aurelia-materialize-bridge'));
// this.version = bridge.version;
this.version = '0.20.2';
}
onSelectionChanged(e) {
let selected = this.list.getSelected();
let names = selected.map(i => i.name);
this.logger.log('selection changed: ' + names.join(', '));
// this.logger.log(`selection changed ${e.detail.item.name}`);
}
}
|
JavaScript
| 0.000004 |
@@ -926,17 +926,17 @@
= '0.20.
-2
+3
';%0A %7D%0A%0A
|
52fbc1d694e0a89e2f06ff9d70f34f53e896a25f
|
set viewbox attr of svg; also set forceX and forceY for simulation ==> better viz for large graphs
|
frontend/src/render.js
|
frontend/src/render.js
|
import * as d3 from "d3";
// avoid divide-by-zero errors
const EPSILON = 0.000001;
// circle dimensions
const MIN_RADIUS = 5;
const MAX_RADIUS = 20;
const LINK_DISTANCE = 70;
const CHARGE = -250;
const ALPHA = 0.3;
class SchemaRenderer {
constructor(data) {
this.nodes = data.nodes;
this.links = data.links;
}
render() {
const svg = d3.select("svg");
const simulation = d3
.forceSimulation(this.nodes)
.force(
"link",
d3
.forceLink(this.links)
.id(d => d.name)
.distance(LINK_DISTANCE)
)
.force("charge", d3.forceManyBody().strength(CHARGE));
// build the arrow.
svg
.append("svg:defs")
.selectAll("marker")
.data(["end"])
.join("svg:marker")
.attr("id", String)
.attr("refX", 5)
.attr("refY", 3)
.attr("markerWidth", 6)
.attr("markerHeight", 6)
.attr("orient", "auto")
.append("svg:path")
.attr("d", "M0,0 L0,6 L6,3 Z");
// add the links and the arrows
const path = svg
.append("svg:g")
.selectAll("path")
.data(this.links)
.join("svg:path")
.attr("class", "link")
.attr("marker-end", "url(#end)");
const node = svg
.selectAll(".node")
.data(this.nodes)
.join("g")
.attr("class", "node")
.call(drag(simulation));
const rscale = d3
.scaleLinear()
.domain([0, d3.max(this.nodes, d => d.edges)])
.range([MIN_RADIUS, MAX_RADIUS]);
// add the nodes
node.append("circle").attr("r", d => rscale(d.edges));
// show name as text on hover
node.append("title").text(d => d.name);
simulation.on("tick", () => {
path.attr("d", d => {
const r = Math.hypot(d.target.x - d.source.x, d.target.y - d.source.y);
const n = rscale(d.target.edges); // radius of target circle
const k = n / (r + EPSILON); // multiplier
const x2 = (1 - k) * d.target.x + k * d.source.x;
const y2 = (1 - k) * d.target.y + k * d.source.y;
return `M${d.source.x},${d.source.y} A${r},${r} 0 0,1 ${x2},${y2}`;
});
node.attr("transform", d => `translate(${d.x}, ${d.y})`);
});
}
}
function drag(simulation) {
function dragstarted(event, d) {
if (!event.active) simulation.alphaTarget(ALPHA).restart();
d.fx = d.x;
d.fy = d.y;
}
function dragged(event, d) {
d.fx = event.x;
d.fy = event.y;
}
function dragended(event, d) {
if (!event.active) simulation.alphaTarget(0);
d.fx = null;
d.fy = null;
}
return d3
.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended);
}
export default SchemaRenderer;
|
JavaScript
| 0 |
@@ -147,34 +147,8 @@
20;%0A
-const LINK_DISTANCE = 70;%0A
cons
@@ -338,16 +338,173 @@
(%22svg%22);
+%0A const %7B width, height %7D = svg.node().getBoundingClientRect();%0A // set the view box%0A svg.attr(%22viewBox%22, %5B-width / 2, -height / 2, width, height%5D);
%0A%0A co
@@ -598,27 +598,16 @@
d3
-%0A
.forceLi
@@ -620,27 +620,16 @@
s.links)
-%0A
.id(d =%3E
@@ -641,43 +641,8 @@
me)%0A
- .distance(LINK_DISTANCE)%0A
@@ -704,16 +704,78 @@
CHARGE))
+%0A .force(%22x%22, d3.forceX())%0A .force(%22y%22, d3.forceY())
;%0A%0A /
|
f97b6397872ecb48ac56e703b8e6ad9c0464403c
|
add replace_microseconds parameter (#2121)
|
composer/functions/composer-storage-trigger/index.js
|
composer/functions/composer-storage-trigger/index.js
|
/**
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// [START composer_trigger]
'use strict';
const fetch = require('node-fetch');
const FormData = require('form-data');
/**
* Triggered from a message on a Cloud Storage bucket.
*
* IAP authorization based on:
* https://stackoverflow.com/questions/45787676/how-to-authenticate-google-cloud-functions-for-access-to-secure-app-engine-endpo
* and
* https://cloud.google.com/iap/docs/authentication-howto
*
* @param {!Object} data The Cloud Functions event data.
* @returns {Promise}
*/
exports.triggerDag = async data => {
// Fill in your Composer environment information here.
// The project that holds your function
const PROJECT_ID = 'your-project-id';
// Navigate to your webserver's login page and get this from the URL
const CLIENT_ID = 'your-iap-client-id';
// This should be part of your webserver's URL:
// {tenant-project-id}.appspot.com
const WEBSERVER_ID = 'your-tenant-project-id';
// The name of the DAG you wish to trigger
const DAG_NAME = 'composer_sample_trigger_response_dag';
// Other constants
const WEBSERVER_URL = `https://${WEBSERVER_ID}.appspot.com/api/experimental/dags/${DAG_NAME}/dag_runs`;
const USER_AGENT = 'gcf-event-trigger';
const BODY = {conf: JSON.stringify(data)};
// Make the request
try {
const iap = await authorizeIap(CLIENT_ID, PROJECT_ID, USER_AGENT);
return makeIapPostRequest(WEBSERVER_URL, BODY, iap.idToken, USER_AGENT);
} catch (err) {
console.error('Error authorizing IAP:', err.message);
throw new Error(err);
}
};
/**
* @param {string} clientId The client id associated with the Composer webserver application.
* @param {string} projectId The id for the project containing the Cloud Function.
* @param {string} userAgent The user agent string which will be provided with the webserver request.
*/
const authorizeIap = async (clientId, projectId, userAgent) => {
const SERVICE_ACCOUNT = `${projectId}@appspot.gserviceaccount.com`;
const JWT_HEADER = Buffer.from(
JSON.stringify({alg: 'RS256', typ: 'JWT'})
).toString('base64');
let jwt = '';
let jwtClaimset = '';
// Obtain an Oauth2 access token for the appspot service account
const res = await fetch(
`http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/${SERVICE_ACCOUNT}/token`,
{
headers: {'User-Agent': userAgent, 'Metadata-Flavor': 'Google'},
}
);
const tokenResponse = await res.json();
if (tokenResponse.error) {
console.error('Error in token reponse:', tokenResponse.error.message);
return Promise.reject(tokenResponse.error);
}
const accessToken = tokenResponse.access_token;
const iat = Math.floor(new Date().getTime() / 1000);
const claims = {
iss: SERVICE_ACCOUNT,
aud: 'https://www.googleapis.com/oauth2/v4/token',
iat: iat,
exp: iat + 60,
target_audience: clientId,
};
jwtClaimset = Buffer.from(JSON.stringify(claims)).toString('base64');
const toSign = [JWT_HEADER, jwtClaimset].join('.');
const blob = await fetch(
`https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/${SERVICE_ACCOUNT}:signBlob`,
{
method: 'POST',
body: JSON.stringify({
bytesToSign: Buffer.from(toSign).toString('base64'),
}),
headers: {
'User-Agent': userAgent,
Authorization: `Bearer ${accessToken}`,
},
}
);
const blobJson = await blob.json();
if (blobJson.error) {
console.error('Error in blob signing:', blobJson.error.message);
return Promise.reject(blobJson.error);
}
// Request service account signature on header and claimset
const jwtSignature = blobJson.signature;
jwt = [JWT_HEADER, jwtClaimset, jwtSignature].join('.');
const form = new FormData();
form.append('grant_type', 'urn:ietf:params:oauth:grant-type:jwt-bearer');
form.append('assertion', jwt);
const token = await fetch('https://www.googleapis.com/oauth2/v4/token', {
method: 'POST',
body: form,
});
const tokenJson = await token.json();
if (tokenJson.error) {
console.error('Error fetching token:', tokenJson.error.message);
return Promise.reject(tokenJson.error);
}
return {
idToken: tokenJson.id_token,
};
};
/**
* @param {string} url The url that the post request targets.
* @param {string} body The body of the post request.
* @param {string} idToken Bearer token used to authorize the iap request.
* @param {string} userAgent The user agent to identify the requester.
*/
const makeIapPostRequest = async (url, body, idToken, userAgent) => {
const res = await fetch(url, {
method: 'POST',
headers: {
'User-Agent': userAgent,
Authorization: `Bearer ${idToken}`,
},
body: JSON.stringify(body),
});
if (!res.ok) {
const err = await res.text();
console.error('Error making IAP post request:', err.message);
throw new Error(err);
}
};
// [END composer_trigger]
|
JavaScript
| 0 |
@@ -1825,16 +1825,47 @@
fy(data)
+, replace_microseconds: 'false'
%7D;%0A%0A //
|
ea6803238d80a91cbb6dd92892b525a307885dc3
|
Use AutoSizedWindow.
|
src/devilry/devilry/apps/extjshelpers/static/extjs_classes/extjshelpers/HelpWindow.js
|
src/devilry/devilry/apps/extjshelpers/static/extjs_classes/extjshelpers/HelpWindow.js
|
Ext.define('devilry.extjshelpers.HelpWindow', {
extend: 'Ext.window.Window',
alias: 'widget.helpwindow',
modal: true,
layout: 'fit',
width: 800,
height: 600,
closable: false, // To easy to double click and close an undelying window
helptpl: Ext.create('Ext.XTemplate', '<div class="section helpsection">{helptext}</div>'),
helpdata: {},
initComponent: function() {
Ext.apply(this, {
items: {
xtype: 'box',
cls: 'helpbox',
autoScroll: true,
html: this.helptpl.apply(Ext.apply(this.helpdata, {helptext:this.helptext}))
},
dockedItems: [{
xtype: 'toolbar',
ui: 'footer',
dock: 'bottom',
items: ['->', {
xtype: 'button',
text: 'Close help',
scale: 'large',
listeners: {
scope: this,
click: function() {
this.close();
}
}
}, '->']
}]
});
this.callParent(arguments);
}
});
|
JavaScript
| 0 |
@@ -58,19 +58,38 @@
d: '
-Ext.window.
+devilry.extjshelpers.AutoSized
Wind
|
bd07426742a9e5fd5688cbf3dff4f17c639c5594
|
simplify hqModules code slightly
|
corehq/apps/hqwebapp/static/hqwebapp/js/hqModules.js
|
corehq/apps/hqwebapp/static/hqwebapp/js/hqModules.js
|
/*
* hqModules provides a poor man's module system for js. It is not a module *loader*,
* only a module *referencer*: "importing" a module doesn't automatically load it as
* a script to the page; it must already have been loaded with an explict script tag.
*
* Modules MUST have a name, and SHOULD be given then name
* of the javascript file in which they reside, and
* SHOULD be themselves simple javascript objects.
*
* Modules are defined with hqDefine, and "imported" (referenced) with hqImport. Example:
*
* Define the module:
* // myapp/static/myapp/js/utils.js
* hqDefine('myapp/js/utils.js', function () {
* var module = {};
* module.util1 = function () {...};
* module.util2 = function () {...};
* return module;
* });
*
* Include the module source on your page:
* // myapp/templates/myapp/page.html
* ...
* <script src="myapp/js/utils.js"></script>
* ...
*
* Reference the module in other code
* (either directly in the template or in another file/module):
*
* var utils = hqImport('myapp/js/utils.js');
* ... utils.util1() ...
* ... utils.util2() ...
*
* You can also use the following idiom to effectively import
* only one property or function:
*
* var util1 = hqImport('myapp/js/utils.js').util1;
*/
var COMMCAREHQ_MODULES = {};
function hqDefine(path, moduleAccessor) {
var parts = ['COMMCAREHQ_MODULES'].concat(path.split('/'));
var i;
var object = window;
for (i = 0; i < parts.length - 1; i += 1) {
if (typeof object[parts[i]] === 'undefined') {
object[parts[i]] = {};
}
object = object[parts[i]];
}
if (typeof object[parts[i]] !== 'undefined') {
throw new Error("The module '" + path + "' has already been defined elsewhere.");
}
object[parts[i]] = moduleAccessor();
}
function hqImport(path) {
var parts = ['COMMCAREHQ_MODULES'].concat(path.split('/'));
var i;
var object = window;
for (i = 0; i < parts.length; i += 1) {
object = object[parts[i]];
}
return object;
}
|
JavaScript
| 0.000004 |
@@ -1379,38 +1379,8 @@
s =
-%5B'COMMCAREHQ_MODULES'%5D.concat(
path
@@ -1382,33 +1382,32 @@
path.split('/')
-)
;%0A var i;%0A
@@ -1412,38 +1412,50 @@
var object =
-window
+COMMCAREHQ_MODULES
;%0A for (i = 0
@@ -1866,38 +1866,8 @@
s =
-%5B'COMMCAREHQ_MODULES'%5D.concat(
path
@@ -1877,17 +1877,16 @@
lit('/')
-)
;%0A va
@@ -1911,14 +1911,26 @@
t =
-window
+COMMCAREHQ_MODULES
;%0A
|
9e4a3c5d4836accf163e0cb8757960b6bcfc0a6d
|
Allow schema and editorAttrs overwritten by html data-* nodes
|
tornado_backbone/static/tbf.js
|
tornado_backbone/static/tbf.js
|
/**
* User: Martin Martimeo
* Date: 13.08.13
* Time: 18:30
*
* Extension to backbone_forms
*/
require(["jquery", "underscore", "backbone", "backbone_forms"],function ($, _, Backbone, BackboneForm) {
var self = this.Tornado || {};
var Tornado = this.Tornado = self;
Tornado.BackboneForm = function (element, options) {
this.$element = $(element);
this.options = $.extend({}, Tornado.BackboneForm.DEFAULTS, options);
if (this.options.model) {
if (typeof this.options.model == "string") {
this.model = this.options.model = new window[this.options.model]();
} else {
this.model = this.options.model;
}
}
this.form = new Backbone.Form(this.options);
};
Tornado.BackboneForm.DEFAULTS = {};
/**
* (re)render the form
*
* Based on backbone-forms.js/render by Charles Davison
*/
Tornado.BackboneForm.prototype.render = function () {
var self = this.form,
$form = this.$element,
fields = this.form.fields;
//Render standalone editors
$form.find('[data-editors]').add($form).each(function (i, el) {
var $container = $(el),
selection = $container.attr('data-editors');
if (_.isUndefined(selection)) {
return;
}
//Work out which fields to include
var keys = (selection == '*')
? self.selectedFields || _.keys(fields)
: selection.split(',');
//Add them
_.each(keys, function (key) {
var field = fields[key];
$container.append(field.editor.render().el);
});
});
//Render standalone fields
$form.find('[data-fields]').add($form).each(function (i, el) {
var $container = $(el),
selection = $container.attr('data-fields');
if (_.isUndefined(selection)) {
return;
}
//Work out which fields to include
var keys = (selection == '*')
? self.selectedFields || _.keys(fields)
: selection.split(',');
//Add them
_.each(keys, function (key) {
var field = fields[key];
$container.append(field.render().el);
});
});
//Render fieldsets
$form.find('[data-fieldsets]').add($form).each(function (i, el) {
var $container = $(el),
selection = $container.attr('data-fieldsets');
if (_.isUndefined(selection)) return;
_.each(self.fieldsets, function (fieldset) {
$container.append(fieldset.render().el);
});
});
//Set the main element
self.setElement($form);
//Set class
$form.addClass(self.className);
return self;
};
/**
* Allows to facility html elements with backbone-forms or model functionality
*
* @param option
*/
$.fn.backbone = function (option) {
return this.each(function () {
var $this = $(this);
var data = $this.data('tb.backbone');
var options = typeof option == 'object' && option;
if (!data) {
$this.data('tb.backbone', (data = new Tornado.BackboneForm(this, options)));
$this.data('tb.backbone').render();
}
if (typeof option == 'string') {
data[option]();
}
});
};
$.fn.backbone.Constructor = Tornado.BackboneForm;
// Facile elements with backbone-forms
$(window).on('load', function () {
$('[data-model][data-require]').each(function () {
var $form = $(this);
require([$(this).data('require')], function () {
$form.backbone($form.data())
});
});
$('[data-model]:not([data-require])').each(function () {
var $form = $(this);
$form.backbone($form.data());
});
});
return Tornado;
}).call(window);
|
JavaScript
| 0 |
@@ -2360,45 +2360,496 @@
-$container.append(field.render().el);
+field.schema = field.schema %7C%7C %7B%7D;%0A field.schema = _.extend(field.schema, $container.data(%22schema%22));%0A%0A var $el = $container.append(field.render().el);%0A%0A // Update editor Attrs%0A field.schema.editorAttrs = field.schema.editorAttrs %7C%7C %7B%7D;%0A field.schema.editorAttrs = _.extend(field.schema.editorAttrs, $container.data(%22editorAttrs%22));%0A $el.find(%22%5Bdata-editor%5D input%22).attr(field.schema.editorAttrs);%0A
%0A
@@ -4173,51 +4173,8 @@
rms%0A
- $(window).on('load', function () %7B%0A
@@ -4224,36 +4224,32 @@
on () %7B%0A
-
-
var $form = $(th
@@ -4250,28 +4250,24 @@
= $(this);%0A%0A
-
requ
@@ -4303,36 +4303,32 @@
, function () %7B%0A
-
$for
@@ -4356,36 +4356,32 @@
())%0A
-
%7D);%0A
%7D);%0A
@@ -4364,36 +4364,32 @@
%7D);%0A
-
-
%7D);%0A
$('%5Bdata
@@ -4376,20 +4376,16 @@
%7D);%0A
-
-
$('%5Bdata
@@ -4437,28 +4437,24 @@
) %7B%0A
-
var $form =
@@ -4462,36 +4462,32 @@
(this);%0A
-
-
$form.backbone($
@@ -4500,28 +4500,16 @@
ata());%0A
- %7D);%0A
%7D);%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.