commit
stringlengths 40
40
| old_file
stringlengths 4
236
| new_file
stringlengths 4
236
| old_contents
stringlengths 1
3.26k
| new_contents
stringlengths 16
4.43k
| subject
stringlengths 16
624
| message
stringlengths 17
3.29k
| lang
stringclasses 5
values | license
stringclasses 13
values | repos
stringlengths 5
91.5k
|
|---|---|---|---|---|---|---|---|---|---|
fece5a97acbf07c6d405c5a8bd9f40de60fa5c29
|
src/kit/ui/StringComponent.js
|
src/kit/ui/StringComponent.js
|
import { Component } from 'substance'
import TextInput from './TextInput'
export default class StringComponent extends Component {
render ($$) {
let placeholder = this.props.placeholder
let model = this.props.model
let path = model.getPath()
let name = path.join('.')
let el = $$('div').addClass(this.getClassNames())
el.append(
$$(TextInput, {
name,
path,
placeholder
}).ref('input')
)
return el
}
getClassNames () {
return 'sc-string'
}
}
|
import { Component } from 'substance'
import TextInput from './TextInput'
export default class StringComponent extends Component {
render ($$) {
let placeholder = this.props.placeholder
let model = this.props.model
let path = model.getPath()
let name = path.join('.')
let el = $$('div').addClass(this.getClassNames())
if (this.props.readOnly) {
let doc = this.context.api.getDocument()
let TextPropertyComponent = this.getComponent('text-property')
el.append(
$$(TextPropertyComponent, {
doc,
tagName: 'div',
placeholder,
path
}).ref('display')
)
} else {
el.append(
$$(TextInput, {
name,
path,
placeholder
}).ref('input')
)
}
return el
}
getClassNames () {
return 'sc-string'
}
}
|
Allow to render text or string read-only.
|
Allow to render text or string read-only.
|
JavaScript
|
mit
|
substance/texture,substance/texture
|
1c19dbe6c8b8b462f86f3d901203e77ef5486cbd
|
lib/createHeader.js
|
lib/createHeader.js
|
var Immutable = require('immutable');
var Draft = require('draft-js');
var TYPES = require('./TYPES');
var createRow = require('./createRow');
/**
* Create a new table header
*
* @param {String} tableKey
* @param {Number} countColumns
* @return {OrderedMap<String:Draft.ContentBlock>}
*/
function createHeader(tableKey, countColumns) {
var tableHeaderKey = Draft.genNestedKey(tableKey);
var tableHeaderBlock = new Draft.ContentBlock({
key: tableHeaderKey,
type: TYPES.HEADER
});
return Immutable.OrderedMap([
[tableHeaderKey, tableHeaderBlock]
])
.merge(
createRow(tableHeaderKey, countColumns)
);
}
module.exports = createHeader;
|
var Immutable = require('immutable');
var Draft = require('draft-js');
var TYPES = require('./TYPES');
var createRow = require('./createRow');
/**
* Create a new table header
*
* @param {String} tableKey
* @param {Number} countColumns
* @return {OrderedMap<String:Draft.ContentBlock>}
*/
function createHeader(tableKey, countColumns) {
var tableHeaderKey = Draft.genNestedKey(tableKey);
var tableHeaderBlock = new Draft.ContentBlock({
key: tableHeaderKey,
type: TYPES.HEADER,
data: Immutable.Map({
align: Array
.apply(null, Array(10))
.map(function(){ return TYPES.LEFT; })
})
});
return Immutable.OrderedMap([
[tableHeaderKey, tableHeaderBlock]
])
.merge(
createRow(tableHeaderKey, countColumns)
);
}
module.exports = createHeader;
|
Create align data when creating table
|
Create align data when creating table
|
JavaScript
|
apache-2.0
|
SamyPesse/draft-js-table,SamyPesse/draft-js-table
|
a58013389178b6254eed66983b3d6bac5a2c4ae0
|
lib/diff-pane-item-component.js
|
lib/diff-pane-item-component.js
|
/* @flow */
/** @jsx etch.dom */
import etch from 'etch'
// $FlowBug: Yes, we know this isn't a React component :\
import DiffComponent from './diff-component'
import type DiffViewModel from './diff-view-model'
type DiffPaneItemComponentProps = {diffViewModel: DiffViewModel}
export default class DiffPaneItemComponent {
diffViewModel: DiffViewModel;
element: HTMLElement;
refs: {diffComponent: HTMLElement};
constructor (props: DiffPaneItemComponentProps) {
this.acceptProps(props)
}
acceptProps ({diffViewModel}: DiffPaneItemComponentProps): Promise<void> {
this.diffViewModel = diffViewModel
let updatePromise = Promise.resolve()
if (this.element) {
updatePromise = etch.update(this)
} else {
etch.initialize(this)
}
this.element.addEventListener('focus', () => this.refs.diffComponent.focus())
return updatePromise
}
update (props: DiffPaneItemComponentProps, children: Array<any>): Promise<void> {
return this.acceptProps(props)
}
render () {
return (
<div className='pane-item' tabIndex='-1'>{
<DiffComponent ref='diffComponent' diffViewModel={this.diffViewModel}/>
}</div>
)
}
}
|
/* @flow */
/** @jsx etch.dom */
import etch from 'etch'
import {Disposable, CompositeDisposable} from 'atom'
// $FlowBug: Yes, we know this isn't a React component :\
import DiffComponent from './diff-component'
import type DiffViewModel from './diff-view-model'
type DiffPaneItemComponentProps = {diffViewModel: DiffViewModel}
export default class DiffPaneItemComponent {
diffViewModel: DiffViewModel;
element: HTMLElement;
refs: {diffComponent: HTMLElement};
subscriptions: CompositeDisposable;
constructor (props: DiffPaneItemComponentProps) {
this.subscriptions = new CompositeDisposable()
this.acceptProps(props)
const onFocus = () => this.refs.diffComponent.focus()
this.element.addEventListener('focus', onFocus)
this.subscriptions.add(new Disposable(() => this.element.removeEventListener('focus', onFocus)))
}
acceptProps ({diffViewModel}: DiffPaneItemComponentProps): Promise<void> {
this.diffViewModel = diffViewModel
let updatePromise = Promise.resolve()
if (this.element) {
updatePromise = etch.update(this)
} else {
etch.initialize(this)
}
return updatePromise
}
update (props: DiffPaneItemComponentProps, children: Array<any>): Promise<void> {
return this.acceptProps(props)
}
render () {
return (
<div className='pane-item' tabIndex='-1'>{
<DiffComponent ref='diffComponent' diffViewModel={this.diffViewModel}/>
}</div>
)
}
destroy (): Promise<void> {
this.subscriptions.dispose()
return etch.destroy(this)
}
}
|
Clean up the focus handler.
|
Clean up the focus handler.
|
JavaScript
|
mit
|
atom/github,atom/github,atom/github
|
4340850c7b2803002c747f425ef7c3da8bca8fdd
|
.template-lintrc.js
|
.template-lintrc.js
|
/* eslint-env node */
'use strict';
var defaultAllowedBaseStrings = ['(', ')', ',', '.', '&', '+', '-', '=', '*', '/', '#', '%', '!', '?', ':', '[', ']', '{', '}', '<', '>', '•', '—', ' ', '|'];
module.exports = {
extends: 'recommended',
rules: {
'bare-strings': ['?', '»', '—'].concat(defaultAllowedBaseStrings),
'block-indentation': true,
'html-comments': true,
'nested-interactive': true,
'self-closing-void-elements': true,
'img-alt-attributes': false,
'link-rel-noopener': true,
'invalid-interactive': false,
'inline-link-to': true,
'style-concatenation': true,
'triple-curlies': false,
'deprecated-each-syntax': true,
'deprecated-inline-view-helper': false,
}
};
|
/* eslint-env node */
'use strict';
var defaultAllowedBaseStrings = ['(', ')', ',', '.', '&', '+', '-', '=', '*', '/', '#', '%', '!', '?', ':', '[', ']', '{', '}', '<', '>', '•', '—', ' ', '|'];
module.exports = {
extends: 'recommended',
rules: {
'bare-strings': ['?', '»', '—'].concat(defaultAllowedBaseStrings),
'block-indentation': true,
'html-comments': true,
'nested-interactive': true,
'self-closing-void-elements': true,
'img-alt-attributes': false,
'invalid-interactive': false,
'inline-link-to': true,
'triple-curlies': false,
'deprecated-each-syntax': true,
'deprecated-inline-view-helper': false,
}
};
|
Remove rules which are now enabled by default
|
Remove rules which are now enabled by default
These template lint rules are now enabled in the 'recommended'
configuration so we don't need to override them in our config.
|
JavaScript
|
mit
|
jrjohnson/frontend,ilios/frontend,thecoolestguy/frontend,dartajax/frontend,djvoa12/frontend,dartajax/frontend,djvoa12/frontend,gabycampagna/frontend,jrjohnson/frontend,ilios/frontend,gabycampagna/frontend,thecoolestguy/frontend,gboushey/frontend,gboushey/frontend
|
4bd2a3ccb73d9a2b8579a2fed42943548be51199
|
sw-precache-config.js
|
sw-precache-config.js
|
/**
* https://github.com/GoogleChrome/sw-precache#command-line-interface
*/
module.exports = {
root: 'build',
staticFileGlobs: [
'build/javascripts/main.js',
'build/stylesheets/**.css',
'build/images/**/*.*',
],
stripPrefix: 'build/'
}
|
/**
* https://github.com/GoogleChrome/sw-precache#command-line-interface
*/
module.exports = {
root: 'build',
swFile: 'sw-precache.js',
staticFileGlobs: [
'build/javascripts/main.js',
'build/stylesheets/**.css',
'build/images/**/*.*',
],
stripPrefix: 'build/'
}
|
Rename service-worker.js -> sw-precache.js for other worker names
|
feat: Rename service-worker.js -> sw-precache.js for other worker names
|
JavaScript
|
mit
|
Leko/WEB-EGG,Leko/WEB-EGG,Leko/WEB-EGG
|
dd538b5472f01f45822f026624d98da78408e492
|
lib/Procure.js
|
lib/Procure.js
|
var fs = require('fs');
var url = require('url');
var request = require('request');
/**
* @class
*/
var Procure = function() {};
/**
* "Procure" a resource, whether local or remote.
* @function procure
* @param {string} uri Some path to a file.
* @param {Procure~ProcuringComplete} callback Function called on sucess or failure.
*/
Procure.prototype.procure = function( uri , procured ) {
var info = url.parse( uri );
if (~['http:', 'https:'].indexOf( info.protocol )) {
request({
uri: uri,
headers: {
'Accept': 'application/json;q=0.9,*/*;q=0.8'
}
}, function(err, res, body) {
if (res.statusCode != 200 ) return procured('non-200 response');
return procured( err , body );
});
} else {
fs.readFile( uri , procured );
}
};
/**
* The callback function when the file is retrieved (or not).
* @callback Procure~ProcuringComplete
* @param {mixed} err Error message, if any. Null / undefined if none.
* @param {string} body Body of the requested content.
*/
module.exports = Procure;
|
var fs = require('fs');
var url = require('url');
var request = require('request');
var package = require('../package.json');
/**
* @class
*/
var Procure = function() {};
/**
* "Procure" a resource, whether local or remote.
* @function procure
* @param {string} uri Some path to a file.
* @param {Procure~ProcuringComplete} callback Function called on sucess or failure.
*/
Procure.prototype.procure = function( uri , procured ) {
var info = url.parse( uri );
if (~['http:', 'https:'].indexOf( info.protocol )) {
request({
uri: uri,
headers: {
'Accept': 'application/json;q=0.9,*/*;q=0.8',
'User-Agent': 'procure/' + package.version
}
}, function(err, res, body) {
var statusCode = res.statusCode;
if (statusCode != 200 ) return procured('non-200 response ' + statusCode);
return procured( err , body );
});
} else {
fs.readFile( uri , procured );
}
};
/**
* The callback function when the file is retrieved (or not).
* @callback Procure~ProcuringComplete
* @param {mixed} err Error message, if any. Null / undefined if none.
* @param {string} body Body of the requested content.
*/
module.exports = Procure;
|
Add User-Agent for GitHub calls.
|
Add User-Agent for GitHub calls.
|
JavaScript
|
mit
|
martindale/procure
|
5b7b02e254769ec79a9525c23b9eb85353e9b38e
|
src/components/body/ScrollerDirective.js
|
src/components/body/ScrollerDirective.js
|
import { requestAnimFrame } from '../../utils/utils';
import { scrollHelper } from './scrollHelper';
export function ScrollerDirective($timeout){
return {
restrict: 'E',
require:'^dtBody',
transclude: true,
template: `<div ng-style="scrollerStyles()" ng-transclude></div>`,
link: function($scope, $elm, $attrs, ctrl){
var ticking = false,
lastScrollY = 0,
lastScrollX = 0,
helper = scrollHelper.create($elm);
function update(){
$timeout(() => {
ctrl.options.internal.offsetY = lastScrollY;
ctrl.options.internal.offsetX = lastScrollX;
ctrl.updatePage();
});
ticking = false;
};
function requestTick() {
if(!ticking) {
requestAnimFrame(update);
ticking = true;
}
};
$elm.parent().on('scroll', function(ev) {
lastScrollY = this.scrollTop;
lastScrollX = this.scrollLeft;
requestTick();
});
$scope.scrollerStyles = function(scope){
return {
height: ctrl.count * ctrl.options.rowHeight + 'px'
}
};
}
};
};
|
import { requestAnimFrame } from '../../utils/utils';
import { scrollHelper } from './scrollHelper';
export function ScrollerDirective($timeout){
return {
restrict: 'E',
require:'^dtBody',
transclude: true,
replace: true,
template: `<div ng-style="scrollerStyles()" ng-transclude></div>`,
link: function($scope, $elm, $attrs, ctrl){
var ticking = false,
lastScrollY = 0,
lastScrollX = 0,
helper = scrollHelper.create($elm.parent());
function update(){
$timeout(() => {
ctrl.options.internal.offsetY = lastScrollY;
ctrl.options.internal.offsetX = lastScrollX;
ctrl.updatePage();
});
ticking = false;
};
function requestTick() {
if(!ticking) {
requestAnimFrame(update);
ticking = true;
}
};
$elm.parent().on('scroll', function(ev) {
lastScrollY = this.scrollTop;
lastScrollX = this.scrollLeft;
requestTick();
});
$scope.scrollerStyles = function(scope){
return {
height: ctrl.count * ctrl.options.rowHeight + 'px'
}
};
}
};
};
|
Fix footer paging not working
|
Fix footer paging not working
|
JavaScript
|
mit
|
kuzman/angular-data-table,gabigeo/angular-data-table,kuzman/angular-data-table
|
c43bd67537d933ed345e79997ed315263f48c27c
|
examples/simple.js
|
examples/simple.js
|
"use strict";
const FigText = require('../lib/FigText');
const cursor = require('kittik-cursor').create().resetTTY();
FigText.create({
text: 'KittikJS\n Rules\n !!!',
x: 'center',
y: 'middle',
font: 'Star Wars',
foreground: 'yellow_1',
horizontalLayout: 'full'
}).render(cursor);
cursor.flush();
|
"use strict";
const FigText = require('../lib/FigText');
const cursor = require('kittik-cursor').create().resetTTY();
FigText.create({
text: 'KittikJS',
x: 'center',
y: 'middle',
font: 'Star Wars',
foreground: 'yellow_1',
horizontalLayout: 'full'
}).render(cursor);
cursor.moveTo(1, process.stdout.rows).flush();
|
Update shape-basic to the latest version
|
fix(shape): Update shape-basic to the latest version
|
JavaScript
|
mit
|
kittikjs/shape-fig-text
|
523263d6b469f6b65a119b42c5c889f1b445d08e
|
src/fast_validation/helpers/types.js
|
src/fast_validation/helpers/types.js
|
'use strict';
const { mapValues } = require('../../utilities');
const isObject = function (value) {
return value.constructor === Object;
};
const isObjectArray = function (value) {
return Array.isArray(value) && value.every(isObject);
};
const typeTest = ({ test: testFunc, message }) => name => ({
test ({ [name]: value }) {
if (value == null) { return true; }
return testFunc(value);
},
message: `'${name}' must be ${message}`,
});
const typeCheckers = {
stringTest: {
test: value => typeof value === 'string',
message: 'a string',
},
booleanTest: {
test: value => typeof value === 'boolean',
message: 'true or false',
},
numberTest: {
test: value => Number.isFinite(value),
message: 'a number',
},
integerTest: {
test: value => Number.isInteger(value),
message: 'an integer',
},
objectTest: {
test: isObject,
message: 'an object',
},
objectArrayTest: {
test: isObjectArray,
message: 'an array of objects',
},
objectOrArrayTest: {
test: value => isObject(value) || isObjectArray(value),
message: 'an array of objects',
},
};
const typeTests = mapValues(typeCheckers, typeTest);
module.exports = {
...typeTests,
};
|
'use strict';
const { mapValues, get } = require('../../utilities');
const isObject = function (value) {
return value.constructor === Object;
};
const isObjectArray = function (value) {
return Array.isArray(value) && value.every(isObject);
};
const typeTest = ({ test: testFunc, message }) => name => ({
test (value) {
const val = get(value, name.split('.'));
if (val == null) { return true; }
return testFunc(val);
},
message: `'${name}' must be ${message}`,
});
const typeCheckers = {
stringTest: {
test: value => typeof value === 'string',
message: 'a string',
},
booleanTest: {
test: value => typeof value === 'boolean',
message: 'true or false',
},
numberTest: {
test: value => Number.isFinite(value),
message: 'a number',
},
integerTest: {
test: value => Number.isInteger(value),
message: 'an integer',
},
objectTest: {
test: isObject,
message: 'an object',
},
objectArrayTest: {
test: isObjectArray,
message: 'an array of objects',
},
objectOrArrayTest: {
test: value => isObject(value) || isObjectArray(value),
message: 'an array of objects',
},
};
const typeTests = mapValues(typeCheckers, typeTest);
module.exports = {
...typeTests,
};
|
Fix typeTest for deep attrs
|
Fix typeTest for deep attrs
|
JavaScript
|
apache-2.0
|
autoserver-org/autoserver,autoserver-org/autoserver
|
762ea681fb722e0c08761e5daec6ea4979de6d11
|
lib/get_all.js
|
lib/get_all.js
|
var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
}).filter(fp.id).length > 0;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
|
var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields = query.fields;
var limit = query.limit;
var offset = query.offset || 0;
delete query.fields;
delete query.limit;
delete query.offset;
var zq = zip(query);
var ret = model._data;
if(fp.count(query)) {
ret = ret.filter(function(o) {
return zq.map(function(p) {
var a = o[p[0]]? o[p[0]].toLowerCase(): '';
var b = p[1]? p[1].toLowerCase(): '';
return minimatch(a, b);
}).filter(fp.id).length === zq.length;
});
}
if(fields) {
fields = is.array(fields)? fields: [fields];
ret = ret.map(function(o) {
var r = {};
fields.forEach(function(k) {
r[k] = o[k];
});
return r;
});
}
if(limit) {
ret = ret.slice(offset, offset + limit);
}
cb(null, ret);
};
|
Allow fuzzy searches to be combined
|
Allow fuzzy searches to be combined
Ie. v1/jsdelivr/libraries?name=jq*&lastversion=*.0.1 .
|
JavaScript
|
mit
|
jsdelivr/api,MartinKolarik/api-sync,jsdelivr/api-sync,MartinKolarik/api,jsdelivr/api-sync,2947721120/jsdelivr-api,MartinKolarik/api-sync
|
821c22c7318e4405058f56d5c2aacfd7cd23bf52
|
packages/coinstac-server-core/src/services/logger.js
|
packages/coinstac-server-core/src/services/logger.js
|
'use strict';
const mkdirp = require('mkdirp');
const path = require('path');
const pify = require('pify');
const touch = require('touch');
const winston = require('winston');
/**
* @module service/logger
*
* {@link https://www.npmjs.com/package/winston}
*/
/**
* Log file directory.
*
* @const {string}
*/
const LOG_DIR = '/var/log/coinstac';
/**
* Log file name.
*
* @const {string}
*/
const LOG_BASE = 'application.log';
/**
* Logger instance.
*
* @type {winston.Logger}
*/
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
level: 'info',
}),
],
});
/**
* Set up file transport async. If an error occurs the executable will catch the
* unhandled rejection and shut the server down.
*/
pify(mkdirp)(LOG_DIR)
.then(() => {
return new Promise((resolve, reject) => {
touch(path.join(LOG_DIR, LOG_BASE), error => {
if (error) {
reject(error);
} else {
resolve();
}
});
});
})
.then(() => {
logger.add(winston.transports.File, {
filename: path.join(LOG_DIR, LOG_BASE),
level: 'silly',
silent: false,
});
});
module.exports = logger;
|
'use strict';
const mkdirp = require('mkdirp');
const path = require('path');
const pify = require('pify');
const touch = require('touch');
const winston = require('winston');
/**
* @module service/logger
*
* {@link https://www.npmjs.com/package/winston}
*/
/**
* Log file directory.
*
* @const {string}
*/
const LOG_DIR = '/var/log/coinstac';
/**
* Log file name.
*
* @const {string}
*/
const LOG_BASE = 'application.log';
/**
* Logger instance.
*
* @type {winston.Logger}
*/
const logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)({
colorize: true,
level: 'info',
}),
],
});
/**
* Set up file transport async. If an error occurs the executable will catch the
* unhandled rejection and shut the server down.
*/
pify(mkdirp)(LOG_DIR)
.then(() => pify(touch)(path.join(LOG_DIR, LOG_BASE)))
.catch(() => {
throw new Error(
`Couldn't create log file: ${path.join(LOG_DIR, LOG_BASE)}`
);
})
.then(() => {
logger.add(winston.transports.File, {
filename: path.join(LOG_DIR, LOG_BASE),
level: 'silly',
silent: false,
});
});
module.exports = logger;
|
Make log `touch` error more human-readable.
|
Make log `touch` error more human-readable.
|
JavaScript
|
mit
|
MRN-Code/coinstac,MRN-Code/coinstac,MRN-Code/coinstac
|
18e5fe55934899ba1e4454e1383ef49c5068dafb
|
ember-cli-build.js
|
ember-cli-build.js
|
/* eslint-env node */
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
'ember-cli-babel': {
includePolyfill: true
},
'ember-cli-mocha': {
useLintTree: false
},
sassOptions: {
includePaths: [
'addon/styles'
]
},
snippetPaths: [
'code-snippets'
],
snippetSearchPaths: [
'tests/dummy'
]
})
app.import('bower_components/highlightjs/styles/github.css')
app.import(app.project.addonPackages['ember-source']
? 'vendor/ember/ember-template-compiler.js' : 'bower_components/ember/ember-template-compiler.js')
return app.toTree()
}
|
/* eslint-env node */
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon')
module.exports = function (defaults) {
var app = new EmberAddon(defaults, {
babel: {
optional: ['es7.decorators']
},
'ember-cli-babel': {
includePolyfill: true
},
sassOptions: {
includePaths: [
'addon/styles'
]
},
snippetPaths: [
'code-snippets'
],
snippetSearchPaths: [
'tests/dummy'
]
})
app.import('bower_components/highlightjs/styles/github.css')
app.import(app.project.addonPackages['ember-source']
? 'vendor/ember/ember-template-compiler.js' : 'bower_components/ember/ember-template-compiler.js')
return app.toTree()
}
|
Remove useLintTree ember-cli-mocha build configuration
|
Remove useLintTree ember-cli-mocha build configuration
|
JavaScript
|
mit
|
EWhite613/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,dafortin/ember-frost-core,ciena-frost/ember-frost-core,EWhite613/ember-frost-core,EWhite613/ember-frost-core
|
d15cb49d88672b866158c5ef267d1f4c0bd7509b
|
lib/publish.js
|
lib/publish.js
|
// get a url to a tarball, fetch it, read the package.json, and
// publish to the registry.
module.exports = publish
var fs = require("fs")
, path = require("path")
, chain = require("./utils/chain")
, rm = require("./utils/rm-rf")
, readJson = require("./utils/read-json")
, exec = require("./utils/exec")
, mkdir = require("./utils/mkdir-p")
, log = require("./utils/log")
, semver = require("./utils/semver")
, fetch = require("./utils/fetch")
, registry = require("./utils/registry")
, npm = require("../npm")
, url = require("url")
function publish (args, cb) {
log(args, "publish")
npm.commands.cache.add(args[0], args[1], function (er, data) {
if (er) return cb(er)
log(data, "publish")
if (!data) return cb(new Error("no data!?"))
registry.publish(data, cb)
})
}
|
module.exports = publish
var npm = require("../npm")
, registry = require("./utils/registry")
, log = require("./utils/log")
function publish (args, cb) {
log(args, "publish")
npm.commands.cache.add(args[0], args[1], function (er, data) {
if (er) return cb(er)
log(data, "publish")
if (!data) return cb(new Error("no data!?"))
registry.publish(data, cb)
})
}
|
Remove a bunch of unnecessary require() statements
|
Remove a bunch of unnecessary require() statements
|
JavaScript
|
artistic-2.0
|
ekmartin/npm,kriskowal/npm,segmentio/npm,yibn2008/npm,kemitchell/npm,chadnickbok/npm,cchamberlain/npm,segmentio/npm,xalopp/npm,thomblake/npm,cchamberlain/npm,evocateur/npm,xalopp/npm,Volune/npm,segrey/npm,lxe/npm,xalopp/npm,princeofdarkness76/npm,segment-boneyard/npm,evocateur/npm,kemitchell/npm,cchamberlain/npm-msys2,segment-boneyard/npm,princeofdarkness76/npm,midniteio/npm,DIREKTSPEED-LTD/npm,yyx990803/npm,rsp/npm,cchamberlain/npm-msys2,thomblake/npm,yyx990803/npm,cchamberlain/npm,DIREKTSPEED-LTD/npm,segrey/npm,TimeToogo/npm,Volune/npm,kimshinelove/naver-npm,rsp/npm,ekmartin/npm,yibn2008/npm,misterbyrne/npm,segrey/npm,TimeToogo/npm,kimshinelove/naver-npm,evanlucas/npm,TimeToogo/npm,haggholm/npm,segment-boneyard/npm,Volune/npm,kemitchell/npm,haggholm/npm,misterbyrne/npm,lxe/npm,misterbyrne/npm,DIREKTSPEED-LTD/npm,yodeyer/npm,chadnickbok/npm,evanlucas/npm,evanlucas/npm,yodeyer/npm,princeofdarkness76/npm,kriskowal/npm,cchamberlain/npm-msys2,DaveEmmerson/npm,midniteio/npm,DaveEmmerson/npm,chadnickbok/npm,DaveEmmerson/npm,yyx990803/npm,ekmartin/npm,yibn2008/npm,rsp/npm,segmentio/npm,kimshinelove/naver-npm,thomblake/npm,kriskowal/npm,evocateur/npm,lxe/npm,haggholm/npm,yodeyer/npm,midniteio/npm
|
15cf2fd1ca05cf8be0491f10672a36f4352a9d8e
|
packages/ember-model/tests/model_sideloading_test.js
|
packages/ember-model/tests/model_sideloading_test.js
|
var attr = Ember.attr;
module("Ember.Model sideloading");
test("data can be sideloaded without materializing records", function() {
expect(1);
var Model = Ember.Model.extend({
id: attr(),
name: attr()
});
Model.adapter = {
find: function(record, id) {
ok(false, "Adapter#find shouldn't be called for records with sideloaded data");
}
};
Model.load([{id: 1, name: "Erik"}]);
var record = Model.find(1);
ok(record.get('isLoaded'), "Record should be loaded immediately");
// ok(record.get('isLoaded'), "Record should be loaded immediately");
});
|
var attr = Ember.attr;
module("Ember.Model sideloading");
test("data can be sideloaded without materializing records", function() {
expect(1);
var Model = Ember.Model.extend({
id: attr(),
name: attr(),
camelCase: attr()
});
Model.adapter = {
find: function(record, id) {
ok(false, "Adapter#find shouldn't be called for records with sideloaded data");
}
};
Model.load([{id: 1, name: "Erik", camel_case: "Dromedary"}]);
var record = Model.find(1);
ok(record.get('isLoaded'), "Record should be loaded immediately");
strictEqual(record.get('id'), 1, "Record ID retained successfully");
strictEqual(record.get('name'), "Erik", "Record name retained successfully");
strictEqual(record.get('camelCase'), "Dromedary", "camel cased attributes retained correctly");
// ok(record.get('isLoaded'), "Record should be loaded immediately");
});
|
Add breaking test for sideloading data with camel cased attributes
|
Add breaking test for sideloading data with camel cased attributes
|
JavaScript
|
mit
|
zenefits/ember-model,greyhwndz/ember-model,sohara/ember-model,asquet/ember-model,juggy/ember-model,GavinJoyce/ember-model,igorgoroshit/ember-model,ipavelpetrov/ember-model,CondeNast/ember-model,ebryn/ember-model,asquet/ember-model,ckung/ember-model,Swrve/ember-model,julkiewicz/ember-model,c0achmcguirk/ember-model,intercom/ember-model,gmedina/ember-model,ipavelpetrov/ember-model
|
9079ca9a5a9565b02a0bfae9b073f8a8edc789dc
|
app/scripts/museum/address-filter.js
|
app/scripts/museum/address-filter.js
|
(function() {
'use strict';
/**
* Generate a human-readable address string from a single museum object
*
* Can get fancy here and prioritize one of the three address types provided:
* source address, geocoded address, physical address
*
* For now, default to geocoded address since that's what seems to always be populated
*/
/* ngInject */
function AddressFilter() {
return function (input) {
var address = input.gaddress;
var city = input.gcity;
var state = input.gstate;
var zip = input.gzip;
return address + ', ' + city + ', ' + state + ' ' + zip;
};
}
angular.module('imls.museum')
.filter('imlsAddress', AddressFilter);
})();
|
(function() {
'use strict';
/**
* Generate a human-readable address string from a single museum object
*
* Can get fancy here and prioritize one of the three address types provided:
* source address, geocoded address, physical address
*
* For now, default to geocoded address since that's what seems to always be populated
*/
/* ngInject */
function AddressFilter() {
return function (input) {
var address = input.adstreet;
var city = input.adcity;
var state = input.adstate;
var zip = input.adzip;
return address + ', ' + city + ', ' + state + ' ' + zip;
};
}
angular.module('imls.museum')
.filter('imlsAddress', AddressFilter);
})();
|
Use valid columns in address filter
|
Bugfix: Use valid columns in address filter
|
JavaScript
|
apache-2.0
|
MuseumStat/imls-museum-data,azavea/imls-museum-data,azavea/imls-museum-data,azavea/imls-museum-data,MuseumStat/imls-museum-data,MuseumStat/imls-museum-data
|
d17596670403e4f20efa4d1957aad1d1f52b4038
|
lib/runtime.js
|
lib/runtime.js
|
var adt;
try {
adt = require("adt");
} catch (e) {
adt = null;
}
// Given an object and a class name, tries to determin if the object is an
// instance of said class.
function matchesTypeName (obj, name) {
if (adt && isADT(obj)) {
var types = adt.lookup(name);
if (types) {
for (var i = 0, len = types.length; i < len; i++) {
if (obj instanceof types[i]) return true;
}
}
return false;
}
if (obj.constructor && obj.constructor.name && obj.constructor.name === name) {
return true;
}
return false;
}
// Checks whether an object is an adt.js type.
function isADT (obj) {
return obj instanceof adt.__Base__;
}
// Export
module.exports = {
matchesTypeName: matchesTypeName,
isADT: isADT
};
|
var adt;
try {
adt = require("adt");
} catch (e) {
adt = null;
}
// Given an object and a class name, tries to determin if the object is an
// instance of said class.
function matchesTypeName (obj, name) {
if (name === "Number") {
return typeof obj === "number";
}
else if (name === "String") {
return typeof obj === "string";
}
else if (name === "Function") {
return obj instanceof Function;
}
else if (name === "Object") {
return obj instanceof Object;
}
else if (adt && isADT(obj)) {
var types = adt.lookup(name);
if (types) {
for (var i = 0, len = types.length; i < len; i++) {
if (obj instanceof types[i]) return true;
}
}
return false;
}
return false;
}
// Checks whether an object is an adt.js type.
function isADT (obj) {
return obj instanceof adt.__Base__;
}
// Export
module.exports = {
matchesTypeName: matchesTypeName,
isADT: isADT
};
|
Remove checking of constructor.name, instead just check primitive types and adt.js types
|
Remove checking of constructor.name, instead just check primitive types and adt.js types
|
JavaScript
|
mit
|
ermouth/matches.js,natefaubion/matches.js
|
759e7a66ca850755d7dad05974bf4a559d51f984
|
source/javascripts/pricing.js
|
source/javascripts/pricing.js
|
$(function () {
$.fn.equalHeights = function() {
var maxHeight = 0,
$this = $(this);
$this.each( function() {
var height = $(this).innerHeight();
if (height > maxHeight) {
maxHeight = height;
}
});
return $this.css('height', maxHeight);
};
function equilize() {
$('[data-equal]').each(function(){
var $this = $(this),
target = $this.data('equal');
if ($(window).width() >= 992) {
$this.find(target).css('height', '').equalHeights();
} else {
$this.find(target).css('height', '');
}
});
}
setTimeout(equilize, 500);
$(window).on('resize', equilize);
$('.js-faq-question').on('click', function (e) {
e.preventDefault();
isOpen = $(this).closest('.faq-item').is('.is-open');
$('.faq-item.is-open').removeClass('is-open');
if (!isOpen) {
$(this).closest('.faq-item').toggleClass('is-open');
}
});
});
|
$(function () {
$.fn.equalHeights = function() {
var maxHeight = 0,
$this = $(this);
$this.each( function() {
var height = $(this).innerHeight();
if (height > maxHeight) {
maxHeight = height;
}
});
return $this.css('height', maxHeight);
};
function equilize() {
$('[data-equal]').each(function(){
var $this = $(this),
target = $this.data('equal');
if ($(window).width() >= 992) {
$this.find(target).css('height', '').equalHeights();
} else {
$this.find(target).css('height', '');
}
});
}
setTimeout(equilize, 500);
$(window).on('resize', equilize);
$('.featured-item-expand').on('click', function(e) {
var listExpander = $(this);
targetFeatureList = $($(this).attr('href'));
if (!targetFeatureList.is(':visible')) {
targetFeatureList.addClass('list-expanded');
listExpander.addClass('chevron-up');
} else {
targetFeatureList.removeClass('list-expanded');
listExpander.removeClass('chevron-up');
}
e.preventDefault();
});
$('.js-faq-question').on('click', function (e) {
e.preventDefault();
isOpen = $(this).closest('.faq-item').is('.is-open');
$('.faq-item.is-open').removeClass('is-open');
if (!isOpen) {
$(this).closest('.faq-item').toggleClass('is-open');
}
});
});
|
Add event listener to expand/collapse edition card info
|
Add event listener to expand/collapse edition card info
|
JavaScript
|
mit
|
damianhakert/damianhakert.github.io
|
493a5038a3afe675213e2f8e1802a088b2cfc38c
|
src/javascript/app_2/Stores/Modules/Trading/Helpers/end-time.js
|
src/javascript/app_2/Stores/Modules/Trading/Helpers/end-time.js
|
export const getSelectedTime = (
server_time,
selected_time,
market_open_time,
) => {
const boundaries = selected_time.isBefore(market_open_time)
? market_open_time.isBefore(server_time)
? server_time.add(5, 'minute')
: market_open_time.add(5, 'minute')
: selected_time;
return boundaries.format('HH:mm');
};
export const getBoundaries = (
server_time,
market_open_time,
market_close_time,
) => {
const boundaries = {
start: server_time.isBefore(market_open_time)
? market_open_time.add(5, 'minute')
: server_time.add(5, 'minute'),
end: market_close_time,
};
return boundaries;
};
|
export const getSelectedTime = (
server_time,
selected_time,
market_open_time,
) => {
const value = selected_time.isBefore(market_open_time)
? market_open_time.isBefore(server_time)
? server_time.add(5, 'minute')
: market_open_time.add(5, 'minute')
: selected_time;
return value.format('HH:mm');
};
export const getBoundaries = (
server_time,
market_open_time,
market_close_time,
) => {
const boundaries = {
start: server_time.isBefore(market_open_time)
? market_open_time.add(5, 'minute')
: server_time.add(5, 'minute'),
end: market_close_time,
};
return boundaries;
};
|
Rename boundaries -> value, on getSelectedTime
|
Rename boundaries -> value, on getSelectedTime
|
JavaScript
|
apache-2.0
|
ashkanx/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,binary-com/binary-static,binary-com/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,4p00rv/binary-static,kellybinary/binary-static,4p00rv/binary-static,4p00rv/binary-static,kellybinary/binary-static,kellybinary/binary-static
|
4f503b03227cf7eebc552672ae469443016c0d6d
|
src/index.js
|
src/index.js
|
require("./stylesheets/main.less");
var marked = require("marked");
var commands = codebox.require("core/commands");
var dialogs = codebox.require("utils/dialogs");
commands.register({
id: "markdown.preview",
title: "Markdown: Preview",
context: ["editor"],
run: function(args, context) {
return codebox.tabs.add(codebox.tabs.HtmlPanel, {
className: "component-markdown-preview",
content: marked(context.getContent())
}, {
type: "markdown",
title: "Markdown: " + context.model.get("name"),
section: "markdown"
});
}
});
|
require("./stylesheets/main.less");
var marked = require("marked");
var commands = codebox.require("core/commands");
var dialogs = codebox.require("utils/dialogs");
commands.register({
id: "markdown.preview",
title: "Markdown: Preview",
context: ["editor"],
run: function(args, ctx) {
return codebox.tabs.add(codebox.tabs.HtmlPanel, {
className: "component-markdown-preview",
content: marked(ctx.editor.getContent())
}, {
type: "markdown",
title: "Markdown: " + ctx.editor.model.get("name"),
section: "markdown"
});
}
});
|
Use new multiple cmd contexts
|
Use new multiple cmd contexts
|
JavaScript
|
apache-2.0
|
CodeboxIDE/package-markdown
|
30fb1dd1918d561c8ac2a99708af962224824c9e
|
src/index.js
|
src/index.js
|
import {EntityManager} from './entity-manager';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
export {repository} from './decorator/repository';
export {validation} from './decorator/validation';
export {validatedResource} from './decorator/validated-resource';
export function configure(aurelia, configCallback) {
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
}
|
import {EntityManager} from './entity-manager';
import {ValidationGroup} from 'aurelia-validation';
import {HasAssociationValidationRule} from './validator/has-association';
export {DefaultRepository} from './default-repository';
export {Repository} from './repository';
export {Entity} from './entity';
export {OrmMetadata} from './orm-metadata';
export {EntityManager} from './entity-manager';
export {association} from './decorator/association';
export {resource} from './decorator/resource';
export {repository} from './decorator/repository';
export {validation} from './decorator/validation';
export {validatedResource} from './decorator/validated-resource';
export function configure(aurelia, configCallback) {
let entityManagerInstance = aurelia.container.get(EntityManager);
configCallback(entityManagerInstance);
ValidationGroup.prototype.hasAssociation = function() {
return this.isNotEmpty().passesRule(new HasAssociationValidationRule());
};
}
|
Add validation rule for associations to validator
|
feat(validator): Add validation rule for associations to validator
|
JavaScript
|
mit
|
SpoonX/aurelia-orm,kellyethridge/aurelia-orm,freska-fi/aurelia-orm,freska-fi/aurelia-orm,doktordirk/aurelia-orm,kellyethridge/aurelia-orm,SpoonX/aurelia-orm,bas080/aurelia-orm,doktordirk/aurelia-orm,bas080/aurelia-orm
|
a24c7ca0ddbef44abeda4e12cd5382b7748a1204
|
src/store.js
|
src/store.js
|
/** @babel */
import { applyMiddleware, createStore } from 'redux'
import createLogger from 'redux-logger'
import createSagaMiddleware from 'redux-saga'
import reducers from './reducers'
import rootSaga from './sagas'
const logger = createLogger()
const saga = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(logger, saga)
)
saga.run(rootSaga)
|
/** @babel */
import { applyMiddleware, createStore } from 'redux'
import createLogger from 'redux-logger'
import createSagaMiddleware from 'redux-saga'
import reducers from './reducers'
import rootSaga from './sagas'
const logger = createLogger({ collapsed: true, diff: true })
const saga = createSagaMiddleware()
export const store = createStore(
reducers,
applyMiddleware(logger, saga)
)
saga.run(rootSaga)
|
Add collapsing to the logger
|
Add collapsing to the logger
|
JavaScript
|
mit
|
sanack/atom-jq
|
c12f5f84fd3201298b84362cc0f5c0c6de4bc86c
|
lib/assets/javascripts/cartodb3/editor/layers/analysis-views/default-layer-analysis-view.js
|
lib/assets/javascripts/cartodb3/editor/layers/analysis-views/default-layer-analysis-view.js
|
var template = require('./default-layer-analysis-view.tpl');
/**
* View for an analysis node with a single input
*
* this.model is expected to be a analysis-definition-node-nodel
*/
module.exports = cdb.core.View.extend({
initialize: function (opts) {
if (!opts.layerDefinitionModel) throw new Error('layerDefinitionModel is required');
if (!opts.layerAnalysisViewFactory) throw new Error('layerAnalysisViewFactory is required');
this._layerDefinitionModel = opts.layerDefinitionModel;
this._layerAnalysisViewFactory = opts.layerAnalysisViewFactory;
this.model.on('change', this.render, this);
},
render: function () {
this.clearSubViews();
this.$el.html(template({
id: this.model.id,
title: this.model.get('type')
}));
var view = this._layerAnalysisViewFactory.createView(this.model.get('source_id'), this._layerDefinitionModel);
this.addView(view);
this.$el.append(view.render().el);
return this;
}
});
|
var template = require('./default-layer-analysis-view.tpl');
/**
* View for an analysis node with a single input
*
* this.model is expected to be a analysis-definition-node-nodel
*/
module.exports = cdb.core.View.extend({
initialize: function (opts) {
if (!opts.layerDefinitionModel) throw new Error('layerDefinitionModel is required');
if (!opts.layerAnalysisViewFactory) throw new Error('layerAnalysisViewFactory is required');
this._layerDefinitionModel = opts.layerDefinitionModel;
this._layerAnalysisViewFactory = opts.layerAnalysisViewFactory;
this.model.on('change', this.render, this);
},
render: function () {
this.clearSubViews();
this.$el.html(template({
id: this.model.id,
title: this.model.get('type')
}));
var view = this._layerAnalysisViewFactory.createView(this.model.sourceIds()[0], this._layerDefinitionModel);
this.addView(view);
this.$el.append(view.render().el);
return this;
}
});
|
Use sourceIds instead of hardcoded attribute name
|
Use sourceIds instead of hardcoded attribute name
The source_id attr just happened to work, use the sourceIds method
instead
|
JavaScript
|
bsd-3-clause
|
bloomberg/cartodb,codeandtheory/cartodb,CartoDB/cartodb,splashblot/dronedb,bloomberg/cartodb,codeandtheory/cartodb,bloomberg/cartodb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,bloomberg/cartodb,codeandtheory/cartodb,CartoDB/cartodb,codeandtheory/cartodb,codeandtheory/cartodb,splashblot/dronedb,CartoDB/cartodb,bloomberg/cartodb,splashblot/dronedb,splashblot/dronedb
|
57a4b691eb7dcc09c6f4f970b6880b6e5c1c2538
|
src/process/normalizeToPercentage.js
|
src/process/normalizeToPercentage.js
|
// @flow
import type Series from '../series/Series';
type Config = {
key: string
};
export default function normalizeToPercentage(config: Config) {
const {key} = config;
return (series: Series) => {
series.preprocess.normalizeToPercentage = true;
series.preprocess.stacked = true;
series.preprocess.stackType = 'points';
const next = series.mapPoints((point) => {
const total = point.reduce((rr, point) => rr + (point[key] || 0), 0);
let sum = 0;
const nextPoints = point.map(point => {
let next = Object.assign({}, point);
next.originalValue = next[key];
sum += (next[key] || 0);
next[key] = sum / total;
return next;
});
return nextPoints;
});
return next;
};
}
|
// @flow
import type Series from '../series/Series';
type Config = {
key: string
};
export default function normalizeToPercentage(config: Config) {
const {key} = config;
return (series: Series) => {
series.preprocess.normalizeToPercentage = true;
series.preprocess.stacked = true;
series.preprocess.stackType = 'points';
const next = series.mapPoints((point) => {
const total = point.reduce((rr, point) => rr + (point[key] || 0), 0);
let sum = 0;
const nextPoints = point.map(point => {
let next = Object.assign({}, point);
next.originalValue = next[key];
next.percentValue = ((next[key] || 0) / total);
sum += (next[key] || 0);
next[key] = sum / total;
return next;
});
return nextPoints;
});
return next;
};
}
|
Add percentage value to points
|
Add percentage value to points
points contained their ending % position and original decimal value however did not contain a percentage value from the total of the series, this has been added.
|
JavaScript
|
mit
|
bigdatr/pnut,bigdatr/pnut
|
3aee21ae0a0b376e101861e97431f09cc431a11a
|
packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/schema.js
|
packages/plugins/users-permissions/admin/src/pages/AdvancedSettings/utils/schema.js
|
import * as yup from 'yup';
import { translatedErrors } from '@strapi/helper-plugin';
const URL_REGEX = new RegExp('(^$)|((https?://.*)(d*)/?(.*))');
const schema = yup.object().shape({
email_confirmation_redirection: yup.mixed().when('email_confirmation', {
is: true,
then: yup
.string()
.matches(URL_REGEX)
.required(),
otherwise: yup.string().nullable(),
}),
email_reset_password: yup
.string(translatedErrors.string)
.matches(URL_REGEX, translatedErrors.regex)
.nullable(),
});
export default schema;
|
import * as yup from 'yup';
import { translatedErrors } from '@strapi/helper-plugin';
const URL_REGEX = new RegExp('(^$)|((.+:\\/\\/.*)(d*)\\/?(.*))');
const schema = yup.object().shape({
email_confirmation_redirection: yup.mixed().when('email_confirmation', {
is: true,
then: yup
.string()
.matches(URL_REGEX)
.required(),
otherwise: yup.string().nullable(),
}),
email_reset_password: yup
.string(translatedErrors.string)
.matches(URL_REGEX, translatedErrors.regex)
.nullable(),
});
export default schema;
|
Allow all URI schemes for setting reset password page
|
Allow all URI schemes for setting reset password page
|
JavaScript
|
mit
|
wistityhq/strapi,wistityhq/strapi
|
77aa85536f93aea8caeb48b7008665ab1477d1c3
|
src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/cell/select-cell.js
|
src/Oro/Bundle/DataGridBundle/Resources/public/js/datagrid/cell/select-cell.js
|
define([
'underscore',
'backgrid',
'orodatagrid/js/datagrid/editor/select-cell-radio-editor'
], function(_, Backgrid, SelectCellRadioEditor) {
'use strict';
var SelectCell;
/**
* Select column cell. Added missing behaviour.
*
* @export oro/datagrid/cell/select-cell
* @class oro.datagrid.cell.SelectCell
* @extends Backgrid.SelectCell
*/
SelectCell = Backgrid.SelectCell.extend({
/**
* @inheritDoc
*/
initialize: function(options) {
if (this.expanded && !this.multiple) {
this.editor = SelectCellRadioEditor;
}
if (options.column.get('metadata').choices) {
this.optionValues = [];
_.each(options.column.get('metadata').choices, function(value, key) {
this.optionValues.push([value, key]);
}, this);
} else {
throw new Error('Column metadata must have choices specified');
}
SelectCell.__super__.initialize.apply(this, arguments);
}
});
return SelectCell;
});
|
define([
'underscore',
'backgrid',
'orodatagrid/js/datagrid/editor/select-cell-radio-editor'
], function(_, Backgrid, SelectCellRadioEditor) {
'use strict';
var SelectCell;
/**
* Select column cell. Added missing behaviour.
*
* @export oro/datagrid/cell/select-cell
* @class oro.datagrid.cell.SelectCell
* @extends Backgrid.SelectCell
*/
SelectCell = Backgrid.SelectCell.extend({
/**
* @inheritDoc
*/
initialize: function(options) {
if (this.expanded && !this.multiple) {
this.editor = SelectCellRadioEditor;
}
if (options.column.get('metadata').choices) {
this.optionValues = [];
_.each(options.column.get('metadata').choices, function(value, key) {
this.optionValues.push([value, key]);
}, this);
} else {
throw new Error('Column metadata must have choices specified');
}
SelectCell.__super__.initialize.apply(this, arguments);
this.listenTo(this.model, 'change:' + this.column.get('name'), function() {
this.enterEditMode();
this.$el.find('select').uniform();
});
},
/**
* @inheritDoc
*/
render: function() {
var render = SelectCell.__super__.render.apply(this, arguments);
this.enterEditMode();
return render;
},
/**
* @inheritDoc
*/
enterEditMode: function() {
if (this.column.get('editable')) {
SelectCell.__super__.enterEditMode.apply(this, arguments);
}
},
/**
* @inheritDoc
*/
exitEditMode: function() {
this.$el.removeClass('error');
this.stopListening(this.currentEditor);
delete this.currentEditor;
}
});
return SelectCell;
});
|
Test and merge to master - revert select cell functionality
|
BB-1315: Test and merge to master
- revert select cell functionality
|
JavaScript
|
mit
|
ramunasd/platform,geoffroycochard/platform,trustify/oroplatform,Djamy/platform,trustify/oroplatform,orocrm/platform,orocrm/platform,trustify/oroplatform,ramunasd/platform,orocrm/platform,Djamy/platform,geoffroycochard/platform,Djamy/platform,geoffroycochard/platform,ramunasd/platform
|
5298747365e5ecc6c15a2e5582da48e76ed34a4c
|
src/TypeaheadContext.js
|
src/TypeaheadContext.js
|
import {noop, pick} from 'lodash';
import createReactContext from 'create-react-context';
import React from 'react';
const TypeaheadContext = createReactContext({
activeIndex: -1,
hintText: '',
initialItem: null,
isOnlyResult: false,
onActiveItemChange: noop,
onAdd: noop,
onInitialItemChange: noop,
onMenuItemClick: noop,
selectHintOnEnter: false,
});
export const withContext = (Component, values) => (props) => (
<TypeaheadContext.Consumer>
{(context) => <Component {...props} {...pick(context, values)} />}
</TypeaheadContext.Consumer>
);
export default TypeaheadContext;
|
import {noop, pick} from 'lodash';
import createReactContext from 'create-react-context';
import React from 'react';
const TypeaheadContext = createReactContext({
activeIndex: -1,
hintText: '',
initialItem: null,
isOnlyResult: false,
onActiveItemChange: noop,
onAdd: noop,
onInitialItemChange: noop,
onMenuItemClick: noop,
selectHintOnEnter: false,
});
export const withContext = (Component, values) => {
// Note: Use a class instead of function component to support refs.
/* eslint-disable-next-line react/prefer-stateless-function */
return class extends React.Component {
render() {
return (
<TypeaheadContext.Consumer>
{(context) => (
<Component {...this.props} {...pick(context, values)} />
)}
</TypeaheadContext.Consumer>
);
}
};
};
export default TypeaheadContext;
|
Use class instead of stateless component in `withContext`
|
Use class instead of stateless component in `withContext`
|
JavaScript
|
mit
|
ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead,ericgio/react-bootstrap-typeahead
|
5f9a7836146062c94ce08b98db2705c2bab10e34
|
Kwf_js/Viewport.js
|
Kwf_js/Viewport.js
|
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
}
}, this);
return ret;
}
});
Kwf.Viewport = Ext2.extend(Kwf.ViewportWithoutMenu, {
initComponent: function()
{
Kwf.menu = Ext2.ComponentMgr.create({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.items.push({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.layout = 'border';
Kwf.Viewport.superclass.initComponent.call(this);
}
});
|
Kwf.ViewportWithoutMenu = Ext2.extend(Ext2.Viewport, {
layout: 'fit',
mabySubmit: function(cb, options) {
var ret = true;
this.items.each(function(i) {
if (i.mabySubmit && !i.mabySubmit(cb, options)) {
ret = false;
return false; //break each
}
}, this);
return ret;
}
});
Kwf.Viewport = Ext2.extend(Kwf.ViewportWithoutMenu, {
initComponent: function()
{
Kwf.menu = Ext2.ComponentMgr.create({
xtype: 'kwf.menu',
region: 'north',
height: 30
});
this.items.push(Kwf.menu);
this.layout = 'border';
Kwf.Viewport.superclass.initComponent.call(this);
}
});
|
Fix Menu reload after re-login
|
Fix Menu reload after re-login
This bug existed for ages. After re-login there always was this 'this.tr is undefined' error.
Problem was that two menu objects where created and the one actually rendered was not set to Kwf.menu. That caused the reload for the wrong object.
|
JavaScript
|
bsd-2-clause
|
nsams/koala-framework,koala-framework/koala-framework,kaufmo/koala-framework,kaufmo/koala-framework,koala-framework/koala-framework,kaufmo/koala-framework,nsams/koala-framework,nsams/koala-framework
|
3ce6ed46cb1da34e631abc6bda5fd9f15ae4f53a
|
html/main.js
|
html/main.js
|
var ProtoBuf = dcodeIO.ProtoBuf;
var Builder = ProtoBuf.loadProtoFile("proto/ClientMessage.proto");
ProtoBuf.loadProtoFile("proto/Login.proto", Builder);
var Message = Builder.build("msg");
var ClientMessage = Message.ClientMessage;
var LoginMessage = Message.Login;
var loginMsg = new LoginMessage("integr@gmail.com","secret");
var clientMsg = new ClientMessage({
"msgType" : "LoginType",
"login":{
"email":"integr@gmail.com", "password":"secret"}});
var ws;
window.onload=function(){
ws=new WebSocket("ws://localhost:8080/index");
ws.onmessage = function(evt) {
console.log(evt.data);
var loginFormSection = document.getElementById("loginFormSection");
if(evt.data == "AUTHPLS") {
loginFormSection.style.display = "block";
}
if(evt.data == "AUTHOKTHX") {
loginFormSection.style.display = "none";
document.getElementById("portal").style.display = "block";
}
};
ws.onopen=function(evt){
// ws.send("Hello");
ws.send(clientMsg.toArrayBuffer());
};
};
window.onclose=function(){
ws.close();
};
function loginSubmitEvent () {
var email = document.getElementById("loginEmail").value;
var password = document.getElementById("loginPassword").value;
ws.send(email + ":" + password);
}
|
var ProtoBuf = dcodeIO.ProtoBuf;
var Builder = ProtoBuf.loadProtoFile("proto/ClientMessage.proto");
ProtoBuf.loadProtoFile("proto/Login.proto", Builder);
var Message = Builder.build("msg");
var ClientMessage = Message.ClientMessage;
var LoginMessage = Message.Login;
var loginMsg = new LoginMessage("integr@gmail.com","secret");
var clientMsg = new ClientMessage({
"msgType" : "LoginType",
"login":{
"email":"integr@gmail.com", "password":"secret"}});
var ws;
window.onload=function(){
ws=new WebSocket("ws://localhost:8080/index");
ws.onmessage = function(evt) {
console.log(evt.data);
var loginFormSection = document.getElementById("loginFormSection");
if(evt.data == "AUTHPLS") {
loginFormSection.style.display = "block";
}
if(evt.data == "AUTHOKTHX") {
loginFormSection.style.display = "none";
document.getElementById("portal").style.display = "block";
}
};
ws.onopen=function(evt){
// ws.send("Hello");
for(i = 0; i < 1000; i++) {
ws.send(clientMsg.toArrayBuffer());
}
};
};
window.onclose=function(){
ws.close();
};
function loginSubmitEvent () {
var email = document.getElementById("loginEmail").value;
var password = document.getElementById("loginPassword").value;
ws.send(email + ":" + password);
}
|
Send 1k messages on startup for testing.
|
Send 1k messages on startup for testing.
|
JavaScript
|
mit
|
mjgerdes/cg,mjgerdes/cg,mjgerdes/cg,mjgerdes/cg
|
d7505d1c5497192c8768bf5da3a0f8d585717241
|
src/server/db/mongoHelper.js
|
src/server/db/mongoHelper.js
|
const mongoose = require('mongoose');
const Grid = require('gridfs-stream');
const mongoURI = process.env.MONGODB_URI || process.env.MONGOHQ_URL;
mongoose.Promise = Promise;
mongoose.connect(mongoURI, { useMongoClient: true });
const mongoHelper = {
init() {
const connection = mongoose.createConnection(mongoURI, { useMongoClient: true });
connection.once('open', () => {
mongoHelper.gridfs = Grid(connection.db, mongoose.mongo);
});
},
gridfs: undefined,
};
module.exports = mongoHelper;
|
const mongoose = require('mongoose');
const Grid = require('gridfs-stream');
const mongoURI = process.env.MONGODB_URI || process.env.MONGOHQ_URL;
mongoose.Promise = Promise;
mongoose.connect(mongoURI);
const mongoHelper = {
init() {
const connection = mongoose.createConnection(mongoURI);
connection.once('open', () => {
mongoHelper.gridfs = Grid(connection.db, mongoose.mongo);
});
},
gridfs: undefined,
};
module.exports = mongoHelper;
|
Revert "fix deprecated mongoose methods"
|
Revert "fix deprecated mongoose methods"
This reverts commit 4dce797
|
JavaScript
|
mit
|
r3dDoX/geekplanet,r3dDoX/geekplanet,r3dDoX/geekplanet
|
f69040c9d2b21491e33a9676a68ce20d97787ab4
|
test/load.js
|
test/load.js
|
process.env.TZ = "America/Los_Angeles";
var smash = require("smash"),
jsdom = require("jsdom");
require("./XMLHttpRequest");
module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
sandbox = null;
files.unshift("src/start");
files.push("src/end");
function topic() {
smash.load(files, expression, sandbox, this.callback);
}
topic.expression = function(_) {
expression = _;
return topic;
};
topic.document = function(_) {
var document = jsdom.jsdom("<html><head></head><body></body></html>");
// Monkey-patch createRange support to JSDOM.
document.createRange = function() {
return {
selectNode: function() {},
createContextualFragment: jsdom.jsdom
};
};
sandbox = {
console: console,
XMLHttpRequest: XMLHttpRequest,
document: document,
window: document.createWindow(),
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Date: Date // so we can override Date.now in tests
};
return topic;
};
return topic;
};
process.on("uncaughtException", function(e) {
console.trace(e.stack);
});
|
process.env.TZ = "America/Los_Angeles";
var smash = require("smash"),
jsdom = require("jsdom");
require("./XMLHttpRequest");
module.exports = function() {
var files = [].slice.call(arguments).map(function(d) { return "src/" + d; }),
expression = "d3",
sandbox = {Date: Date}; // so we can use deepEqual in tests
files.unshift("src/start");
files.push("src/end");
function topic() {
smash.load(files, expression, sandbox, this.callback);
}
topic.expression = function(_) {
expression = _;
return topic;
};
topic.document = function(_) {
var document = jsdom.jsdom("<html><head></head><body></body></html>");
// Monkey-patch createRange support to JSDOM.
document.createRange = function() {
return {
selectNode: function() {},
createContextualFragment: jsdom.jsdom
};
};
sandbox = {
console: console,
XMLHttpRequest: XMLHttpRequest,
document: document,
window: document.createWindow(),
setTimeout: setTimeout,
clearTimeout: clearTimeout,
Date: Date // so we can override Date.now in tests, and use deepEqual
};
return topic;
};
return topic;
};
process.on("uncaughtException", function(e) {
console.trace(e.stack);
});
|
Fix time tests by adding Date to sandbox.
|
Fix time tests by adding Date to sandbox.
Since tests are now run in their own sandbox, assert.deepEqual was not
properly testing the returned Date objects for equality, as they weren't
instances of the same Date class used by the test itself, causing type
inference to fail. It was always returning true, even for different
dates.
|
JavaScript
|
bsd-3-clause
|
josealbertohm/d3,nishant8BITS/d3,Limky/d3,Jonathan-S-Phillips/d3,welloncn/d3,azilnoor/d3,mujiatong/d3,lijanele/d3,xiaojie123/d3,Sigfried/d3,madlen99/d3,jordancheah/d3,pradeeptas/d3,ornelaxh/d3,zhoux10/d3,Vardhan17/d3,zzzzw/d3,makenti/d3,Ali925/d3,aihua/d3,ishang27/d3,li0t/d3,nicgallardo/d3,mountwe/d34kpor,w124384389/d3,clarinete/d3,supriyantomaftuh/d3,ABaldwinHunter/d3,liang42hao/d3,kewal07/d3,whoinlee/d3,CallAnotherBarry/d3,burakkp/d3,kpcorda/d3,fsaglam2002/d3,ThinkedCoder/d3,abhuzz/d3,mainelander/d3,lunyang/d3,ssrx17/d3,Eric-Zhong/d3,atsolakid/d3,nonconforme/d3,lauraweaver/d3,idkwim/d3,angeliaz/d3,s-a-r-id/d3,JunichiWatanuki/d3,bestwpw/d3,christianevans214/d3,tempbottle/d3,standino/go-easy-portal,larskris/d3,kjeldandersen/d3,codingang/d3-1,charlesDADI/d3,danforthdesign/d3,geoff111/d3,s-a-r-id/d3,ZhuLiangwh/d3,roma07/d3,n1n9-jp/d3,aljachimiak/d3,nitishmadhukar/d3,aluck19/d3,house-fiction/d3,sk187/d3,yuanzhiqian/d3,jessiejea/d3,fredlang/d3,hqren/d3,smartinsantos/d3,MeganBeneteau/d3,RacingTadpole/d3,HardlyHaki/d3,lihanhui/d3,Petah/d3,dbirchak/d3,agarbuno/d3,okierie/d3,kaijie/d3,keyanzhang/d3,halcyonstar/d3,marianbida/d3,evdevgit/d3,vp2177/d3,buzybee83/d3,fatmazaman/d3,Petermuturi/d3,ABaldwinHunter/d3-classic,humanrelationships/d3,AromaR/d3,lukeskip/d3,cbtpro/d3,house-fiction/d3,supriyantomaftuh/d3,wangjun/d3,reynoldqi/TestFirst,ammula88/d3,sajeetharan/d3,Hbl15/d3,Ahmad-Hilali/d3,shaximinion/d3,DagoCIMA/Prueba1,kyroskoh/d3,berlynhubler/d3,keyanzhang/d3,Hbl15/d3,johnnyg3p/d3,ammula88/d3,ishang27/d3,leeleo26/d3,yuhualingfeng/d3,emirhartato/d3,kidaa/d3,wallmarkets/d3,jakimhartford/d3,stity/d3,radovanx/d3,nicksrandall/d3,kyoungchinseo/d3,GibbleBots/d3,xujie-nm/d3,npmcomponent/mbostock-d3,makenti/d3,hillaryskye/d3,behzad88/d3,AromaR/d3,AndBicScadMedia/d3,xiaochen0620/d3,hgarnelo/d3,anusornc/d3,markpj1/d3,Limky/d3,dongnhut/d3,ilovezy/d3,jessiejea/d3,trinath3/d3,ayshaabbas/d3,mountwe/d34kpor,johnochs/d3,radovanx/d3,JungMinu/d3,Acker2015/d3,allenjin/d3,8DTechnologies/d3,nbende/d3,burakkp/d3,ilo10/d3,Jonham/d3,onlyyouandty/d3,lypzln/d3,triggerThis/d3,ralic/d3,leohmoraes/d3,studiowangfei/d3,AlpinHologramm/d3,mendax-grip/d3,Teino1978-Corp/Teino1978-Corp-d3,woshiniuren/d3,smartpcr/d3,joehannes-libs/d3,liang42hao/d3,evdevgit/d3,chaoallsome/d3,salambolog/d3,tempbottle/d3,Sachin-Ganesh/d3,onlyyouandty/d3,okierie/d3,Henrilin28/d3,fatmazaman/d3,HomeMango/d3,Ali925/d3,XueQian/d3,nitishmadhukar/d3,UpstatePedro/d3,m-br/d3,iamcap/d3,Shuffguy/d3,VirosaLi/d3,guangyue/d3,mlawry/d3,nheinzer1210/d3,reiaaoyama/d3,batnasan06/d3,UmarMughal/d3,gyenumula/d3,Ahmad-Hilali/d3,nishant8BITS/d3,moodboom/d3,youprofit/d3,aihua/d3,edktsnr/d3,supzann3/d3,KevinMarkVI/d3,Petermuturi/d3,nirajvora/d3,JeebsM/d3,nbende/d3,1174751315/d3,ananya77041/d3,mssjtxwd/d3,guangyue/d3,Shuffguy/d3,2947721120/redolent-hockeypuck,mingyaaaa/d3,emmanuelq2/d3,MilkXin/dingTalk,monoc44/d3,UpstatePedro/d3,latur19318/d3,2947721120/redolent-hockeypuck,chenflat/d3,boshika/d3,peterwu8/d3,allenjin/d3,gorcz/d3,UmarMughal/d3,itxd/d3,xuzhaokui/d3,monoc44/d3,larskris/d3,taylorhxu/d3,salamer/d3,aigouzz/d3,qodbtn41/d3,JungMinu/d3,VirosaLi/d3,Simon-Lau/d3,juliaty/d3,moodboom/d3,nilqed/d3,eaglesjava/d3,leitzler/d3,smartpcr/d3,jordancheah/d3,ABaldwinHunter/d3,Eric-Zhong/d3,FangMath/d3,fredlang/d3,ilovezy/d3,patrickkillalea/d3,macressler/d3,kiwizhang/d3,chenflat/d3,maureenwaitherero/d3,MartinDavila/d3,macressler/d3,lukeskip/d3,hqren/d3,kx1911/d3,gorcz/d3,jakimhartford/d3,lovewitty/d3,sigma-random/d3,3mao/d3,RCGTDev/d3,shashi-dokania/d3,polzak/d3,folpindo/d3,LikeGit-2013/d3,JoaquinSiabra/d3,marianbida/d3,kaijie/d3,emmanuelq2/d3,trankmichael/d3,Wombatpm/d3,sunios/d3,awdesch/d3,imshibaji/d3,chiu/d3,LikeGit-2013/d3,emirhartato/d3,rlugojr/d3,supzann3/d3,Lchchen/d3,wallmarkets/d3,amccartney/d3,Sachin-Ganesh/d3,ansjcy/d3,chewett/d3,kitlomerc/d3,FredrikAhlberg/IconLiveD3.js,DataVizApril/d3,stefwalter/d3,darshanhs90/d3,erhanBLC/d3,zicouser/d3,fsaglam2002/d3,mattcale7/d3,studiowangfei/d3,lauraweaver/d3,markengelstad/d3,madlen99/d3,teefresh/d3,ansjcy/d3,vp2177/d3,cool-Blue/d3,amccartney/d3,suezse/d3,aaron-goshine/d3,anant10/dinto,sysexits/d3,aleksa000777/d3,mhsmith/d3,nicksrandall/d3,li0t/d3,smartinsantos/d3,MartinDavila/d3,alex-zhang/d3,Jonekee/d3,christianevans214/d3,JoaquinSiabra/d3,rubenv/d3,Simon-Lau/d3,oanaradulescu/d3,boshika/d3,XiqianZ/d3,joycedelatorre/d3,excelwang/d3,chaoallsome/d3,clayzermk1/d3,MeganBeneteau/d3,trinath3/d3,jeanpan/d3,ZhuLiangwh/d3,datawrapper/d3-light,imshibaji/d3,3mao/d3,chen-ben/d3,johnochs/d3,2947721120/squealing-octo-capsicum,alexgarciac/d3,forkmsrini/d3,quevedin/d3,n1n9-jp/d3,xc145214/d3,tessafallon/nypl-pg,jsan4christ/d3,yuanzhiqian/d3,bestwpw/d3,10000TB/d3,welloncn/d3,Tinysymphony/d3,CrandellWS/d3,uetsujitomoya/d3,dongnhut/d3,dogobox/d3,ayadoguchi/d3_practice,kevinresol/d3,CallAnotherBarry/d3,kx1911/d3,nheinzer1210/d3,dushmis/d3,caseytrombley/d3,10000TB/d3,kingland/d3,Acker2015/d3,hyrole/d3,xuzhaokui/d3,oanaradulescu/d3,kpcorda/d3,joycedelatorre/d3,iyogeshjoshi/d3,sysexits/d3,danforthdesign/d3,abhuzz/d3,suezse/d3,hillaryskye/d3,Petah/d3,mssjtxwd/d3,kitlomerc/d3,matheosu/d3,FangMath/d3,salamer/d3,ClaireRutkoske/d3,GibbleBots/d3,lrinili/d3,abgaryanharutyun/d3,darshanhs90/d3,iorikiir/d3,datawrapper/d3-light,angeliaz/d3,ChaofengZhou/d3,alex-zhang/d3,DagoCIMA/Prueba1,ykominami/d3,littlstar/d3,awdesch/d3,2947721120/squealing-octo-capsicum,xujie-nm/d3,nirajvora/d3,kyoungchinseo/d3,caseytrombley/d3,lunyang/d3,batnasan06/d3,dieface/d3,jsan4christ/d3,elpoisterio/d3,ssrx17/d3,krystism/d3,Ossehoht/d3,hkjels/d3,elpoisterio/d3,roma07/d3,kjeldandersen/d3,larskotthoff/d3,iyogeshjoshi/d3,mssyogi/d3,aleksa000777/d3,kennethd/d3,littlstar/d3,ABaldwinHunter/d3-classic,manashmndl/d3,amorwilliams/d3,idkwim/d3,leeleo26/d3,bqevin/d3,kbarnhart/d3,jeanpan/d3,mlawry/d3,1174751315/d3,navjotahuja92/d3,okcd00/d3,aigouzz/d3,datawrapper/d3-light,davidvmckay/d3,buzybee83/d3,KevinMarkVI/d3,woshiniuren/d3,fsanchezro/d3,rohittiwarirvt/d3,wangjun/d3,zicouser/d3,leohmoraes/d3,elkingtonmcb/d3,elancom/d3,uetsujitomoya/d3,julialintern/d3,latur19318/d3,danbwhiting/d3,Jonham/d3,Jonathan-S-Phillips/d3,chen-ben/d3,Naomifh/moboshock,nilqed/d3,kyroskoh/d3,nirmalks/d3,josealbertohm/d3,hyrole/d3,itxd/d3,ee08b397/d3,diazmartin/d3,mssyogi/d3,18Shubhamgupta/d3,codingang/d3-1,amorwilliams/d3,xc145214/d3,overmind1980/d3,bsipocz/d3,folpindo/d3,danbwhiting/d3,Lyoneidas/d3,jamesgarfield/d3,teefresh/d3,salambolog/d3,Jonekee/d3,witcxc/d3,Jai-Chaudhary/d3,alexgarciac/d3,okcd00/d3,aljachimiak/d3,whoinlee/d3,18Shubhamgupta/d3,standino/go-easy-portal,standino/go-easy-portal,d3/d3,halcyonstar/d3,lovewitty/d3,AndBicScadMedia/d3,Lyoneidas/d3,leitzler/d3,AlpinHologramm/d3,cool-Blue/d3,mattcale7/d3,jamesblunt/d3,aluck19/d3,DataVizApril/d3,ornelaxh/d3,mayblue9/d3,alex179ohm/d3,joehannes-libs/d3,sigma-random/d3,SystemicEmotions/d3,elkingtonmcb/d3,kevinresol/d3,larskotthoff/d3,kewal07/d3,sk187/d3,XueQian/d3,clarinete/d3,yuhualingfeng/d3,Sigfried/d3,qqqlllyyyy/d3,alex179ohm/d3,ThinkedCoder/d3,qodbtn41/d3,ee08b397/d3,diazmartin/d3,atsolakid/d3,stefanom/d3,patrickkillalea/d3,esparza83/d3,kaktus40/d3,julialintern/d3,standino/go-easy-portal,stefwalter/d3,youprofit/d3,hubandbob/d3,zhoux10/d3,kennethd/d3,edktsnr/d3,JunichiWatanuki/d3,jamesgarfield/d3,shaximinion/d3,ferrero-zhang/d3,omarbenites/d3,mainelander/d3,zzzzw/d3,nicgallardo/d3,Teino1978-Corp/Teino1978-Corp-d3,JeebsM/d3,SystemicEmotions/d3,RCGTDev/d3,ClaireRutkoske/d3,quevedin/d3,rubenv/d3,m4s0/d3,sunios/d3,dogobox/d3,v11yu/d3,ptkeller/d3,omarbenites/d3,kidaa/d3,HardlyHaki/d3,dbirchak/d3,manashmndl/d3,polzak/d3,markpj1/d3,ayshaabbas/d3,azilnoor/d3,KehindeAyanleye/d3,kbarnhart/d3,nirmalks/d3,jling90/d3,berlynhubler/d3,reynoldqi/TestFirst,mingyaaaa/d3,krystism/d3,nonconforme/d3,overmind1980/d3,geoff111/d3,mhsmith/d3,juliaty/d3,abgaryanharutyun/d3,Tinysymphony/d3,pradeeptas/d3,clayzermk1/d3,m4s0/d3,mayblue9/d3,xiaojie123/d3,anant10/dinto,bqevin/d3,hgarnelo/d3,esparza83/d3,lypzln/d3,vinicius5581/d3,sajeetharan/d3,stefanom/d3,dieface/d3,maureenwaitherero/d3,trankmichael/d3,lijanele/d3,ralic/d3,hkjels/d3,shashi-dokania/d3,v11yu/d3,Lchchen/d3,aaronhoffman/d3,hubandbob/d3,qqqlllyyyy/d3,vinicius5581/d3,Yelp/d3,lihanhui/d3,matheosu/d3,ferrero-zhang/d3,bsipocz/d3,rohittiwarirvt/d3,fsanchezro/d3,reiaaoyama/d3,staceb/d3,jamesblunt/d3,402332509/d3,Vardhan17/d3,jling90/d3,Genie77998/d3,taylorhxu/d3,ChaofengZhou/d3,triggerThis/d3,ptkeller/d3,peterwu8/d3,elancom/d3,anusornc/d3,markengelstad/d3,futuraprime/d3,XiqianZ/d3,Ossehoht/d3,xudongcamsys/d3,Genie77998/d3,ykominami/d3,mujiatong/d3,402332509/d3,iorikiir/d3,CrandellWS/d3,KehindeAyanleye/d3,futuraprime/d3,stity/d3,w124384389/d3,forkmsrini/d3,behzad88/d3,kiwizhang/d3,DaEunPark/d3,excelwang/d3,lrinili/d3,ananya77041/d3,cbtpro/d3,gyenumula/d3,tessafallon/nypl-pg,8DTechnologies/d3,HomeMango/d3,tessafallon/nypl-pg,xiaochen0620/d3,charlesDADI/d3,m-br/d3,chiu/d3,ilo10/d3,mendax-grip/d3,johnnyg3p/d3,suryasingh/d3
|
3425cb4aedf0a0c2160ea63f550bfd0f0de6d19d
|
ghost/admin/routes/editor.js
|
ghost/admin/routes/editor.js
|
import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var EditorRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['editor'],
controllerName: 'posts.post',
model: function (params) {
return this.store.find('post', params.post_id);
}
});
export default EditorRoute;
|
import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var EditorRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['editor'],
controllerName: 'posts.post',
model: function (params) {
var post = this.store.getById('post', params.post_id);
if (post) {
return post;
}
return this.store.filter('post', { status: 'all' }, function (post) {
return post.get('id') === params.post_id;
}).then(function (records) {
return records.get('firstObject');
});
}
});
export default EditorRoute;
|
Fix Editor/:postId 404 on draft
|
Fix Editor/:postId 404 on draft
closes #2857
- in EditorRoute, get model from the datastore if it's there
- if page is refreshed, get model from `/posts` API with `{status: 'all'}`
|
JavaScript
|
mit
|
TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost
|
116808327ac226934af7cd48ac8336d16e602af7
|
addon/mixins/component-lookup-mixin.js
|
addon/mixins/component-lookup-mixin.js
|
import Ember from 'ember';
export default Ember.Mixin.create({
componentFor(name, owner) {
let component = this._super(name, owner);
// Ensure components are always managed my the container and thus have a connection to their styles
if (!component) {
owner.register(`component:${name}`, Ember.Component);
component = this._super(name, owner);
}
return component;
}
});
|
import Ember from 'ember';
export default Ember.Mixin.create({
componentFor(name, owner) {
let component = this._super(name, owner);
// Ensure components are always managed my the container and thus have a connection to their styles
if (!component) {
if (owner.register) {
owner.register(`component:${name}`, Ember.Component);
} else {
owner._registry.register(`component:${name}`, Ember.Component); // Support for Ember 2.0.X
}
component = this._super(name, owner);
}
return component;
}
});
|
Fix error in Ember 2.0
|
Fix error in Ember 2.0
|
JavaScript
|
mit
|
salsify/ember-css-modules,salsify/ember-css-modules
|
49d0f365e0a2da4ab9ba2c571806229052a8cc83
|
app/webpack/entities/circleBurger/Door.js
|
app/webpack/entities/circleBurger/Door.js
|
import NormalDoor from 'entities/Door';
import state from 'state';
import finish from 'finish';
import action from 'action';
import { changeScene } from 'currentScene';
import entrance from 'scenes/circleBurger/entrance';
export default class Door extends NormalDoor {
actions() {
return [
action(this.actionName, () => {
changeScene(this.destination);
state.currentTime.add(Math.floor((Math.random() * 5) + 1), 'minutes');
}),
action("Lock the door. (This ends the game. You can't go back.)", () => {
state.doorLocked = true;
if (this.destination === entrance) {
state.lockedIn = true;
}
if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
state.closedEarly = true;
}
if (state.currentTime.isAfter(
state.closingTime.clone().add(1, 'hour')
)) {
state.closedLate = true;
}
finish();
})
];
}
};
|
import NormalDoor from 'entities/Door';
import state from 'state';
import finish from 'finish';
import action from 'action';
import { changeScene } from 'currentScene';
import entrance from 'scenes/circleBurger/entrance';
export default class Door extends NormalDoor {
actions() {
return [
action(this.actionName, () => {
changeScene(this.destination);
state.currentTime.add(Math.floor((Math.random() * 5) + 1), 'minutes');
}),
action("Lock the door. (This ends the game. You can't go back.)", () => {
if(confirm("Closing the Circle Burger ends the day.\n\nAre you sure you've done enough to keep your job?")) {
state.doorLocked = true;
if (this.destination === entrance) {
state.lockedIn = true;
}
if (state.currentTime.isBefore(state.closingTime.clone().subtract(5, 'minutes'))) {
state.closedEarly = true;
}
if (state.currentTime.isAfter(
state.closingTime.clone().add(1, 'hour')
)) {
state.closedLate = true;
}
finish();
}
})
];
}
};
|
Add confirm on end game door
|
Add confirm on end game door
|
JavaScript
|
mit
|
TEAMBUTT/LD35
|
a5d2080045c34b23e53b3da5798b806293cd4d9b
|
core/app/assets/javascripts/backbone/views/fact_relation_view.js
|
core/app/assets/javascripts/backbone/views/fact_relation_view.js
|
window.FactRelationView = Backbone.View.extend({
tagName: "li",
className: "fact-relation",
events: {
"click .relation-actions>.weakening": "disbelieveFactRelation",
"click .relation-actions>.supporting": "believeFactRelation"
},
initialize: function() {
this.useTemplate('fact_relations','fact_relation');
this.model.bind('destroy', this.remove, this);
this.model.bind('change', this.render, this);
},
remove: function() {
this.$el.fadeOut('fast', function() {
this.$el.remove();
});
},
render: function() {
this.$el.html(Mustache.to_html(this.tmpl, this.model.toJSON(), this.partials)).factlink();
$('a.supporting',this.$el).tooltip({'title':"This is relevant"});
$('a.weakening',this.$el).tooltip({'title':"This is not relevant", 'placement':'bottom'});
return this;
},
disbelieveFactRelation: function() {
this.model.disbelieve();
},
believeFactRelation: function() {
this.model.believe();
},
highlight: function() {
var self = this;
self.$el.animate({"background-color": "#ffffe1"}, {duration: 2000, complete: function() {
$(this).animate({"background-color": "#ffffff"}, 2000);
}});
}
});
|
window.FactRelationView = Backbone.View.extend({
tagName: "li",
className: "fact-relation",
events: {
"click .relation-actions>.weakening": "disbelieveFactRelation",
"click .relation-actions>.supporting": "believeFactRelation"
},
initialize: function() {
this.useTemplate('fact_relations','fact_relation');
this.model.bind('destroy', this.remove, this);
this.model.bind('change', this.render, this);
},
remove: function() {
this.$el.fadeOut('fast', function() {
this.$el.remove();
});
},
render: function() {
$('a.weakening',this.$el).tooltip('hide');
$('a.supporting',this.$el).tooltip('hide');
this.$el.html(Mustache.to_html(this.tmpl, this.model.toJSON(), this.partials)).factlink();
$('a.supporting',this.$el).tooltip({'title':"This is relevant"});
$('a.weakening',this.$el).tooltip({'title':"This is not relevant", 'placement':'bottom'});
return this;
},
disbelieveFactRelation: function() {
this.model.disbelieve();
},
believeFactRelation: function() {
this.model.believe();
},
highlight: function() {
var self = this;
self.$el.animate({"background-color": "#ffffe1"}, {duration: 2000, complete: function() {
$(this).animate({"background-color": "#ffffff"}, 2000);
}});
}
});
|
Make the tooltips hide when they are clicked.
|
Make the tooltips hide when they are clicked.
|
JavaScript
|
mit
|
daukantas/factlink-core,Factlink/factlink-core,daukantas/factlink-core,Factlink/factlink-core,Factlink/factlink-core,Factlink/factlink-core,daukantas/factlink-core,daukantas/factlink-core
|
c1c138acb4026af9173008dbf037f97fe4f19b9e
|
src/AppBundle/Resources/assets/javascripts/sticky.js
|
src/AppBundle/Resources/assets/javascripts/sticky.js
|
/*jshint browser: true */
(function () {
"use strict";
var root = this,
$ = root.jQuery,
body = $('body');
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }
var StickyHeader = function(element) {
this.top = $(element).offset().top - 30;
this.addEventHandlers();
};
StickyHeader.prototype.addEventHandlers = function () {
this.windowScrollHandler = this.getWindowScrollEventHandler();
window.onscroll = this.windowScrollHandler;
};
StickyHeader.prototype.getWindowScrollEventHandler = function () {
return function (e) {
this.handleWindowScroll($(e.target));
}.bind(this);
};
StickyHeader.prototype.handleWindowScroll = function () {
if (window.pageYOffset >= this.top) {
body.addClass('fixed');
} else {
body.removeClass('fixed');
}
};
root.GOVUK.StickyHeader = StickyHeader;
}).call(this);
|
/*jshint browser: true */
(function () {
"use strict";
var root = this,
$ = root.jQuery,
body = $('body'),
mobileSafari = navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/);
if (typeof GOVUK === 'undefined') { root.GOVUK = {}; }
var StickyHeader = function(element) {
this.wrapper = $(element);
this.top = $(element).offset().top - 30;
this.addEventHandlers();
};
StickyHeader.prototype.addEventHandlers = function () {
this.windowScrollHandler = this.getWindowScrollEventHandler();
document.addEventListener("scroll", this.windowScrollHandler, false);
};
StickyHeader.prototype.getWindowScrollEventHandler = function () {
return function (e) {
this.handleWindowScroll($(e.target));
}.bind(this);
};
StickyHeader.prototype.handleWindowScroll = function () {
if (window.pageYOffset >= this.top) {
body.addClass('fixed');
// Mobile safari hides fixed elements when the keyboard is shown so use
// absolute instead.
if (mobileSafari) {
this.wrapper.css({
position: 'absolute',
top: window.pageYOffset + 'px',
left: 0
});
}
} else {
body.removeClass('fixed');
if (mobileSafari) {
this.wrapper.css({
position: 'static'
});
}
}
};
root.GOVUK.StickyHeader = StickyHeader;
}).call(this);
|
Fix issue with Safari on IOS which caused the title to be hidden when entering data.
|
Fix issue with Safari on IOS which caused the title to be hidden when entering data.
|
JavaScript
|
mit
|
ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client,ministryofjustice/opg-digi-deps-client
|
222bf732b58e1f12b78c0c3aa2671d8993be8908
|
http/assets/js/aside-menu.js
|
http/assets/js/aside-menu.js
|
'use strict';
/**
* Open and close button for aside-menu
*/
$('show-aside-button').addEvent('click', function (event) {
// Get the aside current margin-left as integer
var asideMargin = parseInt($('aside-menu').getStyle('margin-left'));
/**
* Change aside margin to show or hide it
*/
$('aside-menu').setStyle(
'margin-left',
asideMargin === 0 ? '-18rem' : '0rem'
);
/**
* Change content width do adjust to fit on the side of aside
*/
$('content').setStyle(
'width',
asideMargin === 0 ? '100%' : 'calc(100% - 17rem)'
);
});
|
'use strict';
/**
* Change aside margin to show it
* Change content width do adjust to fit on the side of aside
*/
var showAside = (function() {
$('aside-menu').setStyle('margin-left', '0rem');
$('content').setStyle('width', 'calc(100% - 17rem)');
});
/**
* Change aside margin to hide it
* Change content width do adjust to fit on the side of aside
*/
var hideAside = (function() {
$('aside-menu').setStyle('margin-left', '-18rem');
$('content').setStyle('width', '100%');
});
/**
* Open and close button for aside-menu
*/
$('show-aside-button').addEvent('click', function (event) {
// Get the aside current margin-left as integer
var asideMargin = parseInt($('aside-menu').getStyle('margin-left'));
if (0 === asideMargin) {
hideAside();
return true;
}
showAside();
});
/**
* Catch all clicks on the content element, then check if we should close the
* aside or not.
*/
$('content').addEvent('click', function (event) {
var asideButtonVisible = $('show-aside-button').getStyle('display') === 'inline-block';
var asideVisible = parseInt($('aside-menu').getStyle('margin-left')) === 0;
if (false === asideButtonVisible && false === asideVisible) {
showAside();
}
if (true === asideButtonVisible && true === asideVisible) {
hideAside();
}
});
|
Refactor and other ways to close the aside
|
Refactor and other ways to close the aside
|
JavaScript
|
isc
|
etu/0bRSS,etu/0bRSS,etu/0bRSS
|
fa59afebde57aff27c919e65222815b6497db8da
|
hyp-content-for.js
|
hyp-content-for.js
|
angular.module("hypContentFor", [])
.constant("HYP_CONTENT_FOR_IDS", [ ])
.directive("content", function (HYP_CONTENT_FOR_IDS) {
return {
scope: { "for": "@" },
transclude: true,
controller: function ($scope, $transclude) {
HYP_CONTENT_FOR_IDS[$scope["for"]] = $transclude();
}
};
})
.directive("yield", function ($interval, HYP_CONTENT_FOR_IDS) {
return {
scope: { to: "@" },
link: function (scope, elem) {
interval = null;
repeatFn = function () {
content = HYP_CONTENT_FOR_IDS[scope.to];
if (content) {
$interval.cancel(interval);
} else {
return;
}
elem.replaceWith(content);
}
repeatFn();
interval = $interval(repeatFn, 100, 9);
}
};
});
|
angular.module("hypContentFor", [])
.value("HYP_CONTENT_FOR_IDS", { })
.directive("content", function () {
return {
scope: { "for": "@" },
transclude: true,
controller: function ($scope, $transclude, HYP_CONTENT_FOR_IDS) {
HYP_CONTENT_FOR_IDS[$scope["for"]] = $transclude();
}
};
})
.directive("yield", function ($interval, HYP_CONTENT_FOR_IDS) {
return {
scope: { to: "@" },
link: function (scope, elem) {
interval = null;
watchFn = function () { return HYP_CONTENT_FOR_IDS[scope.to]; };
scope.$watch(watchFn, function (newValue) {
elem.empty();
elem.append(newValue);
});
}
};
});
|
Watch for changes on HYP_CONTENT_FOR_IDS
|
Watch for changes on HYP_CONTENT_FOR_IDS
|
JavaScript
|
mit
|
hyperoslo/hyper-content-for-angular,hyperoslo/hyper-content-for-angular
|
0e6ba9a3d53ec694c565273c9560ecf77485c010
|
src/js/libs/load-new-data.js
|
src/js/libs/load-new-data.js
|
import getWeatherInfo from './get-weather-info';
import fetchRandomPhoto from './fetch-random-photo';
import { lessThanOneHourAgo, lessThan24HoursAgo } from './helpers';
/*
* Load the next image and update the weather
*/
const loadNewData = () => {
chrome.storage.sync.get('photoFrequency', result => {
const { photoFrequency } = result;
if (photoFrequency === 'newtab') {
fetchRandomPhoto();
return;
}
const nextImage = JSON.parse(localStorage.getItem('nextImage'));
if (
photoFrequency === 'everyhour' &&
!lessThanOneHourAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
return;
}
if (
photoFrequency === 'everyday' &&
!lessThan24HoursAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
}
});
chrome.storage.local.get('forecast', result => {
const { forecast } = result;
chrome.storage.sync.get('coords', d => {
const { coords } = d;
if (!forecast && coords) {
getWeatherInfo();
return;
}
if (forecast) {
const { timestamp } = forecast;
if (timestamp) {
if (!lessThanOneHourAgo(timestamp)) {
getWeatherInfo();
}
}
}
});
});
};
export default loadNewData;
|
import getWeatherInfo from './get-weather-info';
import fetchRandomPhoto from './fetch-random-photo';
import { lessThanOneHourAgo, lessThan24HoursAgo } from './helpers';
/*
* Load the next image and update the weather
*/
const loadNewData = () => {
chrome.storage.sync.get('photoFrequency', result => {
const { photoFrequency } = result;
if (photoFrequency === 'newtab') {
fetchRandomPhoto();
return;
}
chrome.storage.local.get('nextImage', r => {
const { nextImage } = r;
if (
photoFrequency === 'everyhour' &&
!lessThanOneHourAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
return;
}
if (
photoFrequency === 'everyday' &&
!lessThan24HoursAgo(nextImage.timestamp)
) {
fetchRandomPhoto();
}
});
});
chrome.storage.local.get('forecast', result => {
const { forecast } = result;
chrome.storage.sync.get('coords', d => {
const { coords } = d;
if (!forecast && coords) {
getWeatherInfo();
return;
}
if (forecast) {
const { timestamp } = forecast;
if (timestamp) {
if (!lessThanOneHourAgo(timestamp)) {
getWeatherInfo();
}
}
}
});
});
};
export default loadNewData;
|
Change from local storage to chrome storage
|
Change from local storage to chrome storage
|
JavaScript
|
mit
|
ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos,ayoisaiah/stellar-photos
|
f2875d45257f892607df8a460b253cd35fb0900a
|
config/http-get-param-interceptor.js
|
config/http-get-param-interceptor.js
|
'use strict';
angular.module('gc.ngHttpGetParamInterceptor', [
'gc.utils'
]).factory('httpGetParamInterceptor', [
'utils',
function httpGetParamInterceptor(utils) {
function deleteUndefinedValues(obj) {
_.keys(obj).forEach(function(key) {
if (_.isUndefined(obj[key])) {
delete obj[key];
} else if (_.isObject(obj[key])) {
deleteUndefinedValues(obj[key]);
}
});
}
return {
request: function(config) {
// Manually build query params using custom logic because Angular and
// Rails do not handle nested query parameters in the same way
if (config.params) {
deleteUndefinedValues(config.params);
config.url = config.url + '?' + utils.param(config.params);
delete config.params;
}
return config;
}
};
}
]);
|
'use strict';
angular.module('gc.ngHttpGetParamInterceptor', [
'gc.utils'
]).factory('httpGetParamInterceptor', [
'utils',
function httpGetParamInterceptor(utils) {
return {
request: function(config) {
// Manually build query params using custom logic because Angular and
// Rails do not handle nested query parameters in the same way
if (config.params) {
config.url = config.url + '?' + utils.param(config.params);
delete config.params;
}
return config;
}
};
}
]);
|
Revert "delete undefined properties from http config params"
|
Revert "delete undefined properties from http config params"
This reverts commit f52b94743e6539bf8088e773310359762b3d9cb5.
|
JavaScript
|
mit
|
gocardless-ng/ng-gc-base-app-service
|
6cbcdd143c822b6edefc28d8d70f123b0c53ea6d
|
tasks/remark.js
|
tasks/remark.js
|
'use strict';
var remark = require('remark');
var engine = require('unified-engine');
module.exports = function(grunt) {
grunt.registerMultiTask('remark', 'Process markdown with remark', function() {
var done = this.async();
var globs = this.filesSrc;
var options = this.options({
processor: remark,
globs: globs,
extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
pluginPrefix: 'remark',
presetPrefix: 'remark-preset',
rcName: '.remarkrc',
packageField: 'remarkConfig',
ignoreName: '.remarkignore',
color: true
});
engine(options, function(err) {
if (err) grunt.fail.warn(err);
done();
});
});
};
|
'use strict';
var remark = require('remark');
var engine = require('unified-engine');
module.exports = function(grunt) {
grunt.registerMultiTask('remark', 'Process markdown with remark', function() {
var done = this.async();
var globs = this.filesSrc;
var options = this.options({
processor: remark,
globs: globs,
extensions: ['md', 'markdown', 'mkd', 'mkdn', 'mkdown'],
pluginPrefix: 'remark',
presetPrefix: 'remark-preset',
rcName: '.remarkrc',
packageField: 'remarkConfig',
ignoreName: '.remarkignore',
color: true
});
engine(options, function(err, status) {
if (err || status) grunt.fail.warn(err || 'Unsuccessful running');
done();
});
});
};
|
Allow failure based off run status
|
Allow failure based off run status
Add a default message when an error message is not passed
|
JavaScript
|
mit
|
ChristianMurphy/grunt-remark
|
7dbf771b1ce636ab3991458c955f7e34e6e2207f
|
app.js
|
app.js
|
/*!
* AllOrigins
* written by Gabriel Nunes <gabriel@multiverso.me>
* http://github.com/gnuns
*/
const express = require('express')
const {version} = require('./package.json')
const processRequest = require('./app/process-request')
// yep, global. it's ok
// https://softwareengineering.stackexchange.com/a/47926/289420
global.AO_VERSION = version
const app = express()
app.set('case sensitive routing', false)
app.disable('x-powered-by')
app.use(enableCORS)
app.all('/:format', processRequest)
function enableCORS (req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin || '*')
res.header('Access-Control-Allow-Credentials', true)
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PATCH, PUT, DELETE')
res.header('Via', `allOrigins v${version}`)
next()
}
module.exports = app
|
/*!
* AllOrigins
* written by Gabriel Nunes <gabriel@multiverso.me>
* http://github.com/gnuns
*/
const express = require('express')
const {version} = require('./package.json')
// yep, global. it's ok
// https://softwareengineering.stackexchange.com/a/47926/289420
global.AO_VERSION = version
const processRequest = require('./app/process-request')
const app = express()
app.set('case sensitive routing', false)
app.disable('x-powered-by')
app.use(enableCORS)
app.all('/:format', processRequest)
function enableCORS (req, res, next) {
res.header('Access-Control-Allow-Origin', req.headers.origin || '*')
res.header('Access-Control-Allow-Credentials', true)
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
res.header('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PATCH, PUT, DELETE')
res.header('Via', `allOrigins v${version}`)
next()
}
module.exports = app
|
Define AO_VERSION before require process-request
|
Define AO_VERSION before require process-request
|
JavaScript
|
mit
|
gnuns/AllOrigins
|
48c8c0d3ef20cfef5aeb946f89c09155804be4ed
|
app.js
|
app.js
|
RTC({
// use the public google stun servers :)
ice: [
{ url: 'stun1.l.google.com:19302' },
{ url: 'stun2.l.google.com:19302' },
{ url: 'stun3.l.google.com:19302' },
{ url: 'stun4.l.google.com:19302' }
],
// we want this to work on iOS as well so we will use
// the rtc-plugin-nicta-ios plugin so we can use the
// build.rtc.io to create a native iOS app
plugins: [ RTC.IOS ]
});
|
var conference = RTC({
// use the public google stun servers :)
ice: [
{ url: 'stun1.l.google.com:19302' },
{ url: 'stun2.l.google.com:19302' },
{ url: 'stun3.l.google.com:19302' },
{ url: 'stun4.l.google.com:19302' }
],
// we want this to work on iOS as well so we will use
// the rtc-plugin-nicta-ios plugin so we can use the
// build.rtc.io to create a native iOS app
plugins: [ RTC.IOS ]
});
|
Create a conference variable that can be played with by forkers
|
Create a conference variable that can be played with by forkers
|
JavaScript
|
mit
|
rtc-io/demo-helloworld,rtc-io/demo-helloworld,rtc-io/demo-helloworld
|
db0bcc505eaf95cae39d4dd0b2f7b39fc4e404c1
|
test/unit/GameOfLife.spec.js
|
test/unit/GameOfLife.spec.js
|
var ALIVE = "alive", DEAD = "dead";
function Cell(initialState) {
var state = initialState || DEAD;
return {
setNeighbours: function (neighbours) {
var nbAliveCells = 0;
neighbours.forEach(function(neighbor) {
if(neighbor.state === ALIVE) {
nbAliveCells += 1;
}
});
if(nbAliveCells < 2) {
state = DEAD;
}
},
get state() {
return state;
}
};
}
describe('Live cell', function () {
it('should die when it has fewer than two live neighbours', function () {
var cell = new Cell(ALIVE);
cell.setNeighbours([new Cell(ALIVE)]);
expect(cell.state).toBe(DEAD);
});
});
|
var GameOfLife = (function() {
var ALIVE = "alive", DEAD = "dead";
function Cell(initialState) {
var state = initialState || DEAD;
function getNumberOfAlive(neighbours) {
var nbAliveCells = 0;
neighbours.forEach(function (neighbor) {
if (neighbor.isAlive()) {
nbAliveCells += 1;
}
});
return nbAliveCells;
}
return {
setNeighbours: function (neighbours) {
if(getNumberOfAlive(neighbours) < 2) {
state = DEAD;
}
},
isAlive: function() {
return state === ALIVE;
}
};
}
function AliveCell() {
return new Cell(ALIVE);
}
function DeadCell() {
return new Cell(DEAD);
}
return {
AliveCell: AliveCell,
DeadCell: DeadCell
};
})();
describe('Live cell', function () {
it('should die when it has fewer than two live neighbours', function () {
var cell = new GameOfLife.AliveCell();
cell.setNeighbours([new GameOfLife.AliveCell()]);
expect(cell.isAlive()).toBe(false);
});
});
|
Refactor less than two neighbours then cell dies
|
Refactor less than two neighbours then cell dies
|
JavaScript
|
mit
|
velcrin/GameOfLife
|
76c051f0874c76671a33e8974a8e0e2c0cba3ec8
|
test/unit/controllersSpec.js
|
test/unit/controllersSpec.js
|
'use strict';
/* jasmine specs for controllers go here */
describe('RootCtrl', function(){
beforeEach(module('swiftBrowser.controllers'));
it('should list containers', inject(function($controller, $httpBackend) {
var containers = [
{"count": 10, "bytes": 1234, "name": "foo"},
{"count": 20, "bytes": 2345, "name": "bar"},
];
var scope = {};
$httpBackend.whenGET('/v1/AUTH_abc?format=json')
.respond(200, containers);
$controller('RootCtrl', {$scope: scope});
expect(scope.containers).toEqual([]);
$httpBackend.flush();
expect(scope.containers).toEqual(containers);
}));
it('should set sort order', inject(function($controller) {
var scope = {};
$controller('RootCtrl', {$scope: scope});
expect(scope.orderProp).toEqual('name');
}));
});
|
'use strict';
/* jasmine specs for controllers go here */
describe('RootCtrl', function(){
var scope;
beforeEach(module('swiftBrowser.controllers'));
beforeEach(inject(function($controller) {
scope = {};
$controller('RootCtrl', {$scope: scope});
}));
it('should list containers', inject(function($httpBackend) {
var containers = [
{"count": 10, "bytes": 1234, "name": "foo"},
{"count": 20, "bytes": 2345, "name": "bar"},
];
$httpBackend.whenGET('/v1/AUTH_abc?format=json')
.respond(200, containers);
expect(scope.containers).toEqual([]);
$httpBackend.flush();
expect(scope.containers).toEqual(containers);
}));
it('should set sort order', function() {
expect(scope.orderProp).toEqual('name');
});
});
|
Refactor common logic for setting up RootCtrl and scope
|
Refactor common logic for setting up RootCtrl and scope
|
JavaScript
|
apache-2.0
|
mgeisler/swift-browser,mindware/swift-browser,mgeisler/swift-browser,zerovm/swift-browser,mindware/swift-browser,zerovm/swift-browser
|
897f72d6c7d52abcdc8274756644fb7c217c3572
|
app/assets/javascripts/new_timeslot.js
|
app/assets/javascripts/new_timeslot.js
|
$(document).ready(function(){
$("#new-timeslot-form").submit(function(event){
event.preventDefault();
var data = createDate();
$("#modal_new_timeslot").modal('toggle');
$.ajax({
type: "POST",
url: "/api/timeslots",
data: { start: data }
}).done(function(response) {
swal({
title: "Great!",
text: "You have set up a tutoring availability!",
confirmButtonColor: "#66BB6A",
type: "success"
});
$('#tutor-cal').fullCalendar( 'refetchEvents' );
}).fail(function(response) {
swal({
title: "Oops...",
text: "Something went wrong!",
confirmButtonColor: "#EF5350",
type: "error"
});
});
})
})
var createDate = function() {
var date = $('.timepicker').val();
var time = $('.datepicker').val();
var dateTime = date + " " + time;
return (new Date(dateTime));
}
|
$(document).ready(function(){
$("#new-timeslot-form").submit(function(event){
event.preventDefault();
var data = createDate();
$("#modal_new_timeslot").modal('toggle');
$.ajax({
type: "POST",
url: "/api/timeslots",
data: { start: data },
beforeSend: customBlockUi(this)
}).done(function(response) {
swal({
title: "Great!",
text: "You have set up a tutoring availability!",
confirmButtonColor: "#66BB6A",
type: "success"
});
$('#tutor-cal').fullCalendar( 'refetchEvents' );
}).fail(function(response) {
swal({
title: "Oops...",
text: "Something went wrong!",
confirmButtonColor: "#EF5350",
type: "error"
});
});
})
})
var createDate = function() {
var date = $('.timepicker').val();
var time = $('.datepicker').val();
var dateTime = date + " " + time;
return (new Date(dateTime));
}
|
Add block ui to ajax call for creating new timeslot
|
Add block ui to ajax call for creating new timeslot
|
JavaScript
|
mit
|
theresaboard/theres-a-board,theresaboard/theres-a-board,theresaboard/theres-a-board
|
85bee713801bb259fdcbf6c06358372c692b508b
|
src/ZSchema.js
|
src/ZSchema.js
|
"use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
forceMaxLength: false,
// force properties or patternProperties to be defined on "object" types
forceProperties: false,
// disallow usage of keywords that this validator can't handle
noExtraKeywords: false,
// disallow usage of schema's without "type" defined
noTypeless: false,
// disallow zero length strings in validated objects
noZeroLengthStrings: false,
// forces "uri" format to be in fully rfc3986 compliant
strictUris: false,
// forces "email" format to be validated more strictly
strictEmails: false,
// turn on all of the above
strict: false
};
/*
constructor
*/
function ZSchema(options) {
this.options = options;
}
/*
instance methods
*/
ZSchema.prototype.compileSchema = function (schema, callback) {
};
ZSchema.prototype.validateSchema = function (schema, callback) {
};
ZSchema.prototype.validate = function (json, schema, callback) {
};
/*
static methods
*/
ZSchema.registerFormat = function (formatName, validatorFunction) {
};
module.exports = ZSchema;
|
"use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
forceMaxLength: false,
// force properties or patternProperties to be defined on "object" types
forceProperties: false,
// disallow usage of keywords that this validator can't handle
noExtraKeywords: false,
// disallow usage of schema's without "type" defined
noTypeless: false,
// disallow zero length strings in validated objects
noZeroLengthStrings: false,
// forces "uri" format to be in fully rfc3986 compliant
strictUris: false,
// forces "email" format to be validated more strictly
strictEmails: false,
// turn on all of the above
strict: false
};
/*
constructor
*/
function ZSchema(options) {
this.options = options;
}
/*
instance methods
*/
ZSchema.prototype.compileSchema = function (schema, callback) {
};
ZSchema.prototype.validateSchema = function (schema, callback) {
};
ZSchema.prototype.validate = function (json, schema, callback) {
};
/*
static methods
*/
ZSchema.registerFormat = function (formatName, validatorFunction) {
};
ZSchema.registerFormatter = function (formatterName, formatterFunction) {
};
module.exports = ZSchema;
|
Add an API for formatter functionality.
|
Add an API for formatter functionality.
|
JavaScript
|
mit
|
whitlockjc/z-schema,crypti/z-schema,whitlockjc/z-schema,crypti/z-schema
|
081312e0ab495e4e8d2e93ce8ff3a8d7305644ea
|
src/interface/button.js
|
src/interface/button.js
|
/* @flow */
import { isPayPalDomain } from '@paypal/sdk-client/src';
import { PopupOpenError as _PopupOpenError, destroy as zoidDestroy, destroyComponents } from 'zoid/src';
import { setupLogger, allowIframe as _allowIframe } from '../lib';
import { getCheckoutComponent } from '../checkout';
import { getButtonsComponent } from '../buttons';
import { Buttons as _ButtonsTemplate } from '../buttons/template';
export const request = {
addHeaderBuilder: () => {
// pass
}
};
export const Buttons = {
__get__: () => getButtonsComponent()
};
export const Checkout = {
__get__: () => {
const component = getCheckoutComponent();
if (isPayPalDomain()) {
return component;
}
}
};
export const ButtonsTemplate = {
__get__: () => {
if (isPayPalDomain()) {
return _ButtonsTemplate;
}
}
};
export const PopupOpenError = {
__get__: () => {
if (isPayPalDomain()) {
return _PopupOpenError;
}
}
};
export const allowIframe = {
__get__: () => {
if (isPayPalDomain()) {
return _allowIframe;
}
}
};
export const destroyAll = {
__get__: () => {
if (isPayPalDomain() || __TEST__) {
return destroyComponents;
}
}
};
export function setup() {
setupLogger();
getButtonsComponent();
getCheckoutComponent();
}
export function destroy() {
zoidDestroy();
}
|
/* @flow */
import { isPayPalDomain } from '@paypal/sdk-client/src';
import { PopupOpenError as _PopupOpenError, destroy as zoidDestroy, destroyComponents } from 'zoid/src';
import { setupLogger, allowIframe as _allowIframe } from '../lib';
import { getCheckoutComponent } from '../checkout';
import { getButtonsComponent } from '../buttons';
import { Buttons as _ButtonsTemplate } from '../buttons/template';
function protectedExport<T>(xport : T) : ?T {
if (isPayPalDomain()) {
return xport;
}
}
export const request = {
addHeaderBuilder: () => {
// pass
}
};
export const Buttons = {
__get__: () => getButtonsComponent()
};
export const Checkout = {
__get__: () => protectedExport(getCheckoutComponent())
};
export const ButtonsTemplate = {
__get__: () => protectedExport(_ButtonsTemplate)
};
export const PopupOpenError = {
__get__: () => protectedExport(_PopupOpenError)
};
export const allowIframe = {
__get__: () => protectedExport(_allowIframe)
};
export const forceIframe = {
__get__: () => protectedExport(_allowIframe)
};
export const destroyAll = {
__get__: () => protectedExport(destroyComponents)
};
export function setup() {
setupLogger();
getButtonsComponent();
getCheckoutComponent();
}
export function destroy() {
zoidDestroy();
}
|
Add forceIframe as a protected export
|
Add forceIframe as a protected export
|
JavaScript
|
apache-2.0
|
paypal/paypal-checkout,paypal/paypal-checkout,paypal/paypal-checkout
|
def0b69334011054fabaa1dc83b9ea4fb1a1b0cd
|
client/components/banettes/banettes.constant.js
|
client/components/banettes/banettes.constant.js
|
'use strict';
angular.module('impactApp').constant('banettes', [
{
id: 'toutes',
label: 'Toutes'
},
{
id: 'emise',
label: 'Émise'
},
{
id: 'complet',
label: 'Complète'
},
{
id: 'incomplet',
label: 'Incomplète'
},
{
id: 'archive',
label: 'Archivée'
}
]);
|
'use strict';
angular.module('impactApp').constant('banettes', [
{
id: 'toutes',
label: 'Toutes'
},
{
id: 'emise',
label: 'Émise'
},
{
id: 'complet',
label: 'Complète'
},
{
id: 'incomplet',
label: 'Incomplète'
},
{
id: 'en_cours',
label: 'En cours de saisie'
},
{
id: 'archive',
label: 'Archivée'
}
]);
|
Add display of new status
|
Add display of new status
|
JavaScript
|
agpl-3.0
|
sgmap/impact,sgmap/impact
|
e6b0b562e53afde0dfc32abb90d367456ba9d1d8
|
client/templates/courses/tagged-courses.js
|
client/templates/courses/tagged-courses.js
|
Template.taggedCourses.helpers({
'courses': function () {
return Courses.find().fetch();
},
'tag': function () {
// Get reference to template instance
var instance = this;
// Get tag from instance
var tag = instance.tag;
return tag;
}
});
Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagged with the current tag
instance.subscribe('taggedCourses', instance.tag);
// Subscribe to course images
instance.subscribe('images');
});
|
Template.taggedCourses.helpers({
'courses': function () {
return Courses.find().fetch();
},
'tag': function () {
// Get reference to template instance
var instance = this;
// Get tag from instance
var tag = instance.tag;
return tag;
}
});
Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagged with the current tag
instance.subscribe('taggedCourses', instance.tag);
// Subscribe to course images
instance.subscribe('images');
});
Template.taggedCourses.rendered = function () {
// Get reference to template instance
var instance = this;
// Set the page site title for SEO
Meta.setTitle('Courses tagged "' + instance.tag + '"');
};
|
Set page title on render
|
Set page title on render
|
JavaScript
|
agpl-3.0
|
Crowducate/crowducate-platform,Crowducate/crowducate-platform
|
02cc9cfbd1e23bfedff71a256ed60c32936afb1e
|
cmd/tchaik/ui/static/js/__tests__/components/ArtworkImage-test.js
|
cmd/tchaik/ui/static/js/__tests__/components/ArtworkImage-test.js
|
var __path__ = '../../src/components/ArtworkImage.js';
jest.dontMock(__path__);
describe('ArtworkImage', function() {
var React, TestUtils, ArtworkImage;
var artworkImage;
beforeEach(function() {
React = require('react/addons');
TestUtils = React.addons.TestUtils;
ArtworkImage = require(__path__);
artworkImage = TestUtils.renderIntoDocument(
<ArtworkImage path='/artwork/19199193' />
)
});
it('works', function() {
expect(true).toBeTruthy();
});
});
|
var __path__ = '../../src/components/ArtworkImage.js';
jest.dontMock(__path__);
describe('ArtworkImage', function() {
var React, TestUtils, ArtworkImage;
var domNode, artworkImage;
beforeEach(function() {
React = require('react/addons');
TestUtils = React.addons.TestUtils;
ArtworkImage = require(__path__);
artworkImage = TestUtils.renderIntoDocument(
<ArtworkImage path='/artwork/19199193' />
);
domNode = React.findDOMNode(artworkImage);
});
describe('in the initial state', function() {
it('should not be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).not.toContain('visible');
});
});
describe('after the image has loaded', function() {
beforeEach(function() {
TestUtils.Simulate.load(domNode);
});
it('should be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).toContain('visible');
});
});
describe('after the image has errored', function() {
beforeEach(function() {
TestUtils.Simulate.error(domNode);
});
it('should be visible', function() {
var classes = domNode.getAttribute('class').split(' ');
expect(classes).not.toContain('visible');
});
});
});
|
Add *useful* tests for the ArtworkImage component
|
Add *useful* tests for the ArtworkImage component
|
JavaScript
|
bsd-2-clause
|
solarnz/tchaik,solarnz/tchaik,GrahamGoudeau21/tchaik,solarnz/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,solarnz/tchaik,tchaik/tchaik,GrahamGoudeau21/tchaik,tchaik/tchaik
|
d5baa6a9f98ddf3c6c46bb8eb8f6a98f62e4d8b7
|
src/TodoApp/TodoList/Todo.js
|
src/TodoApp/TodoList/Todo.js
|
import React from 'react';
export default class Todo extends React.Component {
static propTypes = {
text: React.PropTypes.string.isRequired
}
render() {
return (
<li>{this.props.text}</li>
);
}
}
|
import React from 'react';
export default class Todo extends React.Component {
static propTypes = {
text: React.PropTypes.string.isRequired
}
state = {
completed: false
}
render() {
const style = {
textDecoration: this.state.completed ? 'line-through' : undefined,
cursor: 'default'
};
return (
<li
style={style}
onClick={this.toggleCompleted}
>
{this.props.text}
</li>
);
}
toggleCompleted = (event) => {
this.setState({ completed: !this.state.completed });
}
}
|
Add the ability to cross off items on the list
|
Add the ability to cross off items on the list
|
JavaScript
|
cc0-1.0
|
ksmithbaylor/react-todo-list,ksmithbaylor/react-todo-list
|
18e9cf3851ddaae9f865b326f4152d53ce5eb882
|
types/number.js
|
types/number.js
|
"use strict";
let errors = require('../errors.js');
let Type = require('./type.js');
let Value = require('./value.js');
class NumberValue extends Value {
constructor(type) {
super(type);
this.value = 0;
}
assign(newValue) {
if (typeof newValue == 'number') {
this.value = newValue;
} else if (newValue.value !== undefined && typeof newValue.value == 'number') {
this.value = newValue.value;
} else {
throw new errors.Internal(`Trying to assign ${newValue.type} to Number;`);
}
}
equals(other) {
return this.type == other.type && this.value == other.value;
}
innerToString() {
return `${this.value}`;
}
toString() {
return `${this.value}`;
}
}
class NumberType extends Type {
constructor() {
super(null, null, 'Number');
}
equals(other) {
return other === NumberType.singleton;
}
makeDefaultValue() {
return new NumberValue(this);
}
toString() {
return 'Number';
}
}
NumberType.singleton = new NumberType();
module.exports = {
Type: NumberType,
Value: NumberValue,
};
|
"use strict";
let errors = require('../errors.js');
let Type = require('./type.js');
let Value = require('./value.js');
class NumberValue extends Value {
constructor(type) {
super(type);
this.value = 0;
}
assign(newValue) {
if (typeof newValue == 'number') {
this.value = newValue;
} else if (newValue.value !== undefined && typeof newValue.value == 'number') {
this.value = newValue.value;
} else {
throw new errors.Internal(`Trying to assign ${newValue.type} to Number;`);
}
}
equals(other) {
return this.type == other.type && this.value == other.value;
}
innerToString() {
return `${this.value}`;
}
assignJSON(spec) {
this.value = spec;
}
toJSON() {
return this.value;
}
toString() {
return `${this.value}`;
}
}
class NumberType extends Type {
constructor() {
super(null, null, 'Number');
}
equals(other) {
return other === NumberType.singleton;
}
makeDefaultValue() {
return new NumberValue(this);
}
toString() {
return 'Number';
}
}
NumberType.singleton = new NumberType();
module.exports = {
Type: NumberType,
Value: NumberValue,
};
|
Add assignJSON/toJSON to Number types
|
Add assignJSON/toJSON to Number types
|
JavaScript
|
mit
|
salesforce/runway-browser,SalesforceEng/runway-browser,SalesforceEng/runway-browser
|
81c22ea31edcadd73f459470923cf8ee62b09a8a
|
website/js/dashboard-ajax.js
|
website/js/dashboard-ajax.js
|
// Common ajax-handling functions for dashboard-like pages. Looks for <reload/>
// elements to reload the page, and reports errors or failures via alerts.
g_action_url = "action.php";
// Note that this doesn't run if the $.ajax call has a 'success:' callback that
// generates an error.
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var fail = xmldoc.documentElement.getElementsByTagName("failure");
if (fail && fail.length > 0) {
console.log(xmldoc);
alert("Action failed: " + fail[0].textContent);
}
});
// <reload/> element
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var reload = xmldoc.documentElement.getElementsByTagName("reload");
if (reload && reload.length > 0) {
console.log('ajaxSuccess event: reloading page');
location.reload(true);
}
});
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
console.log("ajaxError: " + thrownError);
console.log(thrownError);
console.log(jqXHR);
console.log(jqXHR.responseText);
console.log(event);
alert("Ajax error: " + thrownError);
});
|
// Common ajax-handling functions for dashboard-like pages. Looks for <reload/>
// elements to reload the page, and reports errors or failures via alerts.
g_action_url = "action.php";
// Note that this doesn't run if the $.ajax call has a 'success:' callback that
// generates an error.
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var fail = xmldoc.documentElement.getElementsByTagName("failure");
if (fail && fail.length > 0) {
console.log(xmldoc);
alert("Action failed: " + fail[0].textContent);
}
});
// <reload/> element
$(document).ajaxSuccess(function(event, xhr, options, xmldoc) {
var reload = xmldoc.documentElement.getElementsByTagName("reload");
if (reload && reload.length > 0) {
console.log('ajaxSuccess event: reloading page');
location.reload(true);
}
});
$(document).ajaxError(function(event, jqXHR, ajaxSettings, thrownError) {
console.log("ajaxError: " + thrownError);
console.log(thrownError);
console.log(jqXHR);
console.log("Response text: " + jqXHR.responseText);
console.log("ReadyState: " + jqXHR.readyState);
console.log("status: " + jqXHR.status);
console.log(event);
alert("Ajax error: " + thrownError);
});
|
Add some additional logging for ajax failures.
|
Add some additional logging for ajax failures.
|
JavaScript
|
mit
|
jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet,jeffpiazza/derbynet
|
cc56d5cce91d4031b4a12d71739bdabd86b8481d
|
lib/collections.js
|
lib/collections.js
|
CommitMessages = new Mongo.Collection("CommitMessages");
RepositoryList = new Mongo.Collection("RepositoryList");
Announcements = new Mongo.Collection("Announcements");
MentorQueue = new Mongo.Collection("MentorQueue");
AnonReports = new Mongo.Collection('AnonReports');
|
CommitMessages = new Mongo.Collection("CommitMessages");
RepositoryList = new Mongo.Collection("RepositoryList");
Announcements = new Mongo.Collection("Announcements");
MentorQueue = new Mongo.Collection("MentorQueue");
AnonReports = new Mongo.Collection('AnonReports');
AnonUserData = new Mongo.Collection('AnonUserData');
|
Initialize collection for anonymous data
|
Initialize collection for anonymous data
|
JavaScript
|
mit
|
mpoegel/HackRPI-Status-Board,hack-rpi/Status-Board,hack-rpi/Status-Board,mpoegel/HackRPI-Status-Board,hack-rpi/Status-Board,mpoegel/HackRPI-Status-Board,mpoegel/HackRPI-Status-Board
|
10c71a738177fc02053601dff5594ba17cb2ab61
|
src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js
|
src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js
|
function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
$scope.renderModel.value = true;
}
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
$scope.renderModel.value = true;
}
}
setupViewModel();
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server
setupViewModel();
};
// Update the value when the toggle is clicked
$scope.toggle = function(){
if($scope.renderModel.value){
$scope.model.value = "0";
setupViewModel();
return;
}
$scope.model.value = "1";
setupViewModel();
};
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
|
function booleanEditorController($scope, $rootScope, assetsService) {
function setupViewModel() {
$scope.renderModel = {
value: false
};
if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
$scope.renderModel.value = true;
}
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
$scope.renderModel.value = true;
}
}
setupViewModel();
if( $scope.model && !$scope.model.value ) {
$scope.model.value = ($scope.renderModel.value === true) ? '1' : '0';
}
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
//update the display val again if it has changed from the server
setupViewModel();
};
// Update the value when the toggle is clicked
$scope.toggle = function(){
if($scope.renderModel.value){
$scope.model.value = "0";
setupViewModel();
return;
}
$scope.model.value = "1";
setupViewModel();
};
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
|
Set a initial $scope.model.value for true/false
|
Set a initial $scope.model.value for true/false
|
JavaScript
|
mit
|
marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,NikRimington/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,abryukhov/Umbraco-CMS,mattbrailsford/Umbraco-CMS,abryukhov/Umbraco-CMS,hfloyd/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,hfloyd/Umbraco-CMS,lars-erik/Umbraco-CMS,madsoulswe/Umbraco-CMS,bjarnef/Umbraco-CMS,dawoe/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,hfloyd/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,tcmorris/Umbraco-CMS,robertjf/Umbraco-CMS,lars-erik/Umbraco-CMS,dawoe/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tcmorris/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,arknu/Umbraco-CMS,tcmorris/Umbraco-CMS,hfloyd/Umbraco-CMS,WebCentrum/Umbraco-CMS,aaronpowell/Umbraco-CMS,madsoulswe/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,arknu/Umbraco-CMS,marcemarc/Umbraco-CMS,umbraco/Umbraco-CMS,WebCentrum/Umbraco-CMS,mattbrailsford/Umbraco-CMS,dawoe/Umbraco-CMS,abjerner/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,aaronpowell/Umbraco-CMS,madsoulswe/Umbraco-CMS,abryukhov/Umbraco-CMS,leekelleher/Umbraco-CMS,rasmuseeg/Umbraco-CMS,leekelleher/Umbraco-CMS,tompipe/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,hfloyd/Umbraco-CMS,bjarnef/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,tcmorris/Umbraco-CMS,marcemarc/Umbraco-CMS,leekelleher/Umbraco-CMS,lars-erik/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,robertjf/Umbraco-CMS,NikRimington/Umbraco-CMS,bjarnef/Umbraco-CMS,tcmorris/Umbraco-CMS,aaronpowell/Umbraco-CMS,umbraco/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,tompipe/Umbraco-CMS,umbraco/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,rasmuseeg/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,lars-erik/Umbraco-CMS,leekelleher/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,arknu/Umbraco-CMS
|
d85c88ca5e9e069d889fc6a54e26bfe90cefcf3b
|
gulpfile.js
|
gulpfile.js
|
var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('default', ['serve']);
gulp.task('serve', function() {
browserSync.init(null, {
server: {
baseDir: './'
},
notify: false
});
gulp.watch([
'./*.html',
'./css/**/*.css',
'./js/**/*.js'
], browserSync.reload);
});
|
var gulp = require('gulp');
var browserSync = require('browser-sync');
gulp.task('default', ['serve']);
gulp.task('serve', function() {
browserSync.init(null, {
server: {
baseDir: './'
},
notify: false
});
gulp.watch([
'./*.html',
'./css/**/*.css',
'./js/**/*.js'
], function() {
browserSync.reload({ once: true });
});
});
|
Make sure that the reload only triggers once for multiple file updates.
|
Make sure that the reload only triggers once for multiple file updates.
|
JavaScript
|
mit
|
tvararu/tvararu.github.io,tvararu/tvararu.github.io
|
4ccd42acf0f930562280640d176c5e5d80f6a18b
|
gulpfile.js
|
gulpfile.js
|
var gulp = require( 'gulp' ),
bower = require( 'gulp-bower' ),
del = require( 'del' ),
vui = require( 'vui-helpers' );
gulp.task( 'clean', function( cb ) {
del([ 'accordion.css' ], cb);
} );
gulp.task( 'lib', function() {
return bower( 'lib/' );
} );
gulp.task( 'css', function () {
return vui.makeCss(
'accordion.css.less',
'accordion.css',
{ 'lintOpts' : '.csslintrc' }
);
} );
gulp.task( 'default', [ 'clean' ], function() {
gulp.start( 'css' );
} );
gulp.task( 'test', [ 'lib' ], function () {
return vui.test(
'test/unit/karma.conf.js',
[
'lib/jquery/jquery.min.js',
'lib/jquery.ui/ui/jquery.ui.core.js',
'lib//jquery.ui/ui/jquery.ui.widget.js',
'test/unit/**/*Spec.js'
],
'accordion.css'
);
} );
|
var gulp = require( 'gulp' ),
bower = require( 'gulp-bower' ),
del = require( 'del' ),
vui = require( 'vui-helpers' );
gulp.task( 'clean', function( cb ) {
del([ 'accordion.css' ], cb);
} );
gulp.task( 'lib', function() {
return bower( 'lib/' );
} );
gulp.task( 'css', function () {
return vui.makeCss(
'accordion.css.less',
'accordion.css',
{ 'lintOpts' : '.csslintrc' }
);
} );
gulp.task( 'default', [ 'clean' ], function() {
gulp.start( 'css' );
} );
gulp.task( 'test', [ 'lib' ], function () {
return vui.test(
'test/unit/karma.conf.js',
[
'lib/jquery/jquery.min.js',
'lib/jquery.ui/ui/jquery.ui.core.js',
'lib//jquery.ui/ui/jquery.ui.widget.js',
'accordion.js',
'test/unit/**/*Spec.js'
],
'accordion.css'
);
} );
|
Include accordion.js in list of JavaScript files for testing.
|
Include accordion.js in list of JavaScript files for testing.
|
JavaScript
|
apache-2.0
|
Brightspace/jquery-valence-ui-accordion
|
e50e843f0fa2faa7f2d7b591f3273cffef538820
|
js/check_result.js
|
js/check_result.js
|
'use strict';
/* global TbplJob, Notification */
setTimeout(checkResult, 5000);
function checkResult() {
var tbpl = new TbplJob();
var result = 'Fail!';
if (tbpl.isDone()) {
if (tbpl.isSuccessful()) {
result = 'Success!';
}
Notification.requestPermission(function() {
var notification = new Notification(tbpl.description, { body: result });
notification.onclick = function() {
window.focus();
};
});
} else {
setTimeout(checkResult, 5000);
}
}
|
'use strict';
/* global TbplJob, Notification */
(function() {
var container = document.querySelector('#container');
addTrackingSign();
setTimeout(checkResult, 5000);
function checkResult() {
var tbpl = new TbplJob();
var result = 'Fail!';
if (tbpl.isDone()) {
if (tbpl.isSuccessful()) {
result = 'Success!';
}
Notification.requestPermission(function() {
var notification = new Notification(tbpl.description, { body: result });
notification.onclick = function() {
window.focus();
};
});
removeTrackingSign();
} else {
setTimeout(checkResult, 5000);
}
}
function addTrackingSign() {
container.style.borderStyle = 'dashed';
// Firefox light orange, https://www.mozilla.org/en-US/styleguide/identity/firefox/color/.
container.style.borderColor = '#FF9500';
}
function removeTrackingSign() {
container.style.borderStyle = null;
container.style.borderColor = null;
}
})();
|
Add tracking sign as a border of the container element
|
Add tracking sign as a border of the container element
|
JavaScript
|
mit
|
evanxd/tbpl-hou,evanxd/tbpl-hou
|
ce50cd526f259ac44c593dc2a1914e4106f427a0
|
app/assets/javascripts/roster/sorts/reverse_number.js
|
app/assets/javascripts/roster/sorts/reverse_number.js
|
(function(){
var cleanNumber = function(i) {
return i.replace(/[^\-?0-9.]/g, '');
},
compareNumberReverse = function(a, b) {
a = parseFloat(a);
b = parseFloat(b);
a = isNaN(a) ? 0 : a;
b = isNaN(b) ? 0 : b;
return b - a;
};
Tablesort.extend('reverse_number', function(item) {
return item.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
a = cleanNumber(a);
b = cleanNumber(b);
return compareNumberReverse(b, a);
});
}());
|
(function(){
var cleanNumber = function(i) {
var n = parseFloat(i.replace(/[^\-?0-9.]/g, ''));
return isNaN(n) ? null : n;
},
compareNumberReverse = function(a, b) {
// Treat null as always greater
if (a === null) return 1;
if (b === null) return -1;
return a - b;
};
Tablesort.extend('reverse_number', function(item) {
return item.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
return compareNumberReverse(cleanNumber(a), cleanNumber(b));
});
}());
|
Sort null risk levels correctly
|
Sort null risk levels correctly
I'm a little surprised that the Tablesort comparator works in the exact
opposite way to pretty much every other comparator, but it's late, and I
could be missing something.
addresses #344
|
JavaScript
|
mit
|
jhilde/studentinsights,studentinsights/studentinsights,erose/studentinsights,studentinsights/studentinsights,jhilde/studentinsights,jhilde/studentinsights,erose/studentinsights,studentinsights/studentinsights,jhilde/studentinsights,erose/studentinsights,erose/studentinsights,studentinsights/studentinsights
|
d3c0d76c26119347957d55dbf6631aeaea36cab0
|
js/parser/stack.js
|
js/parser/stack.js
|
(function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
if( sep > -1 )
{
var dbName = token.substring( 0, sep );
var path = token.substring( sep+1 ).split( '|', 2 );
if( path.length > 1 )
return widget.util.get( dbName, path[0], path[1] );
else
return widget.util.get( dbName, path[0] );
}
else
{
context = context || (widget.util.getStack() || [])[0];
return widget.get( context, token ) || "${" + token + "}";
}
}
})();
|
(function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
var path;
if( sep > -1 )
{
var dbName = token.substring( 0, sep );
path = token.substring( sep+1 ).split( '|', 2 );
return widget.util.get( dbName, path[0], path[1] );
}
else
{
context = context || (widget.util.getStack() || [])[0];
path = token.split( '|', 2 );
return widget.get( context, path[0], path[1] ) || "${" + token + "}";
}
}
})();
|
Fix bug not letting default values through in ${} templates
|
Fix bug not letting default values through in ${} templates
|
JavaScript
|
mit
|
tony-jacobs/widget.js,tony-jacobs/widget.js
|
af2249bfb9a85a5517b7d4c0321173f5d862ee59
|
src/L.RotatedMarker.js
|
src/L.RotatedMarker.js
|
L.RotatedMarker = L.Marker.extend({
options: {
angle: 0
},
statics: {
// determine the best and only CSS transform rule to use for this browser
bestTransform: L.DomUtil.testProp([
'transform',
'WebkitTransform',
'msTransform',
'MozTransform',
'OTransform'
])
},
_setPos: function (pos) {
L.Marker.prototype._setPos.call(this, pos);
var rotate = ' rotate(' + this.options.angle + 'deg)';
if (L.RotatedMarker.bestTransform) {
// use the CSS transform rule if available
this._icon.style[L.RotatedMarker.bestTransform] += rotate;
} else if(L.Browser.ie) {
// fallback for IE6, IE7, IE8
var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
costheta = Math.cos(rad),
sintheta = Math.sin(rad);
this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
}
}
});
|
L.RotatedMarker = L.Marker.extend({
options: {
angle: 0
},
statics: {
// determine the best and only CSS transform rule to use for this browser
bestTransform: L.DomUtil.testProp([
'transform',
'WebkitTransform',
'msTransform',
'MozTransform',
'OTransform'
])
},
_setPos: function (pos) {
L.Marker.prototype._setPos.call(this, pos);
var rotate = ' rotate(' + this.options.angle + 'deg)';
if (L.RotatedMarker.bestTransform) {
// use the CSS transform rule if available
this._icon.style[L.RotatedMarker.bestTransform] += rotate;
} else if(L.Browser.ie) {
// fallback for IE6, IE7, IE8
var rad = this.options.angle * L.LatLng.DEG_TO_RAD,
costheta = Math.cos(rad),
sintheta = Math.sin(rad);
this._icon.style.filter += ' progid:DXImageTransform.Microsoft.Matrix(sizingMethod=\'auto expand\', M11=' +
costheta + ', M12=' + (-sintheta) + ', M21=' + sintheta + ', M22=' + costheta + ')';
}
}
});
|
Replace tabs coming from bad editor conf with spaces
|
Replace tabs coming from bad editor conf with spaces
|
JavaScript
|
mit
|
Stonelinks/Leaflet.PolylineDecorator,bbecquet/Leaflet.PolylineDecorator,bbecquet/Leaflet.PolylineDecorator,Stonelinks/Leaflet.PolylineDecorator
|
3bbb038cd182d7f3694874acbabe9fce4b77b040
|
test/bundle.js
|
test/bundle.js
|
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
function bundle (file) {
test('bundle transform', function (t) {
t.plan(1);
var b = browserify();
b.add(__dirname + file);
b.transform(__dirname + '/..');
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
}
bundle('/../example/bar.js');
function testBundle(src, t) {
function log (msg) {
t.equal(msg, 555);
}
vm.runInNewContext(src, {
console: { log: log }
});
}
|
var test = require('tap').test;
var browserify = require('browserify');
var vm = require('vm');
test('no options bundle', function(t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/../example/bar.js');
b.transform(__dirname + '/..');
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
test('options bundle', function(t) {
t.plan(1);
var b = browserify();
b.add(__dirname + '/../example/bar.js');
b.transform(require('../index.js').jade({
pretty: false
}));
b.bundle(function (err, src) {
if (err) t.fail(err);
testBundle(src, t);
});
});
function testBundle(src, t) {
function log (msg) {
t.equal(msg, 555);
}
vm.runInNewContext(src, {
console: { log: log }
});
}
|
Add test for options transfomr
|
Add test for options transfomr
|
JavaScript
|
mit
|
sidorares/pugify,sidorares/pugify,sidorares/browserify-jade,deedw/pugify,tellnes/browserify-jade,sidorares/browserify-jade,deedw/pugify,tellnes/browserify-jade
|
6323a5ef929ac6322c5eb4cf3730e8a0df21cbca
|
test/loader.js
|
test/loader.js
|
var tests = Object.keys(window.__karma__.files).filter(function (file) {
return (/Spec\.js$/).test(file);
});
requirejs.config({
// Karma serves files from '/base'
baseUrl: "/base",
paths: {
"sugar-web": ".",
"mustache": "lib/mustache",
"text": "lib/text"
},
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});
|
var tests = Object.keys(window.__karma__.files).filter(function (file) {
return (/Spec\.js$/).test(file);
});
requirejs.config({
// Karma serves files from '/base'
baseUrl: "/base",
paths: {
"sugar-web": ".",
"mustache": "lib/mustache",
"text": "lib/text",
"webL10n": "lib/webL10n"
},
// ask Require.js to load these files (all our tests)
deps: tests,
// start test run, once Require.js is done
callback: window.__karma__.start
});
|
Add webL10n missing definition path
|
Add webL10n missing definition path
|
JavaScript
|
apache-2.0
|
sugarlabs/sugar-web,godiard/sugar-web
|
e947a1094535d2b4ea7d1113194d0f4906cf0f0d
|
src/main/js/lib/rivets-cfg.js
|
src/main/js/lib/rivets-cfg.js
|
define([
'rivets',
'jquery',
'rivets-backbone-adapter'
], function (rivets, $) {
'use strict';
rivets.formatters.join = function (array, separator) {
return $.isArray(array) ? array.join(separator) : array;
};
rivets.formatters.contains = function (array, needle) {
return $.isArray(array) ? $.inArray(needle, array) > -1 : false;
};
rivets.formatters.not = function (value) {
return !value;
};
rivets.formatters.unit = function(value, unit) {
return value || value === 0 ? value + unit : value;
};
return rivets;
});
|
define([
'rivets',
'underscore',
'rivets-backbone-adapter'
], function (rivets, _) {
'use strict';
/* Make sure Array.isArray is available (should be). */
if (!Array.isArray) {
Array.isArray = function(arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
}
rivets.formatters.join = function (array, separator) {
return isArray(array) ? array.join(separator) : array;
};
rivets.formatters.contains = function (array, needle) {
return isArray(array) ? _.indexOf(array, needle) > -1 : false;
};
rivets.formatters.not = function (value) {
return !value;
};
rivets.formatters.unit = function(value, unit) {
return value || value === 0 ? value + unit : value;
};
return rivets;
});
|
Use underscore rather than jQuery for array utils
|
Use underscore rather than jQuery for array utils
|
JavaScript
|
unknown
|
cyChop/beverages-js,cyChop/teas-js,cyChop/beverages-js,cyChop/beverages-js,cyChop/teas-js
|
7b74cba2f228f7a4bbab0fe6856b4842c47aaae1
|
app/lib/config/index.js
|
app/lib/config/index.js
|
import fs from 'fs';
import path from 'path';
import { logFatal } from '../log';
const configPath = path.resolve(__dirname, 'config.js');
if (!fs.existsSync(configPath)) {
logFatal(`No config file called config.js found at ${configPath}`);
}
const config = require('./config.js');
const keys = Object.keys(config);
const missingKeys = ['restroomBotToken', 'kitchenBotToken', 'livingRoomBotToken'].filter(key => {
return !keys.includes(key);
})
console.log(missingKeys)
if (missingKeys.length != 0) {
logFatal(`Missing configuration variables: ${missingKeys.join()}`);
}
export default config
|
import fs from 'fs';
import path from 'path';
import { logFatal } from '../log';
const configPath = path.resolve(__dirname, 'config.js');
if (!fs.existsSync(configPath)) {
logFatal(`No config file called config.js found at ${configPath}`);
}
// Use require syntax here because ES2015 module declarations are hoisted
const config = require('./config.js');
const keys = Object.keys(config);
const missingKeys = ['restroomBotToken', 'kitchenBotToken', 'livingRoomBotToken'].filter(key => {
return !keys.includes(key);
});
if (missingKeys.length != 0) {
logFatal(`Missing configuration variables: ${missingKeys.join()}`);
}
export default config
|
Remove some debug statements in config parsing
|
Remove some debug statements in config parsing
|
JavaScript
|
mit
|
melonmanchan/telegram-bot-iot-home
|
32e492a065a57a14337f3043ab4509257e4755aa
|
src/app/PageActions.js
|
src/app/PageActions.js
|
var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <a href="#messages" className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></a>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
|
var React = require('react'),
{Link} = require('react-router');
module.exports = React.createClass({
render: function() {
let channel = '';
if (this.props.params && this.props.params.name) {
channel = `@${this.props.params.name}`;
} else if (this.props.params && this.props.params.category) {
channel = this.props.params.category
}
return (
<div className="actions">
<div className="triggers">
{this.props.edit && <Link to="/profile/edit" className="trigger"><i className="icon icon-md material-icons">format_paint</i></Link>}
{this.props.likes && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">thumb_up</i></a>}
{this.props.replies && <a href="#replies" className="trigger"><i className="icon icon-md material-icons">reply</i></a>}
{this.props.messages && <Link to={`/messages/${channel}`} className="trigger"><i className="icon icon-md material-icons">chat_bubble_outline</i></Link>}
{this.props.add && <Link to="/write" className="trigger"><i className="icon icon-md material-icons">add</i></Link>}
</div>
</div>
);
}
});
|
Add messages link to the floating actions bubble
|
Add messages link to the floating actions bubble
|
JavaScript
|
mit
|
Sekhmet/busy,busyorg/busy,Sekhmet/busy,busyorg/busy,ryanbaer/busy,ryanbaer/busy
|
b04a607862cc6d7d4390403def025199682b4849
|
auth.example.js
|
auth.example.js
|
module.exports = {
facebook: {
appID: 'FACEBOOK_APP_ID',
appSecret: 'FACEBOOK_APP_SECRET',
callbackUrl: 'http://localhost:3000/auth/facebook/callback',
profileFields: ['id', 'displayName', 'name', 'email', 'gender', 'age_range', 'link', 'picture', 'locale', 'timezone', 'updated_time', 'verified']
},
amazon: {
appID: 'AMAZON_APP_ID',
appSecret: 'AMAZON_APP_SECRET',
callbackUrl: 'http://127.0.0.1:3000/auth/amazon/callback'
}
}
|
module.exports = {
facebook: {
appID: 'FACEBOOK_APP_ID',
appSecret: 'FACEBOOK_APP_SECRET',
callbackUrl: 'http://localhost:3000/auth/facebook/callback',
profileFields: ['id', 'displayName', 'name', 'email', 'gender', 'age_range', 'link', 'picture', 'locale', 'timezone', 'updated_time', 'verified']
},
amazon: {
appID: 'AMAZON_APP_ID',
appSecret: 'AMAZON_APP_SECRET',
callbackUrl: 'http://127.0.0.1:3000/auth/amazon/callback'
},
google: {
type: 'service_account',
project_id: 'GOOGLE_PROJECT_ID',
private_key_id: 'GOOGLE_PRIVATE_KEY_ID',
private_key: 'GOOGLE_PRIVATE_KEY',
client_email: 'GOOGLE_CLIENT_EMAIL',
client_id: 'GOOGLE_CLIENT_ID',
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
token_uri: 'https://accounts.google.com/o/oauth2/token',
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
client_x509_cert_url: 'GOOGLE_CLIENT_x509_CERT_URL'
}
}
|
Add template for google cloud api keys
|
Add template for google cloud api keys
|
JavaScript
|
mit
|
scrumptiousAmpersand/journey,scrumptiousAmpersand/journey
|
779b5dfc590226388052062c98b329362de8ada7
|
money-format/money-format.js
|
money-format/money-format.js
|
'use strict';
function formatMoney(value) {
var rem = value - ~~value;
var arr = String(~~value).split('');
var result = [];
while (arr.length) {
var from = Math.max(0, arr.length - 3);
result.unshift(arr.splice(from, 3));
}
return result.reduce(function (a, b) {
return a + ' ' + b.join('');
}) + rem.toFixed(2).slice(1);
}
|
module.exports = function (value) {
var remaining = value - ~~value,
string = '' + ~~value,
length = string.length,
places = 0;
while (--length) {
places += 1;
// At every third position we want to insert a comma
if (places % 3 === 0) {
string = string.substr(0, length) + ',' + string.substr(length);
}
}
return '$' + string + remaining.toFixed(2).slice(1);
}
|
Apply functionality from the number format to the money format solution.
|
Apply functionality from the number format to the money format solution.
|
JavaScript
|
mit
|
akaragkiozidis/code-problems,AndrewKishino/code-problems,blakeembrey/code-problems,ankur-anand/code-problems,patrickford/code-problems,BastinRobin/code-problems,patrickford/code-problems,lgulliver/code-problems,blakeembrey/code-problems,cjjavellana/code-problems,nickell-andrew/code-problems,tahoeRobbo/code-problems,ranveer-git/code-problems,akaragkiozidis/code-problems,ockang/code-problems,ankur-anand/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,nacho-gil/code-problems,nickell-andrew/code-problems,saurabhjn76/code-problems,ankur-anand/code-problems,akaragkiozidis/code-problems,sethdame/code-problems,nickell-andrew/code-problems,faruzzy/code-problems,patrickford/code-problems,sethdame/code-problems,rkho/code-problems,jmera/code-problems,aloisdg/code-problems,saurabhjn76/code-problems,caoglish/code-problems,hlan2/code-problems,jmera/code-problems,nacho-gil/code-problems,AndrewKishino/code-problems,nacho-gil/code-problems,ranveer-git/code-problems,angelkar/code-problems,lgulliver/code-problems,netuoso/code-problems,sethdame/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,jefimenko/code-problems,dwatson3/code-problems,ockang/code-problems,AndrewKishino/code-problems,AndrewKishino/code-problems,blakeembrey/code-problems,rkho/code-problems,Widea/code-problems,nacho-gil/code-problems,akaragkiozidis/code-problems,aloisdg/code-problems,tahoeRobbo/code-problems,sisirkoppaka/code-problems,akaragkiozidis/code-problems,modulexcite/code-problems,diversedition/code-problems,ranveer-git/code-problems,blakeembrey/code-problems,tahoeRobbo/code-problems,nacho-gil/code-problems,Widea/code-problems,ranveer-git/code-problems,tahoeRobbo/code-problems,jefimenko/code-problems,marcoviappiani/code-problems,caoglish/code-problems,blakeembrey/code-problems,nickell-andrew/code-problems,tahoeRobbo/code-problems,lgulliver/code-problems,ankur-anand/code-problems,aloisdg/code-problems,ankur-anand/code-problems,akaragkiozidis/code-problems,dwatson3/code-problems,modulexcite/code-problems,BastinRobin/code-problems,angelkar/code-problems,sisirkoppaka/code-problems,SterlingVix/code-problems,nickell-andrew/code-problems,hlan2/code-problems,cjjavellana/code-problems,modulexcite/code-problems,ranveer-git/code-problems,dwatson3/code-problems,ockang/code-problems,hlan2/code-problems,diversedition/code-problems,caoglish/code-problems,marcoviappiani/code-problems,angelkar/code-problems,jmera/code-problems,cjjavellana/code-problems,ockang/code-problems,lgulliver/code-problems,patrickford/code-problems,aloisdg/code-problems,nacho-gil/code-problems,SterlingVix/code-problems,faruzzy/code-problems,marcoviappiani/code-problems,sisirkoppaka/code-problems,nacho-gil/code-problems,SterlingVix/code-problems,ranveer-git/code-problems,BastinRobin/code-problems,caoglish/code-problems,jmera/code-problems,SterlingVix/code-problems,jefimenko/code-problems,diversedition/code-problems,faruzzy/code-problems,BastinRobin/code-problems,AndrewKishino/code-problems,aloisdg/code-problems,diversedition/code-problems,caoglish/code-problems,saurabhjn76/code-problems,rkho/code-problems,akaragkiozidis/code-problems,modulexcite/code-problems,modulexcite/code-problems,faruzzy/code-problems,ockang/code-problems,modulexcite/code-problems,modulexcite/code-problems,sisirkoppaka/code-problems,jmera/code-problems,aloisdg/code-problems,rkho/code-problems,jefimenko/code-problems,marcoviappiani/code-problems,marcoviappiani/code-problems,patrickford/code-problems,sethdame/code-problems,lgulliver/code-problems,Widea/code-problems,BastinRobin/code-problems,ockang/code-problems,caoglish/code-problems,ockang/code-problems,jefimenko/code-problems,jefimenko/code-problems,modulexcite/code-problems,nickell-andrew/code-problems,blakeembrey/code-problems,saurabhjn76/code-problems,angelkar/code-problems,caoglish/code-problems,ankur-anand/code-problems,tahoeRobbo/code-problems,nickell-andrew/code-problems,sisirkoppaka/code-problems,dwatson3/code-problems,jmera/code-problems,jmera/code-problems,aloisdg/code-problems,marcoviappiani/code-problems,diversedition/code-problems,BastinRobin/code-problems,AndrewKishino/code-problems,rkho/code-problems,sethdame/code-problems,SterlingVix/code-problems,SterlingVix/code-problems,AndrewKishino/code-problems,ranveer-git/code-problems,saurabhjn76/code-problems,marcoviappiani/code-problems,angelkar/code-problems,angelkar/code-problems,faruzzy/code-problems,jmera/code-problems,akaragkiozidis/code-problems,cjjavellana/code-problems,sisirkoppaka/code-problems,angelkar/code-problems,marcoviappiani/code-problems,diversedition/code-problems,dwatson3/code-problems,hlan2/code-problems,Widea/code-problems,SterlingVix/code-problems,ankur-anand/code-problems,jefimenko/code-problems,angelkar/code-problems,lgulliver/code-problems,rkho/code-problems,modulexcite/code-problems,jefimenko/code-problems,netuoso/code-problems,nacho-gil/code-problems,sethdame/code-problems,saurabhjn76/code-problems,netuoso/code-problems,aloisdg/code-problems,faruzzy/code-problems,netuoso/code-problems,patrickford/code-problems,ankur-anand/code-problems,Widea/code-problems,netuoso/code-problems,hlan2/code-problems,faruzzy/code-problems,tahoeRobbo/code-problems,rkho/code-problems,cjjavellana/code-problems,sethdame/code-problems,dwatson3/code-problems,angelkar/code-problems,blakeembrey/code-problems,netuoso/code-problems,AndrewKishino/code-problems,diversedition/code-problems,akaragkiozidis/code-problems,ankur-anand/code-problems,faruzzy/code-problems,caoglish/code-problems,sisirkoppaka/code-problems,Widea/code-problems,jmera/code-problems,ranveer-git/code-problems,hlan2/code-problems,caoglish/code-problems,rkho/code-problems,cjjavellana/code-problems,patrickford/code-problems,tahoeRobbo/code-problems,cjjavellana/code-problems,Widea/code-problems,aloisdg/code-problems,jefimenko/code-problems,netuoso/code-problems,lgulliver/code-problems,Widea/code-problems,jmera/code-problems,tahoeRobbo/code-problems,hlan2/code-problems,BastinRobin/code-problems,sethdame/code-problems,nickell-andrew/code-problems,marcoviappiani/code-problems,cjjavellana/code-problems,modulexcite/code-problems,angelkar/code-problems,BastinRobin/code-problems,marcoviappiani/code-problems,netuoso/code-problems,hlan2/code-problems,dwatson3/code-problems,tahoeRobbo/code-problems,ockang/code-problems,SterlingVix/code-problems,dwatson3/code-problems,AndrewKishino/code-problems,AndrewKishino/code-problems,sethdame/code-problems,ockang/code-problems,sisirkoppaka/code-problems,sisirkoppaka/code-problems,saurabhjn76/code-problems,netuoso/code-problems,rkho/code-problems,lgulliver/code-problems,hlan2/code-problems,nickell-andrew/code-problems,patrickford/code-problems,nickell-andrew/code-problems,sethdame/code-problems,SterlingVix/code-problems,ranveer-git/code-problems,nacho-gil/code-problems,cjjavellana/code-problems,blakeembrey/code-problems,BastinRobin/code-problems,diversedition/code-problems,caoglish/code-problems,cjjavellana/code-problems,sisirkoppaka/code-problems,dwatson3/code-problems,lgulliver/code-problems,SterlingVix/code-problems,patrickford/code-problems,hlan2/code-problems,akaragkiozidis/code-problems,nacho-gil/code-problems,Widea/code-problems,aloisdg/code-problems,Widea/code-problems,jefimenko/code-problems,ranveer-git/code-problems,ankur-anand/code-problems,saurabhjn76/code-problems,rkho/code-problems,faruzzy/code-problems,faruzzy/code-problems,ockang/code-problems,diversedition/code-problems,lgulliver/code-problems,dwatson3/code-problems,patrickford/code-problems
|
4cf97eb49b15261f9aeb197a6c6c488f7082bea8
|
src/containers/Home.js
|
src/containers/Home.js
|
import React from 'react'
import { getSiteProps } from 'react-static'
//
import logoImg from '../logo.png'
export default getSiteProps(() => (
<div>
<div id="social-media-links">
<a target="_blank" href="https://www.linkedin.com/in/tanay-prabhudesai-1029b073/"><i className="fa fa-linkedin" aria-hidden="true"></i></a>
<a target="_blank" href="https://plus.google.com/+TanayPrabhuDesai"><i className="fa fa-google" aria-hidden="true"></i></a>
<a target="_blank" href="https://twitter.com/tanayseven"><i className="fa fa-twitter" aria-hidden="true"></i></a>
<a target="_blank" href="https://github.com/tanayseven"><i className="fa fa-github" aria-hidden="true"></i></a>
</div>
<p>Hi, I'm Tanay PrabhuDesai.</p>
<p>I'm a software engineer based in Pune, India.</p>
<p>This website is generated using <a href="https://github.com/tanayseven/personal_website/">Frozen Flask</a></p>
</div>
))
|
import React from 'react'
import { getSiteProps } from 'react-static'
//
import logoImg from '../logo.png'
export default getSiteProps(() => (
<div>
<div id="social-media-links">
<a target="_blank" href="https://www.linkedin.com/in/tanay-prabhudesai-1029b073/"><i className="fa fa-linkedin" aria-hidden="true"></i></a>
<a target="_blank" href="https://plus.google.com/+TanayPrabhuDesai"><i className="fa fa-google" aria-hidden="true"></i></a>
<a target="_blank" href="https://twitter.com/tanayseven"><i className="fa fa-twitter" aria-hidden="true"></i></a>
<a target="_blank" href="https://github.com/tanayseven"><i className="fa fa-github" aria-hidden="true"></i></a>
</div>
<p>Hi, I'm Tanay PrabhuDesai.</p>
<p>I'm a software engineer based in Pune, India.</p>
</div>
))
|
Remove unnessary line from home page
|
Remove unnessary line from home page
|
JavaScript
|
mit
|
tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website,tanayseven/personal_website
|
3003685020f4a81aeb363297e64aba430282fd2d
|
test/protractor.conf.js
|
test/protractor.conf.js
|
// An example configuration file.
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
allScriptsTimeout: 11000,
specs: [
'e2e/specs/*.js'
],
capabilities: {
'browserName': 'chrome'
},
chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
|
// Docs for protractor 0.24:
// https://github.com/angular/protractor/blob/8582b195ed0f4d48a0d9513017b21e99f8feb2fe/docs/api.md
exports.config = {
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
allScriptsTimeout: 11000,
specs: [
'e2e/specs/*.js'
],
capabilities: {
'browserName': 'chrome'
},
chromeOnly: true,
baseUrl: 'http://localhost:8000/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
|
Add comment pointing to appropriate version of protractor API
|
Add comment pointing to appropriate version of protractor API
|
JavaScript
|
mit
|
davidfurlong/ng-inspector,kennyx46/ng-inspector,rev087/ng-inspector,davidfurlong/ng-inspector,hafeez-syed/ng-inspector,hitesh97/ng-inspector,haithemaraissia/ng-inspector,rev087/ng-inspector,DrewML/ng-inspector,vitvad/ng-inspector,hitesh97/ng-inspector,vitvad/ng-inspector,hafeez-syed/ng-inspector,haithemaraissia/ng-inspector,DrewML/ng-inspector,kennyx46/ng-inspector
|
2c9dc54e90aff065be59fa970975b33edc497e53
|
src/scripts/formController.js
|
src/scripts/formController.js
|
/**
* Controller to bring functionality for the modal.
*
* @author Claire Wilgar
*/
/**
* Module export of controller function.
*
* @ngInject
* @param {angular.Service} $scope
* @param {angular.Service} $mdDialog
* @param {service} ApiService
* @param {var} item
*/
module.exports = function($scope, $mdDialog, ApiService, item) {
var self = this;
self.item = item;
if (!angular.isUndefined(self.item.available)) {
console.log(self.item.available);
self.item.available = new Date(self.item.available);
}
self.hide = function() {
$mdDialog.hide();
};
self.cancel = function() {
$mdDialog.cancel();
};
self.submitForm = function(data) {
ApiService.submitForm(data)
.then(function() {
$mdDialog.hide(data);
}, function(response) {
$mdDialog.cancel(response);
});
};
};
|
/**
* Controller to bring functionality for the modal.
*
* @author Claire Wilgar
*/
/**
* Module export of controller function.
*
* @ngInject
* @param {angular.Service} $scope
* @param {angular.Service} $mdDialog
* @param {service} ApiService
* @param {var} item
*/
module.exports = function($scope, $mdDialog, ApiService, item) {
var self = this;
self.item = item;
if (!angular.isUndefined(self.item) && self.item != null) {
console.log(self.item.available);
self.item.available = new Date(self.item.available);
}
self.hide = function() {
$mdDialog.hide();
};
self.cancel = function() {
$mdDialog.cancel();
};
self.submitForm = function(data) {
ApiService.submitForm(data)
.then(function() {
$mdDialog.hide(data);
}, function(response) {
$mdDialog.cancel(response);
});
};
};
|
Fix issue checking date when creating new item
|
Fix issue checking date when creating new item
|
JavaScript
|
mit
|
clairebones/stockkeeper,clairebones/stockkeeper
|
b9a1e215e2ce93daf684dfc1e3b5588352cea375
|
admin/server/routes/signout.js
|
admin/server/routes/signout.js
|
var keystone = require('../../../');
var session = require('../../../lib/session');
module.exports = function (req, res) {
session.signout(req, res, function () {
if (typeof keystone.get('signout redirect') === 'string') {
return res.redirect(keystone.get('signout redirect'));
} else if (typeof keystone.get('signout redirect') === 'function') {
return keystone.get('signout redirect')(req, res);
} else {
return res.redirect('/' + keystone.get('admin path') + '/signin?signedout');
}
});
};
|
var keystone = require('../../../');
var session = require('../../../lib/session');
module.exports = function (req, res) {
session.signout(req, res, function () {
if (typeof keystone.get('signout redirect') === 'string') {
return res.redirect(keystone.get('signout redirect'));
} else if (typeof keystone.get('signout redirect') === 'function') {
return keystone.get('signout redirect')(req, res);
} else {
return res.redirect('/' + keystone.get('admin path') + '/signin?signedout');
// After logging out, the user will be redirected to /signin?signedout
// It shows a bar on top of the sign in panel saying "You have been signed out".
}
});
};
|
Comment for signin?signedout version added
|
Comment for signin?signedout version added
|
JavaScript
|
mit
|
creynders/keystone,creynders/keystone
|
21898f01d9ee9559e7d5413f6e96ab65ff2f02b1
|
actions/actions.js
|
actions/actions.js
|
// All actions, used by actions or reducers, go here
export const CLOSE_CARD = 'CLOSE_CARD'
export const LOAD_CARD_PAGE = 'LOAD_CARD_PAGE'
export const NAVIGATE = 'NAVIGATE'
export const OPEN_CARD = 'OPEN_CARD'
export const RECEIVE_ALL_REGIONS = 'RECEIVE_ALL_REGIONS'
export const RECEIVE_CARD_PAGE_DATA = 'RECEIVE_CARD_PAGE_DATA'
export const RECEIVE_CARD_PAGES = 'RECEIVE_CARD_PAGES'
export const RECEIVE_CARD_QUERY = 'RECEIVE_CARD_QUERY'
export const RECEIVE_CHART_DATA = 'RECEIVE_CHART_DATA'
export const RECEIVE_QUERY_RESULT = 'RECEIVE_QUERY_RESULT'
export const RECEIVE_REGION = 'RECEIVE_REGION'
export const RECEIVE_TABLE_HEADERS = 'RECEIVE_TABLE_HEADERS'
export const RECEIVE_TABLES = 'RECEIVE_TABLES'
export const REQUEST_CARD_QUERY = 'REQUEST_CARD_QUERY'
export const REQUEST_CHART_DATA = 'REQUEST_CHART_DATA'
export const REQUEST_REGION = 'REQUEST_REGION'
export const SELECT_DATA_VIEW = 'SELECT_DATA_VIEW'
export const UPDATE_CARD_QUERY = 'UPDATE_CARD_QUERY'
|
// All actions, used by actions or reducers, go here
export const CLOSE_CARD = 'CLOSE_CARD'
export const LOAD_CARD_PAGE = 'LOAD_CARD_PAGE'
export const NAVIGATE = 'NAVIGATE'
export const OPEN_CARD = 'OPEN_CARD'
export const RECEIVE_ALL_REGIONS = 'RECEIVE_ALL_REGIONS'
export const RECEIVE_CARD_PAGE_DATA = 'RECEIVE_CARD_PAGE_DATA'
export const RECEIVE_CARD_PAGES = 'RECEIVE_CARD_PAGES'
export const RECEIVE_CARD_QUERY = 'RECEIVE_CARD_QUERY'
export const RECEIVE_CHART_DATA = 'RECEIVE_CHART_DATA'
export const RECEIVE_QUERY_RESULT = 'RECEIVE_QUERY_RESULT'
export const RECEIVE_REGION = 'RECEIVE_REGION'
export const RECEIVE_TABLE_HEADERS = 'RECEIVE_TABLE_HEADERS'
export const RECEIVE_TABLES = 'RECEIVE_TABLES'
export const REQUEST_CARD_QUERY = 'REQUEST_CARD_QUERY'
export const REQUEST_CHART_DATA = 'REQUEST_CHART_DATA'
export const REQUEST_REGION = 'REQUEST_REGION'
export const SELECT_DATA_VIEW = 'SELECT_DATA_VIEW'
export const UPDATE_CARD_QUERY = 'UPDATE_CARD_QUERY'
export const SET_TABLE_VISIBILITY = 'SET_TABLE_VISIBILITY'
|
Add action for fiddling with the show table button
|
Add action for fiddling with the show table button
|
JavaScript
|
mit
|
bengler/imdikator,bengler/imdikator
|
0011f6d4c08e2b5992e8329b5a60291c72144bf9
|
src/services/dateFnsHelper.js
|
src/services/dateFnsHelper.js
|
import Vue from 'vue'
import distanceInWords from 'date-fns/distance_in_words'
export default new Vue({
data: {
locale: 'en',
loadedLocale: 'en',
locales: {},
now: new Date(),
},
created () {
setInterval(() => { this.now = new Date() }, 10 * 1000)
},
watch: {
async locale (locale) {
if (locale === 'zh') locale = 'zh_tw' // https://date-fns.org/v1.29.0/docs/I18n
Vue.set(this.locales, this.locale, await import(`date-fns/locale/${locale}`))
this.loadedLocale = this.locale
},
},
methods: {
distanceInWordsToNow (date, options = {}) {
if (options.disallowFuture && date > this.now) date = this.now
return distanceInWords(this.now, date, { locale: this.locales[this.loadedLocale], ...options })
},
},
})
|
import Vue from 'vue'
import distanceInWords from 'date-fns/distance_in_words'
// https://date-fns.org/v1.29.0/docs/I18n
const localeMap = {
zh: 'zh_tw',
}
export default new Vue({
data: {
locale: 'en',
localeData: null,
now: new Date(),
},
created () {
setInterval(() => { this.now = new Date() }, 10 * 1000)
},
watch: {
async locale (locale) {
this.localeData = await import(`date-fns/locale/${localeMap[locale] || locale}`)
},
},
methods: {
distanceInWordsToNow (date, options = {}) {
if (options.disallowFuture && date > this.now) date = this.now
return distanceInWords(this.now, date, { locale: this.localeData, ...options })
},
},
})
|
Simplify dateFns locale data handling + add map
|
Simplify dateFns locale data handling + add map
Previously cached it internally, but the import() gets cached
anyway.
|
JavaScript
|
mit
|
yunity/karrot-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/foodsaving-frontend,yunity/karrot-frontend,yunity/karrot-frontend,yunity/foodsaving-frontend,yunity/foodsaving-frontend
|
4e1b1049d2b07d625a5473fbde365987f69bf5ab
|
lib/core/window.js
|
lib/core/window.js
|
/* See license.txt for terms of usage */
"use strict";
const { Trace, TraceError } = require("../core/trace.js").get(module.id);
const { once } = require("sdk/dom/events.js");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const { openTab } = require("sdk/tabs/utils");
// Module implementation
var Win = {};
/**
* Returns a promise that is resolved as soon as the window is loaded
* or immediately if the window is already loaded.
*
* @param {Window} The window object we need use when loaded.
*/
Win.loaded = win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "load", event => resolve(event.target));
}
});
// xxxHonza: we might want to merge with Win.loaded
Win.domContentLoaded = win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "DOMContentLoaded", event => resolve(event.target));
}
});
Win.openNewTab = function(url, options) {
let browser = getMostRecentBrowserWindow();
openTab(browser, url, options);
}
// Exports from this module
exports.Win = Win;
|
/* See license.txt for terms of usage */
"use strict";
const { Cu } = require("chrome");
const { Trace, TraceError } = require("../core/trace.js").get(module.id);
const { once } = require("sdk/dom/events.js");
const { getMostRecentBrowserWindow } = require("sdk/window/utils");
const { openTab } = require("sdk/tabs/utils");
const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
const { makeInfallible } = devtools["require"]("devtools/toolkit/DevToolsUtils.js");
// Module implementation
var Win = {};
/**
* Returns a promise that is resolved as soon as the window is loaded
* or immediately if the window is already loaded.
*
* @param {Window} The window object we need use when loaded.
*/
Win.loaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "load", event => resolve(event.target));
}
}));
// xxxHonza: we might want to merge with Win.loaded
Win.domContentLoaded = makeInfallible(win => new Promise(resolve => {
if (win.document.readyState === "complete") {
resolve(win.document);
}
else {
once(win, "DOMContentLoaded", event => resolve(event.target));
}
}));
Win.openNewTab = function(url, options) {
let browser = getMostRecentBrowserWindow();
openTab(browser, url, options);
}
// Exports from this module
exports.Win = Win;
|
Use make infallible for win load handlers
|
Use make infallible for win load handlers
|
JavaScript
|
bsd-3-clause
|
vlajos/firebug.next,firebug/firebug.next,bmdeveloper/firebug.next,firebug/firebug.next,bmdeveloper/firebug.next,vlajos/firebug.next
|
5cd9024bbc121cdcd3590d84cc5e3bb9e6efde64
|
packages/rotonde-plugin-chat/src/index.js
|
packages/rotonde-plugin-chat/src/index.js
|
import { PLUGIN_TYPE } from 'rotonde-plugin';
export const TYPE = PLUGIN_TYPE.ISOMORPHIC;
export { default as ChatClientPlugin } from './client';
export { default as ChatServerPlugin } from './server';
|
import { PLUGIN_TYPE } from 'rotonde-plugin';
import ChatClientPlugin from './client';
import ChatServerPlugin from './server';
export {
ChatClientPlugin,
ChatServerPlugin
};
// Plugin export.
export const TYPE = PLUGIN_TYPE.ISOMORPHIC;
export const ClientPlugin = ChatClientPlugin;
export const ServerPlugin = ChatServerPlugin;
|
Use consistent exports for plugins
|
Use consistent exports for plugins
This allows us to use them generically
|
JavaScript
|
mit
|
merveilles/Rotonde,merveilles/Rotonde
|
591d4366c43173fa4d0490a1325a3eef25f95c48
|
lib/js/spinners.js
|
lib/js/spinners.js
|
!function(){
window.attachSpinnerEvents = function () {
var spinners = document.querySelectorAll('.toggle-spinner'),
i = spinners.length;
while (i--) {
console.log('Attaching spinners');
var s = spinners[i];
s.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var target = e.target;
if (e.target.nodeName === 'I') {
target = e.target.parentNode;
}
var spinner = target.parentNode.querySelectorAll('.spinner')[0];
spinner.classList.toggle('active');
});
}
// Close spinner event handler
document.addEventListener('click', function (e) {
var els = document.querySelectorAll('.spinner'),
o = els.length;
while (o--) els[o].classList.remove('active');
});
}
attachSpinnerEvents();
}();
|
!function(){
window.attachSpinnerEvents = function () {
var spinners = document.querySelectorAll('.toggle-spinner'),
i = spinners.length;
while (i--) {
var s = spinners[i];
s.addEventListener('click', function (e) {
e.preventDefault();
e.stopPropagation();
var target = e.target;
if (e.target.nodeName === 'I') {
target = e.target.parentNode;
}
var spinner = target.parentNode.querySelectorAll('.spinner')[0];
spinner.classList.toggle('active');
});
}
// Close spinner event handler
document.addEventListener('click', function (e) {
var els = document.querySelectorAll('.spinner'),
o = els.length;
while (o--) els[o].classList.remove('active');
});
}
attachSpinnerEvents();
}();
|
Remove comment in the while loop
|
Remove comment in the while loop
|
JavaScript
|
mit
|
Distrotech/fries,lilien1010/fries,wleopar-d/Fires,lilien1010/fries,jaunesarmiento/fries,eyecatchup/fries,wleopar-d/Fires,ao-forks/fries,ao-forks/fries,lilien1010/fries,jaunesarmiento/fries,wleopar-d/Fires
|
0468f019b6c040b978d6aae55dea27ec22a85cb7
|
assets/js/racer.js
|
assets/js/racer.js
|
function Game(){
this.$track = $('#racetrack');
}
function Player(id){
this.player = $('.player')[id - 1];
this.position = 10;
}
Player.prototype.move = function(){
this.position += 10;
};
Player.prototype.updatePosition = function(){
$player = $(this.player);
$player.css('margin-left', this.position);
};
$(document).ready(function() {
var game = new Game();
var player1 = new Player(1);
var player2 = new Player(2);
$(document).on('keyup', function(keyPress){
if(keyPress.keyCode === 80) {
player1.move();
player1.updatePosition();
} else if (keyPress.keyCode === 81) {
player2.move();
player2.updatePosition();
}
});
});
|
function Game(){
this.$track = $('#racetrack');
this.finishLine = this.$track.width() - 54;
}
function Player(id){
this.player = $('.player')[id - 1];
this.position = 10;
}
Player.prototype.move = function(){
this.position += 10;
};
Player.prototype.updatePosition = function(){
$player = $(this.player);
$player.css('margin-left', this.position);
};
$(document).ready(function() {
var game = new Game();
var player1 = new Player(1);
var player2 = new Player(2);
$(document).on('keyup', function(keyPress){
if(keyPress.keyCode === 80) {
player1.move();
player1.updatePosition();
} else if (keyPress.keyCode === 81) {
player2.move();
player2.updatePosition();
}
});
});
|
Add finishLine state to Game object
|
Add finishLine state to Game object
|
JavaScript
|
mit
|
SputterPuttRedux/basic-javascript-racer,SputterPuttRedux/basic-javascript-racer
|
b4b7fd4f7353c92587b55afc7ad593787575fe09
|
app/routes/login.js
|
app/routes/login.js
|
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
var win = window.open('/github_login', 'Authorization',
'width=1000,height=450,' +
'toolbar=0,scrollbars=1,status=1,resizable=1,' +
'location=1,menuBar=0');
if (!win) { return; }
// For the life of me I cannot figure out how to do this other than
// polling
var self = this;
var oauthInterval = window.setInterval(function(){
if (!win.closed) { return; }
window.clearInterval(oauthInterval);
var response = JSON.parse(localStorage.github_response);
if (!response.ok) {
self.controllerFor('application').set('flashError',
'Failed to log in');
return;
}
var data = response.data;
if (data.errors) {
var error = "Failed to log in: " + data.errors[0];
self.controllerFor('application').set('flashError', error);
return;
}
var user = self.store.push('user', data.user);
var transition = self.session.get('savedTransition');
self.session.loginUser(user);
if (transition) {
transition.retry();
}
}, 200);
transition.abort();
}
});
|
import Ember from 'ember';
export default Ember.Route.extend({
beforeModel: function(transition) {
var win = window.open('/github_login', 'Authorization',
'width=1000,height=450,' +
'toolbar=0,scrollbars=1,status=1,resizable=1,' +
'location=1,menuBar=0');
if (!win) { return; }
// For the life of me I cannot figure out how to do this other than
// polling
var self = this;
var oauthInterval = window.setInterval(function(){
if (!win.closed) { return; }
window.clearInterval(oauthInterval);
var response = JSON.parse(localStorage.github_response);
if (!response.ok) {
self.controllerFor('application').set('flashError',
'Failed to log in');
return;
}
var data = response.data;
if (data.errors) {
var error = "Failed to log in: " + data.errors[0];
self.controllerFor('application').set('flashError', error);
return;
}
var user = self.store.push('user', data.user);
user.set('api_token', data.api_token);
var transition = self.session.get('savedTransition');
self.session.loginUser(user);
if (transition) {
transition.retry();
}
}, 200);
transition.abort();
}
});
|
Set the api token from a successful authorization
|
Set the api token from a successful authorization
|
JavaScript
|
apache-2.0
|
withoutboats/crates.io,Gankro/crates.io,steveklabnik/crates.io,chenxizhang/crates.io,mbrubeck/crates.io,Gankro/crates.io,steveklabnik/crates.io,BlakeWilliams/crates.io,rust-lang/crates.io,achanda/crates.io,chenxizhang/crates.io,withoutboats/crates.io,achanda/crates.io,sfackler/crates.io,BlakeWilliams/crates.io,Gankro/crates.io,achanda/crates.io,Susurrus/crates.io,chenxizhang/crates.io,withoutboats/crates.io,rust-lang/crates.io,mbrubeck/crates.io,rust-lang/crates.io,sfackler/crates.io,BlakeWilliams/crates.io,Gankro/crates.io,chenxizhang/crates.io,BlakeWilliams/crates.io,Susurrus/crates.io,sfackler/crates.io,steveklabnik/crates.io,mbrubeck/crates.io,Susurrus/crates.io,rust-lang/crates.io,achanda/crates.io,withoutboats/crates.io,Susurrus/crates.io,mbrubeck/crates.io,steveklabnik/crates.io
|
929a80bb98e44a2c0f0bd05716d3152d7828e72f
|
webdiagrams/uml.js
|
webdiagrams/uml.js
|
/**
* Created by Leandro Luque on 24/07/17.
*/
/* JSHint configurations */
/* jshint esversion: 6 */
/* jshint -W097 */
'use strict';
// A.
const ATTRIBUTE = "A1";
// C.
const CLASS = "C1";
// D.
const DEFAULT = "~";
// I.
const INITIAL_VALUE = "I1";
const INTERFACE = "I2";
const IS_ABSTRACT = "I3";
const IS_LEAF = "I4";
const IS_READ_ONLY = "I5";
const IS_STATIC = "I6";
// M.
const MODEL = "M1";
// O.
const OPERATION = "O1";
// P.
const PRIVATE = "-";
const PROTECTED = "#";
const PUBLIC = "+";
// R.
const RETURN_TYPE = "R1";
// S.
const STEREOTYPE = "S1";
// T.
const TYPE = "T1";
// V.
const VISIBILITY = "V1";
|
/**
* Created by Leandro Luque on 24/07/17.
*/
/* JSHint configurations */
/* jshint esversion: 6 */
/* jshint -W097 */
'use strict';
// A.
const ATTRIBUTE = "A1";
// C.
const CLASS = "C1";
// D.
const DEFAULT = "~";
// I.
const INITIAL_VALUE = "I1";
const INTERFACE = "I2";
const IS_ABSTRACT = "I3";
const IS_LEAF = "I4";
const IS_READ_ONLY = "I5";
const IS_STATIC = "I6";
// M.
const MODEL = "M1";
// O.
const OPERATION = "O1";
// P.
const PRIVATE = "-";
const PROTECTED = "#";
const PUBLIC = "+";
const PARAMETER = "P1"
// R.
const RETURN_TYPE = "R1";
// S.
const STEREOTYPE = "S1";
// T.
const TYPE = "T1";
// V.
const VISIBILITY = "V1";
|
Add parameter to UML constants
|
Add parameter to UML constants
|
JavaScript
|
mit
|
leluque/webdiagrams,leluque/webdiagrams
|
ed3c2a0de70dd7e96fcb376d2199425f0130809a
|
node-tests/unit/utils/validate-platforms-test.js
|
node-tests/unit/utils/validate-platforms-test.js
|
'use strict';
const expect = require('../../helpers/expect');
const ValidatePlatforms = require('../../../src/utils/validate-platforms');
describe('ValidatePlatforms', () => {
context('when platforms contain valid platforms', () => {
it('returns true', () => {
const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
expect(ValidatePlatforms(platforms)).to.equal(true);
});
});
context('when platforms contain invalid platforms', () => {
it('returns false', () => {
const platforms = ['symbian'];
expect(ValidatePlatforms(platforms)).to.equal(false);
});
});
});
|
'use strict';
const expect = require('../../helpers/expect');
const ValidatePlatforms = require('../../../src/utils/validate-platforms');
describe('ValidatePlatforms', () => {
context('when platforms contain valid platforms', () => {
const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
it('returns true', () => {
expect(ValidatePlatforms(platforms)).to.equal(true);
});
});
context('when platforms contain invalid platforms', () => {
const platforms = ['symbian'];
it('returns false', () => {
expect(ValidatePlatforms(platforms)).to.equal(false);
});
});
});
|
Update test to move context code to context block
|
style(validate-platforms): Update test to move context code to context block
|
JavaScript
|
mit
|
isleofcode/splicon
|
ff15e37b70578c1eb202773f310879e6451b4e9e
|
src/storage/storage.js
|
src/storage/storage.js
|
const { remote } = require('electron');
const path = require('path');
const Config = require('electron-config');
const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');
const KEYS = {
BASE_DESTINATION: 'base_destination',
};
let config;
export var init = function () {
config = new Config();
if (! config.has(KEYS.BASE_DESTINATION)) {
config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
}
};
export var save = function (key, value) {
config.set(key, value);
};
export var get = function (key) {
config.get(key);
};
export var getBaseDestination = function () {
return config.get(KEYS.BASE_DESTINATION);
}
|
const { remote } = require('electron');
const path = require('path');
const Config = require('electron-config');
const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');
const KEYS = {
BASE_DESTINATION: 'base_destination',
};
let config;
export var init = function () {
config = new Config();
if (! config.has(KEYS.BASE_DESTINATION)) {
config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
}
};
export var save = function (key, value) {
config.set(key, value);
};
export var get = function (key) {
config.get(key);
};
export var getBaseDestination = function () {
return config.get(KEYS.BASE_DESTINATION);
}
export var setBaseDestination = function (baseDestination) {
config.set(KEYS.BASE_DESTINATION, baseDestination);
}
|
Add method to set base destination
|
Add method to set base destination
|
JavaScript
|
mit
|
yannbertrand/youtube-dl-gui,yannbertrand/youtube-dl-gui,yannbertrand/youtube-dl-gui
|
cab77f9829497b5557ca33ccea9ae1bd52e5e351
|
options.js
|
options.js
|
function generate_key_pair() {
generateKeyPair().then(function(key) {
exportKey(key.privateKey).then(function(exported_private_key) {
chrome.storage.local.set(
{ exported_private_key: exported_private_key },
function() {
var status = document.getElementById('status');
status.textContent = 'Key pair was successfully created.';
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
});
}
function export_public_key() {}
document.getElementById('generate-key-pair').addEventListener('click', generate_key_pair);
//document.getElementById('export-public-key').addEventListener('click', export_public_key);
|
function generate_key_pair() {
generateKeyPair().then(function(key) {
// export and store private key
exportKey(key.privateKey).then(function(exported_private_key) {
chrome.storage.local.set(
{ exported_private_key: exported_private_key },
function() {
var status = document.getElementById('status');
status.textContent = 'Key pair was successfully created.';
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
// export and store public key
exportKey(key.publicKey).then(function(exported_public_key) {
chrome.storage.local.set(
{ exported_public_key: exported_public_key },
function() {
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
});
}
function export_public_key() {}
document.getElementById('generate-key-pair').addEventListener('click', generate_key_pair);
//document.getElementById('export-public-key').addEventListener('click', export_public_key);
|
Store generated public key on chrome.storage.local.
|
Store generated public key on chrome.storage.local.
|
JavaScript
|
bsd-3-clause
|
microwaves/autonomous-messages,microwaves/autonomous-messages
|
575077bf8be2efc2809fa8aa2a77f122f3239396
|
src/js/main.js
|
src/js/main.js
|
;(function(){
angular.module('flockTogether', ['ngRoute'], function($routeProvider, $httpProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
controller: 'loginCtrl'
})//END .when '/'
})//END angular.module 'flock'
.controller('MainController', function(){
// window.fbAsyncInit = function() {
// FB.init({
// appId : '531876423645126',
// xfbml : true,
// version : 'v2.5'
// });
// };
})//END MainController
})();//END IIFE
|
;(function(){
angular.module('flockTogether', ['ngRoute'], function($routeProvider, $httpProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
controller: 'homeCtrl'
})//END .when '/home'
.when('/login', {
templateUrl: 'partials/login.html',
controller: 'loginCtrl'
})//END .when '/login'
.when('/create-event', {
templateUrl: 'partials/create_event.html',
controller: 'createEventCtrl'
})
})//END angular.module 'flock'
.controller('MainController', function($http, $scope){
})//END MainController
})();//END IIFE
|
Add .when for each current partial.
|
Add .when for each current partial.
|
JavaScript
|
mit
|
flock-together/flock-fee,flock-together/flock-fee
|
cdf96b8268996f5c4b7eea4fe2077d0b37205d79
|
js/navbar.js
|
js/navbar.js
|
(function() {
// construct Headroom
var headroom = new Headroom(document.querySelector(".js-nvbr"), {
"offset": Options.navbarOffset,
"tolerance": Options.navbarTolerance
});
// initialize Headroom
headroom.init();
// add click events to sidebar nav links
document.addEventListener("DOMContentLoaded", function() {
// choose elements to add click event to
var elements = document.getElementsByClassName("x2b-sdbr-lnk");
// iterate over elements
for (var i = 0; elements[i]; ++i) {
// add click event
elements[i].onclick = function() {
// fudge scroll position to make Headroom pin
headroom.lastKnownScrollY = headroom.getScrollerHeight();
}
}
});
})();
|
(function() {
// construct Headroom
var headroom = new Headroom(document.querySelector(".js-nvbr"), {
"offset": Options.navbarOffset,
"tolerance": Options.navbarTolerance
});
// initialize Headroom
headroom.init();
// add click events to sidebar nav links
document.addEventListener("DOMContentLoaded", function() {
// choose elements to add click event to
var elements = document.getElementsByClassName("x2b-sdbr-lnk");
// iterate over elements
for (var i = 0; elements[i]; ++i) {
// add click event
elements[i].onclick = function() {
// fudge scroll position to make Headroom pin
headroom.lastKnownScrollY = headroom.getScrollerHeight();
// make Headroom pin even if scroll position has not changed
window.requestAnimationFrame(function() { headroom.pin() });
}
}
});
})();
|
Make Headroom pin even if scroll position has not changed
|
Make Headroom pin even if scroll position has not changed
|
JavaScript
|
mit
|
acch/XML-to-bootstrap,acch/XML-to-bootstrap
|
f8aa1ab924c19b8bab4be2b9f69b68b70bae6576
|
package.js
|
package.js
|
Package.describe({
summary: "Fast and reactive jQuery DataTables using standard Cursors / DataTables API. Supports Bootstrap 3.",
version: "1.0.1",
git: "https://github.com/ephemer/meteor-reactive-datatables.git"
});
Package.onUse(function(api) {
api.versionsFrom('METEOR@0.9.0');
api.use(['templating'], 'client');
api.addFiles([
'jquery.dataTables.min.js',
'reactive-datatables.js',
'reactive-datatable-template.html',
'reactive-datatable-template.js',
], 'client');
});
/*Package.onTest(function(api) {
api.use('tinytest');
api.use('ephemer:reactive-datatables');
api.addFiles('reactive-datatables-tests.js');
});
*/
|
Package.describe({
name: 'ephemer:reactive-datatables',
summary: "Fast and reactive jQuery DataTables using standard Cursors / DataTables API. Supports Bootstrap 3.",
version: "1.0.1",
git: "https://github.com/ephemer/meteor-reactive-datatables.git"
});
Package.onUse(function(api) {
api.versionsFrom('0.9.0');
api.use(['templating'], 'client');
api.addFiles([
'jquery.dataTables.min.js',
'reactive-datatables.js',
'reactive-datatable-template.html',
'reactive-datatable-template.js',
], 'client');
});
/*Package.onTest(function(api) {
api.use('tinytest');
api.use('ephemer_reactive-datatables');
api.addFiles('reactive-datatables-tests.js');
});
*/
|
Add name, prepare test filename to be Windows-friendly
|
Add name, prepare test filename to be Windows-friendly
|
JavaScript
|
mit
|
rossmartin/meteor-reactive-datatables,ephemer/meteor-reactive-datatables,rossmartin/meteor-reactive-datatables,ephemer/meteor-reactive-datatables
|
53d364b5d98c7e2d83b7d8c3d5bde46c37615d64
|
src/js/containers/main-content/header-filter.js
|
src/js/containers/main-content/header-filter.js
|
'use strict'
import React from 'react'
import FormSelect from '../../components/form-select'
import FormSearch from './form-search'
const filterFields = [{
icon: { id: 'date', label: 'Data' },
label: 'Escolha um mês',
options: [
{ text: 'Escolha um mês', value: '' },
{ text: 'Janeiro', value: 'Janeiro' },
{ text: 'Fevereiro', value: 'Fevereiro' },
{ text: 'Março', value: 'Março' }
]
}, {
icon: { id: 'location', label: 'Local' },
label: 'Escolha um estado',
options: [
{ text: 'Escolha um estado', value: '' },
{ text: 'São Paulo', value: 'São Paulo' },
{ text: 'Acre', value: 'Acre' },
{ text: 'Paraná', value: 'Paraná' }
]
}]
const HeaderFilter = () => (
<nav className='filter'>
{filterFields.map((props, index) => (
<FormSelect key={index} {...props} />
))}
<FormSearch />
</nav>
)
export default HeaderFilter
|
'use strict'
import React, { PropTypes } from 'react'
import FormSelect from '../../components/form-select'
import FormSearch from './form-search'
const HeaderFilter = ({ monthFilter, stateFilter, searchField }) => (
<nav className='filter'>
<FormSelect key='months' {...monthFilter} />
<FormSelect key='states' {...stateFilter} />
<FormSearch />
</nav>
)
HeaderFilter.propTypes = {
monthFilter: PropTypes.object.isRequired,
stateFilter: PropTypes.object.isRequired,
searchField: PropTypes.string.isRequired
}
export default HeaderFilter
|
Update header filter, passing props down
|
Update header filter, passing props down
|
JavaScript
|
mit
|
campinas-front-end/institucional,campinas-front-end-meetup/institucional,campinas-front-end-meetup/institucional,campinas-front-end/institucional,frontendbr/eventos
|
e4694ee5e0491344ed04336e2eaabf3838c7f037
|
app/assets/javascripts/application.js
|
app/assets/javascripts/application.js
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require ckeditor-jquery
//= require_tree .
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
|
Remove CKEditor-jquery JS from default app JS
|
Remove CKEditor-jquery JS from default app JS
|
JavaScript
|
agpl-3.0
|
AsunaYuukio/quienmanda.es,civio/quienmanda.es,civio/quienmanda.es,AsunaYuukio/quienmanda.es,AsunaYuukio/quienmanda.es,civio/quienmanda.es,AsunaYuukio/quienmanda.es,civio/quienmanda.es
|
033ee79b6e2fd0ff747efab5b42e8a03ff65d92d
|
lib/assets/javascript.js
|
lib/assets/javascript.js
|
"use strict";
var util = require('util'),
path = require('path'),
jsParser = require('uglify-js').parser,
compressor = require('uglify-js').uglify,
Asset = require('../Asset'),
JSAsset = function(settings) {
settings.compressor = settings.compressor || 'uglify';
this.init(settings);
var self = this;
this.on('variantPostRenderFile', function(variant, file, cb) {
if (!Asset.COMPRESS) return cb();
var basename = path.basename(file);
self.compress(file, variant.getRenderCache(file), function(err, data) {
// errors are already signaled by the compressor
variant.setRenderCache(file, "/* " + basename + " */\n" + data + "\n\n");
cb();
});
});
};
util.inherits(JSAsset, Asset);
Asset.registerCompressor('uglify', function(filepath, data, cb) {
try {
var ast = compressor.ast_squeeze(compressor.ast_mangle(jsParser.parse(data)));
cb(null, ';' + compressor.gen_code(ast));
} catch (ex) {
console.error('ERROR: Uglify compressor error in ' + filepath);
console.error(ex);
// only show the error in the logs...don't stop serving because of this
cb(null, data);
}
});
JSAsset.configure = function(opts) {
Asset.configure(opts);
};
module.exports = JSAsset;
|
"use strict";
var util = require('util'),
path = require('path'),
jsParser = require('uglify-js').parser,
compressor = require('uglify-js').uglify,
Asset = require('../Asset'),
JSAsset = function(settings) {
settings.compressor = settings.compressor || 'uglify';
this.init(settings);
var self = this;
this.on('variantPostRenderFile', function(variant, file, cb) {
var basename = path.basename(file),
contents = variant.getRenderCache(file);
if (!Asset.COMPRESS) {
variant.setRenderCache(file, contents + "\n\n");
return cb();
}
self.compress(file, contents, function(err, data) {
// errors are already signaled by the compressor
variant.setRenderCache(file, "/* " + basename + " */\n" + data + "\n\n");
cb();
});
});
};
util.inherits(JSAsset, Asset);
Asset.registerCompressor('uglify', function(filepath, data, cb) {
try {
var ast = compressor.ast_squeeze(compressor.ast_mangle(jsParser.parse(data)));
cb(null, ';' + compressor.gen_code(ast));
} catch (ex) {
console.error('ERROR: Uglify compressor error in ' + filepath);
console.error(ex);
// only show the error in the logs...don't stop serving because of this
cb(null, data);
}
});
JSAsset.configure = function(opts) {
Asset.configure(opts);
};
module.exports = JSAsset;
|
Add \n\n even when only concat'ing and not compressing JS assets
|
Add \n\n even when only concat'ing and not compressing JS assets
|
JavaScript
|
mit
|
2sidedfigure/exstatic
|
3fb764521d2f503bf33e667c2ea1b7a524526359
|
app/assets/javascripts/application.js
|
app/assets/javascripts/application.js
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require foundation
//= require turbolinks
//= require_tree .
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
$(function(){ $(document).foundation(); });
|
Add scripting for Foundation to fix issue with carousel
|
Add scripting for Foundation to fix issue with carousel
|
JavaScript
|
mit
|
TerrenceLJones/not-bored-tonight,TerrenceLJones/not-bored-tonight
|
542491ba818da8768340464323e9fa38fff268cf
|
app/initializers/extend-ember-link.js
|
app/initializers/extend-ember-link.js
|
import Ember from 'ember';
export function initialize(/*application */) {
Ember.LinkComponent.reopen({
attributeBindings: ['tooltip', 'data-placement'],
// Set activeParent=true on a {{link-to}} to automatically propagate the active
// class to the parent element (like <li>{{link-to}}</li>)
activeParent: false,
addActiveObserver: function() {
if ( this.get('activeParent') ) {
this.addObserver('active', this, 'activeChanged');
this.activeChanged();
}
}.on('didInsertElement'),
activeChanged() {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
// need to mark the parent drop down as active as well
if (this.get('submenuItem')) {
if (!!this.get('active')) {
if (!this.$().closest('li.dropdown.active').length) {
var $dropdown = this.$().closest('li.dropdown');
$dropdown.addClass('active');
$dropdown.siblings('li.active').removeClass('active');
}
}
}
this.$().parent().toggleClass('active', !!this.get('active'));
}
});
}
export default {
name: 'extend-ember-link',
initialize: initialize
};
|
import Ember from 'ember';
export function initialize(/*application */) {
Ember.LinkComponent.reopen({
attributeBindings: ['tooltip', 'data-placement'],
// Set activeParent=true on a {{link-to}} to automatically propagate the active
// class to the parent element (like <li>{{link-to}}</li>)
activeParent: false,
addActiveObserver: function() {
if ( this.get('activeParent') ) {
this.addObserver('active', this, 'activeChanged');
this.activeChanged();
}
}.on('didInsertElement'),
activeChanged() {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
// need to mark the parent drop down as active as well
if (!!this.get('active')) {
if (this.get('submenuItem')) {
if (!this.$().closest('li.dropdown.active').length) {
var $dropdown = this.$().closest('li.dropdown');
$dropdown.addClass('active');
$dropdown.siblings('li.active').removeClass('active');
}
} else {
if (this.$().parent().siblings('li.dropdown.active').length) {
this.$().parent().siblings('li.dropdown.active').removeClass('active');
}
}
}
this.$().parent().toggleClass('active', !!this.get('active'));
}
});
}
export default {
name: 'extend-ember-link',
initialize: initialize
};
|
Update to nav-header dropdown active highlighting
|
Update to nav-header dropdown active highlighting
|
JavaScript
|
apache-2.0
|
rancher/ui,rancherio/ui,rancherio/ui,vincent99/ui,westlywright/ui,lvuch/ui,rancher/ui,westlywright/ui,lvuch/ui,rancherio/ui,rancher/ui,vincent99/ui,pengjiang80/ui,pengjiang80/ui,lvuch/ui,vincent99/ui,pengjiang80/ui,westlywright/ui
|
7c5db77f4b63c60f06cd2f872d09bf83acaf5c7b
|
app/initializers/route-spy.js
|
app/initializers/route-spy.js
|
import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on('didTransition'),
willTranstionNotify: function(transition) {
const router = window.ls('router');
window.top.postMessage({
action: 'before-navigation',
target: transition.targetName,
url: router.urlFor(transition.targetName)
})
}.on('willTransition')
});
// Add listener for post messages to change the route in the application
window.addEventListener('message', (event) => {
const msg = event.data || {};
// Navigate when asked to
if (msg.action === 'navigate') {
const router = window.ls('router');
// If the route being asked for is already loaded, then
if (router.currentRouteName === msg.name) {
window.top.postMessage({
action: 'did-transition',
url: router.urlFor(msg.name)
})
}
router.transitionTo(msg.name);
}
});
}
}
export default {
name: 'route-spy',
initialize,
};
|
import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on('didTransition'),
willTranstionNotify: function(transition) {
const router = window.ls('router');
window.top.postMessage({
action: 'before-navigation',
target: transition.targetName,
url: router.urlFor(transition.targetName)
})
}.on('willTransition')
});
// Add listener for post messages to change the route in the application
window.addEventListener('message', (event) => {
const msg = event.data || {};
// Navigate when asked to
if (msg.action === 'navigate') {
const router = window.ls('router');
// If the route being asked for is already loaded, then
if (router.currentRouteName === msg.name) {
window.top.postMessage({
action: 'did-transition',
url: router.urlFor(msg.name)
})
}
router.transitionTo(msg.name);
} else if (msg.action == 'set-theme') {
const userTheme = window.ls('userTheme');
if (userTheme) {
userTheme.setTheme( msg.name, false);
}
}
});
}
}
export default {
name: 'route-spy',
initialize,
};
|
Allow theme to be changed
|
Allow theme to be changed
|
JavaScript
|
apache-2.0
|
westlywright/ui,vincent99/ui,westlywright/ui,rancherio/ui,rancherio/ui,vincent99/ui,rancher/ui,rancher/ui,vincent99/ui,rancherio/ui,westlywright/ui,rancher/ui
|
85c90d0443f280fe722619a735a9866239e94322
|
spec/javascripts/bootstrap_toggle_spec.js
|
spec/javascripts/bootstrap_toggle_spec.js
|
describe('bootstrap toggle', function() {
var header;
beforeEach(function() {
setFixtures('<li class="dropdown" id="menuOrgs">'+
'<a class="dropdown-toggle" href="#" data-toggle ="dropdown">Organisations</a>' +
'<ul class="dropdown-menu">' +
' <li><a href="/organization_reports/without_users">Without Users</a></li>' +
'</ul>' +
'</li>');
link = $('a')[0];
});
describe('when clicking on the parent', function() {
it('pops up a list', function() {
link.click();
expect($('li#menuOrgs')).toHaveClass('open');
link.click();
expect($('li#menuOrgs')).not.toHaveClass('open');
});
});
});
|
describe('bootstrap toggle', function() {
var link;
beforeEach(function() {
setFixtures('<li class="dropdown" id="menuOrgs">'+
'<a class="dropdown-toggle" href="#" data-toggle ="dropdown">Organisations</a>' +
'<ul class="dropdown-menu">' +
' <li><a href="/organization_reports/without_users">Without Users</a></li>' +
'</ul>' +
'</li>');
link = $('a').first();
});
describe('when clicking on the parent', function() {
it('pops up a list', function() {
link.click();
expect($('li#menuOrgs')).toHaveClass('open');
link.click();
expect($('li#menuOrgs')).not.toHaveClass('open');
});
});
});
|
Use first method instead of zero indexing into an array to fix jasmine spec
|
Use first method instead of zero indexing into an array to fix jasmine spec
|
JavaScript
|
mit
|
Aleks4ndr/LocalSupport,SergiosLen/LocalSupport,dsbabbar/LocalSupport,Aleks4ndr/LocalSupport,marianmosley/LocalSupport,Aleks4ndr/LocalSupport,Aleks4ndr/LocalSupport,tansaku/LocalSupport,curlygirly/LocalSupport,intfrr/LocalSupport,tansaku/LocalSupport,tansaku/LocalSupport,SergiosLen/LocalSupport,dsbabbar/LocalSupport,davidbebb/local_support,ZmagoD/LocalSupport,decareano/LocalSupport,curlygirly/LocalSupport,dsbabbar/LocalSupport,decareano/LocalSupport,johnnymo87/LocalSupport,johnnymo87/LocalSupport,tansaku/LocalSupport,ZmagoD/LocalSupport,SergiosLen/LocalSupport,SergiosLen/LocalSupport,davidbebb/local_support,curlygirly/LocalSupport,decareano/LocalSupport,dsbabbar/LocalSupport,ZmagoD/LocalSupport,johnnymo87/LocalSupport,intfrr/LocalSupport,intfrr/LocalSupport,marianmosley/LocalSupport,intfrr/LocalSupport,davidbebb/local_support,marianmosley/LocalSupport,davidbebb/local_support,ZmagoD/LocalSupport,curlygirly/LocalSupport
|
630e1aefd56854b312b16c2ccd1fcde677a3da00
|
activities/measuring-resistance/javascript/activity-dom-helper.js
|
activities/measuring-resistance/javascript/activity-dom-helper.js
|
(function () {
var mr = sparks.activities.mr;
var str = sparks.string;
mr.ActivityDomHelper = {
ratedResistanceFormId: '#rated_resistance',
ratedResistanceValueId: '#rated_resistance_value_input',
ratedResistanceUnitId: '#rated_resitance_unit_select',
getAnswer: function (questionNum) {
var value, unit;
switch (questionNum) {
case 1:
value = $(this.ratedResistanceValueId).val();
unit = $(this.ratedResistanceUnitId).val();
return [value, unit];
case 2:
case 3:
case 4:
default:
alert('ERROR: ActivityDomHelper.getAnswer: invalid question number ' + questionNum);
return null;
}
},
validateNumberString: function (s) {
var s2 = str.strip(s);
return s2 !== '' && Number(s2) !== NaN;
},
validateResistanceUnitString: function (s) {
}
};
})();
|
(function () {
var mr = sparks.activities.mr;
var str = sparks.string;
mr.ActivityDomHelper = {
ratedResistanceFormId: '#rated_resistance',
ratedResistanceValueId: '#rated_resistance_value_input',
ratedResistanceUnitId: '#rated_resitance_unit_select',
getAnswer: function (questionNum) {
var value, unit;
switch (questionNum) {
case 1:
value = $(this.ratedResistanceValueId).val();
unit = $(this.ratedResistanceUnitId).val();
return [value, unit];
case 2:
case 3:
case 4:
default:
alert('ERROR: ActivityDomHelper.getAnswer: invalid question number ' + questionNum);
return null;
}
},
validateNumberString: function (s) {
var s2 = str.strip(s);
return s2 !== '' && !isNaN(Number(s2));
},
selected: function(selectElem) {
return selectElem.children('option:selected').val();
}
};
})();
|
Use isNaN() to check for NaN. Comparison op '!===' doesn't work.
|
Use isNaN() to check for NaN. Comparison op '!==='
doesn't work.
Also add a method 'selected' to factor out
retrieval of selected value
|
JavaScript
|
apache-2.0
|
concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks
|
5f57ba41403a960278da9e08f71a53fabfb86726
|
obfuscate-email.js
|
obfuscate-email.js
|
(function(){
function random(a,b) {
return Math.floor(Math.random() * b) + a;
};
function obfuscateEmail(email) {
if (!email) return email;
var re = /^(.*)(@)(.*?)(\.)(.*)$/;
return email.replace(re, function(m,username,at,hostname,dot,tld) {
function obs(s) {
var a = [];
var n = s.length;
while (n--) {
if (random(0,3) !== 0) {
a.push('*');
} else {
a.push(s[s.length-1-n]);
}
}
return a.join('');
}
return obs(username) + at + obs(hostname) + dot + obs(tld);
});
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = obfuscateEmail;
} else if (typeof exports !== 'undefined') {
exports.obfuscateEmail = obfuscateEmail;
} else {
window.hasprop = obfuscateEmail;
}
})();
|
(function(){
function random(a,b) {
return Math.floor(Math.random() * b) + a;
};
function obfuscateEmail(email) {
if (!email) return email;
var re = /^(.*)(@)(.*?)(\.)(.*)$/;
return email.replace(re, function(m,username,at,hostname,dot,tld) {
function obs(s) {
var a = [];
var n = s.length;
while (n--) {
if (random(0,3) !== 0) {
a.push('*');
} else {
a.push(s[s.length-1-n]);
}
}
return a.join('');
}
return obs(username) + at + obs(hostname) + dot + obs(tld);
});
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = obfuscateEmail;
} else if (typeof exports !== 'undefined') {
exports.obfuscateEmail = obfuscateEmail;
} else {
window.obfuscateEmail = obfuscateEmail;
}
})();
|
Fix global variable name for browser usage
|
Fix global variable name for browser usage
|
JavaScript
|
mit
|
miguelmota/obfuscate-email
|
2e28dec3d91379b4bc7ed93d854fe5d1e080495e
|
test/unit/controllers/statusControllerSpec.js
|
test/unit/controllers/statusControllerSpec.js
|
'use strict';
var expect = chai.expect;
describe('StatusCtrl', function(){
});
|
'use strict';
var expect = chai.expect;
function run(scope,done) {
done();
}
describe('StatusCtrl', function(){
var rootScope, scope, controller_injector, dependencies, ctrl;
beforeEach(module("rp"));
beforeEach(inject(function($rootScope, $controller, $q) {
rootScope = rootScope;
scope = $rootScope.$new();
controller_injector = $controller;
dependencies = {
$scope: scope,
$element: null
}
ctrl = controller_injector("StatusCtrl", dependencies);
}));
it('should initialize properly', function (done) {
assert.isNotNull(ctrl);
run(scope,done);
});
describe('public functions on $scope', function () {
it('should toggle the secondary', function (done) {
assert.isFunction(scope.toggle_secondary);
run(scope,done);
});
it('should logout', function (done) {
assert.isFunction(scope.logout);
run(scope,done);
});
});
describe('private functions', function() {
it('should set the connection status', function (done) {
assert.isFunction(ctrl.setConnectionStatus);
run(scope,done);
});
it('should enqueue', function (done) {
assert.isFunction(ctrl.enqueue);
run(scope,done);
});
it('should tick', function (done) {
assert.isFunction(ctrl.tick);
run(scope,done);
});
});
});
|
Initialize StatusCtrl and add basic tests
|
[CHORE] Initialize StatusCtrl and add basic tests
Test that private functions and functions on $scope are present
|
JavaScript
|
isc
|
bankonme/ripple-client-desktop,dncohen/ripple-client-desktop,MatthewPhinney/ripple-client,ripple/ripple-client,xdv/ripple-client-desktop,h0vhannes/ripple-client,ripple/ripple-client,wangbibo/ripple-client,MatthewPhinney/ripple-client,thics/ripple-client-desktop,resilience-me/DEPRICATED_ripple-client,xdv/ripple-client,ripple/ripple-client-desktop,yongsoo/ripple-client,xdv/ripple-client-desktop,yongsoo/ripple-client,MatthewPhinney/ripple-client-desktop,dncohen/ripple-client-desktop,bsteinlo/ripple-client,wangbibo/ripple-client,mrajvanshy/ripple-client-desktop,darkdarkdragon/ripple-client,h0vhannes/ripple-client,h0vhannes/ripple-client,yongsoo/ripple-client-desktop,yxxyun/ripple-client,arturomc/ripple-client,mrajvanshy/ripple-client,Madsn/ripple-client,vhpoet/ripple-client-desktop,darkdarkdragon/ripple-client-desktop,vhpoet/ripple-client-desktop,arturomc/ripple-client,ripple/ripple-client,darkdarkdragon/ripple-client,MatthewPhinney/ripple-client,xdv/ripple-client,xdv/ripple-client-desktop,yxxyun/ripple-client,darkdarkdragon/ripple-client-desktop,arturomc/ripple-client,mrajvanshy/ripple-client,yxxyun/ripple-client,h0vhannes/ripple-client,arturomc/ripple-client,ripple/ripple-client,wangbibo/ripple-client,MatthewPhinney/ripple-client-desktop,xdv/ripple-client,Madsn/ripple-client,yxxyun/ripple-client-desktop,Madsn/ripple-client,yongsoo/ripple-client,vhpoet/ripple-client,yxxyun/ripple-client-desktop,xdv/ripple-client,bankonme/ripple-client-desktop,vhpoet/ripple-client,Madsn/ripple-client,yxxyun/ripple-client,vhpoet/ripple-client,mrajvanshy/ripple-client,yongsoo/ripple-client-desktop,thics/ripple-client-desktop,darkdarkdragon/ripple-client,MatthewPhinney/ripple-client,ripple/ripple-client-desktop,vhpoet/ripple-client,mrajvanshy/ripple-client-desktop,yongsoo/ripple-client,mrajvanshy/ripple-client,resilience-me/DEPRICATED_ripple-client,wangbibo/ripple-client,darkdarkdragon/ripple-client,bsteinlo/ripple-client
|
39a23c72bc6c082a69c8aa61abfc6b83cb267c28
|
chai-adapter.js
|
chai-adapter.js
|
(function(window, karma) {
window.should = window.chai.should();
window.expect = window.chai.expect;
window.assert = window.chai.assert;
var chaiConfig = karma.config.chai;
if (chaiConfig) {
for (var key in chaiConfig) {
if (chaiConfig.hasOwnProperty(key)) {
window.chai.config[key] = chaiConfig[key];
}
}
}
karma.loaded = function() {
karma.start();
};
})(window, window.__karma__);
|
(function(window, karma) {
window.should = null;
window.should = window.chai.should();
window.expect = window.chai.expect;
window.assert = window.chai.assert;
var chaiConfig = karma.config.chai;
if (chaiConfig) {
for (var key in chaiConfig) {
if (chaiConfig.hasOwnProperty(key)) {
window.chai.config[key] = chaiConfig[key];
}
}
}
karma.loaded = function() {
karma.start();
};
})(window, window.__karma__);
|
Fix 'Maximum call stack size exceeded' in PhantomJS... again
|
Fix 'Maximum call stack size exceeded' in PhantomJS... again
|
JavaScript
|
mit
|
kmees/karma-sinon-chai
|
61edab4f12e26652f6d53f3456b0b1c75de8faa4
|
app/routes/quotes/components/QuoteList.js
|
app/routes/quotes/components/QuoteList.js
|
// @flow
import React, { Component } from 'react';
import Quote from './Quote';
type Props = {
quotes: Array<Object>,
approve: number => Promise<*>,
deleteQuote: number => Promise<*>,
unapprove: number => Promise<*>,
actionGrant: Array<string>,
currentUser: any,
loggedIn: boolean,
comments: Object
};
type State = {
displayAdminId: number
};
export default class QuoteList extends Component<Props, State> {
state = {
displayAdminId: -1
};
componentWillReceiveProps(newProps: Object) {
this.setState({ displayAdminId: -1 });
}
setDisplayAdmin = (id: number) => {
this.setState(state => ({
displayAdminId: state.displayAdminId === id ? -1 : id
}));
};
render() {
const {
quotes,
actionGrant,
approve,
unapprove,
deleteQuote,
currentUser,
loggedIn,
comments
} = this.props;
return (
<ul>
{quotes.map(quote => (
<Quote
actionGrant={actionGrant}
approve={approve}
unapprove={unapprove}
deleteQuote={deleteQuote}
quote={quote}
key={quote.id}
setDisplayAdmin={this.setDisplayAdmin}
displayAdmin={quote.id === this.state.displayAdminId}
currentUser={currentUser}
loggedIn={loggedIn}
comments={comments}
/>
))}
</ul>
);
}
}
|
// @flow
import React, { Component } from 'react';
import Quote from './Quote';
type Props = {
quotes: Array<Object>,
approve: number => Promise<*>,
deleteQuote: number => Promise<*>,
unapprove: number => Promise<*>,
actionGrant: Array<string>,
currentUser: any,
loggedIn: boolean,
comments: Object
};
type State = {
displayAdminId: number
};
export default class QuoteList extends Component<Props, State> {
state = {
displayAdminId: -1
};
componentWillReceiveProps(newProps: Object) {
this.setState({ displayAdminId: -1 });
}
setDisplayAdmin = (id: number) => {
this.setState(state => ({
displayAdminId: state.displayAdminId === id ? -1 : id
}));
};
render() {
const {
quotes,
actionGrant,
approve,
unapprove,
deleteQuote,
currentUser,
loggedIn,
comments
} = this.props;
return (
<ul>
{quotes
.filter(Boolean)
.map(quote => (
<Quote
actionGrant={actionGrant}
approve={approve}
unapprove={unapprove}
deleteQuote={deleteQuote}
quote={quote}
key={quote.id}
setDisplayAdmin={this.setDisplayAdmin}
displayAdmin={quote.id === this.state.displayAdminId}
currentUser={currentUser}
loggedIn={loggedIn}
comments={comments}
/>
))}
</ul>
);
}
}
|
Fix undefined quotes causing error
|
Fix undefined quotes causing error
|
JavaScript
|
mit
|
webkom/lego-webapp,webkom/lego-webapp,webkom/lego-webapp
|
6fd9db13f5e52651029d18615fd24359898865d5
|
lib/assets/core/javascripts/cartodb3/components/icon/icon-view.js
|
lib/assets/core/javascripts/cartodb3/components/icon/icon-view.js
|
var $ = require('jquery');
var CoreView = require('backbone/core-view');
var iconTemplates = {};
var importAllIconTemplates = function () {
var templates = require.context('./templates', false, /\.tpl$/);
templates.keys().forEach(function (template) {
iconTemplates[template] = templates(template);
});
};
importAllIconTemplates();
module.exports = CoreView.extend({
initialize: function (opts) {
if (!opts || !opts.icon) throw new Error('An icon is required to render IconView');
this.icon = opts.icon;
this.iconTemplate = this._getIconTemplate(this.icon);
if (!this.iconTemplate) {
throw new Error('The selected icon does not have any available template');
}
this.placeholder = opts && opts.placeholder;
},
render: function () {
this.$el.html(this.iconTemplate);
if (this.placeholder) {
var placeholder = $(this.placeholder);
this.$el.removeClass().addClass(placeholder.attr('class'));
placeholder.replaceWith(this.$el);
}
return this;
},
_getIconTemplate: function (icon) {
var iconTemplate = './' + this.icon + '.tpl';
return iconTemplates[iconTemplate];
}
});
|
var $ = require('jquery');
var CoreView = require('backbone/core-view');
var iconTemplates = {};
var importAllIconTemplates = function () {
var templates = require.context('./templates', false, /\.tpl$/);
templates.keys().forEach(function (template) {
iconTemplates[template] = templates(template);
});
};
importAllIconTemplates();
module.exports = CoreView.extend({
constructor: function (opts) {
this.placeholder = this._preinitializeWithPlaceholder(opts && opts.placeholder);
CoreView.prototype.constructor.call(this, opts);
},
initialize: function (opts) {
if (!opts || !opts.icon) throw new Error('An icon is required to render IconView');
this.icon = opts.icon;
this.iconTemplate = this._getIconTemplate(this.icon);
if (!this.iconTemplate) {
throw new Error('The selected icon does not have any available template');
}
},
render: function () {
this.$el.html(this.iconTemplate);
if (this.placeholder) {
this.placeholder.replaceWith(this.$el);
}
return this;
},
_getIconTemplate: function (icon) {
var iconTemplate = './' + this.icon + '.tpl';
return iconTemplates[iconTemplate];
},
_preinitializeWithPlaceholder: function (placeholderNode) {
if (!placeholderNode) {
return;
}
var placeholder = $(placeholderNode);
this.tagName = placeholder.prop('tagName');
this.className = placeholder.attr('class');
return placeholder;
}
});
|
Refactor IconView to simplify placeholder behaviour
|
Refactor IconView to simplify placeholder behaviour
|
JavaScript
|
bsd-3-clause
|
CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb,splashblot/dronedb,splashblot/dronedb,splashblot/dronedb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb
|
5e9bea97acb8948f41b5f3d007ccc250dab13e51
|
packages/base/resources/js/main_page.js
|
packages/base/resources/js/main_page.js
|
function generate_board_page(that, board_id){
/* Generate the board page */
// Gets the node of board page
var bp_node = that.nodeById('board_page');
// Make a serverCall to gets lists and cards related
// to the board.
var result = genro.serverCall(
'get_lists_cards',
{board_id: board_id}
);
// sets the return result to the board datapath
that.setRelativeData('board', result);
var res_asDict = result.asDict(true);
for (var k in res_asDict){
var list_wrapper = bp_node._('div', {_class:'list-wrapper'});
// name of the list
var list_div = list_wrapper._('div', {_class: 'gen-list'})
list_div._('h3', {innerHTML: '^.' + k + '?list_name'});
// create a ul for the cards
var list_cards = list_div._('div', {_class: 'list-cards'});
var cards = res_asDict[k];
for (var c in cards){
var card =list_cards._('div', {
_class: 'list-card'
});
card._('div', {
innerHTML: '^.' + k + '.' + c + '.name',
_class: 'list-card-label'
});
}
}
// Once done with the rendering change the page
that.setRelativeData('page_selected', 1);
}
|
function generate_board_page(that, board_id){
/* Generate the board page */
// Gets the node of board page
var bp_node = that.nodeById('board_page');
// Make a serverCall to gets lists and cards related
// to the board.
var result = genro.serverCall(
'get_lists_cards',
{board_id: board_id}
);
// sets the return result to the board datapath
that.setRelativeData('board', result);
var res_asDict = result.asDict(true);
for (var k in res_asDict){
var list_wrapper = bp_node._('div', {_class:'list-wrapper'});
// name of the list
var list_div = list_wrapper._('div', {_class: 'gen-list'})
list_div._('h3', {innerHTML: '^.' + k + '?list_name'});
// create a ul for the cards
var list_cards = list_div._('div', {
_class: 'list-cards',
dropTarget: true, dropTypes:'*',
});
var cards = res_asDict[k];
for (var c in cards){
var card =list_cards._('div', {
_class: 'list-card', draggable: true,
});
card._('div', {
innerHTML: '^.' + k + '.' + c + '.name',
_class: 'list-card-label'
});
}
}
// Once done with the rendering change the page
that.setRelativeData('page_selected', 1);
}
|
Add attributes for drag and drop
|
Add attributes for drag and drop
|
JavaScript
|
mit
|
mkshid/genrello,mkshid/genrello,mkshid/genrello
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.