commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
45b60408828c430d18a470c16d3c3ac3557d5fc1 | config/ember-try.js | config/ember-try.js | module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release',
'ember-data': 'components/ember-data#1.13.4'
},
resolutions: {
'ember': 'release',
'ember-data': '1.13.4'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta',
'ember-data': 'components/ember-data#canary'
},
resolutions: {
'ember': 'beta',
'ember-data': 'canary'
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary',
'ember-data': 'components/ember-data#canary'
},
resolutions: {
'ember': 'canary',
'ember-data': 'canary'
}
}
]
};
| module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release',
'ember-data': 'components/ember-data#release'
},
resolutions: {
'ember': 'release',
'ember-data': 'release'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta',
'ember-data': 'components/ember-data#canary'
},
resolutions: {
'ember': 'beta',
'ember-data': 'canary'
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary',
'ember-data': 'components/ember-data#canary'
},
resolutions: {
'ember': 'canary',
'ember-data': 'canary'
}
}
]
};
| Use release channel of ember-data | Use release channel of ember-data
v1.13 is not supported for the next version of
ember-data-fixture-adapter.
| JavaScript | mit | emberjs/ember-data-fixture-adapter,emberjs/ember-data-fixture-adapter | ---
+++
@@ -8,11 +8,11 @@
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release',
- 'ember-data': 'components/ember-data#1.13.4'
+ 'ember-data': 'components/ember-data#release'
},
resolutions: {
'ember': 'release',
- 'ember-data': '1.13.4'
+ 'ember-data': 'release'
}
},
{ |
0b148e268b8922d100d51e8bd5703b976955ed2b | lib/node_modules/@stdlib/utils/constructor-name/lib/constructor_name.js | lib/node_modules/@stdlib/utils/constructor-name/lib/constructor_name.js | 'use strict';
// MODULES //
var nativeClass = require( '@stdlib/utils/native-class' );
var RE = require( '@stdlib/regexp/function-name' );
var isBuffer = require( '@stdlib/assert/is-buffer' );
// MAIN //
/**
* Determines the name of a value's constructor.
*
* @param {*} v - input value
* @returns {string} name of a value's constructor
*
* @example
* var v = constructorName( 'a' );
* // returns 'String'
* @example
* var v = constructorName( 5 );
* // returns 'Number'
* @example
* var v = constructorName( null );
* // returns 'Null'
* @example
* var v = constructorName( undefined );
* // returns 'Undefined'
* @example
* var v = constructorName( function noop(){} );
* // returns 'Function'
*/
function constructorName( v ) {
var name;
var ctor;
name = nativeClass( v ).slice( 8, -1 );
if ( (name === 'Object' || name === 'Error') && v.constructor ) {
ctor = v.constructor;
if ( typeof ctor.name === 'string' ) {
return ctor.name;
}
return RE.exec( ctor.toString() )[ 1 ];
}
if ( isBuffer( v ) ) {
return 'Buffer';
}
return name;
} // end FUNCTION constructorName()
// EXPORTS //
module.exports = constructorName;
| 'use strict';
// MODULES //
var nativeClass = require( '@stdlib/utils/native-class' );
var RE = require( '@stdlib/regexp/function-name' );
var isBuffer = require( '@stdlib/assert/is-buffer' );
// MAIN //
/**
* Determines the name of a value's constructor.
*
* @param {*} v - input value
* @returns {string} name of a value's constructor
*
* @example
* var v = constructorName( 'a' );
* // returns 'String'
*
* @example
* var v = constructorName( 5 );
* // returns 'Number'
*
* @example
* var v = constructorName( null );
* // returns 'Null'
*
* @example
* var v = constructorName( undefined );
* // returns 'Undefined'
*
* @example
* var v = constructorName( function noop() {} );
* // returns 'Function'
*/
function constructorName( v ) {
var name;
var ctor;
name = nativeClass( v ).slice( 8, -1 );
if ( (name === 'Object' || name === 'Error') && v.constructor ) {
ctor = v.constructor;
if ( typeof ctor.name === 'string' ) {
return ctor.name;
}
return RE.exec( ctor.toString() )[ 1 ];
}
if ( isBuffer( v ) ) {
return 'Buffer';
}
return name;
} // end FUNCTION constructorName()
// EXPORTS //
module.exports = constructorName;
| Fix lint error and update JSDoc examples | Fix lint error and update JSDoc examples
| JavaScript | apache-2.0 | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | ---
+++
@@ -18,17 +18,21 @@
* @example
* var v = constructorName( 'a' );
* // returns 'String'
+*
* @example
* var v = constructorName( 5 );
* // returns 'Number'
+*
* @example
* var v = constructorName( null );
* // returns 'Null'
+*
* @example
* var v = constructorName( undefined );
* // returns 'Undefined'
+*
* @example
-* var v = constructorName( function noop(){} );
+* var v = constructorName( function noop() {} );
* // returns 'Function'
*/
function constructorName( v ) { |
dbfc34db0f4413c10205357ed423b244827c6388 | shaq_overflow/app/assets/javascripts/app.js | shaq_overflow/app/assets/javascripts/app.js | $(document).ready(function() {
$("a.up-vote-answer").click(function(event) {
event.preventDefault();
var $target = $(event.target);
console.log($target.data("url"))
$.ajax({
type: "post",
url: $target.data("url"),
data: $target.data(),
success:
function(response) {
$('#' + $target.data('answer-id')).empty();
$('#' + $target.data('answer-id')).append(response)
}
});
}
);
}); | $(document).ready(function() {
$("a.up-vote-answer").click(function(event) {
event.preventDefault();
var $target = $(event.target);
$.ajax({
type: "post",
url: $target.data("url"),
data: $target.data(),
success: function(response) {
$('#' + $target.data('answer-id')).empty();
$('#' + $target.data('answer-id')).append(response)
}
});
}
);
$("a.up-vote-question").click(function(event) {
event.preventDefault();
var $target = $(event.target);
console.log($target.data("url"))
$.ajax({
type: "post",
url: $target.data("url"),
data: $target.data(),
success: function(response) {
console.log(response);
$('#' + $target.data('question-id')).empty();
$('#' + $target.data('question-id')).append(response)
}
});
}
);
}); | Add ajax call for questions | Add ajax call for questions
| JavaScript | mit | lucasrsantos1/lucky-ambassador,lucasrsantos1/lucky-ambassador,lucasrsantos1/lucky-ambassador | ---
+++
@@ -1,6 +1,21 @@
$(document).ready(function() {
$("a.up-vote-answer").click(function(event) {
+ event.preventDefault();
+ var $target = $(event.target);
+ $.ajax({
+ type: "post",
+ url: $target.data("url"),
+ data: $target.data(),
+ success: function(response) {
+ $('#' + $target.data('answer-id')).empty();
+ $('#' + $target.data('answer-id')).append(response)
+ }
+ });
+ }
+ );
+
+ $("a.up-vote-question").click(function(event) {
event.preventDefault();
var $target = $(event.target);
console.log($target.data("url"))
@@ -8,10 +23,10 @@
type: "post",
url: $target.data("url"),
data: $target.data(),
- success:
- function(response) {
- $('#' + $target.data('answer-id')).empty();
- $('#' + $target.data('answer-id')).append(response)
+ success: function(response) {
+ console.log(response);
+ $('#' + $target.data('question-id')).empty();
+ $('#' + $target.data('question-id')).append(response)
}
});
} |
3cbedcf697029d844f472c6d2503f47edee6506d | src/helpers/getPetitionDaysRemaining.js | src/helpers/getPetitionDaysRemaining.js | import moment from 'moment';
import getPetitionEndDate from 'selectors/petitionEndDate';
export default ({ created, expires }, timeNow) => {
const endDate = getPetitionEndDate({ created, expires });
const nowDate = timeNow || moment().valueOf();
const daysRemaining = moment.duration(moment(endDate).diff(nowDate)).asDays();
return Math.max(Math.round(daysRemaining), 0);
};
| import moment from 'moment';
import getPetitionEndDate from 'selectors/petitionEndDate';
export default ({ created, expires }) => {
const endDate = getPetitionEndDate({ created, expires });
const nowDate = moment().valueOf();
const daysRemaining = moment.duration(endDate.diff(nowDate)).asDays();
return Math.max(Math.round(daysRemaining), 0);
};
| Remove unused param from daysRemaining function | Remove unused param from daysRemaining function
| JavaScript | apache-2.0 | iris-dni/iris-frontend,iris-dni/iris-frontend,iris-dni/iris-frontend | ---
+++
@@ -1,9 +1,9 @@
import moment from 'moment';
import getPetitionEndDate from 'selectors/petitionEndDate';
-export default ({ created, expires }, timeNow) => {
+export default ({ created, expires }) => {
const endDate = getPetitionEndDate({ created, expires });
- const nowDate = timeNow || moment().valueOf();
- const daysRemaining = moment.duration(moment(endDate).diff(nowDate)).asDays();
+ const nowDate = moment().valueOf();
+ const daysRemaining = moment.duration(endDate.diff(nowDate)).asDays();
return Math.max(Math.round(daysRemaining), 0);
}; |
071b13d9b044fd09d31f3d3f5c4d7f7c2385a793 | src/models/CustomerIoEvent.js | src/models/CustomerIoEvent.js | 'use strict';
class CustomerIoEvent {
constructor(id, name, data) {
this.id = id;
this.name = name;
this.data = data;
}
getId() {
return this.id;
}
getName() {
return this.name;
}
getData() {
return this.data;
}
setVersion(version) {
this.data.version = version;
}
}
module.exports = CustomerIoEvent;
| 'use strict';
class CustomerIoEvent {
constructor(id, name, data) {
this.id = id;
this.name = name;
this.data = data;
}
getId() {
return this.id;
}
getName() {
return this.name;
}
getData() {
return this.data;
}
// Schema version of event data.
setVersion(version) {
this.data.version = version;
}
}
module.exports = CustomerIoEvent;
| Add comment clarifying that cio event version is data schema version | Add comment clarifying that cio event version is data schema version
| JavaScript | mit | DoSomething/blink,DoSomething/blink | ---
+++
@@ -19,6 +19,7 @@
return this.data;
}
+ // Schema version of event data.
setVersion(version) {
this.data.version = version;
} |
fa74ef9e2294c798743d689d30fd8aa6138a2e44 | lib/jsdom/living/post-message.js | lib/jsdom/living/post-message.js | "use strict";
const isValidTargetOrigin = require("../utils").isValidTargetOrigin;
const DOMException = require("../web-idl/DOMException");
module.exports = function (message, targetOrigin) {
if (arguments.length < 2) {
throw new TypeError("'postMessage' requires 2 arguments: 'message' and 'targetOrigin'");
}
targetOrigin = String(targetOrigin);
if (!isValidTargetOrigin(targetOrigin)) {
throw new DOMException(DOMException.SYNTAX_ERR, "Failed to execute 'postMessage' on 'Window': " +
"Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'.");
}
// TODO: targetOrigin === '/' - requires reference to source window
// See https://github.com/tmpvar/jsdom/pull/1140#issuecomment-111587499
if (targetOrigin !== "*" && targetOrigin !== this.origin) {
return;
}
// TODO: event.source - requires reference to source window
// TODO: event.origin - requires reference to source window
// TODO: event.ports
// TODO: event.data - structured clone message - requires cloning DOM nodes
const event = new this.MessageEvent("message", {
data: message
});
event.initEvent("message", false, false);
setTimeout(() => {
this.dispatchEvent(event);
}, 0);
};
| "use strict";
const isValidTargetOrigin = require("../utils").isValidTargetOrigin;
const DOMException = require("../web-idl/DOMException");
module.exports = function (message, targetOrigin) {
if (arguments.length < 2) {
throw new TypeError("'postMessage' requires 2 arguments: 'message' and 'targetOrigin'");
}
targetOrigin = String(targetOrigin);
if (!isValidTargetOrigin(targetOrigin)) {
throw new DOMException(DOMException.SYNTAX_ERR, "Failed to execute 'postMessage' on 'Window': " +
"Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'.");
}
// TODO: targetOrigin === '/' - requires reference to source window
// See https://github.com/tmpvar/jsdom/pull/1140#issuecomment-111587499
if (targetOrigin !== "*" && targetOrigin !== this.location.origin) {
return;
}
// TODO: event.source - requires reference to source window
// TODO: event.origin - requires reference to source window
// TODO: event.ports
// TODO: event.data - structured clone message - requires cloning DOM nodes
const event = new this.MessageEvent("message", {
data: message
});
event.initEvent("message", false, false);
setTimeout(() => {
this.dispatchEvent(event);
}, 0);
};
| Fix origin-checking logic in postMessage | Fix origin-checking logic in postMessage
This allows us to post messages where the origin is something other than `*`. Closes #1789. | JavaScript | mit | mzgol/jsdom,Zirro/jsdom,Zirro/jsdom,mzgol/jsdom,mzgol/jsdom,tmpvar/jsdom,tmpvar/jsdom,snuggs/jsdom,snuggs/jsdom | ---
+++
@@ -16,7 +16,7 @@
// TODO: targetOrigin === '/' - requires reference to source window
// See https://github.com/tmpvar/jsdom/pull/1140#issuecomment-111587499
- if (targetOrigin !== "*" && targetOrigin !== this.origin) {
+ if (targetOrigin !== "*" && targetOrigin !== this.location.origin) {
return;
}
|
aa31895f622ad0beebda72284ff76d7971edaf3a | generate-config-schema.js | generate-config-schema.js | "use strict";
const fs = require("fs");
const packageJsonPath = "./package.json";
const packageJson = require(packageJsonPath);
const configurationSchema = require("./node_modules/markdownlint/schema/markdownlint-config-schema.json");
const defaultConfig = require("./default-config.json");
// Update package.json
const configurationRoot = packageJson.contributes.configuration.properties["markdownlint.config"];
configurationRoot.default = defaultConfig;
configurationRoot.properties = configurationSchema.properties;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, "\t"));
| "use strict";
const fs = require("fs");
const packageJsonPath = "./package.json";
const packageJson = require(packageJsonPath);
const configurationSchema = require("./node_modules/markdownlint/schema/markdownlint-config-schema.json");
const defaultConfig = require("./default-config.json");
// Update package.json
const configurationRoot = packageJson.contributes.configuration.properties["markdownlint.config"];
configurationRoot.default = defaultConfig;
configurationRoot.properties = configurationSchema.properties;
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, "\t") + "\n");
| Add trailing newline charater when generating config schema for package.json. | Add trailing newline charater when generating config schema for package.json.
| JavaScript | mit | DavidAnson/vscode-markdownlint | ---
+++
@@ -10,4 +10,4 @@
const configurationRoot = packageJson.contributes.configuration.properties["markdownlint.config"];
configurationRoot.default = defaultConfig;
configurationRoot.properties = configurationSchema.properties;
-fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, "\t"));
+fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, "\t") + "\n"); |
c442ad739f2b65e5a62b7c4e6579a10ab5d34004 | test/integration/assertions/noJsErrors.js | test/integration/assertions/noJsErrors.js | exports.assertion = function () {
this.message = 'Page loaded with no errors.';
this.expected = [];
this.pass = function (result) {
return result && result.length === 0;
};
this.failure = function (result) {
var failed = result.value.length > 0;
if (failed) {
this.message = result.value;
}
return failed;
};
this.value = function (result) {
return result.value;
};
this.command = function (callback) {
this.api.getJsErrors(callback);
return this;
};
}; | exports.assertion = function () {
this.message = 'Page loaded with no errors.';
this.expected = [];
this.pass = function (result) {
return !result.value && result.length === 0;
};
this.failure = function (result) {
var failed = result.value && result.value.length > 0;
if (failed) {
this.message = result.value;
}
return failed;
};
this.value = function (result) {
return result ? result.value : [];
};
this.command = function (callback) {
this.api.getJsErrors(callback);
return this;
};
}; | Improve client side error detection | Improve client side error detection
| JavaScript | apache-2.0 | junbon/binary-static-www2,borisyankov/binary-static,massihx/binary-static,borisyankov/binary-static,brodiecapel16/binary-static,massihx/binary-static,massihx/binary-static,junbon/binary-static-www2,einhverfr/binary-static,borisyankov/binary-static,animeshsaxena/binary-static,brodiecapel16/binary-static,tfoertsch/binary-static,brodiecapel16/binary-static,einhverfr/binary-static,borisyankov/binary-static,animeshsaxena/binary-static,massihx/binary-static,tfoertsch/binary-static,einhverfr/binary-static,animeshsaxena/binary-static,einhverfr/binary-static,brodiecapel16/binary-static,animeshsaxena/binary-static | ---
+++
@@ -6,12 +6,12 @@
this.pass = function (result) {
- return result && result.length === 0;
+ return !result.value && result.length === 0;
};
this.failure = function (result) {
- var failed = result.value.length > 0;
+ var failed = result.value && result.value.length > 0;
if (failed) {
this.message = result.value;
}
@@ -20,7 +20,7 @@
};
this.value = function (result) {
- return result.value;
+ return result ? result.value : [];
};
this.command = function (callback) { |
cfeb83d35a957a433362e8eed762c0e364cb4d6e | modules/angular-meteor-user.js | modules/angular-meteor-user.js | var angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils']);
angularMeteorUser.run(['$rootScope', '$meteorUtils', function($rootScope, $meteorUtils){
var currentUserDefer;
$meteorUtils.autorun($rootScope, function(){
if (Meteor.user) {
$rootScope.currentUser = Meteor.user();
$rootScope.loggingIn = Meteor.loggingIn();
}
// if there is no currentUserDefer (on first autorun)
// or it is already resolved, but the Meteor.user() is changing
if (!currentUserDefer || Meteor.loggingIn() ) {
currentUserDefer = $q.defer();
$rootScope.currentUserPromise = currentUserDefer.promise;
}
if ( !Meteor.loggingIn() ) {
currentUserDefer.resolve( Meteor.user() );
}
});
}]); | var angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils']);
angularMeteorUser.run(['$rootScope', '$meteorUtils', '$q', function($rootScope, $meteorUtils, $q){
var currentUserDefer;
$meteorUtils.autorun($rootScope, function(){
if (Meteor.user) {
$rootScope.currentUser = Meteor.user();
$rootScope.loggingIn = Meteor.loggingIn();
}
// if there is no currentUserDefer (on first autorun)
// or it is already resolved, but the Meteor.user() is changing
if (!currentUserDefer || Meteor.loggingIn() ) {
currentUserDefer = $q.defer();
$rootScope.currentUserPromise = currentUserDefer.promise;
}
if ( !Meteor.loggingIn() ) {
currentUserDefer.resolve( Meteor.user() );
}
});
}]);
| Add missing $q service to User | Add missing $q service to User
| JavaScript | mit | shankarregmi/angular-meteor,Wanderfalke/angular-meteor,davidyaha/angular-meteor,Urigo/angular-meteor,evanliomain/angular-meteor,manhtuongbkhn/angular-meteor,nweat/angular-meteor,efosao12/angular-meteor,IgorMinar/angular-meteor,idanwe/angular-meteor,omer72/angular-meteor,eugene-d/angular-meteor,ahmedshuhel/angular-meteor,mxab/angular-meteor,kamilkisiela/angular-meteor,IgorMinar/angular-meteor,mushkab/angular-meteor,shankarregmi/angular-meteor,tgienger/angular-meteor,divramod/angular-meteor,oshai/angular-meteor,Unavi/angular-meteor,tgienger/angular-meteor,omer72/angular-meteor,ahmedshuhel/angular-meteor,Tallyb/angular-meteor,mauricionr/angular-meteor,jonmc12/angular-meteor,aleksander351/angular-meteor,ajbarry/angular-meteor,aleksander351/angular-meteor,thomkaufmann/angular-meteor,michelalbers/angular-meteor,hoalongntc/angular-meteor,klenis/angular-meteor,mushkab/angular-meteor,dtruel/angular-meteor,kyroskoh/angular-meteor,barbatus/angular-meteor,dj0nes/angular-meteor,sebakerckhof/angular-meteor,tgienger/angular-meteor,simonv3/angular-meteor,ahmedshuhel/angular-meteor,tgienger/angular-meteor,mushkab/angular-meteor,alexandr2110pro/angular-meteor,craigmcdonald/angular-meteor,IgorMinar/angular-meteor,klenis/angular-meteor,zhoulvming/angular-meteor,ahmedshuhel/angular-meteor,simonv3/angular-meteor,michelalbers/angular-meteor,okland/angular-meteor,zhoulvming/angular-meteor,Urigo/angular-meteor-legacy,manhtuongbkhn/angular-meteor,simonv3/angular-meteor,MarkPhillips7/angular-meteor,dj0nes/angular-meteor,alexandr2110pro/angular-meteor,dtruel/angular-meteor,ajbarry/angular-meteor,aleksander351/angular-meteor,hoalongntc/angular-meteor,pbastowski/angular-meteor,nweat/angular-meteor,sebakerckhof/angular-meteor,dszczyt/angular-meteor,mushkab/angular-meteor,cuitianze/angular-meteor,dtruel/angular-meteor,barbatus/angular-meteor,kyroskoh/angular-meteor,sebakerckhof/angular-meteor,gonengar/angular-meteor,newswim/angular-meteor,DAB0mB/angular-meteor,Tallyb/angular-meteor,oshai/angular-meteor,cuitianze/angular-meteor,manhtuongbkhn/angular-meteor,Wanderfalke/angular-meteor,ccortezia/angular-meteor,hoalongntc/angular-meteor,modcoms/angular-meteor,pbastowski/angular-meteor,michelalbers/angular-meteor,modcoms/angular-meteor,evanliomain/angular-meteor,nweat/angular-meteor,revspringjake/angular-meteor-tutorial,dszczyt/angular-meteor,nhducit/angular-meteor,mauricionr/angular-meteor,zhoulvming/angular-meteor,oshai/angular-meteor,revspringjake/angular-meteor-tutorial,omer72/angular-meteor,kamilkisiela/angular-meteor,Wanderfalke/angular-meteor,efosao12/angular-meteor,dj0nes/angular-meteor,pbastowski/angular-meteor,omer72/angular-meteor,kyroskoh/angular-meteor,revspringjake/angular-meteor-tutorial,thomkaufmann/angular-meteor,idanwe/angular-meteor,okland/angular-meteor,hoalongntc/angular-meteor,klenis/angular-meteor,ajbarry/angular-meteor,ajbarry/angular-meteor,divramod/angular-meteor,klenis/angular-meteor,nweat/angular-meteor,zhoulvming/angular-meteor,newswim/angular-meteor,michelalbers/angular-meteor,eugene-d/angular-meteor,davidyaha/angular-meteor,jonmc12/angular-meteor,divramod/angular-meteor,alexandr2110pro/angular-meteor,mxab/angular-meteor,cuitianze/angular-meteor,eugene-d/angular-meteor,thomkaufmann/angular-meteor,gonengar/angular-meteor,mauricionr/angular-meteor,divramod/angular-meteor,Wanderfalke/angular-meteor,darkbasic/angular-meteor,gonengar/angular-meteor,cuitianze/angular-meteor,mauricionr/angular-meteor,craigmcdonald/angular-meteor,DAB0mB/angular-meteor,dtruel/angular-meteor,Unavi/angular-meteor,dj0nes/angular-meteor,alexandr2110pro/angular-meteor,newswim/angular-meteor,aleksander351/angular-meteor,okland/angular-meteor,simonv3/angular-meteor,dszczyt/angular-meteor,DAB0mB/angular-meteor,nhducit/angular-meteor,craigmcdonald/angular-meteor,ShMcK/angular-meteor,ccortezia/angular-meteor,efosao12/angular-meteor,jonmc12/angular-meteor,gonengar/angular-meteor,manhtuongbkhn/angular-meteor,thomkaufmann/angular-meteor,pbastowski/angular-meteor,okland/angular-meteor,craigmcdonald/angular-meteor,revspringjake/angular-meteor-tutorial,mxab/angular-meteor,efosao12/angular-meteor,eugene-d/angular-meteor,nhducit/angular-meteor,shankarregmi/angular-meteor,IgorMinar/angular-meteor,evanliomain/angular-meteor,kamilkisiela/angular-meteor,MarkPhillips7/angular-meteor,kyroskoh/angular-meteor,Unavi/angular-meteor,ShMcK/angular-meteor,dszczyt/angular-meteor,nhducit/angular-meteor,jonmc12/angular-meteor,Unavi/angular-meteor,barbatus/angular-meteor,evanliomain/angular-meteor,oshai/angular-meteor,davidyaha/angular-meteor,modcoms/angular-meteor | ---
+++
@@ -1,6 +1,6 @@
var angularMeteorUser = angular.module('angular-meteor.user', ['angular-meteor.utils']);
-angularMeteorUser.run(['$rootScope', '$meteorUtils', function($rootScope, $meteorUtils){
+angularMeteorUser.run(['$rootScope', '$meteorUtils', '$q', function($rootScope, $meteorUtils, $q){
var currentUserDefer;
$meteorUtils.autorun($rootScope, function(){ |
777ca8757c04561f0bd0c3ad17e43ad384424504 | src/routes.js | src/routes.js | //@flow
import React from 'react'
import { Route, IndexRoute } from 'react-router'
import App from './App'
if (process.env.NODE_ENV === 'development' || typeof require.ensure === 'undefined') require.ensure = (undefined, fc) => fc(require)
export default () => ( // eslint-disable-line
<Route component={App}>
<Route path="/">
<IndexRoute
getComponent={
(location, callback) => {
require.ensure([], (require) => {
callback(null, require('./Posts').default)
})
}
}
/>
<Route path="addPost"
getComponent={
(location, callback) => {
require.ensure([], (require) => {
callback(null, require('./AddPost').default)
})
}
}
/>
</Route>
</Route>
)
| //@flow
import React from 'react'
import { Route, IndexRoute } from 'react-router'
import App from './App'
import Posts from './Posts'
import AddPost from './AddPost'
export default () => ( // eslint-disable-line
<Route component={App}>
<Route path="/">
<IndexRoute component={Posts}/>
<Route path="addPost" component={AddPost}/>
</Route>
</Route>
)
| Revert "Disable code-split in development mode and for server side" | Revert "Disable code-split in development mode and for server side"
This reverts commit 90d307f6cf9792882dc4beabc2cd1d007ae26dc6.
| JavaScript | mit | MrEfrem/TestApp,MrEfrem/TestApp | ---
+++
@@ -2,30 +2,14 @@
import React from 'react'
import { Route, IndexRoute } from 'react-router'
import App from './App'
-
-if (process.env.NODE_ENV === 'development' || typeof require.ensure === 'undefined') require.ensure = (undefined, fc) => fc(require)
+import Posts from './Posts'
+import AddPost from './AddPost'
export default () => ( // eslint-disable-line
<Route component={App}>
<Route path="/">
- <IndexRoute
- getComponent={
- (location, callback) => {
- require.ensure([], (require) => {
- callback(null, require('./Posts').default)
- })
- }
- }
- />
- <Route path="addPost"
- getComponent={
- (location, callback) => {
- require.ensure([], (require) => {
- callback(null, require('./AddPost').default)
- })
- }
- }
- />
+ <IndexRoute component={Posts}/>
+ <Route path="addPost" component={AddPost}/>
</Route>
</Route>
) |
aea16e7ef4aa2fe11d282a2dabfbf73ade85fe31 | ghost/admin/components/gh-notification.js | ghost/admin/components/gh-notification.js | var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
if (typeof message.toJSON === 'function') {
type = message.get('type');
dismissible = message.get('dismissible');
}
else {
type = message.type;
dismissible = message.dismissible;
}
classes += 'notification-' + type;
if (type === 'success' && dismissible !== false) {
classes += ' notification-passive';
}
return classes;
}.property(),
didInsertElement: function () {
var self = this;
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
self.notifications.removeObject(self.get('message'));
});
},
actions: {
closeNotification: function () {
var self = this;
self.notifications.closeNotification(self.get('message'));
}
}
});
export default NotificationComponent;
| var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
if (typeof message.toJSON === 'function') {
type = message.get('type');
dismissible = message.get('dismissible');
}
else {
type = message.type;
dismissible = message.dismissible;
}
classes += 'notification-' + type;
if (type === 'success' && dismissible !== false) {
classes += ' notification-passive';
}
return classes;
}.property(),
didInsertElement: function () {
var self = this;
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
if (event.originalEvent.animationName === 'fade-out') {
self.notifications.removeObject(self.get('message'));
}
});
},
actions: {
closeNotification: function () {
var self = this;
self.notifications.closeNotification(self.get('message'));
}
}
});
export default NotificationComponent;
| Check the end of notification fade-out animation | Check the end of notification fade-out animation
| JavaScript | mit | TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost | ---
+++
@@ -31,7 +31,9 @@
self.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function (event) {
/* jshint unused: false */
- self.notifications.removeObject(self.get('message'));
+ if (event.originalEvent.animationName === 'fade-out') {
+ self.notifications.removeObject(self.get('message'));
+ }
});
},
|
e31c5e39f3775e2278f7bdb1b8e4de919c97266e | ghost/admin/components/gh-upload-modal.js | ghost/admin/components/gh-upload-modal.js | import ModalDialog from 'ghost/components/gh-modal-dialog';
import upload from 'ghost/assets/lib/uploader';
var UploadModal = ModalDialog.extend({
layoutName: 'components/gh-modal-dialog',
didInsertElement: function () {
this._super();
upload.call(this.$('.js-drop-zone'), {fileStorage: this.get('config.fileStorage')});
},
confirm: {
reject: {
func: function () { // The function called on rejection
return true;
},
buttonClass: true,
text: 'Cancel' // The reject button text
},
accept: {
buttonClass: 'btn btn-blue right',
text: 'Save', // The accept button texttext: 'Save'
func: function () {
var imageType = 'model.' + this.get('imageType');
if (this.$('.js-upload-url').val()) {
this.set(imageType, this.$('.js-upload-url').val());
} else {
this.set(imageType, this.$('.js-upload-target').attr('src'));
}
return true;
}
}
},
actions: {
closeModal: function () {
this.sendAction();
},
confirm: function (type) {
var func = this.get('confirm.' + type + '.func');
if (typeof func === 'function') {
func.apply(this);
}
this.sendAction();
this.sendAction('confirm' + type);
}
}
});
export default UploadModal;
| import ModalDialog from 'ghost/components/gh-modal-dialog';
import upload from 'ghost/assets/lib/uploader';
var UploadModal = ModalDialog.extend({
layoutName: 'components/gh-modal-dialog',
didInsertElement: function () {
this._super();
upload.call(this.$('.js-drop-zone'), {fileStorage: this.get('config.fileStorage')});
},
confirm: {
reject: {
func: function () { // The function called on rejection
return true;
},
buttonClass: 'btn btn-default',
text: 'Cancel' // The reject button text
},
accept: {
buttonClass: 'btn btn-blue right',
text: 'Save', // The accept button texttext: 'Save'
func: function () {
var imageType = 'model.' + this.get('imageType');
if (this.$('.js-upload-url').val()) {
this.set(imageType, this.$('.js-upload-url').val());
} else {
this.set(imageType, this.$('.js-upload-target').attr('src'));
}
return true;
}
}
},
actions: {
closeModal: function () {
this.sendAction();
},
confirm: function (type) {
var func = this.get('confirm.' + type + '.func');
if (typeof func === 'function') {
func.apply(this);
}
this.sendAction();
this.sendAction('confirm' + type);
}
}
});
export default UploadModal;
| Fix button class on upload modal | Fix button class on upload modal
no issue
- this makes sure that the cancel button on the upload modal gets the
correct class
| JavaScript | mit | TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost | ---
+++
@@ -13,7 +13,7 @@
func: function () { // The function called on rejection
return true;
},
- buttonClass: true,
+ buttonClass: 'btn btn-default',
text: 'Cancel' // The reject button text
},
accept: { |
23b4df8733dd31415a3053b8f8625144b259894c | test/component-test.js | test/component-test.js | var tape = require("tape"),
jsdom = require("jsdom"),
d3 = Object.assign(
require("../"),
require("d3-selection")
);
// An example component.
function Paragraph(){
return function (context, d){ context.text(d); };
}
Paragraph.tagName = "p";
tape("component()", function(test) {
var div = d3.select(jsdom.jsdom().body).append("div");
var paragraph = d3.component(Paragraph);
div.call(paragraph, ["foo", "bar"]);
test.equal(div.html(), "<p>foo</p><p>bar</p>");
test.end();
});
| var tape = require("tape"),
jsdom = require("jsdom"),
d3 = Object.assign(
require("../"),
require("d3-selection")
);
// An example component.
function Paragraph(){
return function (context, d){
context.text(d);
};
}
Paragraph.tagName = "p";
tape("A component should render multiple instances.", function(test) {
var div = d3.select(jsdom.jsdom().body).append("div");
var paragraph = d3.component(Paragraph);
div.call(paragraph, ["foo", "bar"]);
test.equal(div.html(), "<p>foo</p><p>bar</p>");
test.end();
});
tape("A component should render a single instance.", function(test) {
var div = d3.select(jsdom.jsdom().body).append("div");
var paragraph = d3.component(Paragraph);
div.call(paragraph, "foo");
test.equal(div.html(), "<p>foo</p>");
test.end();
});
| Add test for single instance | Add test for single instance
| JavaScript | bsd-3-clause | curran/d3-component | ---
+++
@@ -7,14 +7,24 @@
// An example component.
function Paragraph(){
- return function (context, d){ context.text(d); };
+ return function (context, d){
+ context.text(d);
+ };
}
Paragraph.tagName = "p";
-tape("component()", function(test) {
+tape("A component should render multiple instances.", function(test) {
var div = d3.select(jsdom.jsdom().body).append("div");
var paragraph = d3.component(Paragraph);
div.call(paragraph, ["foo", "bar"]);
test.equal(div.html(), "<p>foo</p><p>bar</p>");
test.end();
});
+
+tape("A component should render a single instance.", function(test) {
+ var div = d3.select(jsdom.jsdom().body).append("div");
+ var paragraph = d3.component(Paragraph);
+ div.call(paragraph, "foo");
+ test.equal(div.html(), "<p>foo</p>");
+ test.end();
+}); |
50fbcfd21058af009584b41cfd543c98b38ccb5a | reverse-array-in-place.js | reverse-array-in-place.js | // Reverse Array In Place
/*RULES:
Take array as parameter
Reverse array
Return reversed array
NOTES:
Can't create new empty array to push in
Must modify given array
Can't use array.reverse();
*/
/*PSEUDOCODE
1) Find array length
2) Create variable "stopper" for last element in array
2) (array.length - 1) times do:
2a) Push element previous to "stopper" to the end of the array
2b) Splice that same element out from in front of 'stopper'
3) When done, return reversed array
*/
function reverseArray(arr){
var count = arr.length;
} | // Reverse Array In Place
/*RULES:
Take array as parameter
Reverse array
Return reversed array
NOTES:
Can't create new empty array to push in
Must modify given array
Can't use array.reverse();
*/
/*PSEUDOCODE
1) Find array length
2) Create variable "stopper" for last element in array
2) (array.length - 1) times do:
2a) Push element previous to "stopper" to the end of the array
2b) Splice that same element out from in front of 'stopper'
3) When done, return reversed array
*/
function reverseArray(arr){
var count = arr.length;
var stopper = arr[count - 1];
for (var i = 0; i < count; i++){
arr.push(arr[arr.indexOf(stopper) - 1]);
arr.splice((arr.indexOf(stopper) - 1), 1);
}
return arr;
} | Complete working algorithm, follows all rules and works perfectly | Complete working algorithm, follows all rules and works perfectly
| JavaScript | mit | benjaminhyw/javascript_algorithms | ---
+++
@@ -23,5 +23,12 @@
function reverseArray(arr){
var count = arr.length;
+ var stopper = arr[count - 1];
+ for (var i = 0; i < count; i++){
+ arr.push(arr[arr.indexOf(stopper) - 1]);
+ arr.splice((arr.indexOf(stopper) - 1), 1);
+ }
+
+ return arr;
} |
37738318c9c13f5c796467a302776cca08c441bc | .eslintrc.js | .eslintrc.js | module.exports = {
"extends": "react-app",
"rules": {
"comma-dangle": ["error", "always-multiline"],
// disallow unnecessary semicolons
'no-extra-semi': 'error',
},
};
| module.exports = {
"extends": "react-app",
"rules": {
"comma-dangle": ["warn", "always-multiline"],
// disallow unnecessary semicolons
'no-extra-semi': 'warn',
},
};
| Change code style issues to warnings | Change code style issues to warnings
| JavaScript | agpl-3.0 | sMteX/WoWAnalyzer,FaideWW/WoWAnalyzer,Yuyz0112/WoWAnalyzer,sMteX/WoWAnalyzer,ronaldpereira/WoWAnalyzer,Juko8/WoWAnalyzer,ronaldpereira/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,anom0ly/WoWAnalyzer,yajinni/WoWAnalyzer,Yuyz0112/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,enragednuke/WoWAnalyzer,FaideWW/WoWAnalyzer,hasseboulen/WoWAnalyzer,mwwscott0/WoWAnalyzer,yajinni/WoWAnalyzer,fyruna/WoWAnalyzer,FaideWW/WoWAnalyzer,fyruna/WoWAnalyzer,hasseboulen/WoWAnalyzer,enragednuke/WoWAnalyzer,yajinni/WoWAnalyzer,anom0ly/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,hasseboulen/WoWAnalyzer,yajinni/WoWAnalyzer,fyruna/WoWAnalyzer,Juko8/WoWAnalyzer,enragednuke/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,mwwscott0/WoWAnalyzer,anom0ly/WoWAnalyzer,ronaldpereira/WoWAnalyzer,Juko8/WoWAnalyzer | ---
+++
@@ -1,8 +1,8 @@
module.exports = {
"extends": "react-app",
"rules": {
- "comma-dangle": ["error", "always-multiline"],
+ "comma-dangle": ["warn", "always-multiline"],
// disallow unnecessary semicolons
- 'no-extra-semi': 'error',
+ 'no-extra-semi': 'warn',
},
}; |
23af74d81b718ab07db40c38c46b8c1c6337374b | app/assets/javascripts/dispatcher/index.js | app/assets/javascripts/dispatcher/index.js | // This dispatcher modifies some of the ideas in Facebook's template:
// https://github.com/facebook/flux/blob/master/src/Dispatcher.js
var FluxDispatcher = require('flux').Dispatcher;
class AppDispatcher extends FluxDispatcher {
dispatch(payload) {
if (!payload.action && !payload.type) {
console.error('Cannot dispatch null action. Make sure action type is in constants.js');
return;
}
super.dispatch(payload);
}
};
module.exports = window.Dispatcher = new AppDispatcher();
| var FluxDispatcher = require('flux').Dispatcher;
class AppDispatcher extends FluxDispatcher {
dispatch(payload) {
if (!payload.action && !payload.type) {
console.error('Cannot dispatch null action. Make sure action type is in constants.js');
return;
}
super.dispatch(payload);
}
};
module.exports = window.Dispatcher = new AppDispatcher();
| Remove unnecessary comment, since the origins of the Dispatcher are now apparent | Remove unnecessary comment, since the origins of the Dispatcher are now
apparent
| JavaScript | agpl-3.0 | lachlanjc/meta,assemblymade/meta,assemblymade/meta,assemblymade/meta,lachlanjc/meta,lachlanjc/meta,assemblymade/meta,lachlanjc/meta | ---
+++
@@ -1,6 +1,3 @@
-// This dispatcher modifies some of the ideas in Facebook's template:
-// https://github.com/facebook/flux/blob/master/src/Dispatcher.js
-
var FluxDispatcher = require('flux').Dispatcher;
class AppDispatcher extends FluxDispatcher { |
414958ef0ee5d48d7f823517976493a2b237d2f3 | test/encoders.tests.js | test/encoders.tests.js | var assert = require('assert');
var encoders = require('../lib/encoders');
var fixtures = require('./fixture/server');
describe('encoders', function () {
describe('thumbprint', function () {
it('should return the thumbprint in all caps', function () {
var certThumbprint = encoders.thumbprint(fixtures.credentials.cert);
assert.equal(certThumbprint, '499FDF1C2218A99C8595AAC2FD95CE36F0A6D59D');
});
});
});
| 'use strict';
const assert = require('assert');
const encoders = require('../lib/encoders');
const fixtures = require('./fixture/server');
describe('encoders', function () {
describe('thumbprint', function () {
it('should return the thumbprint in all caps', function () {
const certThumbprint = encoders.thumbprint(fixtures.credentials.cert);
assert.equal(certThumbprint, '499FDF1C2218A99C8595AAC2FD95CE36F0A6D59D');
});
});
});
| Revert "Make compatible with Node 0.10 🤢" | Revert "Make compatible with Node 0.10 🤢"
This reverts commit eaf1ad7
| JavaScript | mit | auth0/node-wsfed,auth0/node-wsfed | ---
+++
@@ -1,11 +1,13 @@
-var assert = require('assert');
-var encoders = require('../lib/encoders');
-var fixtures = require('./fixture/server');
+'use strict';
+
+const assert = require('assert');
+const encoders = require('../lib/encoders');
+const fixtures = require('./fixture/server');
describe('encoders', function () {
describe('thumbprint', function () {
it('should return the thumbprint in all caps', function () {
- var certThumbprint = encoders.thumbprint(fixtures.credentials.cert);
+ const certThumbprint = encoders.thumbprint(fixtures.credentials.cert);
assert.equal(certThumbprint, '499FDF1C2218A99C8595AAC2FD95CE36F0A6D59D');
});
}); |
028e456ff191d013c3cf48fcaaa106e11348c5c2 | src/js/views/controls.js | src/js/views/controls.js | define(['underscore', 'backbone', 'jquery'], function(_, Backbone, $) {
'use strict';
var $navigatorBtn = $('.caption .controls button.navigator');
var $navigatorOverlay = $('.navigator-overlay');
return Backbone.View.extend({
initialize: function() {
$navigatorBtn.click(_.bind(this.toggleNavigator, this));
$navigatorOverlay.on('click mousedown touchdown', _.bind(this.closeNavigator, this));
},
openNavigator: function() {
$('body').addClass('navigator');
},
closeNavigator: function() {
$('body').removeClass('navigator');
},
isNavigatorOpen: function() {
return $('body').hasClass('navigator');
},
toggleNavigator: function() {
if (!this.isNavigatorOpen()) {
this.openNavigator();
} else {
this.closeNavigator();
}
return false;
}
});
});
| define(['underscore', 'backbone', 'jquery'], function(_, Backbone, $) {
'use strict';
var $navigatorBtn = $('.caption .controls button.navigator');
var $navigatorOverlay = $('.navigator-overlay');
return Backbone.View.extend({
initialize: function() {
$navigatorBtn.click(_.bind(this.toggleNavigator, this));
$navigatorOverlay.on('click mousedown touchdown', _.bind(this.closeNavigator, this));
},
toggleNavigator: function() {
$('body').toggleClass('navigator');
},
closeNavigator: function() {
$('body').removeClass('navigator');
}
});
});
| Remove unused methods from navigator control | Remove unused methods from navigator control
| JavaScript | mit | nuclearwingsclan/skymaps,asleepwalker/skymaps,asleepwalker/skymaps,nuclearwingsclan/skymaps | ---
+++
@@ -10,26 +10,13 @@
$navigatorOverlay.on('click mousedown touchdown', _.bind(this.closeNavigator, this));
},
- openNavigator: function() {
- $('body').addClass('navigator');
+ toggleNavigator: function() {
+ $('body').toggleClass('navigator');
},
closeNavigator: function() {
$('body').removeClass('navigator');
- },
-
- isNavigatorOpen: function() {
- return $('body').hasClass('navigator');
- },
-
- toggleNavigator: function() {
- if (!this.isNavigatorOpen()) {
- this.openNavigator();
- } else {
- this.closeNavigator();
- }
- return false;
- }
+ }
});
}); |
c847d07a1d096750b9188a0969795c65afa859f5 | lib/rules/validate-self-closing-tags.js | lib/rules/validate-self-closing-tags.js | var utils = require('../utils')
, selfClosing = require('void-elements')
module.exports = function () {}
module.exports.prototype =
{ name: 'validateSelfClosingTags'
, configure: function (options) {
utils.validateTrueOptions(this.name, options)
}
, lint: function (file, errors) {
var isXml
file.iterateTokensByType('doctype', function (token) {
isXml = token.val === 'xml'
})
if (!isXml) {
file.iterateTokensByType('tag', function (token) {
if (token.selfClosing && selfClosing[token.val]) {
errors.add('Unnecessary self closing tag', token.line)
}
})
}
}
}
| var utils = require('../utils')
, selfClosing = require('void-elements')
module.exports = function () {}
module.exports.prototype =
{ name: 'validateSelfClosingTags'
, configure: function (options) {
utils.validateTrueOptions(this.name, options)
}
, lint: function (file, errors) {
var isXml
file.iterateTokensByType('doctype', function (token) {
isXml = token.val === 'xml'
})
if (!isXml) {
file.iterateTokensByType('tag', function (token) {
var nextToken = file.getToken(token._index + 1)
if (nextToken.type === 'slash' && selfClosing[token.val]) {
errors.add('Unnecessary self closing tag', token.line)
}
})
}
}
}
| Refactor `validateSelfClosingTags` to handle new token structure | Refactor `validateSelfClosingTags` to handle new token structure
| JavaScript | isc | benedfit/jade-lint,pugjs/jade-lint,pugjs/pug-lint,benedfit/jadelint | ---
+++
@@ -22,7 +22,9 @@
if (!isXml) {
file.iterateTokensByType('tag', function (token) {
- if (token.selfClosing && selfClosing[token.val]) {
+ var nextToken = file.getToken(token._index + 1)
+
+ if (nextToken.type === 'slash' && selfClosing[token.val]) {
errors.add('Unnecessary self closing tag', token.line)
}
}) |
c8ed1fb00519c3a0c42739476e07ad632bba86c0 | lib/server/model.js | lib/server/model.js | 'use strict';
const CommonModel = require('../common/model.js');
class ServerModel extends CommonModel {
constructor(validator, messenger, dbStorage, config, jwt) {
super(validator, messenger);
this.db = dbStorage;
this.config = config;
this.jwt = jwt;
}
signinPassword(event) {
this.db
.getUser(this.getUsername(), this.getPassword())
.then(this.handleUser.bind(this, event))
.catch(this.messenger.handleError.bind(this.messenger, event));
}
signinToken(event) {
this.reply(event, this.jwt.verify(
this.getToken(),
this.config.get('@scola.auth.privateKey')
));
}
handleUser(event, user) {
if (!user) {
throw new Error('@scola.auth.error.user-not-found');
}
const token = this.jwt.sign({
userId: user.user_id
}, this.config.get('@scola.auth.privateKey'), {
expiresIn: '7 days'
});
this.reply(event, {
token,
userId: user.user_id
});
}
}
module.exports = ServerModel;
| 'use strict';
const CommonModel = require('../common/model.js');
class ServerModel extends CommonModel {
constructor(validator, messenger, dbStorage, config, jwt) {
super(validator, messenger);
this.db = dbStorage;
this.config = config;
this.jwt = jwt;
}
signinPassword(event) {
this.db
.getUser(this.getUsername(), this.getPassword())
.then(this.handleUser.bind(this, event))
.catch(this.messenger.handleError.bind(this.messenger, event));
}
signinToken(event) {
this.messenger.reply(event, this.jwt.verify(
this.getToken(),
this.config.get('@scola.auth.privateKey')
));
}
handleUser(event, user) {
if (!user) {
throw new Error('@scola.auth.error.user-not-found');
}
const token = this.jwt.sign({
userId: user.user_id
}, this.config.get('@scola.auth.privateKey'), {
expiresIn: '7 days'
});
this.messenger.reply(event, {
token,
userId: user.user_id
});
}
}
module.exports = ServerModel;
| Fix bug: call reply method on messenger | Fix bug: call reply method on messenger
| JavaScript | mit | scola84/node-auth | ---
+++
@@ -19,7 +19,7 @@
}
signinToken(event) {
- this.reply(event, this.jwt.verify(
+ this.messenger.reply(event, this.jwt.verify(
this.getToken(),
this.config.get('@scola.auth.privateKey')
));
@@ -36,7 +36,7 @@
expiresIn: '7 days'
});
- this.reply(event, {
+ this.messenger.reply(event, {
token,
userId: user.user_id
}); |
b72a2e4ecd8c8fee9dba0b9bba059b31757dd0f7 | lib/services/tag.js | lib/services/tag.js | import rp from 'request-promise';
import {Microservices} from '../../configs/microservices';
import {isEmpty, assignToAllById} from '../../common';
export default {
// fetches the tags data
fetchTagInfo(tags) {
if (isEmpty(tags)) return Promise.resolve([]);
return rp.get({
uri: `${Microservices.tag.uri}/tags`,
qs: {
tagName: tags.map((t) => t.tagName),
paging: false, // this allows for unpaged results
},
useQuerystring: true,
json: true,
});
},
};
| import rp from 'request-promise';
import {Microservices} from '../../configs/microservices';
import {isEmpty, assignToAllById} from '../../common';
export default {
// fetches the tags data
fetchTagInfo(tags) {
if (isEmpty(tags)) return Promise.resolve([]);
return rp.get({
uri: `${Microservices.tag.uri}/tags`,
qs: {
tagType: 'all',
tagName: tags.map((t) => t.tagName),
paging: false, // this allows for unpaged results
},
useQuerystring: true,
json: true,
});
},
};
| Fix no topics shown when loading a deck | Fix no topics shown when loading a deck
| JavaScript | mpl-2.0 | slidewiki/slidewiki-platform,slidewiki/slidewiki-platform,slidewiki/slidewiki-platform | ---
+++
@@ -12,6 +12,7 @@
return rp.get({
uri: `${Microservices.tag.uri}/tags`,
qs: {
+ tagType: 'all',
tagName: tags.map((t) => t.tagName),
paging: false, // this allows for unpaged results
}, |
03b3bd619dcf68fbba409fa6de788d2e02f4c0ca | test/selectors.spec.js | test/selectors.spec.js | import * as selectors from '../src/selectors'
describe('selectors', () => {
it('includes selector to get session data', () => {
const state = {
session: {
data: { token: 'abcde' }
}
}
const result = selectors.getSessionData(state)
expect(result).toEqual({ token: 'abcde' })
})
it('includes selector to get isAuthenticated', () => {
const state = {
session: {
isAuthenticated: true
}
}
const result = selectors.getIsAuthenticated(state)
expect(result).toEqual(true)
})
it('includes selector to get authenticator', () => {
const state = {
session: {
authenticator: 'credentials'
}
}
const result = selectors.getAuthenticator(state)
expect(result).toEqual('credentials')
})
it('includes selector to get isRestored', () => {
const state = {
session: {
isRestored: false
}
}
const result = selectors.getIsRestored(state)
expect(result).toEqual(false)
})
it('includes selector to get lastError', () => {
const state = {
session: {
lastError: 'You shall not pass'
}
}
const result = selectors.getLastError(state)
expect(result).toEqual('You shall not pass')
})
})
| import * as selectors from '../src/selectors'
describe('selectors', () => {
it('includes selector to get session data', () => {
const state = {
session: {
data: { token: 'abcde' }
}
}
const result = selectors.getSessionData(state)
expect(result).toEqual({ token: 'abcde' })
})
it('includes selector to get isAuthenticated', () => {
const state = {
session: {
isAuthenticated: true
}
}
const result = selectors.getIsAuthenticated(state)
expect(result).toEqual(true)
})
it('includes selector to get authenticator', () => {
const state = {
session: {
authenticator: 'credentials'
}
}
const result = selectors.getAuthenticator(state)
expect(result).toEqual('credentials')
})
it('includes selector to get isRestored', () => {
const state = {
session: {
isRestored: false
}
}
const result = selectors.getIsRestored(state)
expect(result).toEqual(false)
})
it('includes selector to get lastError', () => {
const state = {
session: {
lastError: 'You shall not pass'
}
}
const result = selectors.getLastError(state)
expect(result).toEqual('You shall not pass')
})
it('includes selector to get hasFailedAuth', () => {
const state = {
session: {
hasFailedAuth: true
}
}
const result = selectors.getHasFailedAuth(state)
expect(result).toEqual(true)
})
})
| Add test for getHasFailedAuth selector | Add test for getHasFailedAuth selector
| JavaScript | mit | jerelmiller/redux-simple-auth | ---
+++
@@ -60,4 +60,16 @@
expect(result).toEqual('You shall not pass')
})
+
+ it('includes selector to get hasFailedAuth', () => {
+ const state = {
+ session: {
+ hasFailedAuth: true
+ }
+ }
+
+ const result = selectors.getHasFailedAuth(state)
+
+ expect(result).toEqual(true)
+ })
}) |
923e723b701bb382c87ff811a2a4b861e4e6ec36 | src/components/laws/LawCollectionChooser.js | src/components/laws/LawCollectionChooser.js | import React, { PropTypes } from 'react';
import ImmutableTypes from 'react-immutable-proptypes';
import { Grid, Cell, Button } from 'react-mdl';
const LawCollectionChooser = ({ collections, selected, onSelect }) => (
<Grid noSpacing>
{collections.map(title => (
<Cell key={title} col={3} tablet={4} phone={1}>
<Button
ripple raised
accent={selected === title}
onClick={() => onSelect(selected !== title ? title : '')}
>
{title}
</Button>
</Cell>
))}
</Grid>
);
LawCollectionChooser.propTypes = {
collections: ImmutableTypes.listOf(PropTypes.string).isRequired,
onSelect: PropTypes.func.isRequired,
selected: PropTypes.string,
};
export default LawCollectionChooser;
| import React, { PropTypes } from 'react';
import { List } from 'immutable';
import { range } from 'lodash';
import ImmutableTypes from 'react-immutable-proptypes';
import { Grid, Cell, Button } from 'react-mdl';
const shell = List(range(4).map(() => ''));
const LawCollectionChooser = ({ collections, selected, onSelect }) => (
<Grid>
{(collections.size ? collections : shell).map((title, idx) => (
<Cell
key={title || `shell-${idx}`}
col={3}
tablet={4}
phone={4}
>
<Button
ripple raised
disabled={title === ''}
accent={selected === title}
onClick={() => onSelect(selected !== title ? title : '')}
style={{ width: '100%' }}
>
{title}
</Button>
</Cell>
))}
</Grid>
);
LawCollectionChooser.propTypes = {
collections: ImmutableTypes.listOf(PropTypes.string).isRequired,
onSelect: PropTypes.func.isRequired,
selected: PropTypes.string,
};
export default LawCollectionChooser;
| Implement shells for law index collection chooser. | Implement shells for law index collection chooser.
| JavaScript | agpl-3.0 | ahoereth/lawly,ahoereth/lawly,ahoereth/lawly | ---
+++
@@ -1,16 +1,28 @@
import React, { PropTypes } from 'react';
+import { List } from 'immutable';
+import { range } from 'lodash';
import ImmutableTypes from 'react-immutable-proptypes';
import { Grid, Cell, Button } from 'react-mdl';
+const shell = List(range(4).map(() => ''));
+
+
const LawCollectionChooser = ({ collections, selected, onSelect }) => (
- <Grid noSpacing>
- {collections.map(title => (
- <Cell key={title} col={3} tablet={4} phone={1}>
+ <Grid>
+ {(collections.size ? collections : shell).map((title, idx) => (
+ <Cell
+ key={title || `shell-${idx}`}
+ col={3}
+ tablet={4}
+ phone={4}
+ >
<Button
ripple raised
+ disabled={title === ''}
accent={selected === title}
onClick={() => onSelect(selected !== title ? title : '')}
+ style={{ width: '100%' }}
>
{title}
</Button> |
05a0de2d8680c92a40739027bd15a19c205d1f80 | lib/utils/images.js | lib/utils/images.js | var _ = require("lodash");
var Q = require("q");
var fs = require("./fs");
var shellescape = require('shell-escape');
var spawn = require('spawn-cmd').spawn;
var links = require("./links");
// Convert a svg file
var convertSVG = function(source, dest, options) {
if (!fs.existsSync(source)) return Q.reject(new Error("File doesn't exist: "+source));
var d = Q.defer();
options = _.defaults(options || {}, {
});
//var command = shellescape(['svgexport', source, dest]);
var child = spawn('svgexport', [source, dest]);
child.on("error", function(error) {
if (error.code == "ENOENT") error = new Error("Need to install 'svgexport' using 'npm install svgexport -g'");
return d.reject(error);
});
child.on("close", function(code) {
if (code == 0 && fs.existsSync(dest)) {
d.resolve();
} else {
d.reject(new Error("Error converting "+source+" into "+dest));
}
});
return d.promise;
};
module.exports = {
convertSVG: convertSVG,
INVALID: [".svg"]
};
| var _ = require("lodash");
var Q = require("q");
var fs = require("./fs");
var spawn = require('spawn-cmd').spawn;
var links = require("./links");
// Convert a svg file
var convertSVG = function(source, dest, options) {
if (!fs.existsSync(source)) return Q.reject(new Error("File doesn't exist: "+source));
var d = Q.defer();
options = _.defaults(options || {}, {
});
//var command = shellescape(['svgexport', source, dest]);
var child = spawn('svgexport', [source, dest]);
child.on("error", function(error) {
if (error.code == "ENOENT") error = new Error("Need to install 'svgexport' using 'npm install svgexport -g'");
return d.reject(error);
});
child.on("close", function(code) {
if (code == 0 && fs.existsSync(dest)) {
d.resolve();
} else {
d.reject(new Error("Error converting "+source+" into "+dest));
}
});
return d.promise;
};
module.exports = {
convertSVG: convertSVG,
INVALID: [".svg"]
};
| Remove require of old dependency "shell-escape" | Remove require of old dependency "shell-escape"
| JavaScript | apache-2.0 | haamop/documentation,jocr1627/gitbook,hongbinz/gitbook,hujianfei1989/gitbook,athiruban/gitbook,switchspan/gitbook,haamop/documentation,bradparks/gitbook,gencer/gitbook,palerdot/gitbook,grokcoder/gitbook,sunlianghua/gitbook,sunlianghua/gitbook,jasonslyvia/gitbook,xxxhycl2010/gitbook,kamyu104/gitbook,webwlsong/gitbook,sudobashme/gitbook,grokcoder/gitbook,nycitt/gitbook,CN-Sean/gitbook,tshoper/gitbook,JohnTroony/gitbook,guiquanz/gitbook,GitbookIO/gitbook,wewelove/gitbook,xcv58/gitbook,alex-dixon/gitbook,gdbooks/gitbook,vehar/gitbook,thelastmile/gitbook,npracht/documentation,youprofit/gitbook,2390183798/gitbook,minghe/gitbook,tshoper/gitbook,intfrr/gitbook,ferrior30/gitbook,boyXiong/gitbook,intfrr/gitbook,npracht/documentation,megumiteam/documentation,rohan07/gitbook,minghe/gitbook,FKV587/gitbook,hujianfei1989/gitbook,shibe97/gitbook,escopecz/documentation,OriPekelman/gitbook,OriPekelman/gitbook,a-moses/gitbook,megumiteam/documentation,lucciano/gitbook,athiruban/gitbook,kamyu104/gitbook,qingying5810/gitbook,mautic/documentation,2390183798/gitbook,mruse/gitbook,wewelove/gitbook,guiquanz/gitbook,boyXiong/gitbook,bradparks/gitbook,jasonslyvia/gitbook,mruse/gitbook,webwlsong/gitbook,alex-dixon/gitbook,CN-Sean/gitbook,rohan07/gitbook,gaearon/gitbook,qingying5810/gitbook,FKV587/gitbook,youprofit/gitbook,shibe97/gitbook,mautic/documentation,escopecz/documentation,gaearon/gitbook,ZachLamb/gitbook,ZachLamb/gitbook,snowsnail/gitbook,xxxhycl2010/gitbook,gdbooks/gitbook,tzq668766/gitbook,iflyup/gitbook,sudobashme/gitbook,thelastmile/gitbook,vehar/gitbook,xcv58/gitbook,ferrior30/gitbook,nycitt/gitbook,justinleoye/gitbook,ryanswanson/gitbook,justinleoye/gitbook,tzq668766/gitbook,a-moses/gitbook,iamchenxin/gitbook,iamchenxin/gitbook,switchspan/gitbook,gencer/gitbook,palerdot/gitbook,snowsnail/gitbook,JohnTroony/gitbook,hongbinz/gitbook,lucciano/gitbook,strawluffy/gitbook,jocr1627/gitbook,iflyup/gitbook | ---
+++
@@ -1,7 +1,6 @@
var _ = require("lodash");
var Q = require("q");
var fs = require("./fs");
-var shellescape = require('shell-escape');
var spawn = require('spawn-cmd').spawn;
var links = require("./links"); |
8de090891a3492729fbb74b94fb28740c7143428 | src/components/loggertrace/HeaderDisplay.js | src/components/loggertrace/HeaderDisplay.js | import React, { PropTypes } from 'react';
import { Table } from 'react-bootstrap';
import { List } from 'immutable';
import moment from 'moment';
import HeaderRow from './HeaderRow';
function HeaderDisplay(props) {
let headers = props.headers;
const rows = headers.map(h => {
const name = h.get('name');
const value = h.get('value').toString();
return (
<HeaderRow key={name} name={name} value={value} />
);
});
const { flightDate, timezone } = props;
return (
<Table striped>
<tbody>
<HeaderRow key="Flight date" name="Flight date" value={flightDate.format('dddd, LL')} />
<HeaderRow key="Timezone" name="Time zone" value={`${timezone} (UTC ${flightDate.format('Z')})`} />
{rows}
</tbody>
</Table>
);
}
HeaderDisplay.propTypes = {
headers: PropTypes.instanceOf(List).isRequired,
flightDate: PropTypes.instanceOf(moment).isRequired,
timezone: PropTypes.string.isRequired
};
export default HeaderDisplay;
| import React, { PropTypes } from 'react';
import { Table } from 'react-bootstrap';
import { List } from 'immutable';
import moment from 'moment';
import HeaderRow from './HeaderRow';
function HeaderDisplay(props) {
let headers = props.headers;
const rows = headers.map((h, index) => {
const name = h.get('name');
const value = h.get('value').toString();
return (
<HeaderRow key={`${name}${index}`} name={name} value={value} />
);
});
const { flightDate, timezone } = props;
return (
<Table striped>
<tbody>
<HeaderRow key="Flight date" name="Flight date" value={flightDate.format('dddd, LL')} />
<HeaderRow key="Timezone" name="Time zone" value={`${timezone} (UTC ${flightDate.format('Z')})`} />
{rows}
</tbody>
</Table>
);
}
HeaderDisplay.propTypes = {
headers: PropTypes.instanceOf(List).isRequired,
flightDate: PropTypes.instanceOf(moment).isRequired,
timezone: PropTypes.string.isRequired
};
export default HeaderDisplay;
| Support for two headers with same name. | Support for two headers with same name.
I found an example file with two different firmware version header lines. This caused a React error due to duplicate item keys.
Fixed by appending the index to the name.
| JavaScript | mit | alistairmgreen/soaring-analyst,alistairmgreen/soaring-analyst | ---
+++
@@ -7,12 +7,12 @@
function HeaderDisplay(props) {
let headers = props.headers;
- const rows = headers.map(h => {
+ const rows = headers.map((h, index) => {
const name = h.get('name');
const value = h.get('value').toString();
return (
- <HeaderRow key={name} name={name} value={value} />
+ <HeaderRow key={`${name}${index}`} name={name} value={value} />
);
});
|
af861de8c276b56babd2d978e2a1bc2950115ff5 | main.js | main.js | import { app, BrowserWindow } from 'electron';
let mainWindow = null;
app.on('window-all-closed', () => {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', () => {
mainWindow = new BrowserWindow({width: 800, maxWidth: 800, height: 600}); //, titleBarStyle: 'hidden'});
mainWindow.loadURL('file://' + __dirname + '/index.html');
// Open the DevTools.
//mainWindow.webContents.openDevTools();
});
| import { app, BrowserWindow } from 'electron';
let mainWindow = null;
let willQuit = false;
function createWindow() {
mainWindow = new BrowserWindow({width: 800, maxWidth: 800, height: 600, fullscreenable: false}); //, titleBarStyle: 'hidden'});
mainWindow.loadURL('file://' + __dirname + '/index.html');
}
app.on('ready', () => {
createWindow();
mainWindow.on('close', (e) => {
if (willQuit) {
mainWindow = null;
} else {
e.preventDefault();
mainWindow.hide();
}
});
});
app.on('activate', () => mainWindow.show());
app.on('before-quit', () => willQuitApp = true);
| Make window persist on close | Make window persist on close
| JavaScript | mit | cassidoo/todometer,jdebarochez/todometer,jdebarochez/todometer,cassidoo/todometer | ---
+++
@@ -1,16 +1,25 @@
import { app, BrowserWindow } from 'electron';
let mainWindow = null;
+let willQuit = false;
-app.on('window-all-closed', () => {
- if (process.platform != 'darwin') {
- app.quit();
- }
+function createWindow() {
+ mainWindow = new BrowserWindow({width: 800, maxWidth: 800, height: 600, fullscreenable: false}); //, titleBarStyle: 'hidden'});
+ mainWindow.loadURL('file://' + __dirname + '/index.html');
+}
+
+app.on('ready', () => {
+ createWindow();
+
+ mainWindow.on('close', (e) => {
+ if (willQuit) {
+ mainWindow = null;
+ } else {
+ e.preventDefault();
+ mainWindow.hide();
+ }
+ });
});
-app.on('ready', () => {
- mainWindow = new BrowserWindow({width: 800, maxWidth: 800, height: 600}); //, titleBarStyle: 'hidden'});
- mainWindow.loadURL('file://' + __dirname + '/index.html');
- // Open the DevTools.
- //mainWindow.webContents.openDevTools();
-});
+app.on('activate', () => mainWindow.show());
+app.on('before-quit', () => willQuitApp = true); |
516e2ca05aefe603e3ad2bbff272af1e2506d339 | generators/client/templates/src/main/webapp/app/home/_home.controller.js | generators/client/templates/src/main/webapp/app/home/_home.controller.js | 'use strict';
angular.module('<%=angularAppName%>')
.controller('HomeController', function ($scope, Principal, LoginService) {
function getAccount() {
Principal.identity().then(function(account) {
$scope.account = account;
$scope.isAuthenticated = Principal.isAuthenticated;
});
}
getAccount();
$scope.$on('authenticationSuccess', function() {
getAccount();
});
});
| 'use strict';
angular.module('<%=angularAppName%>')
.controller('HomeController', function ($scope, Principal, LoginService) {
function getAccount() {
Principal.identity().then(function(account) {
$scope.account = account;
$scope.isAuthenticated = Principal.isAuthenticated;
});
}
getAccount();
$scope.$on('authenticationSuccess', function() {
getAccount();
});
$scope.login = LoginService.open;
});
| Fix the link sign in | Fix the link sign in
| JavaScript | apache-2.0 | danielpetisme/generator-jhipster,atomfrede/generator-jhipster,nkolosnjaji/generator-jhipster,ruddell/generator-jhipster,hdurix/generator-jhipster,eosimosu/generator-jhipster,liseri/generator-jhipster,maniacneron/generator-jhipster,PierreBesson/generator-jhipster,atomfrede/generator-jhipster,yongli82/generator-jhipster,jhipster/generator-jhipster,duderoot/generator-jhipster,robertmilowski/generator-jhipster,duderoot/generator-jhipster,dalbelap/generator-jhipster,maniacneron/generator-jhipster,jhipster/generator-jhipster,PierreBesson/generator-jhipster,dimeros/generator-jhipster,sohibegit/generator-jhipster,deepu105/generator-jhipster,jkutner/generator-jhipster,rkohel/generator-jhipster,atomfrede/generator-jhipster,baskeboler/generator-jhipster,hdurix/generator-jhipster,deepu105/generator-jhipster,mosoft521/generator-jhipster,nkolosnjaji/generator-jhipster,cbornet/generator-jhipster,cbornet/generator-jhipster,gmarziou/generator-jhipster,robertmilowski/generator-jhipster,yongli82/generator-jhipster,yongli82/generator-jhipster,mosoft521/generator-jhipster,nkolosnjaji/generator-jhipster,duderoot/generator-jhipster,dynamicguy/generator-jhipster,wmarques/generator-jhipster,atomfrede/generator-jhipster,dynamicguy/generator-jhipster,rifatdover/generator-jhipster,liseri/generator-jhipster,gzsombor/generator-jhipster,siliconharborlabs/generator-jhipster,Tcharl/generator-jhipster,ramzimaalej/generator-jhipster,pascalgrimaud/generator-jhipster,duderoot/generator-jhipster,dimeros/generator-jhipster,yongli82/generator-jhipster,ruddell/generator-jhipster,ziogiugno/generator-jhipster,erikkemperman/generator-jhipster,deepu105/generator-jhipster,mraible/generator-jhipster,dynamicguy/generator-jhipster,gzsombor/generator-jhipster,maniacneron/generator-jhipster,ctamisier/generator-jhipster,cbornet/generator-jhipster,vivekmore/generator-jhipster,vivekmore/generator-jhipster,eosimosu/generator-jhipster,danielpetisme/generator-jhipster,nkolosnjaji/generator-jhipster,maniacneron/generator-jhipster,deepu105/generator-jhipster,JulienMrgrd/generator-jhipster,hdurix/generator-jhipster,nkolosnjaji/generator-jhipster,liseri/generator-jhipster,baskeboler/generator-jhipster,stevehouel/generator-jhipster,PierreBesson/generator-jhipster,dalbelap/generator-jhipster,rifatdover/generator-jhipster,ziogiugno/generator-jhipster,pascalgrimaud/generator-jhipster,ruddell/generator-jhipster,danielpetisme/generator-jhipster,Tcharl/generator-jhipster,mosoft521/generator-jhipster,ctamisier/generator-jhipster,ctamisier/generator-jhipster,PierreBesson/generator-jhipster,vivekmore/generator-jhipster,mraible/generator-jhipster,danielpetisme/generator-jhipster,stevehouel/generator-jhipster,dalbelap/generator-jhipster,duderoot/generator-jhipster,gzsombor/generator-jhipster,sendilkumarn/generator-jhipster,ctamisier/generator-jhipster,dimeros/generator-jhipster,ctamisier/generator-jhipster,deepu105/generator-jhipster,pascalgrimaud/generator-jhipster,jkutner/generator-jhipster,pascalgrimaud/generator-jhipster,robertmilowski/generator-jhipster,lrkwz/generator-jhipster,jkutner/generator-jhipster,ramzimaalej/generator-jhipster,Tcharl/generator-jhipster,dynamicguy/generator-jhipster,liseri/generator-jhipster,jhipster/generator-jhipster,rkohel/generator-jhipster,eosimosu/generator-jhipster,Tcharl/generator-jhipster,baskeboler/generator-jhipster,wmarques/generator-jhipster,xetys/generator-jhipster,xetys/generator-jhipster,siliconharborlabs/generator-jhipster,maniacneron/generator-jhipster,cbornet/generator-jhipster,sendilkumarn/generator-jhipster,JulienMrgrd/generator-jhipster,siliconharborlabs/generator-jhipster,baskeboler/generator-jhipster,sohibegit/generator-jhipster,gmarziou/generator-jhipster,jhipster/generator-jhipster,dalbelap/generator-jhipster,erikkemperman/generator-jhipster,mraible/generator-jhipster,jkutner/generator-jhipster,eosimosu/generator-jhipster,vivekmore/generator-jhipster,Tcharl/generator-jhipster,mosoft521/generator-jhipster,ruddell/generator-jhipster,eosimosu/generator-jhipster,robertmilowski/generator-jhipster,lrkwz/generator-jhipster,stevehouel/generator-jhipster,lrkwz/generator-jhipster,gzsombor/generator-jhipster,rkohel/generator-jhipster,erikkemperman/generator-jhipster,ruddell/generator-jhipster,gmarziou/generator-jhipster,erikkemperman/generator-jhipster,ziogiugno/generator-jhipster,cbornet/generator-jhipster,robertmilowski/generator-jhipster,PierreBesson/generator-jhipster,sendilkumarn/generator-jhipster,JulienMrgrd/generator-jhipster,JulienMrgrd/generator-jhipster,ziogiugno/generator-jhipster,xetys/generator-jhipster,ziogiugno/generator-jhipster,jhipster/generator-jhipster,stevehouel/generator-jhipster,wmarques/generator-jhipster,wmarques/generator-jhipster,gmarziou/generator-jhipster,rkohel/generator-jhipster,dimeros/generator-jhipster,mraible/generator-jhipster,wmarques/generator-jhipster,vivekmore/generator-jhipster,danielpetisme/generator-jhipster,sohibegit/generator-jhipster,sohibegit/generator-jhipster,gmarziou/generator-jhipster,gzsombor/generator-jhipster,ramzimaalej/generator-jhipster,dalbelap/generator-jhipster,dimeros/generator-jhipster,liseri/generator-jhipster,siliconharborlabs/generator-jhipster,hdurix/generator-jhipster,rkohel/generator-jhipster,lrkwz/generator-jhipster,sendilkumarn/generator-jhipster,yongli82/generator-jhipster,mosoft521/generator-jhipster,hdurix/generator-jhipster,jkutner/generator-jhipster,mraible/generator-jhipster,lrkwz/generator-jhipster,baskeboler/generator-jhipster,atomfrede/generator-jhipster,rifatdover/generator-jhipster,xetys/generator-jhipster,sendilkumarn/generator-jhipster,siliconharborlabs/generator-jhipster,erikkemperman/generator-jhipster,pascalgrimaud/generator-jhipster,sohibegit/generator-jhipster,stevehouel/generator-jhipster,JulienMrgrd/generator-jhipster | ---
+++
@@ -13,4 +13,6 @@
$scope.$on('authenticationSuccess', function() {
getAccount();
});
+
+ $scope.login = LoginService.open;
}); |
0d23116dc716585310a41cbd083988406d1013b0 | backend-services-push-hybrid-advanced/scripts/app.js | backend-services-push-hybrid-advanced/scripts/app.js | (function (global) {
'use strict';
var app = global.app = global.app || {};
var fixViewResize = function () {
if (device.platform === 'iOS') {
setTimeout(function() {
$(document.body).height(window.innerHeight);
}, 10);
}
};
var onDeviceReady = function() {
navigator.splashscreen.hide();
if (!app.isKeySet(app.config.everlive.apiKey)) {
$(app.config.views.init).hide();
$('#pushApp').addClass('noapikey-scrn').html(app.constants.NO_API_KEY_MESSAGE);
return;
}
fixViewResize();
var os = kendo.support.mobileOS,
statusBarStyle = os.ios && os.flatVersion >= 700 ? 'black-translucent' : 'black';
app.mobile = new kendo.mobile.Application(document.body, {
transition: 'slide',
statusBarStyle: statusBarStyle,
skin: 'flat'
});
app.everlive = new Everlive({
apiKey: app.config.everlive.apiKey,
scheme: app.config.everlive.scheme
});
};
document.addEventListener('deviceready', onDeviceReady, false);
document.addEventListener('orientationchange', fixViewResize);
}(window));
| (function (global) {
'use strict';
var app = global.app = global.app || {};
app.everlive = new Everlive({
apiKey: app.config.everlive.apiKey,
scheme: app.config.everlive.scheme
});
var fixViewResize = function () {
if (device.platform === 'iOS') {
setTimeout(function() {
$(document.body).height(window.innerHeight);
}, 10);
}
};
var onDeviceReady = function() {
navigator.splashscreen.hide();
if (!app.isKeySet(app.config.everlive.apiKey)) {
$(app.config.views.init).hide();
$('#pushApp').addClass('noapikey-scrn').html(app.constants.NO_API_KEY_MESSAGE);
return;
}
fixViewResize();
var os = kendo.support.mobileOS,
statusBarStyle = os.ios && os.flatVersion >= 700 ? 'black-translucent' : 'black';
app.mobile = new kendo.mobile.Application(document.body, {
transition: 'slide',
statusBarStyle: statusBarStyle,
skin: 'flat'
});
};
document.addEventListener('deviceready', onDeviceReady, false);
document.addEventListener('orientationchange', fixViewResize);
}(window));
| Initialize earlier the Everlive instance. | Initialize earlier the Everlive instance. | JavaScript | bsd-2-clause | telerik/backend-services-push-hybrid-advanced,telerik/backend-services-push-hybrid-advanced | ---
+++
@@ -3,6 +3,11 @@
var app = global.app = global.app || {};
+ app.everlive = new Everlive({
+ apiKey: app.config.everlive.apiKey,
+ scheme: app.config.everlive.scheme
+ });
+
var fixViewResize = function () {
if (device.platform === 'iOS') {
@@ -32,11 +37,6 @@
statusBarStyle: statusBarStyle,
skin: 'flat'
});
-
- app.everlive = new Everlive({
- apiKey: app.config.everlive.apiKey,
- scheme: app.config.everlive.scheme
- });
};
document.addEventListener('deviceready', onDeviceReady, false); |
5bae5495c6e2518bb71ada45cc80fc98cbe94623 | Gruntfile.js | Gruntfile.js | 'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//JS Source files
src: {
js: ['app/js/**/*.js']
},
//JS Test files
test: {
karmaConfig: 'test/karma.conf.js',
unit: ['test/unit/**/*.js']
},
// Configure Lint\JSHint Task
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= src.js %>',
'<%= test.unit %>'
]
},
karma: {
unit: {
configFile: '<%= test.karmaConfig %>',
singleRun: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
};
| 'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//JS Source files
src: {
js: ['app/js/**/*.js']
},
//JS Test files
test: {
karmaConfig: 'test/karma.conf.js',
unit: ['test/unit/**/*.js']
},
// Configure Lint\JSHint Task
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= src.js %>',
'<%= test.unit %>'
]
},
karma: {
unit: {
configFile: '<%= test.karmaConfig %>',
singleRun: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
};
| Change tab to 4 instead of 8 | Change tab to 4 instead of 8 | JavaScript | mit | joetravis/angular-grunt-karma-coverage-seed | ---
+++
@@ -39,3 +39,4 @@
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-karma');
};
+ |
a8ed7c84080df374058353ea93f404a203d8a6b7 | js/index.js | js/index.js | /**
* Pulsar
*
* Core UI components that should always be present.
*
* Jadu Ltd.
*/
// Fixes issue with dependencies that expect both $ and jQuery to be set
window.jQuery = window.$ = require('jquery');
// Global UI components
var $ = require('jquery'),
deck = require('./deck'),
dropdown = require('./dropdown'),
modal = require('./modal'),
tab = require('./tab'),
popover = require('./popover'),
tooltip = require('./tooltip'),
clickover = require('../libs/bootstrapx-clickover/js/bootstrapx-clickover'),
svgeezy = require('../libs/svgeezy/svgeezy.min'),
select2 = require('../libs/select2/dist/js/select2.min'),
toggles = require('../libs/jquery-toggles/toggles.min'),
ButtonComponent = require('./ButtonComponent'),
FlashMessageComponent = require('./FlashMessageComponent'),
MasterSwitchComponent = require('./MasterSwitchComponent'),
NavMainComponent = require('./NavMainComponent'),
SignInComponent = require('./area/signin/signin');
module.exports = {
ButtonComponent: ButtonComponent,
FlashMessageComponent: FlashMessageComponent,
MasterSwitchComponent: MasterSwitchComponent,
NavMainComponent: NavMainComponent,
SignInComponent: SignInComponent,
svgeezy: svgeezy
};
| /**
* Pulsar
*
* Core UI components that should always be present.
*
* Jadu Ltd.
*/
// Fixes issue with dependencies that expect both $ and jQuery to be set
window.jQuery = window.$ = require('jquery');
// Global UI components
var $ = require('jquery'),
deck = require('./deck'),
dropdown = require('./dropdown'),
modal = require('./modal'),
tab = require('./tab'),
popover = require('./popover'),
tooltip = require('./tooltip'),
clickover = require('../libs/bootstrapx-clickover/js/bootstrapx-clickover'),
datatables = require('../libs/datatables/media/js/jquery.dataTables.min'),
responsive = require('../libs/datatables-responsive/js/dataTables.responsive'),
svgeezy = require('../libs/svgeezy/svgeezy.min'),
select2 = require('../libs/select2/dist/js/select2.min'),
TableTools = require('../libs/datatables-tabletools/js/dataTables.tableTools'),
toggles = require('../libs/jquery-toggles/toggles.min'),
ButtonComponent = require('./ButtonComponent'),
FlashMessageComponent = require('./FlashMessageComponent'),
MasterSwitchComponent = require('./MasterSwitchComponent'),
NavMainComponent = require('./NavMainComponent'),
SignInComponent = require('./area/signin/signin');
module.exports = {
ButtonComponent: ButtonComponent,
FlashMessageComponent: FlashMessageComponent,
MasterSwitchComponent: MasterSwitchComponent,
NavMainComponent: NavMainComponent,
SignInComponent: SignInComponent,
svgeezy: svgeezy
};
| Add datatable libs to browserify config | Add datatable libs to browserify config
| JavaScript | mit | jadu/pulsar,jadu/pulsar,jadu/pulsar | ---
+++
@@ -10,18 +10,21 @@
window.jQuery = window.$ = require('jquery');
// Global UI components
-var $ = require('jquery'),
- deck = require('./deck'),
- dropdown = require('./dropdown'),
- modal = require('./modal'),
- tab = require('./tab'),
- popover = require('./popover'),
- tooltip = require('./tooltip'),
+var $ = require('jquery'),
+ deck = require('./deck'),
+ dropdown = require('./dropdown'),
+ modal = require('./modal'),
+ tab = require('./tab'),
+ popover = require('./popover'),
+ tooltip = require('./tooltip'),
- clickover = require('../libs/bootstrapx-clickover/js/bootstrapx-clickover'),
- svgeezy = require('../libs/svgeezy/svgeezy.min'),
- select2 = require('../libs/select2/dist/js/select2.min'),
- toggles = require('../libs/jquery-toggles/toggles.min'),
+ clickover = require('../libs/bootstrapx-clickover/js/bootstrapx-clickover'),
+ datatables = require('../libs/datatables/media/js/jquery.dataTables.min'),
+ responsive = require('../libs/datatables-responsive/js/dataTables.responsive'),
+ svgeezy = require('../libs/svgeezy/svgeezy.min'),
+ select2 = require('../libs/select2/dist/js/select2.min'),
+ TableTools = require('../libs/datatables-tabletools/js/dataTables.tableTools'),
+ toggles = require('../libs/jquery-toggles/toggles.min'),
ButtonComponent = require('./ButtonComponent'),
FlashMessageComponent = require('./FlashMessageComponent'), |
57e634af79738c46b25df71a12282763721a072c | js/index.js | js/index.js | module.exports = require('./load-image')
require('./load-image-meta')
require('./load-image-exif')
require('./load-image-exif-map')
require('./load-image-orientation')
| module.exports = require('./load-image')
require('./load-image-scale')
require('./load-image-meta')
require('./load-image-fetch')
require('./load-image-exif')
require('./load-image-exif-map')
require('./load-image-orientation')
| Include the scale and fetch plugins in the module. | Include the scale and fetch plugins in the module.
| JavaScript | mit | blueimp/JavaScript-Load-Image,blueimp/JavaScript-Load-Image | ---
+++
@@ -1,6 +1,8 @@
module.exports = require('./load-image')
+require('./load-image-scale')
require('./load-image-meta')
+require('./load-image-fetch')
require('./load-image-exif')
require('./load-image-exif-map')
require('./load-image-orientation') |
47aefc0b32b1c008fb7cb2798b02cc7571d82380 | test/fixtures/multiTargets/Gruntfile.js | test/fixtures/multiTargets/Gruntfile.js | module.exports = function(grunt) {
'use strict';
grunt.initConfig({
echo: {
one: { message: 'one has changed' },
two: { message: 'two has changed' },
wait: { message: 'I waited 2s', wait: 2000 },
interrupt: { message: 'I was interrupted', wait: 2000 },
},
watch: {
one: {
files: ['lib/one.js'],
tasks: ['echo:one']
},
two: {
files: ['lib/two.js'],
tasks: ['echo:two']
},
wait: {
files: ['lib/wait.js'],
tasks: ['echo:wait']
},
interrupt: {
files: ['lib/interrupt.js'],
tasks: ['echo:interrupt'],
options: { interrupt: true }
}
}
});
// Load the echo task
grunt.loadTasks('../tasks');
// Load this watch task
grunt.loadTasks('../../../tasks');
grunt.registerTask('default', ['echo']);
};
| module.exports = function(grunt) {
'use strict';
grunt.initConfig({
echo: {
one: { message: 'one has changed' },
two: { message: 'two has changed' },
wait: { message: 'I waited 2s', wait: 2000 },
interrupt: { message: 'I was interrupted', wait: 5000 },
},
watch: {
one: {
files: ['lib/one.js'],
tasks: ['echo:one']
},
two: {
files: ['lib/two.js'],
tasks: ['echo:two']
},
wait: {
files: ['lib/wait.js'],
tasks: ['echo:wait']
},
interrupt: {
files: ['lib/interrupt.js'],
tasks: ['echo:interrupt'],
options: { interrupt: true }
}
}
});
// Load the echo task
grunt.loadTasks('../tasks');
// Load this watch task
grunt.loadTasks('../../../tasks');
grunt.registerTask('default', ['echo']);
};
| Increase interrupt test wait time to 5s | Increase interrupt test wait time to 5s
| JavaScript | mit | testcodefresh/grunt-contrib-watch,testsUser/1428079884569,Ariel-Isaacm/grunt-contrib-watch,chemoish/grunt-contrib-watch,mobify/grunt-contrib-watch,Rebzie/grunt-contrib-watch,gruntjs/grunt-contrib-watch,JimRobs/grunt-chokidar,RealSkillorg/1427451101848,testsUser/1428079877839,yuhualingfeng/grunt-contrib-watch,chrisirhc/grunt-incremental,AlexJeng/grunt-contrib-watch,whisklabs/grunt-contrib-watch,testsUser/1428079533661,testsUser/1428079530253,eddiemonge/grunt-contrib-watch | ---
+++
@@ -5,7 +5,7 @@
one: { message: 'one has changed' },
two: { message: 'two has changed' },
wait: { message: 'I waited 2s', wait: 2000 },
- interrupt: { message: 'I was interrupted', wait: 2000 },
+ interrupt: { message: 'I was interrupted', wait: 5000 },
},
watch: {
one: { |
84e9e1957356f730aa78632971cfaa7c1b16eaef | app/scripts/controllers/logachievement.js | app/scripts/controllers/logachievement.js | angular.module('worldOfWorkCraftApp')
.controller('LogAchievementCtrl', function($scope, $routeParams, $location, $http, UserData) {
$scope.challengeName = $routeParams.challengeName;
// TODO replace with real service endpoint
$http.get('http://localhost:8080/worldofworkcraft/learner/'+UserData.username+'/achievements')
.success(function(data) {
$scope.achievements = data;
})
.error(function(data, status) {
console.error('Failed to fetch achievement data');
});
// TODO replace with real service endpoint
$http.get('../achievement-options.json')
.success(function(data) {
$scope.achievementOptions = data;
})
.error(function(data, status) {
console.error('Failed to fetch achievement data');
});
$scope.logAchievement = function(achievement, pointValue) {
// TODO replace with real POST
console.log('Would have posted to achievements');
$http.post('http://localhost:8080/worldofworkcraft/logger', {uniqname:UserData.username, achievementName:achievement, verb:'LEARN'});
$scope.achievements.push({name: achievementName, points: pointValue});
};
$scope.goBack = function() {
$location.path('/leaderboard/' + $scope.challengeName);
}
});
| angular.module('worldOfWorkCraftApp')
.controller('LogAchievementCtrl', function($scope, $routeParams, $location, $http, UserData) {
$scope.challengeName = $routeParams.challengeName;
// TODO replace with real service endpoint
$http.get('http://localhost:8080/worldofworkcraft/learner/'+UserData.username+'/achievements')
.success(function(data) {
$scope.achievements = data;
})
.error(function(data, status) {
console.error('Failed to fetch achievement data');
});
// TODO replace with real service endpoint
$http.get('../achievement-options.json')
.success(function(data) {
$scope.achievementOptions = data;
})
.error(function(data, status) {
console.error('Failed to fetch achievement data');
});
$scope.logAchievement = function(achievement, pointValue) {
// TODO replace with real POST
console.log('Would have posted to achievements with achievement ' + achievement + ' and pointValue ' + pointValue);
$http.post('http://localhost:8080/worldofworkcraft/logger/log', {uniqname:UserData.username, achievementName:achievement, verb:'LEARN'});
$scope.achievements.push({name: achievement, points: pointValue});
};
$scope.goBack = function() {
$location.path('/leaderboard/' + $scope.challengeName);
}
});
| Fix URL for logging achievement to match RequestMapping | Fix URL for logging achievement to match RequestMapping
| JavaScript | mit | StevenACoffman/WorldOfWorkCraft,StevenACoffman/WorldOfWorkCraft | ---
+++
@@ -24,11 +24,11 @@
$scope.logAchievement = function(achievement, pointValue) {
// TODO replace with real POST
- console.log('Would have posted to achievements');
-
- $http.post('http://localhost:8080/worldofworkcraft/logger', {uniqname:UserData.username, achievementName:achievement, verb:'LEARN'});
+ console.log('Would have posted to achievements with achievement ' + achievement + ' and pointValue ' + pointValue);
- $scope.achievements.push({name: achievementName, points: pointValue});
+ $http.post('http://localhost:8080/worldofworkcraft/logger/log', {uniqname:UserData.username, achievementName:achievement, verb:'LEARN'});
+
+ $scope.achievements.push({name: achievement, points: pointValue});
};
$scope.goBack = function() { |
5e92ba10682c5e3419fd21c9f3e57a315c1e1e38 | lib/configuration/hooks/i18n/index.js | lib/configuration/hooks/i18n/index.js | 'use strict';
/**
* Module dependencies
*/
// Node.js core.
const path = require('path');
// Public node modules.
const _ = require('lodash');
/**
* i18n hook
*/
module.exports = function (strapi) {
const hook = {
/**
* Default options
*/
defaults: {
i18n: {
defaultLocale: 'en',
modes: ['query', 'subdomain', 'cookie', 'header', 'url', 'tld'],
cookieName: 'locale'
}
},
/**
* Initialize the hook
*/
initialize: function (cb) {
if (_.isPlainObject(strapi.config.i18n) && !_.isEmpty(strapi.config.i18n)) {
strapi.middlewares.locale(strapi.app);
strapi.app.use(strapi.middlewares.i18n(strapi.app, {
directory: path.resolve(strapi.config.appPath, strapi.config.paths.config, 'locales'),
locales: strapi.config.i18n.locales,
defaultLocale: strapi.config.i18n.defaultLocale,
modes: strapi.config.i18n.modes,
cookieName: strapi.config.i18n.cookieName,
extension: '.json'
}));
}
cb();
}
};
return hook;
};
| 'use strict';
/**
* Module dependencies
*/
// Node.js core.
const path = require('path');
// Public node modules.
const _ = require('lodash');
/**
* i18n hook
*/
module.exports = function (strapi) {
const hook = {
/**
* Default options
*/
defaults: {
i18n: {
defaultLocale: 'en_US',
modes: ['query', 'subdomain', 'cookie', 'header', 'url', 'tld'],
cookieName: 'locale'
}
},
/**
* Initialize the hook
*/
initialize: function (cb) {
if (_.isPlainObject(strapi.config.i18n) && !_.isEmpty(strapi.config.i18n)) {
strapi.middlewares.locale(strapi.app);
strapi.app.use(strapi.middlewares.i18n(strapi.app, {
directory: path.resolve(strapi.config.appPath, strapi.config.paths.config, 'locales'),
locales: strapi.config.i18n.locales,
defaultLocale: strapi.config.i18n.defaultLocale,
modes: strapi.config.i18n.modes,
cookieName: strapi.config.i18n.cookieName,
extension: '.json'
}));
}
cb();
}
};
return hook;
};
| Update hook i18n to consider new locales filename | Update hook i18n to consider new locales filename
| JavaScript | mit | lucusteen/strap,skelpook/strapi,evian42/starpies,lucusteen/strap,skelpook/strapi,wistityhq/strapi,evian42/starpies,evian42/starpies,wistityhq/strapi,skelpook/strapi,lucusteen/strap | ---
+++
@@ -23,7 +23,7 @@
defaults: {
i18n: {
- defaultLocale: 'en',
+ defaultLocale: 'en_US',
modes: ['query', 'subdomain', 'cookie', 'header', 'url', 'tld'],
cookieName: 'locale'
} |
f4f9703afebfcb51bb6a7905b930feef160f41aa | src/utils/file-loader.js | src/utils/file-loader.js | VideoStream.utils.loadFileFromURL = function(file, dir = '.'){
if(!file){
return new Promise(function(resolve){resolve('');});
}
var path = file;
if(file.startsWith('/') == false && file.startsWith(/http(s):\/\/|file:\/\//) == false){
path = dir.endsWith('/') ? dir + file : dir + '/' + file;
}
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(this.readyState == 4){
if(this.status == 200){
resolve(this.responseText);
}
else{
reject(this.status, this);
}
}
};
xhr.onerror = function(){
reject(this.status, this);
};
xhr.open('GET', path, true);
xhr.send();
})
.catch(function(status, xhr){
var errorText = 'Error while loading file! [Status: ' + status + ']';
console.log(errorText);
console.log(xhr);
throw new Error(errorText);
});
} | VideoStream.utils.loadFileFromURL = function(file, dir = '.'){
if(!file){
return new Promise(function(resolve){resolve(null);});
}
var path = file;
if(file.startsWith('/') == false && file.startsWith(/http(s):\/\/|file:\/\//) == false){
path = dir.endsWith('/') ? dir + file : dir + '/' + file;
}
return new Promise(function(resolve, reject){
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(){
if(this.readyState == 4){
if(this.status == 200){
resolve(this.responseText);
}
else{
reject(this.status, this);
}
}
};
xhr.onerror = function(){
reject(this.status, this);
};
xhr.open('GET', path, true);
xhr.send();
})
.catch(function(status, xhr){
var errorText = 'Error while loading file! [Status: ' + status + ']';
console.log(errorText);
console.log(xhr);
throw new Error(errorText);
});
} | Change return type on empty arguments | Change return type on empty arguments | JavaScript | apache-2.0 | 2b2/video-stream.js | ---
+++
@@ -1,6 +1,6 @@
VideoStream.utils.loadFileFromURL = function(file, dir = '.'){
if(!file){
- return new Promise(function(resolve){resolve('');});
+ return new Promise(function(resolve){resolve(null);});
}
var path = file;
if(file.startsWith('/') == false && file.startsWith(/http(s):\/\/|file:\/\//) == false){ |
a08e21fb52b0c46b8b90221719fb54c56f06d317 | tests/unit/mixins/service-cache-test.js | tests/unit/mixins/service-cache-test.js | import Ember from 'ember';
import ServiceCacheMixin from '../../../mixins/service-cache';
import { module, test } from 'qunit';
module('Unit | Mixin | service cache');
// Replace this with your real tests.
test('it works', function(assert) {
var ServiceCacheObject = Ember.Object.extend(ServiceCacheMixin);
var subject = ServiceCacheObject.create();
assert.ok(subject);
});
QUnit.skip('#initCache', function(assert) {});
QUnit.skip('#cacheResource', function(assert) {});
QUnit.skip('#cacheMeta', function(assert) {});
QUnit.skip('#cacheData', function(assert) {});
| import Ember from 'ember';
import ServiceCacheMixin from '../../../mixins/service-cache';
import { module, test } from 'qunit';
import { Post } from 'dummy/tests/helpers/resources';
let sandbox, subject;
module('Unit | Mixin | service cache', {
beforeEach() {
sandbox = window.sinon.sandbox.create();
let ServiceCacheObject = Ember.Object.extend(ServiceCacheMixin);
subject = ServiceCacheObject.create();
},
afterEach() {
sandbox.restore();
}
});
test('#initCache', function(assert) {
assert.ok(subject.cache, 'cache property setup');
assert.equal(subject.cache.meta, null, 'cache meta property setup as null');
assert.ok(Array.isArray(subject.cache.data.get('content')), 'cache data property setup as Array');
});
test('#cacheResource calls #cacheMeta and #cacheData', function(assert) {
sandbox.stub(subject, 'cacheMeta', function () { return; });
sandbox.stub(subject, 'cacheData', function () { return; });
let resource = {};
subject.cacheResource(resource);
assert.ok(subject.cacheMeta.calledOnce, 'cacheMeta called');
assert.ok(subject.cacheMeta.calledWith(resource), 'cacheMeta called with resource');
assert.ok(subject.cacheData.calledWith(resource), 'cacheData called with resource');
assert.ok(subject.cacheData.calledOnce, 'cacheData called');
});
test('#cacheMeta', function(assert) {
let resource = { meta: { total: 5 } };
subject.cacheMeta(resource);
assert.equal(subject.get('cache.meta'), resource.meta, 'meta object set on cache.meta');
});
test('#cacheData stores a single resource', function(assert) {
let resource = Post.create({ id: '1' });
subject.cacheData({ data: resource });
assert.equal(subject.get('cache.data').get('firstObject'), resource, 'resource added to cache.data collection');
});
test('#cacheData stores a collection of resources', function(assert) {
let resourceA = Post.create({ id: '1' });
let resourceB = Post.create({ id: '2' });
subject.cacheData({ data: Ember.A([resourceA, resourceB]) });
assert.equal(subject.get('cache.data').get('firstObject'), resourceA, 'resourceA added to cache.data collection');
assert.equal(subject.get('cache.data').get('lastObject'), resourceB, 'resourceA added to cache.data collection');
});
| Add unit tests for service cache mixin | Add unit tests for service cache mixin
| JavaScript | mit | Rahien/ember-jsonapi-resources,pixelhandler/ember-jsonapi-resources,kmkamruzzaman/ember-jsonapi-resources,greyhwndz/ember-jsonapi-resources,proteamer/ember-jsonapi-resources,rwjblue/ember-jsonapi-resources,Rahien/ember-jsonapi-resources,greyhwndz/ember-jsonapi-resources,proteamer/ember-jsonapi-resources,pixelhandler/ember-jsonapi-resources,oliverbarnes/ember-jsonapi-resources,rwjblue/ember-jsonapi-resources,kmkamruzzaman/ember-jsonapi-resources,oliverbarnes/ember-jsonapi-resources | ---
+++
@@ -1,20 +1,54 @@
import Ember from 'ember';
import ServiceCacheMixin from '../../../mixins/service-cache';
import { module, test } from 'qunit';
+import { Post } from 'dummy/tests/helpers/resources';
-module('Unit | Mixin | service cache');
+let sandbox, subject;
-// Replace this with your real tests.
-test('it works', function(assert) {
- var ServiceCacheObject = Ember.Object.extend(ServiceCacheMixin);
- var subject = ServiceCacheObject.create();
- assert.ok(subject);
+module('Unit | Mixin | service cache', {
+ beforeEach() {
+ sandbox = window.sinon.sandbox.create();
+ let ServiceCacheObject = Ember.Object.extend(ServiceCacheMixin);
+ subject = ServiceCacheObject.create();
+ },
+ afterEach() {
+ sandbox.restore();
+ }
});
-QUnit.skip('#initCache', function(assert) {});
+test('#initCache', function(assert) {
+ assert.ok(subject.cache, 'cache property setup');
+ assert.equal(subject.cache.meta, null, 'cache meta property setup as null');
+ assert.ok(Array.isArray(subject.cache.data.get('content')), 'cache data property setup as Array');
+});
-QUnit.skip('#cacheResource', function(assert) {});
+test('#cacheResource calls #cacheMeta and #cacheData', function(assert) {
+ sandbox.stub(subject, 'cacheMeta', function () { return; });
+ sandbox.stub(subject, 'cacheData', function () { return; });
+ let resource = {};
+ subject.cacheResource(resource);
+ assert.ok(subject.cacheMeta.calledOnce, 'cacheMeta called');
+ assert.ok(subject.cacheMeta.calledWith(resource), 'cacheMeta called with resource');
+ assert.ok(subject.cacheData.calledWith(resource), 'cacheData called with resource');
+ assert.ok(subject.cacheData.calledOnce, 'cacheData called');
+});
-QUnit.skip('#cacheMeta', function(assert) {});
+test('#cacheMeta', function(assert) {
+ let resource = { meta: { total: 5 } };
+ subject.cacheMeta(resource);
+ assert.equal(subject.get('cache.meta'), resource.meta, 'meta object set on cache.meta');
+});
-QUnit.skip('#cacheData', function(assert) {});
+test('#cacheData stores a single resource', function(assert) {
+ let resource = Post.create({ id: '1' });
+ subject.cacheData({ data: resource });
+ assert.equal(subject.get('cache.data').get('firstObject'), resource, 'resource added to cache.data collection');
+});
+
+test('#cacheData stores a collection of resources', function(assert) {
+ let resourceA = Post.create({ id: '1' });
+ let resourceB = Post.create({ id: '2' });
+ subject.cacheData({ data: Ember.A([resourceA, resourceB]) });
+ assert.equal(subject.get('cache.data').get('firstObject'), resourceA, 'resourceA added to cache.data collection');
+ assert.equal(subject.get('cache.data').get('lastObject'), resourceB, 'resourceA added to cache.data collection');
+}); |
41c4f7f557aa24983a6367a715bdfcc3f4e7ff78 | test.js | test.js | 'use strict';
var test = require('ava');
var githubRepos = require('./');
test('user with more than 100 repos', function (t) {
t.plan(2);
var token = '523ef691191741c99d5afbcfe58079bfa0038771';
githubRepos('kevva', {token: token}, function (err, data) {
t.assert(!err, err);
t.assert(data.length, data.length);
});
});
test('user with lower than 100 repos', function (t) {
t.plan(2);
var token = '523ef691191741c99d5afbcfe58079bfa0038771';
githubRepos('octocat', {token: token}, function (err, data) {
t.assert(!err, err);
t.assert(data.length, data.length);
});
});
| 'use strict';
var test = require('ava');
var githubRepos = require('./');
test('user with more than 100 repos', function (t) {
t.plan(2);
var token = '523ef691191741c99d5afbcfe58079bfa0038771';
githubRepos('kevva', {token: token}, function (err, data) {
t.assert(!err, err);
t.assert(data.length, data.length);
});
});
test('user with lower than 100 repos', function (t) {
t.plan(2);
var token = '523ef691191741c99d5afbcfe58079bfa0038771';
githubRepos('octocat', {token: token}, function (err, data) {
t.assert(!err, err);
t.assert(data.length, data.length);
});
});
test('two requests should return same data', function (t) {
t.plan(5);
var token = '523ef691191741c99d5afbcfe58079bfa0038771';
githubRepos('octocat', {token: token}, function (err, data1) {
t.assert(!err, err);
t.assert(data1.length, data1.length);
githubRepos('octocat', {token: token}, function (err, data2) {
t.assert(!err, err);
t.assert(data2.length, data2.length);
t.assert(data1.length === data2.length);
});
});
});
| Test two subsequent requests get the same data | Test two subsequent requests get the same data
| JavaScript | mit | forivall/github-repositories,kevva/github-repositories | ---
+++
@@ -22,3 +22,18 @@
t.assert(data.length, data.length);
});
});
+
+test('two requests should return same data', function (t) {
+ t.plan(5);
+ var token = '523ef691191741c99d5afbcfe58079bfa0038771';
+
+ githubRepos('octocat', {token: token}, function (err, data1) {
+ t.assert(!err, err);
+ t.assert(data1.length, data1.length);
+ githubRepos('octocat', {token: token}, function (err, data2) {
+ t.assert(!err, err);
+ t.assert(data2.length, data2.length);
+ t.assert(data1.length === data2.length);
+ });
+ });
+}); |
dec57486ad76b180f7bd4c1e4541d046677addcf | src/projects/ll-links.js | src/projects/ll-links.js | import { inject, bindable, bindingMode } from 'aurelia-framework';
import { EventAggregator } from 'aurelia-event-aggregator';
@inject(EventAggregator)
export class LlLinks {
@bindable({ defaultBindingMode: bindingMode.twoWay }) source;
constructor(eventAggregator) {
this.ea = eventAggregator;
this.link = {};
}
attached() {
if (this.source && !this.source.links) {
this.source.links = [];
}
}
save() {
if (this.link.url != '' && this.link.display_name != '') {
this.source.links.push(this.link);
this.ea.publish('projectUpdated', {source: 'links'});
this.add = false;
this.link = {};
}
}
remove(index) {
this.source.links.splice(index, 1);
this.ea.publish('projectUpdated', {source: 'links'});
}
cancel() {
this.add = false;
this.link = {};
}
}
| import { inject, bindable, bindingMode } from 'aurelia-framework';
import { EventAggregator } from 'aurelia-event-aggregator';
@inject(EventAggregator)
export class LlLinks {
@bindable({ defaultBindingMode: bindingMode.twoWay }) source;
constructor(eventAggregator) {
this.ea = eventAggregator;
this.link = {};
}
sourceChanged() {
if (this.source && !this.source.links) {
this.source.links = [];
}
}
save() {
if (this.link.url != '' && this.link.display_name != '') {
this.source.links.push(this.link);
this.ea.publish('projectUpdated', {source: 'links'});
this.add = false;
this.link = {};
}
}
remove(index) {
this.source.links.splice(index, 1);
this.ea.publish('projectUpdated', {source: 'links'});
}
cancel() {
this.add = false;
this.link = {};
}
}
| Fix links on project not saved because of failed init | Fix links on project not saved because of failed init
| JavaScript | mit | GETLIMS/LIMS-Frontend,GETLIMS/LIMS-Frontend | ---
+++
@@ -10,7 +10,7 @@
this.link = {};
}
- attached() {
+ sourceChanged() {
if (this.source && !this.source.links) {
this.source.links = [];
} |
86222918e01b9ab91b8a14c2c8990857b944f953 | src/routes/case/utils.js | src/routes/case/utils.js | /* @flow */
const CONSUMER = 'Consumer';
const NON_CONSUMER = 'Non Consumer';
const days = (date: number) => date / 1000 / 60 / 60 / 24;
const ConsumerParty = {
type: 'Consumer',
name: 'Consumer',
};
function partyType(initiatingParty: ?string) {
switch (initiatingParty) {
case 'Non Consumer':
case 'Business':
return NON_CONSUMER;
case 'Consumer':
case 'Employee':
case 'Home Owner':
return CONSUMER;
case 'Unknown':
default:
return null;
}
}
export {
CONSUMER,
NON_CONSUMER,
ConsumerParty,
days,
partyType,
};
| /* @flow */
const CONSUMER = 'Consumer';
const NON_CONSUMER = 'Non Consumer';
const days = (date: number) => Math.floor(date / 1000 / 60 / 60 / 24);
const ConsumerParty = {
type: 'Consumer',
name: 'Consumer',
};
function partyType(initiatingParty: ?string) {
switch (initiatingParty) {
case 'Non Consumer':
case 'Business':
return NON_CONSUMER;
case 'Consumer':
case 'Employee':
case 'Home Owner':
return CONSUMER;
case 'Unknown':
default:
return null;
}
}
export {
CONSUMER,
NON_CONSUMER,
ConsumerParty,
days,
partyType,
};
| Fix date display on case | Fix date display on case
| JavaScript | mit | LevelPlayingField/levelplayingfield,LevelPlayingField/levelplayingfield | ---
+++
@@ -2,7 +2,7 @@
const CONSUMER = 'Consumer';
const NON_CONSUMER = 'Non Consumer';
-const days = (date: number) => date / 1000 / 60 / 60 / 24;
+const days = (date: number) => Math.floor(date / 1000 / 60 / 60 / 24);
const ConsumerParty = {
type: 'Consumer', |
264e9a53b02f983f2131123eb02a2c17b37bf3b8 | lib/plugin/theme/renderable/renderable.js | lib/plugin/theme/renderable/renderable.js | "use strict";
const merge = require('../../../util/merge');
const {coroutine: co} = require('bluebird');
class Renderable {
constructor(data) {
this.parent = undefined;
this.data = data || {};
this.id = this.constructor.id;
this.name = this.constructor.name;
this.templateFile = this.constructor.templateFile;
this.variables = this.constructor.variables;
}
commit() {
return this.templateFunction(this.data);
}
templateFunction() {
return this.constructor.templateFunction(this.data);
}
getTopmostParent() {
return this.parent ? this.parent.getTopmostParent() : this;
}
init(context, data={}) {
this.context = context;
this.data = merge(this.data, data);
return Promise.resolve();
}
static compileTemplate(variables, code, boilerplate) {
code = ('%>' + code + '<%')
.replace(/(<%=)(([^%]|%(?!>))*)(%>)/g, (...args) => `<% templateOut += (${args[2]});\n%>`)
.replace(/(%>)(([^<]|<(?!%))*)(<%)/g, (...args) => `templateOut += ${JSON.stringify(args[2])};\n`);
boilerplate = boilerplate || '';
return new Function(`"use strict";
return function({${variables.join()}}) {
let templateOut = '';
${boilerplate}
${code}
return templateOut;
};`)();
}
}
module.exports = Renderable;
| "use strict";
const merge = require('../../../util/merge');
const {coroutine: co} = require('bluebird');
class Renderable {
constructor(data) {
this.parent = undefined;
this.data = data || {};
this.id = this.constructor.id;
this.name = (data && data.name) ? data.name : this.constructor.name;
this.templateFile = this.constructor.templateFile;
this.variables = this.constructor.variables;
}
commit() {
return this.templateFunction(this.data);
}
templateFunction() {
return this.constructor.templateFunction(this.data);
}
getTopmostParent() {
return this.parent ? this.parent.getTopmostParent() : this;
}
init(context, data={}) {
this.context = context;
this.data = merge(this.data, data);
return Promise.resolve();
}
static compileTemplate(variables, code, boilerplate) {
code = ('%>' + code + '<%')
.replace(/(<%=)(([^%]|%(?!>))*)(%>)/g, (...args) => `<% templateOut += (${args[2]});\n%>`)
.replace(/(%>)(([^<]|<(?!%))*)(<%)/g, (...args) => `templateOut += ${JSON.stringify(args[2])};\n`);
boilerplate = boilerplate || '';
return new Function(`"use strict";
return function({${variables.join()}}) {
let templateOut = '';
${boilerplate}
${code}
return templateOut;
};`)();
}
}
module.exports = Renderable;
| Allow Renderable name to be included in initialization data | Allow Renderable name to be included in initialization data
| JavaScript | mit | coreyp1/defiant,coreyp1/defiant | ---
+++
@@ -8,7 +8,7 @@
this.parent = undefined;
this.data = data || {};
this.id = this.constructor.id;
- this.name = this.constructor.name;
+ this.name = (data && data.name) ? data.name : this.constructor.name;
this.templateFile = this.constructor.templateFile;
this.variables = this.constructor.variables;
} |
4cdab30201d079b0b7112c14ec56615e94155692 | tasks/prepare-package.js | tasks/prepare-package.js | const fs = require('fs');
const path = require('path');
const pkg = require('../package.json');
const buildDir = path.resolve(__dirname, '../build/ol');
// update the version number in util.js
const utilPath = path.join(buildDir, 'util.js');
const versionRegEx = /const VERSION = '(.*)';/g;
const utilSrc = fs.readFileSync(utilPath, 'utf-8').replace(versionRegEx, `const VERSION = '${pkg.version}';`);
fs.writeFileSync(utilPath, utilSrc, 'utf-8');
// write out simplified package.json
delete pkg.scripts;
delete pkg.devDependencies;
delete pkg.style;
delete pkg.eslintConfig;
delete pkg.private;
fs.writeFileSync(path.join(buildDir, 'package.json'), JSON.stringify(pkg, null, 2), 'utf-8');
| const fs = require('fs');
const path = require('path');
const pkg = require('../package.json');
const buildDir = path.resolve(__dirname, '../build/ol');
// update the version number in util.js
const utilPath = path.join(buildDir, 'util.js');
const versionRegEx = /var VERSION = '(.*)';/g;
const utilSrc = fs.readFileSync(utilPath, 'utf-8').replace(versionRegEx, `var VERSION = '${pkg.version}';`);
fs.writeFileSync(utilPath, utilSrc, 'utf-8');
// write out simplified package.json
delete pkg.scripts;
delete pkg.devDependencies;
delete pkg.style;
delete pkg.eslintConfig;
delete pkg.private;
fs.writeFileSync(path.join(buildDir, 'package.json'), JSON.stringify(pkg, null, 2), 'utf-8');
| Replace VERSION correctly in transpiled code | Replace VERSION correctly in transpiled code
| JavaScript | bsd-2-clause | geekdenz/openlayers,ahocevar/openlayers,stweil/ol3,adube/ol3,mzur/ol3,oterral/ol3,tschaub/ol3,ahocevar/openlayers,bjornharrtell/ol3,fredj/ol3,geekdenz/ol3,geekdenz/openlayers,stweil/openlayers,ahocevar/ol3,oterral/ol3,fredj/ol3,mzur/ol3,tschaub/ol3,oterral/ol3,openlayers/openlayers,stweil/openlayers,tschaub/ol3,geekdenz/openlayers,fredj/ol3,stweil/ol3,ahocevar/ol3,stweil/ol3,bjornharrtell/ol3,geekdenz/ol3,geekdenz/ol3,fredj/ol3,openlayers/openlayers,adube/ol3,geekdenz/ol3,ahocevar/ol3,mzur/ol3,bjornharrtell/ol3,openlayers/openlayers,tschaub/ol3,stweil/openlayers,ahocevar/openlayers,ahocevar/ol3,adube/ol3,mzur/ol3,stweil/ol3 | ---
+++
@@ -6,8 +6,8 @@
// update the version number in util.js
const utilPath = path.join(buildDir, 'util.js');
-const versionRegEx = /const VERSION = '(.*)';/g;
-const utilSrc = fs.readFileSync(utilPath, 'utf-8').replace(versionRegEx, `const VERSION = '${pkg.version}';`);
+const versionRegEx = /var VERSION = '(.*)';/g;
+const utilSrc = fs.readFileSync(utilPath, 'utf-8').replace(versionRegEx, `var VERSION = '${pkg.version}';`);
fs.writeFileSync(utilPath, utilSrc, 'utf-8');
// write out simplified package.json |
8c12936d9664b80716344c8f7e389cf2efcefeb7 | frontend/src/components/chat/navigation/DeleteAccountForm.js | frontend/src/components/chat/navigation/DeleteAccountForm.js | import React, { Component } from 'react';
import {Button} from 'react-bootstrap';
class DeleteAccountForm extends Component {
constructor(props) {
super(props);
this.state = {
displayDeleteAccountMessage: false
};
}
handleDeleteAccountButton = () => {
this.setState({displayDeleteAccountMessage: true});
}
handleDeleteAccountConfirmation = () => {
console.log('Account deleted');
}
handleDeleteAccountChangemind = () => {
this.setState({displayDeleteAccountMessage: false});
}
render() {
return (
<div>
<Button
type="submit"
bsStyle="danger"
id="delete-account"
onClick={this.handleDeleteAccountButton}
>
Delete account
</Button>
{this.state.displayDeleteAccountMessage ? <div className="delete-account-confirmation"><b>We hate to see you leaving. Are you sure? <a onClick={this.handleDeleteAccountConfirmation}>Yes</a> <a onClick={this.handleDeleteAccountChangemind}>No</a></b></div> : null}
</div>
);
}
}
export default DeleteAccountForm;
| import React, { Component } from 'react';
import {Button} from 'react-bootstrap';
import * as config from '../../config';
import axios from 'axios';
axios.defaults.withCredentials = true;
class DeleteAccountForm extends Component {
constructor(props) {
super(props);
this.state = {
displayDeleteAccountMessage: false
};
}
handleDeleteAccountButton = () => {
this.setState({displayDeleteAccountMessage: true});
}
static get contextTypes() {
return {
router: React.PropTypes.object.isRequired,
};
}
handleDeleteAccountConfirmation = () => {
axios.delete(config.backendUrl + '/delete_user')
.then(res => {
this.context.router.history.push('/');
})
.catch(error => {
console.log(error);
})
}
handleDeleteAccountChangemind = () => {
this.setState({displayDeleteAccountMessage: false});
}
render() {
return (
<div>
<Button
type="submit"
bsStyle="danger"
id="delete-account"
onClick={this.handleDeleteAccountButton}
>
Delete account
</Button>
{this.state.displayDeleteAccountMessage ? <div className="delete-account-confirmation"><b>We hate to see you leaving. Are you sure? <a onClick={this.handleDeleteAccountConfirmation}>Yes</a> <a onClick={this.handleDeleteAccountChangemind}>No</a></b></div> : null}
</div>
);
}
}
export default DeleteAccountForm;
| Call backend view on delete account frontend | Call backend view on delete account frontend
| JavaScript | mit | dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet | ---
+++
@@ -1,5 +1,9 @@
import React, { Component } from 'react';
import {Button} from 'react-bootstrap';
+import * as config from '../../config';
+
+import axios from 'axios';
+axios.defaults.withCredentials = true;
class DeleteAccountForm extends Component {
constructor(props) {
@@ -13,8 +17,20 @@
this.setState({displayDeleteAccountMessage: true});
}
+ static get contextTypes() {
+ return {
+ router: React.PropTypes.object.isRequired,
+ };
+ }
+
handleDeleteAccountConfirmation = () => {
- console.log('Account deleted');
+ axios.delete(config.backendUrl + '/delete_user')
+ .then(res => {
+ this.context.router.history.push('/');
+ })
+ .catch(error => {
+ console.log(error);
+ })
}
handleDeleteAccountChangemind = () => { |
27e999ba0fce125acc05c651ffe27811e639360a | static/js/services/dialogs.js | static/js/services/dialogs.js | /*
* Spreed WebRTC.
* Copyright (C) 2013-2014 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(["angular"], function(angular) {
// dialogs
return ["$window", "$modal", "$templateCache", "translation", function($window, $modal, $templateCache, translation) {
return {
create: function(url, controller, data, opts) {
return $modal.open({
templateUrl: url,
controller: controller,
keyboard : opts.kb,
backdrop : opts.bd,
windowClass: opts.wc,
size: opts.ws,
resolve: {
data: function() {
return data;
}
}
});
}
}
}];
}); | /*
* Spreed WebRTC.
* Copyright (C) 2013-2014 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(["angular"], function(angular) {
// dialogs
return ["$window", "$modal", "$templateCache", "translation", function($window, $modal, $templateCache, translation) {
return {
create: function(url, controller, data, opts) {
return $modal.open({
templateUrl: url,
controller: controller,
keyboard : opts.kb === undefined ? true : opts.kb,
backdrop : opts.bd === undefined ? true : opts.bd,
windowClass: opts.wc,
size: opts.ws,
resolve: {
data: function() {
return data;
}
}
});
}
}
}];
});
| Update dialog service to use defaults of angular ui-bootstrap. | Update dialog service to use defaults of angular ui-bootstrap.
| JavaScript | agpl-3.0 | tymiles003/spreed-webrtc,fancycode/spreed-webrtc,gerzhan/spreed-webrtc,theurere/spreed-webrtc,shelsonjava/spreed-webrtc,fancycode/spreed-webrtc,gerzhan/spreed-webrtc,gerzhan/spreed-webrtc,tymiles003/spreed-webrtc,shelsonjava/spreed-webrtc,gerzhan/spreed-webrtc,shelsonjava/spreed-webrtc,gerzhan/spreed-webrtc,shelsonjava/spreed-webrtc,strukturag/spreed-webrtc,strukturag/spreed-webrtc,tymiles003/spreed-webrtc,tymiles003/spreed-webrtc,fancycode/spreed-webrtc,shelsonjava/spreed-webrtc,strukturag/spreed-webrtc,theurere/spreed-webrtc,gerzhan/spreed-webrtc,theurere/spreed-webrtc,theurere/spreed-webrtc,strukturag/spreed-webrtc,fancycode/spreed-webrtc,shelsonjava/spreed-webrtc,shelsonjava/spreed-webrtc,fancycode/spreed-webrtc,theurere/spreed-webrtc,strukturag/spreed-webrtc,theurere/spreed-webrtc,tymiles003/spreed-webrtc,fancycode/spreed-webrtc,gerzhan/spreed-webrtc,strukturag/spreed-webrtc | ---
+++
@@ -30,8 +30,8 @@
return $modal.open({
templateUrl: url,
controller: controller,
- keyboard : opts.kb,
- backdrop : opts.bd,
+ keyboard : opts.kb === undefined ? true : opts.kb,
+ backdrop : opts.bd === undefined ? true : opts.bd,
windowClass: opts.wc,
size: opts.ws,
resolve: { |
aaaa6b05c25c3cd7c24d54bfbf906ee77f109f90 | spec/process-tree.spec.js | spec/process-tree.spec.js | // Copyright (c) 2017 The Regents of the University of Michigan.
// All Rights Reserved. Licensed according to the terms of the Revised
// BSD License. See LICENSE.txt for details.
const processTree = require("../lib/process-tree");
let treeSpy = function(logTree, runningProcess) {
let spy = { };
spy.tree = logTree;
spy.process = runningProcess;
spy.messages = [ ];
spy.log = function(message) {
spy.messages.push(message)
};
return spy;
};
let spy;
let spyOnTree = function(done, setup) {
processTree(treeSpy, setup).then(logger => {
spy = logger;
done();
});
};
describe("a processTree with no children", () => {
beforeEach(done => {
spyOnTree(done, function(o) { });
});
it("returns a spy", () => {
expect(spy.tree).toBeDefined();
});
});
| // Copyright (c) 2017 The Regents of the University of Michigan.
// All Rights Reserved. Licensed according to the terms of the Revised
// BSD License. See LICENSE.txt for details.
const processTree = require("../lib/process-tree");
let treeSpy = function(logTree, runningProcess) {
let spy = { };
spy.tree = logTree;
spy.process = runningProcess;
spy.messages = [ ];
spy.log = function(message) {
spy.messages.push(message)
};
return spy;
};
let spy;
let spyOnTree = async function(done, setup) {
spy = await processTree(treeSpy, setup)
done();
};
describe("a processTree with no children", () => {
beforeEach(done => {
spyOnTree(done, function(o) { });
});
it("returns a spy", () => {
expect(spy.tree).toBeDefined();
});
});
| Use async/await instead of Promise().then | :art: Use async/await instead of Promise().then
| JavaScript | bsd-3-clause | daaang/awful-mess | ---
+++
@@ -19,11 +19,9 @@
};
let spy;
-let spyOnTree = function(done, setup) {
- processTree(treeSpy, setup).then(logger => {
- spy = logger;
- done();
- });
+let spyOnTree = async function(done, setup) {
+ spy = await processTree(treeSpy, setup)
+ done();
};
describe("a processTree with no children", () => { |
da007b0590fb4540bc1c8b5d32a140ef57ccf720 | lib/IntersectionParams.js | lib/IntersectionParams.js | /**
*
* IntersectionParams.js
*
* copyright 2002, Kevin Lindsey
*
*/
/**
* IntersectionParams
*
* @param {String} name
* @param {Array<Point2D} params
* @returns {IntersectionParams}
*/
function IntersectionParams(name, params) {
this.init(name, params);
}
/**
* init
*
* @param {String} name
* @param {Array<Point2D>} params
*/
IntersectionParams.prototype.init = function(name, params) {
this.name = name;
this.params = params;
};
if (typeof module !== "undefined") {
module.exports = IntersectionParams;
} | /**
*
* IntersectionParams.js
*
* copyright 2002, Kevin Lindsey
*
*/
/**
* IntersectionParams
*
* @param {String} name
* @param {Array<Point2D} params
* @returns {IntersectionParams}
*/
function IntersectionParams(name, params) {
this.init(name, params);
}
!function () {
IntersectionParams.TYPE = {};
var t = IntersectionParams.TYPE;
var d = Object.defineProperty;
d(t, 'LINE', { value: 'Line' });
d(t, 'RECT', { value: 'Rectangle' });
d(t, 'ROUNDRECT', { value: 'RoundRectangle' });
d(t, 'CIRCLE', { value: 'Circle' });
d(t, 'ELLIPSE', { value: 'Ellipse' });
d(t, 'POLYGON', { value: 'Polygon' });
d(t, 'POLYLINE', { value: 'Polyline' });
d(t, 'PATH', { value: 'Path' });
d(t, 'ARC', { value: 'Arc' });
d(t, 'BEZIER2', { value: 'Bezier2' });
d(t, 'BEZIER3', { value: 'Bezier3' });
}();
/**
* init
*
* @param {String} name
* @param {Array<Point2D>} params
*/
IntersectionParams.prototype.init = function(name, params) {
this.name = name;
this.params = params;
};
if (typeof module !== "undefined") {
module.exports = IntersectionParams;
} | Make IntersectionPrams standard type strings available as constants. | Make IntersectionPrams standard type strings available as constants.
| JavaScript | bsd-3-clause | Quazistax/kld-intersections,effektif/svg-intersections | ---
+++
@@ -17,6 +17,24 @@
this.init(name, params);
}
+!function () {
+ IntersectionParams.TYPE = {};
+ var t = IntersectionParams.TYPE;
+ var d = Object.defineProperty;
+
+ d(t, 'LINE', { value: 'Line' });
+ d(t, 'RECT', { value: 'Rectangle' });
+ d(t, 'ROUNDRECT', { value: 'RoundRectangle' });
+ d(t, 'CIRCLE', { value: 'Circle' });
+ d(t, 'ELLIPSE', { value: 'Ellipse' });
+ d(t, 'POLYGON', { value: 'Polygon' });
+ d(t, 'POLYLINE', { value: 'Polyline' });
+ d(t, 'PATH', { value: 'Path' });
+ d(t, 'ARC', { value: 'Arc' });
+ d(t, 'BEZIER2', { value: 'Bezier2' });
+ d(t, 'BEZIER3', { value: 'Bezier3' });
+}();
+
/**
* init
* |
7c2a06e6f1d47874b9e394aec4383f5c3a066ab4 | public/src/core/track-network.js | public/src/core/track-network.js | /*
@autor: Robin Giles Ribera
* Module: TrackNetwork
* Used on trackevent.js
*/
define( [], function() {
console.log("[TrackNetwork][***###***]");
function TrackNetwork() {
this.drawLine = function() {
console.log("[DrawLine][***###***]");
var canvasElem = document.getElementById("tracks-container-canvas");
if (!canvasElem) return;
var ctx = canvasElem.getContext("2d");
var lines = [];
ctx.fillStyle="#fff";
//Clear the background
ctx.width = ctx.width;
for(var i in lines) {
//Draw each line in the draw buffer
ctx.beginPath();
ctx.lineWidth = 3;//Math.floor((1+Math.random() * 10));
ctx.strokeStyle = lines[i].color;
ctx.moveTo(lines[i].start.x, lines[i].start.y);
ctx.lineTo(lines[i].end.x, lines[i].end.y);
ctx.stroke();
}
}
}
return TrackNetwork;
}) | /*
@autor: Robin Giles Ribera
* Module: TrackNetwork
* Used on trackevent.js
*/
define( [], function() {
function TrackNetwork() {
//Adds a line in the drawing loop of the background canvas
this.addLine = function(start_x, start_y, end_x, end_y, color) {
lines.push({
start:{
x: start_x,
y: start_y
},
end:{
x: end_x,
y: end_y
},
'color': color?color:"#"+("000"+(Math.random()*(1<<24)|0).toString(16)).substr(-6)
});
}
this.drawLine = function() {
console.log("[DrawLine][***###***]");
var canvasElem = document.getElementById("tracks-container-canvas");
if (!canvasElem) return;
var ctx = canvasElem.getContext("2d");
var lines = [];
console.log("[DrawLine][***getContext OK***]");
ctx.fillStyle="#fff";
//Clear the background
ctx.width = ctx.width;
for(var i in lines) {
//Draw each line in the draw buffer
ctx.beginPath();
ctx.lineWidth = 3;//Math.floor((1+Math.random() * 10));
ctx.strokeStyle = lines[i].color;
ctx.moveTo(lines[i].start.x, lines[i].start.y);
ctx.lineTo(lines[i].end.x, lines[i].end.y);
ctx.stroke();
}
}
}
return TrackNetwork;
}) | Add method 'AddLine' to the Module TrackNetwork | Add method 'AddLine' to the Module TrackNetwork
| JavaScript | mit | robinparadise/videoquizmaker,robinparadise/videoquizmaker | ---
+++
@@ -5,9 +5,23 @@
*/
define( [], function() {
- console.log("[TrackNetwork][***###***]");
function TrackNetwork() {
+
+ //Adds a line in the drawing loop of the background canvas
+ this.addLine = function(start_x, start_y, end_x, end_y, color) {
+ lines.push({
+ start:{
+ x: start_x,
+ y: start_y
+ },
+ end:{
+ x: end_x,
+ y: end_y
+ },
+ 'color': color?color:"#"+("000"+(Math.random()*(1<<24)|0).toString(16)).substr(-6)
+ });
+ }
this.drawLine = function() {
console.log("[DrawLine][***###***]");
@@ -16,6 +30,8 @@
var ctx = canvasElem.getContext("2d");
var lines = [];
+
+ console.log("[DrawLine][***getContext OK***]");
ctx.fillStyle="#fff";
//Clear the background |
cfdc132456e7269377974206939bc0d094f0848b | test/e2e/pages/invite.js | test/e2e/pages/invite.js | 'use strict';
var Chance = require('chance'),
chance = new Chance();
class InvitePage {
constructor () {
this.titleEl = element(by.css('.project-title'));
this.message = chance.sentence();
this.AddPeopleBtn = element(by.css('.invite-button'));
this.inviteBtn = element(by.css('[ng-click="inviteUsers()"]'));
}
get () {
browser.wait(protractor.ExpectedConditions.visibilityOf(this.AddPeopleBtn));
this.AddPeopleBtn.click();
}
invite (who) {
this.inputInvite = element(by.css('.selectize-input input'));
this.inviteOption = () => element(by.css('.create[data-selectable], .cachedOption[data-selectable]'));
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inputInvite));
this.inputInvite.click();
this.inputInvite.sendKeys(who);
browser.wait(protractor.ExpectedConditions.presenceOf(this.inviteOption));
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteOption));
this.inviteOption().click();
this.focusedInvite = element(by.css('.selectize-input input:focus'));
// to blur input in email invite case.
this.inputInvite.sendKeys(protractor.Key.TAB);
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteBtn));
return this.inviteBtn.click();
}
}
module.exports = InvitePage;
| 'use strict';
var Chance = require('chance'),
chance = new Chance();
class InvitePage {
constructor () {
this.titleEl = element(by.css('.project-title'));
this.message = chance.sentence();
this.AddPeopleBtn = element(by.css('.invite-button'));
this.inviteBtn = element(by.css('[ng-click="inviteUsers()"]'));
}
get () {
browser.wait(protractor.ExpectedConditions.visibilityOf(this.AddPeopleBtn));
this.AddPeopleBtn.click();
}
invite (who) {
this.inputInvite = element(by.css('.selectize-input input'));
this.inviteOption = () => element(by.css('.create[data-selectable], .cachedOption[data-selectable]'));
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inputInvite));
this.inputInvite.click();
this.inputInvite.sendKeys(who);
browser.wait(protractor.ExpectedConditions.presenceOf(this.inviteOption()));
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteOption()));
this.inviteOption().click();
this.focusedInvite = element(by.css('.selectize-input input:focus'));
// to blur input in email invite case.
this.inputInvite.sendKeys(protractor.Key.TAB);
browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteBtn));
return this.inviteBtn.click();
}
}
module.exports = InvitePage;
| Add missing function calls in tests | Add missing function calls in tests
| JavaScript | agpl-3.0 | Grasia/teem,P2Pvalue/teem,P2Pvalue/teem,P2Pvalue/pear2pear,Grasia/teem,Grasia/teem,P2Pvalue/teem,P2Pvalue/pear2pear | ---
+++
@@ -35,9 +35,9 @@
this.inputInvite.sendKeys(who);
- browser.wait(protractor.ExpectedConditions.presenceOf(this.inviteOption));
+ browser.wait(protractor.ExpectedConditions.presenceOf(this.inviteOption()));
- browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteOption));
+ browser.wait(protractor.ExpectedConditions.visibilityOf(this.inviteOption()));
this.inviteOption().click();
|
8bda805d45b23c5c46988acf2d27863b0ed4092a | test/git-diff-archive.js | test/git-diff-archive.js | "use strict";
const assert = require("power-assert");
const rimraf = require("rimraf");
const unzip = require("unzip");
const gitDiffArchive = require("../");
const ID1 = "";
const ID2 = "";
const OUTPUT_DIR = `${__dirname}/tmp`;
const OUTPUT_PATH = `${OUTPUT_DIR}/output.zip`;
describe("git-diff-archive", () => {
after(() => {
rimraf.sync(OUTPUT_DIR);
});
it("should be chained promise", () => {
// TODO
assert(false);
});
});
| "use strict";
const fs = require("fs");
const path = require("path");
const assert = require("power-assert");
const glob = require("glob");
const rimraf = require("rimraf");
const unzip = require("unzip");
const gitDiffArchive = require("../");
const ID1 = "b148b54";
const ID2 = "acd6e6d";
const EMPTY_ID1 = "f74c8e2";
const EMPTY_ID2 = "574443a";
const OUTPUT_DIR = `${__dirname}/tmp`;
const OUTPUT_PATH = `${OUTPUT_DIR}/output.zip`;
describe("git-diff-archive", () => {
after(() => {
rimraf.sync(OUTPUT_DIR);
});
it("should be chained promise", (done) => {
gitDiffArchive(ID1, ID2, {output: OUTPUT_PATH})
.then((res) => {
assert(true);
done();
});
});
it("should be cathcing error", (done) => {
gitDiffArchive(EMPTY_ID1, EMPTY_ID2, {output: OUTPUT_PATH})
.catch((err) => {
assert(true);
done();
});
});
it("should be created diff zip", (done) => {
gitDiffArchive(ID1, ID2, {output: OUTPUT_PATH})
.then((res) => {
const stat = fs.statSync(OUTPUT_PATH);
assert(stat.isFile() === true);
fs.createReadStream(OUTPUT_PATH)
.pipe(unzip.Extract(({path: OUTPUT_DIR})))
.on("close", () => {
const files = glob.sync(`${OUTPUT_DIR}/**/*`, {nodir: true, dot: true});
assert(files.length === 7);
assert(files.indexOf(OUTPUT_PATH) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/.eslintrc`) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/LICENSE`) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/README.md`) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/bin/cmd.js`) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/bin/usage.txt`) > -1);
assert(files.indexOf(`${OUTPUT_DIR}/files/package.json`) > -1);
done();
});
});
});
});
| Add promise & create zip tests | Add promise & create zip tests
| JavaScript | mit | tsuyoshiwada/git-diff-archive | ---
+++
@@ -1,12 +1,17 @@
"use strict";
+const fs = require("fs");
+const path = require("path");
const assert = require("power-assert");
+const glob = require("glob");
const rimraf = require("rimraf");
const unzip = require("unzip");
const gitDiffArchive = require("../");
-const ID1 = "";
-const ID2 = "";
+const ID1 = "b148b54";
+const ID2 = "acd6e6d";
+const EMPTY_ID1 = "f74c8e2";
+const EMPTY_ID2 = "574443a";
const OUTPUT_DIR = `${__dirname}/tmp`;
const OUTPUT_PATH = `${OUTPUT_DIR}/output.zip`;
@@ -15,8 +20,42 @@
rimraf.sync(OUTPUT_DIR);
});
- it("should be chained promise", () => {
- // TODO
- assert(false);
+ it("should be chained promise", (done) => {
+ gitDiffArchive(ID1, ID2, {output: OUTPUT_PATH})
+ .then((res) => {
+ assert(true);
+ done();
+ });
+ });
+
+ it("should be cathcing error", (done) => {
+ gitDiffArchive(EMPTY_ID1, EMPTY_ID2, {output: OUTPUT_PATH})
+ .catch((err) => {
+ assert(true);
+ done();
+ });
+ });
+
+ it("should be created diff zip", (done) => {
+ gitDiffArchive(ID1, ID2, {output: OUTPUT_PATH})
+ .then((res) => {
+ const stat = fs.statSync(OUTPUT_PATH);
+ assert(stat.isFile() === true);
+
+ fs.createReadStream(OUTPUT_PATH)
+ .pipe(unzip.Extract(({path: OUTPUT_DIR})))
+ .on("close", () => {
+ const files = glob.sync(`${OUTPUT_DIR}/**/*`, {nodir: true, dot: true});
+ assert(files.length === 7);
+ assert(files.indexOf(OUTPUT_PATH) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/.eslintrc`) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/LICENSE`) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/README.md`) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/bin/cmd.js`) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/bin/usage.txt`) > -1);
+ assert(files.indexOf(`${OUTPUT_DIR}/files/package.json`) > -1);
+ done();
+ });
+ });
});
}); |
de2fb2c260720ae3142066f2a3b611b7ba922af6 | spec/specs.js | spec/specs.js | describe('pingPong', function() {
it("is true for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal(true);
});
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
it("is false for a number that is not divisible by 3 or 5", function() {
expect(pingPong(8)).to.equal(false);
});
});
| describe('pingPong', function() {
it("returns ping for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal("ping");
});
it("returns pong for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal("pong");
});
it("returns ping pong for a number that is divisible by 3 and 5", function() {
expect(pingPong(30)).to.equal("ping pong")
});
it("is false for a number that is not divisible by 3 or 5", function() {
expect(pingPong(8)).to.equal(false);
});
});
| Change spec test according to new javascript test code | Change spec test according to new javascript test code
| JavaScript | mit | kcmdouglas/pingpong,kcmdouglas/pingpong | ---
+++
@@ -1,9 +1,12 @@
describe('pingPong', function() {
- it("is true for a number that is divisible by 3", function() {
- expect(pingPong(6)).to.equal(true);
+ it("returns ping for a number that is divisible by 3", function() {
+ expect(pingPong(6)).to.equal("ping");
});
- it("is true for a number that is divisible by 5", function() {
- expect(pingPong(10)).to.equal(true);
+ it("returns pong for a number that is divisible by 5", function() {
+ expect(pingPong(10)).to.equal("pong");
+ });
+ it("returns ping pong for a number that is divisible by 3 and 5", function() {
+ expect(pingPong(30)).to.equal("ping pong")
});
it("is false for a number that is not divisible by 3 or 5", function() {
expect(pingPong(8)).to.equal(false); |
cc345fd8262974e3cc192c71199c6555d06bb161 | examples/2DScrolling/2DScrolling.js | examples/2DScrolling/2DScrolling.js | var scrollingExample = {
box: {
id: "clip",
className: "clip",
children: {
id: "image",
className: "image"
}
},
constraints: [
"clip.left == 0",
"clip.top == 0",
"clip.right == 300",
"clip.bottom == 300",
// Specify the bounds of the image and hint its position.
"image.right == image.left + 800 !strong",
"image.bottom == image.top + 800 !strong",
"image.left == 0",// !weak",
"image.top == 0",// !weak"
],
motionConstraints: [
// Ensure that the image stays within the clip with springs.
// XXX: We can't yet express motion constraints relative to other linear variables.
[ "image.left", "<=", 0 ],//"clip.left" ],
[ "image.top", "<=", 0 ],//"clip.top" ],
[ "image.bottom", ">=", 300],//"clip.bottom" ],
[ "image.right", ">=", 300]//"clip.right" ],
],
manipulators: [
{ box: "clip", x: "image.left", y: "image.top" }
]
}
Slalom.Serialization.assemble(scrollingExample, document.body);
| var scrollingExample = {
box: {
id: "clip",
className: "clip",
children: {
id: "image",
className: "image"
}
},
constraints: [
"clip.left == 0",
"clip.top == 0",
"clip.right == 300",
"clip.bottom == 300",
// Specify the bounds of the image and hint its position.
"image.right == image.left + 800 !strong",
"image.bottom == image.top + 800 !strong",
"image.left == 0 !weak",
"image.top == 0 !weak"
],
motionConstraints: [
// Ensure that the image stays within the clip with springs.
// XXX: We can't yet express motion constraints relative to other linear variables.
[ "image.left", "<=", 0 ],//"clip.left" ],
[ "image.top", "<=", 0 ],//"clip.top" ],
[ "image.bottom", ">=", 300],//"clip.bottom" ],
[ "image.right", ">=", 300]//"clip.right" ],
],
manipulators: [
{ box: "clip", x: "image.left", y: "image.top" }
]
}
Slalom.Serialization.assemble(scrollingExample, document.body);
| Clean up weak initial position constraints. | Clean up weak initial position constraints.
| JavaScript | apache-2.0 | iamralpht/slalom,iamralpht/slalom,iamralpht/slalom | ---
+++
@@ -15,8 +15,8 @@
// Specify the bounds of the image and hint its position.
"image.right == image.left + 800 !strong",
"image.bottom == image.top + 800 !strong",
- "image.left == 0",// !weak",
- "image.top == 0",// !weak"
+ "image.left == 0 !weak",
+ "image.top == 0 !weak"
],
motionConstraints: [
// Ensure that the image stays within the clip with springs. |
4d39b6e4e1334d571e8e03823740a7b5f8ebf218 | routes/questionRoute.js | routes/questionRoute.js | var QuestionCtrl = require('../controllers/questionCtrl.js');
module.exports = function(express, app){
var router = express.Router();
router.post('/', QuestionCtrl.create);
router.get('/', QuestionCtrl.get);
router.put('/status', QuestionCtrl.set);
app.use('/questions', router);
};
| var QuestionCtrl = require('../controllers/questionCtrl.js');
module.exports = function(express, app) {
var router = express.Router();
router.post('/', QuestionCtrl.create);
router.get('/', QuestionCtrl.get);
router.post('/status', QuestionCtrl.set);
app.use('/questions', router);
};
| Use post over put for the status change api | Use post over put for the status change api
| JavaScript | mit | EasyAce-Edu/easyace-api | ---
+++
@@ -1,12 +1,12 @@
var QuestionCtrl = require('../controllers/questionCtrl.js');
-module.exports = function(express, app){
+module.exports = function(express, app) {
var router = express.Router();
router.post('/', QuestionCtrl.create);
router.get('/', QuestionCtrl.get);
- router.put('/status', QuestionCtrl.set);
+ router.post('/status', QuestionCtrl.set);
app.use('/questions', router);
}; |
edb127f1c41dfb84bcb367cf4076cb25bda52727 | tests/specs/math.test.js | tests/specs/math.test.js | define(['base'], function (base) { "use strict";
var math = base.math;
describe("math", function () {
it(".factorial()", function () {
expect(typeof math.factorial).toBe('function');
[[0,1], [1,1], [2,2], [3,6], [4,24], [5,120], [6,720]].forEach(function (test) {
expect(math.factorial(test[0])).toBe(test[1]);
});
expect(math.factorial(-1)).toBeNaN();
}); // factorial().
}); //// describe math.
}); | define(['base'], function (base) { "use strict";
var math = base.math;
describe("math", function () {
it(".clamp()", function () {
expect(typeof math.clamp).toBe('function');
for (var i = -2; i < 5; ++i) {
for (var min = -2; min < 3; ++min) {
for (var max = min + 1; max < 4; ++max) {
var clamped = math.clamp(i, min, max);
expect(clamped).not.toBeLessThan(min);
expect(clamped).not.toBeGreaterThan(max);
}
}
}
}); // clamp().
it(".sign()", function () {
expect(typeof math.sign).toBe('function');
for (var i = -3; i < 4; ++i) {
expect(math.sign(i)).toBe(i < 0 ? -1 : i > 0 ? +1 : 0);
}
expect(math.sign(-Infinity)).toBe(-1);
expect(math.sign(+Infinity)).toBe(+1);
expect(math.sign(NaN)).toBeNaN();
expect(math.sign('a')).toBeNaN();
}); // sign().
it(".factorial()", function () {
expect(typeof math.factorial).toBe('function');
[[0,1], [1,1], [2,2], [3,6], [4,24], [5,120], [6,720]].forEach(function (test) {
expect(math.factorial(test[0])).toBe(test[1]);
});
expect(math.factorial(-1)).toBeNaN();
}); // factorial().
}); //// describe math.
}); | Test cases for math.sign() and math.clamp() | Test cases for math.sign() and math.clamp()
| JavaScript | mit | LeonardoVal/creatartis-base,LeonardoVal/creatartis-base | ---
+++
@@ -2,6 +2,30 @@
var math = base.math;
describe("math", function () {
+ it(".clamp()", function () {
+ expect(typeof math.clamp).toBe('function');
+ for (var i = -2; i < 5; ++i) {
+ for (var min = -2; min < 3; ++min) {
+ for (var max = min + 1; max < 4; ++max) {
+ var clamped = math.clamp(i, min, max);
+ expect(clamped).not.toBeLessThan(min);
+ expect(clamped).not.toBeGreaterThan(max);
+ }
+ }
+ }
+ }); // clamp().
+
+ it(".sign()", function () {
+ expect(typeof math.sign).toBe('function');
+ for (var i = -3; i < 4; ++i) {
+ expect(math.sign(i)).toBe(i < 0 ? -1 : i > 0 ? +1 : 0);
+ }
+ expect(math.sign(-Infinity)).toBe(-1);
+ expect(math.sign(+Infinity)).toBe(+1);
+ expect(math.sign(NaN)).toBeNaN();
+ expect(math.sign('a')).toBeNaN();
+ }); // sign().
+
it(".factorial()", function () {
expect(typeof math.factorial).toBe('function');
[[0,1], [1,1], [2,2], [3,6], [4,24], [5,120], [6,720]].forEach(function (test) {
@@ -10,5 +34,7 @@
expect(math.factorial(-1)).toBeNaN();
}); // factorial().
+
+
}); //// describe math.
}); |
1999ff53d63ec55759b6ccb9109904a467585aa9 | src/adapters/cli/serve.js | src/adapters/cli/serve.js | #!/usr/bin/env node
/* @flow */
import { serve } from 'aspect/src/adapters/server'
async function run(): Promise<void> {
const server = await serve({
port: 'PORT' in process.env ? Number(process.env.PORT) : null
})
console.log(`Running server at http://127.0.0.1:${server.port}`)
}
run()
| #!/usr/bin/env node
/* @flow */
import { serve } from 'aspect/src/adapters/server'
import { parseEnv, optional } from 'env'
async function run(): Promise<void> {
const config = parseEnv({
PORT: optional(Number)
})
const server = await serve({
port: config.PORT
})
console.log(`Running server at http://127.0.0.1:${server.port}`)
}
run()
| Use env library to parse config out of environment | Use env library to parse config out of environment
| JavaScript | mit | vinsonchuong/aspect,vinsonchuong/aspect | ---
+++
@@ -1,10 +1,15 @@
#!/usr/bin/env node
/* @flow */
import { serve } from 'aspect/src/adapters/server'
+import { parseEnv, optional } from 'env'
async function run(): Promise<void> {
+ const config = parseEnv({
+ PORT: optional(Number)
+ })
+
const server = await serve({
- port: 'PORT' in process.env ? Number(process.env.PORT) : null
+ port: config.PORT
})
console.log(`Running server at http://127.0.0.1:${server.port}`)
} |
7ffa7a9528767ff915e1179e7e6dd7eec66e5afc | utils/slimer-script.js | utils/slimer-script.js | /*global slimer */
var webpage = require("webpage").create();
var messages = [];
var system = require("system");
var args = system.args;
var url = args[1] || "";
var thumbPath = args[2] || "";
webpage.onConsoleMessage = function(message, line, file) {
console.log(message);
};
webpage.onError = function(message) {
console.log(message);
};
webpage
.open(url)
.then(function() {
webpage.viewportSize = { width: 400, height: 300 };
webpage.reload();
setTimeout(function() {
webpage.render(thumbPath, { onlyViewport: true });
webpage.close();
slimer.exit();
}, 500);
});
| /*global slimer */
var webpage = require("webpage").create();
var messages = [];
var system = require("system");
var args = system.args;
var url = args[1] || "";
var thumbPath = args[2] || "";
webpage.onConsoleMessage = function(message, line, file) {
console.log(message);
};
webpage.onError = function(message) {
console.log(message);
};
webpage
.open(url)
.then(function() {
webpage.viewportSize = { width: 400, height: 300 };
webpage.reload();
setTimeout(function() {
webpage.evaluate(function () {
var info = document.querySelector('#info');
//info.innerHTML = 'dupa';
info.parentNode.removeChild(info);
});
}, 100);
setTimeout(function() {
webpage.render(thumbPath, { onlyViewport: true });
webpage.close();
slimer.exit();
}, 200);
});
| Remove example info text before rendering | Remove example info text before rendering | JavaScript | mit | variablestudio/pex-examples,pex-gl/pex-examples | ---
+++
@@ -24,9 +24,18 @@
webpage.reload();
setTimeout(function() {
+ webpage.evaluate(function () {
+ var info = document.querySelector('#info');
+ //info.innerHTML = 'dupa';
+ info.parentNode.removeChild(info);
+ });
+ }, 100);
+
+
+ setTimeout(function() {
webpage.render(thumbPath, { onlyViewport: true });
webpage.close();
slimer.exit();
- }, 500);
+ }, 200);
}); |
af100fdb60b7d5bce620249be4a6370d345071e1 | packages/standard-minifier-css/package.js | packages/standard-minifier-css/package.js | Package.describe({
name: 'standard-minifier-css',
version: '1.3.3-beta.1',
summary: 'Standard css minifier used with Meteor apps by default.',
documentation: 'README.md'
});
Package.registerBuildPlugin({
name: "minifyStdCSS",
use: [
'minifier-css@1.2.14'
],
npmDependencies: {
"source-map": "0.5.6",
"lru-cache": "4.0.1"
},
sources: [
'plugin/minify-css.js'
]
});
Package.onUse(function(api) {
api.use('isobuild:minifier-plugin@1.0.0');
});
| Package.describe({
name: 'standard-minifier-css',
version: '1.3.3',
summary: 'Standard css minifier used with Meteor apps by default.',
documentation: 'README.md'
});
Package.registerBuildPlugin({
name: "minifyStdCSS",
use: [
'minifier-css@1.2.14'
],
npmDependencies: {
"source-map": "0.5.6",
"lru-cache": "4.0.1"
},
sources: [
'plugin/minify-css.js'
]
});
Package.onUse(function(api) {
api.use('isobuild:minifier-plugin@1.0.0');
});
| Remove -beta.n suffix from standard-minifier-css before republishing. | Remove -beta.n suffix from standard-minifier-css before republishing.
| JavaScript | mit | Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor,Hansoft/meteor | ---
+++
@@ -1,6 +1,6 @@
Package.describe({
name: 'standard-minifier-css',
- version: '1.3.3-beta.1',
+ version: '1.3.3',
summary: 'Standard css minifier used with Meteor apps by default.',
documentation: 'README.md'
}); |
7b02cbde4f8e6118597e940cbc332251a86199b9 | demos/demos.js | demos/demos.js | // Demo components.
import "./src/CalendarDayMoonPhase.js";
import "./src/CarouselComboBox.js";
import "./src/CountryListBox.js";
import "./src/CustomCarousel2.js";
import "./src/CustomDrawer.js";
import "./src/FocusVisibleTest.js";
import "./src/LabeledColorSwatch.js";
import "./src/LocaleSelector.js";
import "./src/MessageListBox.js";
import "./src/MessageSummary.js";
import "./src/ModesWithKeyboard.js";
import "./src/PurpleSpinBox.js";
import "./src/RefreshAppDemo.js";
import "./src/RomanSpinBox.js";
import "./src/SampleDialog.js";
import "./src/serene/SereneTabs.js";
import "./src/SingleSelectionDemo.js";
import "./src/SlidingPagesWithArrows.js";
import "./src/SwipeDemo.js";
import "./src/ToolbarTab.js";
import "./src/UnitsSpinBox.js";
// We assume we'll want to provide demos of all of Elix itself.
import "../define/elix.js";
| // Demo components.
import "./src/CalendarDayMoonPhase.js";
import "./src/CarouselComboBox.js";
import "./src/CountryListBox.js";
import "./src/CustomCarousel2.js";
import "./src/CustomDrawer.js";
import "./src/LabeledColorSwatch.js";
import "./src/LocaleSelector.js";
import "./src/MessageListBox.js";
import "./src/MessageSummary.js";
import "./src/ModesWithKeyboard.js";
import "./src/PurpleSpinBox.js";
import "./src/RefreshAppDemo.js";
import "./src/RomanSpinBox.js";
import "./src/SampleDialog.js";
import "./src/serene/SereneTabs.js";
import "./src/SingleSelectionDemo.js";
import "./src/SlidingPagesWithArrows.js";
import "./src/SwipeDemo.js";
import "./src/ToolbarTab.js";
import "./src/UnitsSpinBox.js";
// We assume we'll want to provide demos of all of Elix itself.
import "../define/elix.js";
| Remove reference to old demo. | Remove reference to old demo.
| JavaScript | mit | JanMiksovsky/elix,elix/elix,JanMiksovsky/elix,elix/elix | ---
+++
@@ -4,7 +4,6 @@
import "./src/CountryListBox.js";
import "./src/CustomCarousel2.js";
import "./src/CustomDrawer.js";
-import "./src/FocusVisibleTest.js";
import "./src/LabeledColorSwatch.js";
import "./src/LocaleSelector.js";
import "./src/MessageListBox.js"; |
9cea73194d1274f475fae552ba1cf2ac7a2a4ded | dist/store_watch_mixin.js | dist/store_watch_mixin.js |
var StoreWatchMixin = function(stores, options) {
if (!options) options = {};
options.addListenerFnName = options.addListenerFnName || 'addChangeListener';
options.removeListenerFnName = options.removeListenerFnName || 'removeChangeListener';
options.handlerName = options.handlerName || 'onStoreChange';
return {
componentDidMount: function() {
if (!this[options.handlerName]) {
console.log("WARNING: The handler required for the store listener was not found.");
}
stores.forEach(function(store) {
store[options.addListenerFnName](this[options.handlerName]);
}, this);
},
componentWillUnmount: function() {
stores.forEach(function(store) {
store[options.removeListenerFnName](this[options.handlerName]);
}, this);
}
};
}
module.exports = StoreWatchMixin;
|
var StoreWatchMixin = function(stores, options) {
if (!options) options = {};
options.addListenerFnName = options.addListenerFnName || 'addChangeListener';
options.removeListenerFnName = options.removeListenerFnName || 'removeChangeListener';
options.handlerName = options.handlerName || 'onStoreChange';
return {
componentDidMount: function() {
if (!this[options.handlerName]) {
throw new Error("Handler not found on the view. " +
"Handler with name: [" + options.handlerName + "] expected to be defined on the view.");
}
stores.forEach(function(store) {
store[options.addListenerFnName](this[options.handlerName]);
}, this);
},
componentWillUnmount: function() {
stores.forEach(function(store) {
store[options.removeListenerFnName](this[options.handlerName]);
}, this);
}
};
}
module.exports = StoreWatchMixin;
| Throw instead of warning when the handler is not declared | Throw instead of warning when the handler is not declared
| JavaScript | mit | rafaelchiti/flux-commons-store-watch-mixin | ---
+++
@@ -9,7 +9,8 @@
return {
componentDidMount: function() {
if (!this[options.handlerName]) {
- console.log("WARNING: The handler required for the store listener was not found.");
+ throw new Error("Handler not found on the view. " +
+ "Handler with name: [" + options.handlerName + "] expected to be defined on the view.");
}
stores.forEach(function(store) { |
da316224e7a440d30c944a0ecd17e65e1d7528d9 | api/image.js | api/image.js | var http = require('http');
var request = require('request').defaults({ encoding: null });
var url = require('url');
var h = {
'Referer': null,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
};
function error (response) {
response.writeHead(404);
response.end();
return;
}
http.createServer(function (req, res) {
var img = url.parse(req.url, true).query.img;
if (!img || img === "N/A") {
error(res);
return;
}
request.get({ url: img, headers: h }, function (err, response, body) {
if (response === undefined || response.statusCode !== 200) {
error(res);
return;
} else {
var i = new Buffer(body);
res.writeHead(200, {
'Content-Type': 'image/jpeg',
'Access-Control-Allow-Origin': 'http://localhost:8000' // This need fixing on localhost..
});
res.end('data:image/jpeg;base64,' + body.toString('base64'));
}
});
}).listen(3020);
| var http = require('http');
var request = require('request').defaults({ encoding: null });
var headers = {
'Referer': null,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
};
var result;
function error (response) {
response.writeHead(404);
response.end();
return;
}
http.createServer(function (req, res) {
var API = 'http://www.omdbapi.com';
var url = API + req.url + '&plot=full';
var start = new Date().getTime();
// Get the omdb data
request.get({ url: url }, function (err, omdbResponse, omdbData) {
if (!err && omdbResponse.statusCode === 200) {
// Assign the result to the omdb api data
result = JSON.parse(omdbData.toString());
// Make another request, to the imdb image
request.get({ url: result.Poster, headers: headers }, function (err, imdbResponse, imdbData) {
if (!err && imdbResponse.statusCode === 200) {
// Base64 encode the poster
result.Poster = 'data:image/jpeg;base64,' + imdbData.toString('base64');
// Set response header to 200 and content type to JSON
res.writeHead(200, {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': 'http://localhost:8000' // This need fixing on localhost..
});
var end = new Date().getTime();
// Set the time to ms execution time
result.time = end - start;
// End the request
res.end(JSON.stringify(result));
}
});
}
});
}).listen(3020);
| Update API to do -all- the logic | Update API to do -all- the logic
| JavaScript | mit | jillesme/ng-movies | ---
+++
@@ -1,11 +1,12 @@
var http = require('http');
var request = require('request').defaults({ encoding: null });
-var url = require('url');
-var h = {
+var headers = {
'Referer': null,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
};
+
+var result;
function error (response) {
response.writeHead(404);
@@ -14,26 +15,37 @@
}
http.createServer(function (req, res) {
- var img = url.parse(req.url, true).query.img;
+ var API = 'http://www.omdbapi.com';
+ var url = API + req.url + '&plot=full';
+ var start = new Date().getTime();
- if (!img || img === "N/A") {
- error(res);
- return;
+ // Get the omdb data
+ request.get({ url: url }, function (err, omdbResponse, omdbData) {
+
+ if (!err && omdbResponse.statusCode === 200) {
+ // Assign the result to the omdb api data
+ result = JSON.parse(omdbData.toString());
+
+ // Make another request, to the imdb image
+ request.get({ url: result.Poster, headers: headers }, function (err, imdbResponse, imdbData) {
+
+ if (!err && imdbResponse.statusCode === 200) {
+ // Base64 encode the poster
+ result.Poster = 'data:image/jpeg;base64,' + imdbData.toString('base64');
+ // Set response header to 200 and content type to JSON
+ res.writeHead(200, {
+ 'Content-Type': 'application/json',
+ 'Access-Control-Allow-Origin': 'http://localhost:8000' // This need fixing on localhost..
+ });
+
+ var end = new Date().getTime();
+ // Set the time to ms execution time
+ result.time = end - start;
+ // End the request
+ res.end(JSON.stringify(result));
+ }
+ });
}
-
- request.get({ url: img, headers: h }, function (err, response, body) {
-
- if (response === undefined || response.statusCode !== 200) {
- error(res);
- return;
- } else {
- var i = new Buffer(body);
- res.writeHead(200, {
- 'Content-Type': 'image/jpeg',
- 'Access-Control-Allow-Origin': 'http://localhost:8000' // This need fixing on localhost..
- });
- res.end('data:image/jpeg;base64,' + body.toString('base64'));
- }
- });
+ });
}).listen(3020); |
9c1345b65035216149de35a8959fd6d086c65d44 | website/static/js/pages/profile-page.js | website/static/js/pages/profile-page.js | /**
* Initialization code for the profile page. Currently, this just loads the necessary
* modules and puts the profile module on the global context.
*
*/
var $ = require('jquery');
var m = require('mithril');
require('../project.js'); // Needed for nodelists to work
require('../components/logFeed.js'); // Needed for nodelists to work
var profile = require('../profile.js'); // Social, Job, Education classes
var publicNodes = require('../components/publicNodes.js');
var quickFiles = require('../components/quickFiles.js');
var ctx = window.contextVars;
// Instantiate all the profile modules
new profile.Social('#social', ctx.socialUrls, ['view'], false);
new profile.Jobs('#jobs', ctx.jobsUrls, ['view'], false);
new profile.Schools('#schools', ctx.schoolsUrls, ['view'], false);
$(document).ready(function () {
m.mount(document.getElementById('publicProjects'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'projects'}));
m.mount(document.getElementById('publicComponents'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'components'}));
m.mount(document.getElementById('quickFiles'), m.component(quickFiles.QuickFiles, {user: ctx.user}));
});
| /**
* Initialization code for the profile page. Currently, this just loads the necessary
* modules and puts the profile module on the global context.
*
*/
var $ = require('jquery');
var m = require('mithril');
require('../project.js'); // Needed for nodelists to work
require('../components/logFeed.js'); // Needed for nodelists to work
var profile = require('../profile.js'); // Social, Job, Education classes
var publicNodes = require('../components/publicNodes.js');
var quickFiles = require('../components/quickFiles.js');
var ctx = window.contextVars;
// Instantiate all the profile modules
new profile.Social('#social', ctx.socialUrls, ['view'], false);
new profile.Jobs('#jobs', ctx.jobsUrls, ['view'], false);
new profile.Schools('#schools', ctx.schoolsUrls, ['view'], false);
$(document).ready(function () {
m.mount(document.getElementById('publicProjects'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'projects'}));
m.mount(document.getElementById('publicComponents'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'components'}));
if(ctx.user.has_quickfiles) {
m.mount(document.getElementById('quickFiles'), m.component(quickFiles.QuickFiles, {user: ctx.user}));
}
});
| Stop mounting quickfiles if no quickfiles | Stop mounting quickfiles if no quickfiles
| JavaScript | apache-2.0 | TomBaxter/osf.io,icereval/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,Johnetordoff/osf.io,TomBaxter/osf.io,cslzchen/osf.io,caseyrollins/osf.io,crcresearch/osf.io,HalcyonChimera/osf.io,baylee-d/osf.io,binoculars/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,felliott/osf.io,aaxelb/osf.io,erinspace/osf.io,sloria/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,binoculars/osf.io,crcresearch/osf.io,CenterForOpenScience/osf.io,Johnetordoff/osf.io,crcresearch/osf.io,mattclark/osf.io,Johnetordoff/osf.io,icereval/osf.io,felliott/osf.io,cslzchen/osf.io,erinspace/osf.io,aaxelb/osf.io,felliott/osf.io,mfraezz/osf.io,brianjgeiger/osf.io,caseyrollins/osf.io,adlius/osf.io,leb2dg/osf.io,pattisdr/osf.io,baylee-d/osf.io,chennan47/osf.io,adlius/osf.io,pattisdr/osf.io,saradbowman/osf.io,CenterForOpenScience/osf.io,aaxelb/osf.io,binoculars/osf.io,laurenrevere/osf.io,CenterForOpenScience/osf.io,TomBaxter/osf.io,brianjgeiger/osf.io,sloria/osf.io,saradbowman/osf.io,brianjgeiger/osf.io,leb2dg/osf.io,laurenrevere/osf.io,caseyrollins/osf.io,chennan47/osf.io,leb2dg/osf.io,HalcyonChimera/osf.io,felliott/osf.io,HalcyonChimera/osf.io,cslzchen/osf.io,mfraezz/osf.io,cslzchen/osf.io,laurenrevere/osf.io,erinspace/osf.io,HalcyonChimera/osf.io,leb2dg/osf.io,pattisdr/osf.io,icereval/osf.io,mattclark/osf.io,chennan47/osf.io,mfraezz/osf.io,adlius/osf.io,mattclark/osf.io,sloria/osf.io | ---
+++
@@ -21,6 +21,8 @@
$(document).ready(function () {
m.mount(document.getElementById('publicProjects'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'projects'}));
m.mount(document.getElementById('publicComponents'), m.component(publicNodes.PublicNodes, {user: ctx.user, nodeType: 'components'}));
- m.mount(document.getElementById('quickFiles'), m.component(quickFiles.QuickFiles, {user: ctx.user}));
+ if(ctx.user.has_quickfiles) {
+ m.mount(document.getElementById('quickFiles'), m.component(quickFiles.QuickFiles, {user: ctx.user}));
+ }
});
|
66db7e0c65a87a3b5a613b39b0cb9fc093e67609 | client/controllers/marketing/marketing.js | client/controllers/marketing/marketing.js | MarketingController = RouteController.extend({
waitOn: function () {
return Meteor.subscribe('marketing');
},
action: function () {
var indexPage = Pages.findOne();
if (indexPage) {
Router.go('pages.show', { _id: indexPage.slug || indexPage._id });
} else {
this.render();
}
}
});
| MarketingController = RouteController.extend({
waitOn: function () {
return Meteor.subscribe('marketing');
},
action: function () {
var indexPage = Pages.findOne({ type: 'INDEX' });
if (indexPage) {
Router.go('pages.show', { _id: indexPage.slug || indexPage._id });
} else {
this.render();
}
}
});
| Add constrain type index for home page | Add constrain type index for home page
| JavaScript | mit | bojicas/letterhead,bojicas/letterhead | ---
+++
@@ -4,7 +4,7 @@
},
action: function () {
- var indexPage = Pages.findOne();
+ var indexPage = Pages.findOne({ type: 'INDEX' });
if (indexPage) {
Router.go('pages.show', { _id: indexPage.slug || indexPage._id });
} else { |
8a13fac752a4eb37f7b28a7baa938b5228bb9d6b | webpack.config.react-responsive-select.js | webpack.config.react-responsive-select.js | const nodeExternals = require('webpack-node-externals');
const path = require('path');
const entry = './src/ReactResponsiveSelect.js';
const library = 'ReactResponsiveSelect';
const module = {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: path.resolve(__dirname, 'node_modules')
}]
};
module.exports = [{
entry,
module,
output: {
filename: './dist/ReactResponsiveSelect.js',
libraryTarget: 'umd',
library
},
externals: [ nodeExternals({ whitelist: ['prop-types'] }) ]
}, {
entry,
module,
output: {
filename: './dist/ReactResponsiveSelect.window.js',
libraryTarget: 'window',
library
},
externals: { react: 'React' }
}, {
entry,
module,
output: {
filename: './dist/ReactResponsiveSelect.var.js',
libraryTarget: 'var',
library
},
externals: { react: 'React' }
}];
| const nodeExternals = require('webpack-node-externals');
const path = require('path');
const entry = './src/ReactResponsiveSelect.js';
const library = 'ReactResponsiveSelect';
const moduleConfig = {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
exclude: path.resolve(__dirname, 'node_modules')
}]
};
module.exports = [{
entry,
module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.js',
libraryTarget: 'umd',
library
},
externals: [ nodeExternals({ whitelist: ['prop-types'] }) ]
}, {
entry,
module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.window.js',
libraryTarget: 'window',
library
},
externals: { react: 'React' }
}, {
entry,
module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.var.js',
libraryTarget: 'var',
library
},
externals: { react: 'React' }
}];
| Remove name conflict module => moduleConfig | Remove name conflict module => moduleConfig
| JavaScript | mit | benbowes/react-responsive-select,benbowes/react-responsive-select,benbowes/react-responsive-select | ---
+++
@@ -3,7 +3,7 @@
const entry = './src/ReactResponsiveSelect.js';
const library = 'ReactResponsiveSelect';
-const module = {
+const moduleConfig = {
rules: [{
test: /\.js$/,
loader: 'babel-loader',
@@ -14,7 +14,7 @@
module.exports = [{
entry,
- module,
+ module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.js',
libraryTarget: 'umd',
@@ -25,7 +25,7 @@
}, {
entry,
- module,
+ module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.window.js',
libraryTarget: 'window',
@@ -36,7 +36,7 @@
}, {
entry,
- module,
+ module: moduleConfig,
output: {
filename: './dist/ReactResponsiveSelect.var.js',
libraryTarget: 'var', |
87f37e3b1f94aaae56ae59dfd775f08abe15f7bc | server/models/bikeshed.js | server/models/bikeshed.js | /**
* Bikeshed model
*/
import Joi from 'joi'
import * as utils from './utils'
export const INDEXES = ['userId', 'createdAt']
export const TABLE = 'bikesheds'
export const TYPE = 'Bikeshed'
export const FileListItemSchema = Joi.object().keys({
fieldname: Joi.string(),
originalname: Joi.string(),
encoding: Joi.string(),
mimetype: Joi.string(),
size: Joi.number(),
key: Joi.string()
})
export const BikeshedSchema = Joi.object().keys({
createdAt: Joi.date(),
id: Joi.string().guid(),
userId: Joi.string().guid(),
requestId: Joi.string().guid(),
fileList: Joi.array().min(2).max(8).items(FileListItemSchema),
description: Joi.string().max(4096).allow('').default('').optional()
})
export const validate = utils.createValidate(BikeshedSchema)
export const get = utils.createGet(TABLE)
export async function create (r, values) {
const bikeshedValues = validate(values)
const { generated_keys: [bikeshedId] } = await r.table(TABLE).insert({
createdAt: r.now(),
...bikeshedValues
})
return bikeshedId
}
| /**
* Bikeshed model
*/
import Joi from 'joi'
import BaseModel from './model'
const FileListItemSchema = Joi.object()
.keys({
fieldname: Joi.string(),
originalname: Joi.string(),
encoding: Joi.string(),
mimetype: Joi.string(),
size: Joi.number(),
key: Joi.string()
})
const BikeshedSchema = Joi.object()
.keys({
createdAt: Joi.date(),
id: Joi.string().guid(),
userId: Joi.string().guid().required(),
requestId: Joi.string().guid().required(),
description: Joi.string().max(4096).allow('').default('').optional(),
fileList: Joi.array().min(2).max(8).items(FileListItemSchema).required()
})
.requiredKeys(['userId', 'requestId', 'fileList'])
const PROPS = {
SCHEMA: BikeshedSchema,
INDEXES: ['userId', 'createdAt'],
TABLE: 'bikesheds',
TYPE: 'Bikeshed'
}
export default class Bikeshed extends BaseModel {
}
Object.assign(Bikeshed.prototype, PROPS)
| Update Bikeshed to use BaseModel | Update Bikeshed to use BaseModel
| JavaScript | apache-2.0 | cesarandreu/bshed,cesarandreu/bshed | ---
+++
@@ -2,13 +2,10 @@
* Bikeshed model
*/
import Joi from 'joi'
-import * as utils from './utils'
+import BaseModel from './model'
-export const INDEXES = ['userId', 'createdAt']
-export const TABLE = 'bikesheds'
-export const TYPE = 'Bikeshed'
-
-export const FileListItemSchema = Joi.object().keys({
+const FileListItemSchema = Joi.object()
+.keys({
fieldname: Joi.string(),
originalname: Joi.string(),
encoding: Joi.string(),
@@ -17,25 +14,24 @@
key: Joi.string()
})
-export const BikeshedSchema = Joi.object().keys({
+const BikeshedSchema = Joi.object()
+.keys({
createdAt: Joi.date(),
id: Joi.string().guid(),
- userId: Joi.string().guid(),
- requestId: Joi.string().guid(),
- fileList: Joi.array().min(2).max(8).items(FileListItemSchema),
- description: Joi.string().max(4096).allow('').default('').optional()
+ userId: Joi.string().guid().required(),
+ requestId: Joi.string().guid().required(),
+ description: Joi.string().max(4096).allow('').default('').optional(),
+ fileList: Joi.array().min(2).max(8).items(FileListItemSchema).required()
})
+.requiredKeys(['userId', 'requestId', 'fileList'])
-export const validate = utils.createValidate(BikeshedSchema)
+const PROPS = {
+ SCHEMA: BikeshedSchema,
+ INDEXES: ['userId', 'createdAt'],
+ TABLE: 'bikesheds',
+ TYPE: 'Bikeshed'
+}
-export const get = utils.createGet(TABLE)
-
-export async function create (r, values) {
- const bikeshedValues = validate(values)
-
- const { generated_keys: [bikeshedId] } = await r.table(TABLE).insert({
- createdAt: r.now(),
- ...bikeshedValues
- })
- return bikeshedId
+export default class Bikeshed extends BaseModel {
}
+Object.assign(Bikeshed.prototype, PROPS) |
98512d9d51ab29b6bf9cf57a90958adc31ddc2a3 | app/routes/index.js | app/routes/index.js | 'use strict';
var path = process.cwd();
module.exports = function (app) {
app.route('/')
.get(function (req, res) {
res.sendFile(path + '/public/index.html');
});
app.route('/:time')
.get(function(req, res) {
console.log("Reached the regexp route for", req.url);
let timeStr = req.params.time;
console.log(timeStr);
let timestamp;
let result = {};
console.log("Time string:", timeStr);
// If the time string contains non-numeric characters, attempt to parse it as as time string.
if (timeStr.match(/\D/)) {
timestamp = Date.parse(timeStr);
} else {
// Question: Do we need to round to the start of the day?
timestamp = Number(timeStr * 1000);
}
if (!isNaN(timestamp)) {
let theDate = new Date(timestamp);
result = {
unix: Math.floor(timestamp / 1000),
natural: formatDate(theDate)
}
}
res.json(result);
});
};
// From a given date object, return a string of the form Jan 23, 2013.
function formatDate(aDate) {
let splitDate = aDate.toDateString().split(' ');
splitDate[2] = splitDate[2] + ',';
return splitDate.slice(1).join(' ');
} | 'use strict';
var path = process.cwd();
module.exports = function (app) {
app.route('/')
.get(function (req, res) {
res.sendFile(path + '/public/index.html');
});
app.route('/:time')
.get(function(req, res) {
console.log("Reached the regexp route for", req.url);
let timeStr = req.params.time;
console.log(timeStr);
let timestamp;
let result = {unix: null, natural: null};
console.log("Time string:", timeStr);
// If the time string contains non-numeric characters, attempt to parse it as as time string.
if (timeStr.match(/\D/)) {
timestamp = Date.parse(timeStr);
} else {
// Question: Do we need to round to the start of the day?
timestamp = Number(timeStr * 1000);
}
if (!isNaN(timestamp)) {
let theDate = new Date(timestamp);
result = {
unix: Math.floor(timestamp / 1000),
natural: formatDate(theDate)
}
}
res.json(result);
});
};
// From a given date object, return a string of the form Jan 23, 2013.
function formatDate(aDate) {
let splitDate = aDate.toDateString().split(' ');
splitDate[2] = splitDate[2] + ',';
return splitDate.slice(1).join(' ');
} | Return null for the the properties if the string cannot be parsed as a date | Return null for the the properties if the string cannot be parsed as a date
| JavaScript | mit | paperbagcorner/timestamp-microservice,paperbagcorner/timestamp-microservice | ---
+++
@@ -15,7 +15,7 @@
let timeStr = req.params.time;
console.log(timeStr);
let timestamp;
- let result = {};
+ let result = {unix: null, natural: null};
console.log("Time string:", timeStr);
// If the time string contains non-numeric characters, attempt to parse it as as time string. |
cdc1a125c60dad38fb52403b8c6bea79d7fcffbd | renderer-process/scrubVideoToTimestamp.js | renderer-process/scrubVideoToTimestamp.js | const moment = require('moment')
const scrubVideoToTimestamp = function () {
let player = document.getElementsByTagName('video')[0]
let timestamp = this.innerHTML
const timeToGoTo = moment.duration({
seconds: timestamp.split(':')[1],
minutes: timestamp.split(':')[0]
}).asSeconds()
console.log(timestamp)
console.log(timeToGoTo)
if (player !== null && player.duration !== null) {
if (timeToGoTo >= 0 && timeToGoTo <= player.duration) {
console.log('reached inner condition')
player.currentTime = timeToGoTo
}
}
}
module.exports = scrubVideoToTimestamp
| const moment = require('moment')
const scrubVideoToTimestamp = function () {
let player = document.getElementsByTagName('video')[0]
let timestamp = this.innerHTML
const timeToGoTo = moment
.duration(timestamp)
.asSeconds()
console.log(timestamp)
console.log(timeToGoTo)
if (player !== null && player.duration !== null) {
if (timeToGoTo >= 0 && timeToGoTo <= player.duration) {
console.log('reached inner condition')
player.currentTime = timeToGoTo
}
}
}
module.exports = scrubVideoToTimestamp
| Use momentjs duration to parse timestamps | Use momentjs duration to parse timestamps
| JavaScript | agpl-3.0 | briandk/transcriptase,briandk/transcriptase | ---
+++
@@ -3,10 +3,9 @@
const scrubVideoToTimestamp = function () {
let player = document.getElementsByTagName('video')[0]
let timestamp = this.innerHTML
- const timeToGoTo = moment.duration({
- seconds: timestamp.split(':')[1],
- minutes: timestamp.split(':')[0]
- }).asSeconds()
+ const timeToGoTo = moment
+ .duration(timestamp)
+ .asSeconds()
console.log(timestamp)
console.log(timeToGoTo) |
5eb79eb1492fdf3bd759bf7c04a57d516ad0581f | src/deploy.js | src/deploy.js | #!/bin/node
import path from 'path';
import fs from 'fs';
import {all as rawMetadata} from '../katas/es6/language/__raw-metadata__';
import {writeToFileAsJson} from './_external-deps/filesystem';
import MetaData from './metadata.js';
import FlatMetaData from './flat-metadata';
import GroupedMetaData from './grouped-metadata';
const katasDir = path.join(__dirname, '../katas');
const destinationDir = path.join(__dirname, '../dist/katas/es6/language');
const buildMetadata = () => {
const allJsonFile = path.join(destinationDir, '__all__.json');
const groupedJsonFile = path.join(destinationDir, '__grouped__.json');
new MetaData(writeToFileAsJson)
.convertWith(rawMetadata, FlatMetaData)
.writeToFile(allJsonFile);
new MetaData(writeToFileAsJson)
.convertWith(rawMetadata, GroupedMetaData)
.writeToFile(groupedJsonFile);
fs.unlinkSync(path.join(destinationDir, '__raw-metadata__.js'));
};
// TODO copy __raw-metadata__.js to dist ... or not?
buildMetadata();
import {convertTestsToKatas} from './convert-tests-to-katas';
convertTestsToKatas({sourceDir: katasDir, destinationDir});
| #!/bin/node
import path from 'path';
import fs from 'fs';
import {all as rawMetadata} from '../katas/es6/language/__raw-metadata__';
import {writeToFileAsJson} from './_external-deps/filesystem';
import MetaData from './metadata.js';
import FlatMetaData from './flat-metadata';
import GroupedMetaData from './grouped-metadata';
const katasDir = path.join(__dirname, '../katas');
const destinationDir = path.join(__dirname, '../../dist/katas/es6/language');
const buildMetadata = () => {
const allJsonFile = path.join(destinationDir, '__all__.json');
const groupedJsonFile = path.join(destinationDir, '__grouped__.json');
new MetaData(writeToFileAsJson)
.convertWith(rawMetadata, FlatMetaData)
.writeToFile(allJsonFile);
new MetaData(writeToFileAsJson)
.convertWith(rawMetadata, GroupedMetaData)
.writeToFile(groupedJsonFile);
fs.unlinkSync(path.join(destinationDir, '__raw-metadata__.js'));
};
// TODO copy __raw-metadata__.js to dist ... or not?
buildMetadata();
import {convertTestsToKatas} from './convert-tests-to-katas';
convertTestsToKatas({sourceDir: katasDir, destinationDir});
| Fix the path because the file had moved. | Fix the path because the file had moved.
| JavaScript | mit | tddbin/katas,tddbin/katas,tddbin/katas | ---
+++
@@ -10,7 +10,7 @@
import GroupedMetaData from './grouped-metadata';
const katasDir = path.join(__dirname, '../katas');
-const destinationDir = path.join(__dirname, '../dist/katas/es6/language');
+const destinationDir = path.join(__dirname, '../../dist/katas/es6/language');
const buildMetadata = () => {
const allJsonFile = path.join(destinationDir, '__all__.json'); |
4711c3aab32f24ab4ab1dcdf9ed59f76ece562b1 | Gruntfile.js | Gruntfile.js | module.exports = (grunt) => {
// Grunt configuration
grunt.initConfig({
ghostinspector: {
options: {
apiKey: 'ff586dcaaa9b781163dbae48a230ea1947f894ff'
},
test1: {
suites: ['53cf58c0350c6c41029a11be']
},
test2: {
tests: ['53cf58fc350c6c41029a11bf', '53cf59e0350c6c41029a11c0']
},
test3: {
tests: ['53cf58fc350c6c41029a11bf'],
options: {
startUrl: 'https://www.google.com.br'
}
}
}
})
// Load grunt modules
grunt.loadTasks('tasks')
}
| module.exports = (grunt) => {
// Grunt configuration
grunt.initConfig({
ghostinspector: {
options: {
apiKey: process.env.GHOST_INSPECTOR_API_KEY
},
test1: {
suites: ['53cf58c0350c6c41029a11be']
},
test2: {
tests: ['53cf58fc350c6c41029a11bf', '53cf59e0350c6c41029a11c0']
},
test3: {
tests: ['53cf58fc350c6c41029a11bf'],
options: {
startUrl: 'https://www.google.com.br'
}
}
}
})
// Load grunt modules
grunt.loadTasks('tasks')
}
| Use env variable to API key during testing | Use env variable to API key during testing
| JavaScript | mit | ghost-inspector/grunt-ghost-inspector | ---
+++
@@ -3,7 +3,7 @@
grunt.initConfig({
ghostinspector: {
options: {
- apiKey: 'ff586dcaaa9b781163dbae48a230ea1947f894ff'
+ apiKey: process.env.GHOST_INSPECTOR_API_KEY
},
test1: {
suites: ['53cf58c0350c6c41029a11be'] |
0fc6b9922db01d3c4d71f51120bdbcb2c52df489 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
'use strict';
grunt.initConfig({
less: {
development: {
options: {
paths: ['velvet']
},
files: {
'build/style.css': 'velvet/velvet.less'
}
},
production: {
options: {
paths: ['less'],
yuicompress: true
},
files: {
'css/style.css': 'less/main.less'
}
}
},
copy: {
options: {
processContentExcluded: ['**/*.{png,gif}']
},
main: {
files: [
{ expand: true
, cwd: 'velvet/'
, src: ['*.{png,gif}']
, dest: 'build/'
}
]
}
},
watch: {
files: 'velvet/*.less',
tasks: ['less:development']
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less:development', 'copy']);
grunt.registerTask('release', ['less:production', 'copy']);
};
| module.exports = function(grunt) {
'use strict';
grunt.initConfig({
less: {
development: {
options: {
paths: ['velvet']
},
files: {
'build/style.css': 'velvet/velvet.less'
}
},
production: {
options: {
paths: ['less'],
yuicompress: true
},
files: {
'build/style.css': 'velvet/velvet.less'
}
}
},
copy: {
options: {
processContentExcluded: ['**/*.{png,gif}']
},
main: {
files: [
{ expand: true
, cwd: 'velvet/'
, src: ['*.{png,gif}']
, dest: 'build/'
}
]
}
},
watch: {
files: 'velvet/*.less',
tasks: ['less:development']
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['less:development', 'copy']);
grunt.registerTask('release', ['less:production', 'copy']);
};
| Change production build for input/output files | Change production build for input/output files
| JavaScript | bsd-3-clause | sourrust/velvet | ---
+++
@@ -17,7 +17,7 @@
yuicompress: true
},
files: {
- 'css/style.css': 'less/main.less'
+ 'build/style.css': 'velvet/velvet.less'
}
}
}, |
67a700f507d46e2b5d6ef3e6c61a747ccfd43db5 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', '<%= pkg.name %>.js'],
options: {
globals: {
window: true
}
}
},
uglify: {
options: {
banner: '/* <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n\n'
},
build: {
src: '<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js',
options: {
sourceMap: 'build/<%= pkg.name %>.min.map',
sourceMappingURL: '<%= pkg.name %>.min.map',
preserveComments: 'some'
}
}
},
mocha: {
test: {
src: ['tests/index.html']
}
},
watch: {
js: {
files: ['<%= pkg.name %>.js'],
tasks: ['test'],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('test', ['jshint', 'mocha']);
grunt.registerTask('build', ['test', 'uglify']);
grunt.registerTask('default', ['build']);
};
| module.exports = function(grunt) {
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
jshint: {
files: ['Gruntfile.js', '<%= pkg.name %>.js'],
options: {
globals: {
window: true
}
}
},
uglify: {
options: {
report: 'gzip', // Report minified size
banner: '/* <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n\n'
},
build: {
src: '<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js',
options: {
sourceMap: 'build/<%= pkg.name %>.min.map',
sourceMappingURL: '<%= pkg.name %>.min.map',
preserveComments: 'some'
}
}
},
mocha: {
test: {
src: ['tests/index.html']
}
},
watch: {
js: {
files: ['<%= pkg.name %>.js'],
tasks: ['test'],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-notify');
grunt.registerTask('test', ['jshint', 'mocha']);
grunt.registerTask('build', ['test', 'uglify']);
grunt.registerTask('default', ['build']);
};
| Add minified file size notification on Grunt build | Add minified file size notification on Grunt build
| JavaScript | mit | premasagar/pablo,premasagar/pablo | ---
+++
@@ -12,6 +12,7 @@
},
uglify: {
options: {
+ report: 'gzip', // Report minified size
banner: '/* <%= pkg.name %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) */\n\n'
},
build: { |
641aa2bdbffc43c70f037ecf50940c4e8905e485 | Gruntfile.js | Gruntfile.js | /*jslint node: true, sloppy: true */
module.exports = function (grunt) {
grunt.initConfig({
inlineEverything: {
simpleExample: {
options: {
tags: {
link: true,
script: true
}
},
src: 'czemaco.html',
dest: 'build/czemaco.html'
}
}
});
grunt.loadNpmTasks('grunt-cruncher');
grunt.registerTask('inline', ['inlineEverything']);
grunt.registerTask('default', ['inlineEverything']);
}; | /*jslint node: true, sloppy: true */
module.exports = function (grunt) {
grunt.initConfig({
inlineEverything: {
simpleExample: {
options: {
tags: {
link: true,
script: true
}
},
src: 'czemaco.html',
dest: 'build/index.html'
}
}
});
grunt.loadNpmTasks('grunt-cruncher');
grunt.registerTask('inline', ['inlineEverything']);
grunt.registerTask('default', ['inlineEverything']);
}; | Rename main html file to index.html during build | Rename main html file to index.html during build
to make publish process more streamlined
| JavaScript | mit | vrabcak/czemaco,vrabcak/czemaco,vrabcak/czemaco | ---
+++
@@ -16,7 +16,7 @@
},
src: 'czemaco.html',
- dest: 'build/czemaco.html'
+ dest: 'build/index.html'
}
|
c1898593b80c25df9d2a8319ea83741da7e6979b | Gruntfile.js | Gruntfile.js | module.exports = function (grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
mdlint: {
pass: ['README.md'],
fail: ['test/fixtures/*.md']
},
simplemocha: {
options: {
globals: ['should'],
timeout: 10000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
all: {
src: ['test/integrationTests.js']
}
},
jshint: {
options: {
bitwise: true,
indent: 2,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
nonew: true,
quotmark: 'single',
sub: true,
undef: true,
unused: true,
boss: true,
trailing: true,
eqnull: true,
node: true,
expr: true,
evil: true,
globals: {
describe: true,
it: true,
before: true
}
},
files: {
src: ['*.js', 'test/*.js', 'tasks/*.js']
}
}
});
grunt.registerTask('default', ['jshint', 'simplemocha']);
grunt.loadTasks('tasks');
};
| module.exports = function (grunt) {
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.initConfig({
mdlint: {
pass: ['README.md'],
fail: ['test/fixtures/*.md']
},
simplemocha: {
options: {
globals: ['should'],
timeout: 10000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
all: {
src: ['test/integrationTests.js']
}
},
jshint: {
options: {
bitwise: true,
indent: 2,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
nonew: true,
quotmark: 'single',
sub: true,
undef: true,
unused: true,
boss: true,
trailing: true,
eqnull: true,
node: true,
expr: true,
evil: true,
globals: {
describe: true,
it: true,
before: true
}
},
files: {
src: ['*.js', 'test/*.js', 'tasks/*.js']
}
}
});
grunt.registerTask('default', ['jshint', 'mdlint:pass', 'simplemocha']);
grunt.loadTasks('tasks');
};
| Add grunt-mdlint to CI tests | Add grunt-mdlint to CI tests
| JavaScript | mit | ChrisWren/grunt-mdlint | ---
+++
@@ -49,7 +49,7 @@
}
});
- grunt.registerTask('default', ['jshint', 'simplemocha']);
+ grunt.registerTask('default', ['jshint', 'mdlint:pass', 'simplemocha']);
grunt.loadTasks('tasks');
|
ca5297ae6808f336bb3d468db71410fb1b6e5dad | Gruntfile.js | Gruntfile.js | "use strict";
module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.initConfig({
uglify: {
options: {
report: "gzip"
},
dist: {
files: {
"q.min.js": ["q.js"]
}
}
}
});
grunt.registerTask("default", ["uglify"]);
};
| "use strict";
module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.initConfig({
uglify: {
"q.min.js": ["q.js"],
options: {
report: "gzip"
}
}
});
grunt.registerTask("default", ["uglify"]);
};
| Use less verbose Grunt syntax. | Use less verbose Grunt syntax.
| JavaScript | mit | harks198913/q,ajunflying/q,Zeratul5/q,STRd6/q,liwangbest/q,darkdragon-001/q,miamarti/q,willsmth/q,ShopCo/q,potato620/q,behind2/q,dracher/q,criferlo/q,IbpTeam/node-q,bnicart/q,cgvarela/q,gustavobeavis/q,100star/q,X-Bird/q,lidasong2014/q,npmcomponent/techjacker-q,rasata/q,gorcz/q,darkdragon-001/q,gustavobeavis/q,liwangbest/q,ShopCo/q,kriskowal/q,signpost/q,b12consulting/q,rasata/q,SarunasAzna/q,criferlo/q,zhangwenquan/q,IlianStefanov/q,Muffasa/q,yizziy/q,potato620/q,dracher/q,aramk/q,IlianStefanov/q,jymsy/q,lvdou2518/q,pwmckenna/q,zhangwenquan/q,ajunflying/q,gorcz/q,homer0/q,linalu1/q,cgvarela/q,lvdou2518/q,Zeratul5/q,mcanthony/q,Muffasa/q,greyhwndz/q,X-Bird/q,welbornio/q,lidasong2014/q,IbpTeam/node-q,mcanthony/q,welbornio/q,jymsy/q,miamarti/q,SarunasAzna/q,greyhwndz/q,homer0/q,signpost/q,behind2/q,kriskowal/q,willsmth/q,yizziy/q,pwmckenna/q,harks198913/q,linalu1/q,manushthinkster/q,CozyCo/q,CozyCo/q,aramk/q,b12consulting/q,manushthinkster/q,kevinsawicki/q,bnicart/q | ---
+++
@@ -5,13 +5,9 @@
grunt.initConfig({
uglify: {
+ "q.min.js": ["q.js"],
options: {
report: "gzip"
- },
- dist: {
- files: {
- "q.min.js": ["q.js"]
- }
}
}
}); |
5e00fba2922bfc0d67bc7943e2fa0b0ca69ecff2 | sixquiprend/static/js/main_controller.js | sixquiprend/static/js/main_controller.js | 'use strict';
app.controller('MainController', ['$rootScope', '$scope', '$http', 'growl',
function($rootScope, $scope, $http, growl) {
// UI
$scope.is_admin = function() {
return $rootScope.current_user && $rootScope.current_user.urole == 3;
};
}
]);
| 'use strict';
app.controller('MainController', ['$rootScope', '$scope', '$http', 'growl',
function($rootScope, $scope, $http, growl) {
// UI
$scope.is_admin = function() {
return $rootScope.current_user && $rootScope.current_user.urole == 2;
};
}
]);
| Update admin urole in front | Update admin urole in front
| JavaScript | mit | nyddogghr/SixQuiPrend,nyddogghr/SixQuiPrend,nyddogghr/SixQuiPrend,nyddogghr/SixQuiPrend | ---
+++
@@ -6,7 +6,7 @@
// UI
$scope.is_admin = function() {
- return $rootScope.current_user && $rootScope.current_user.urole == 3;
+ return $rootScope.current_user && $rootScope.current_user.urole == 2;
};
} |
1fbf265beb5d1c1c63a3ac19c13598e14d6735fb | js/exporters/InstancedGeometryExporter.js | js/exporters/InstancedGeometryExporter.js | /**
* @author jimbo00000
*/
THREE.InstancedGeometryExporter = function () {};
THREE.InstancedGeometryExporter.prototype = {
constructor: THREE.InstancedGeometryExporter,
parse: function ( geometry ) {
var output = {
metadata: {
version: 4.0,
type: 'InstancedGeometry',
generator: 'InstancedGeometryExporter'
}
};
console.log(geometry);
//output['fileFormatType'] = '3D instanced geomtry';
//output['fileFormatVersion'] = 0.1;
var cnt = geometry.maxInstancedCount;
output[ 'maxInstancedCount' ] = cnt;
{
var attribute = 'perInstPositions';
var typedArray = geometry.attributes[ attribute ];
var array = [];
for ( var i = 0, l = cnt*4; i < l; i ++ ) {
array[ i ] = typedArray.array[ i ];
}
output[ attribute ] = array;
}
{
var attribute = 'perInstOrientations';
var typedArray = geometry.attributes[ attribute ];
var array = [];
//for ( var i = 0, l = cnt; i < l; i ++ ) {
for ( var i = 0, l = cnt*4; i < l; i ++ ) {
array[ i ] = typedArray.array[ i ];
}
output[ attribute ] = array;
}
return output;
}
};
| /**
* @author jimbo00000
*/
THREE.InstancedGeometryExporter = function () {};
THREE.InstancedGeometryExporter.prototype = {
constructor: THREE.InstancedGeometryExporter,
parse: function ( geometry ) {
var output = {
metadata: {
version: 4.1,
type: 'InstancedGeometry3D',
generator: 'InstancedGeometryExporter'
}
};
console.log(geometry);
var cnt = geometry.maxInstancedCount;
output[ 'maxInstancedCount' ] = cnt;
{
var attribute = 'perInstPositions';
var typedArray = geometry.attributes[ attribute ];
var array = [];
for ( var i = 0, l = cnt*4; i < l; i ++ ) {
array[ i ] = typedArray.array[ i ];
}
output[ attribute ] = array;
}
{
var attribute = 'perInstOrientations';
var typedArray = geometry.attributes[ attribute ];
var array = [];
//for ( var i = 0, l = cnt; i < l; i ++ ) {
for ( var i = 0, l = cnt*4; i < l; i ++ ) {
array[ i ] = typedArray.array[ i ];
}
output[ attribute ] = array;
}
return output;
}
};
| Update file format version string. | Update file format version string.
| JavaScript | mit | jimbo00000/Shmiltbrush,jimbo00000/Shmiltbrush | ---
+++
@@ -12,16 +12,13 @@
var output = {
metadata: {
- version: 4.0,
- type: 'InstancedGeometry',
+ version: 4.1,
+ type: 'InstancedGeometry3D',
generator: 'InstancedGeometryExporter'
}
};
console.log(geometry);
-
- //output['fileFormatType'] = '3D instanced geomtry';
- //output['fileFormatVersion'] = 0.1;
var cnt = geometry.maxInstancedCount;
output[ 'maxInstancedCount' ] = cnt; |
c77addad3e26ad040945acccf603d2937d66a0b1 | src/marbles/dispatcher.js | src/marbles/dispatcher.js | //= require ./core
(function () {
"use strict";
var __callbacks = [];
Marbles.Dispatcher = {
register: function (callback) {
__callbacks.push(callback);
var dispatchIndex = __callbacks.length - 1;
return dispatchIndex;
},
dispatch: function (event) {
var promises = __callbacks.map(function (callback) {
return new Promise(function (resolve) {
callback(event);
resolve(event);
});
});
return Promise.all(promises);
}
};
})();
| //= require ./core
(function () {
"use strict";
var __callbacks = [];
Marbles.Dispatcher = {
register: function (callback) {
__callbacks.push(callback);
var dispatchIndex = __callbacks.length - 1;
return dispatchIndex;
},
dispatch: function (event) {
var promises = __callbacks.map(function (callback) {
return new Promise(function (resolve) {
resolve(callback(event));
});
});
return Promise.all(promises);
}
};
})();
| Update Dispatcher: dispatch resolves with results of callbacks | Update Dispatcher: dispatch resolves with results of callbacks
| JavaScript | bsd-3-clause | jvatic/marbles-js,jvatic/marbles-js | ---
+++
@@ -15,8 +15,7 @@
dispatch: function (event) {
var promises = __callbacks.map(function (callback) {
return new Promise(function (resolve) {
- callback(event);
- resolve(event);
+ resolve(callback(event));
});
});
return Promise.all(promises); |
8879ea7b095f94dcdca49eb199dda4d78906c554 | tools/commit-analyzer.js | tools/commit-analyzer.js | const { parseRawCommit } = require('conventional-changelog/lib/git')
module.exports = function (pluginConfig, {commits}, cb) {
let type = null
commits
.map((commit) => parseRawCommit(`${commit.hash}\n${commit.message}`))
.filter((commit) => !!commit)
.every((commit) => {
if (commit.breaks.length) {
type = 'prerelease'
return false
}
if (commit.type === 'feat') type = 'prerelease'
if (!type && commit.type === 'fix') type = 'prerelease'
return true
})
if(type) {
global.env.PROJECT_HAS_CHANGES = 'true';
}
cb(null, type)
}
| const { parseRawCommit } = require('conventional-changelog/lib/git')
module.exports = function (pluginConfig, {commits}, cb) {
let type = null
commits
.map((commit) => parseRawCommit(`${commit.hash}\n${commit.message}`))
.filter((commit) => !!commit)
.every((commit) => {
if (commit.breaks.length) {
type = 'prerelease'
return false
}
if (commit.type === 'feat') type = 'prerelease'
if (!type && commit.type === 'fix') type = 'prerelease'
return true
})
if(type) {
process.env.PROJECT_HAS_CHANGES = 'true';
}
cb(null, type)
}
| Use process instead of globel to set env variable | chore: Use process instead of globel to set env variable
| JavaScript | mit | matreshkajs/matreshka,matreshkajs/matreshka,finom/matreshka,finom/matreshka | ---
+++
@@ -23,7 +23,7 @@
})
if(type) {
- global.env.PROJECT_HAS_CHANGES = 'true';
+ process.env.PROJECT_HAS_CHANGES = 'true';
}
cb(null, type) |
f3bce3e7938f28c0dd6471ea8bbca5cecab44052 | duo-comment-links.user.js | duo-comment-links.user.js | // ==UserScript==
// @name Duolingo Comment Links
// @description Turn comment timestamps into direct links
// @match *://www.duolingo.com/*
// @author HodofHod
// @namespace HodofHod
// @version 0.0.3
// ==/UserScript==
function inject(f) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.setAttribute('name', 'comment_links');
script.textContent = '(' + f.toString() + ')()';
document.body.appendChild(script);
}
inject(function(){
$(document).on('mouseover', '.discussion-comments-list:not(.dlinked)', function (){
$(this).addClass('dlinked');
$('li[id*=comment-] .body').each(function(){
var $timestamp = $(this).next('.footer').contents().filter(function(){return this.nodeType === 3;}),
$link = $('<a href="' + document.location.pathname.replace(/\$.+$/, '') +
'$comment_id=' + this.id.replace(/^body-(\d+)$/, '$1') +
'">' + $timestamp.text() + '</a>');
$timestamp.replaceWith($link);
});
});
});
| // ==UserScript==
// @name Duolingo Comment Links
// @description Turn comment timestamps into direct links
// @match *://www.duolingo.com/*
// @author HodofHod
// @namespace HodofHod
// @version 0.0.3
// ==/UserScript==
/*
Copyright (c) 2013-2014 HodofHod (https://github.com/HodofHod)
Licensed under the MIT License (MIT)
Full text of the license is available at https://raw2.github.com/HodofHod/Userscripts/master/LICENSE
*/
function inject(f) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.setAttribute('name', 'comment_links');
script.textContent = '(' + f.toString() + ')()';
document.body.appendChild(script);
}
inject(function(){
$(document).on('mouseover', '.discussion-comments-list:not(.dlinked)', function (){
$(this).addClass('dlinked');
$('li[id*=comment-] .body').each(function(){
var $timestamp = $(this).next('.footer').contents().filter(function(){return this.nodeType === 3;}),
$link = $('<a href="' + document.location.pathname.replace(/\$.+$/, '') +
'$comment_id=' + this.id.replace(/^body-(\d+)$/, '$1') +
'">' + $timestamp.text() + '</a>');
$timestamp.replaceWith($link);
});
});
});
| Add Copyright and link to MIT License | Add Copyright and link to MIT License | JavaScript | mit | HodofHod/Userscripts | ---
+++
@@ -7,6 +7,12 @@
// @version 0.0.3
// ==/UserScript==
+/*
+Copyright (c) 2013-2014 HodofHod (https://github.com/HodofHod)
+
+Licensed under the MIT License (MIT)
+Full text of the license is available at https://raw2.github.com/HodofHod/Userscripts/master/LICENSE
+*/
function inject(f) {
var script = document.createElement('script'); |
cb49dac428723756d2529810a2614b9ceab67ad3 | web/src/stores/coords.js | web/src/stores/coords.js | import { observable, action } from 'mobx';
export default new class StoreCoords {
@observable
lat = 0
@observable
lng = 0
@observable
accuracy = 9999
@action
_update(...values) {
[ this.lat, this.lng, this.accuracy ] = values;
}
constructor() {
navigator.geolocation.watchPosition((e) => {
const { latitude: lat, longitude: lng, accuracy } = e.coords;
this._update(lat, lng, accuracy);
}, () => {}, {
enableHighAccuracy: true,
timeout: 100
});
}
};
| import { observable, action } from 'mobx';
export default new class StoreCoords {
@observable
lat = 0
@observable
lng = 0
@observable
accuracy = 9999
@action
_update(...values) {
[ this.lat, this.lng, this.accuracy ] = values;
}
constructor() {
if (navigator.geolocation) navigator.geolocation.watchPosition((e) => {
const { latitude: lat, longitude: lng, accuracy } = e.coords;
this._update(lat, lng, accuracy);
}, () => {}, {
enableHighAccuracy: true,
timeout: 100
});
}
};
| Add Geolocation API compatibility check (web) | Add Geolocation API compatibility check (web)
| JavaScript | agpl-3.0 | karlkoorna/Bussiaeg,karlkoorna/Bussiaeg | ---
+++
@@ -18,7 +18,7 @@
constructor() {
- navigator.geolocation.watchPosition((e) => {
+ if (navigator.geolocation) navigator.geolocation.watchPosition((e) => {
const { latitude: lat, longitude: lng, accuracy } = e.coords;
this._update(lat, lng, accuracy);
}, () => {}, { |
ca99ce59c3f7a40972470eb2194d116f33cccd45 | web/src/stores/coords.js | web/src/stores/coords.js | import { decorate, observable, action } from 'mobx';
class StoreCoords {
lat = 0
lng = 0
accuracy = 9999
// Update coordinates and accuracy in store.
update(coords) {
[ this.lat, this.lng, this.accuracy ] = [ coords.latitude || coords.lat, coords.longitude || coords.lng, coords.accuracy ];
}
constructor() {
if (navigator.geolocation) navigator.geolocation.watchPosition((e) => {
this.update(e.coords);
}, () => {}, {
enableHighAccuracy: true,
timeout: 100
});
}
}
decorate(StoreCoords, {
lat: observable,
lng: observable,
accuracy: observable,
update: action
});
export default new StoreCoords();
| import { decorate, observable, action } from 'mobx';
import { opts as mapOpts } from 'views/Map/Map.jsx';
class StoreCoords {
lat = mapOpts.startLat
lng = mapOpts.startLng
accuracy = 9999
// Update coordinates and accuracy in store.
update(coords) {
[ this.lat, this.lng, this.accuracy ] = [ coords.latitude || coords.lat, coords.longitude || coords.lng, coords.accuracy ];
}
constructor() {
if (navigator.geolocation) navigator.geolocation.watchPosition((e) => {
this.update(e.coords);
}, () => {}, {
enableHighAccuracy: true,
timeout: 100
});
}
}
decorate(StoreCoords, {
lat: observable,
lng: observable,
accuracy: observable,
update: action
});
export default new StoreCoords();
| Fix map flashing outside country (web) | Fix map flashing outside country (web)
| JavaScript | agpl-3.0 | karlkoorna/Bussiaeg,karlkoorna/Bussiaeg | ---
+++
@@ -1,9 +1,11 @@
import { decorate, observable, action } from 'mobx';
+
+import { opts as mapOpts } from 'views/Map/Map.jsx';
class StoreCoords {
- lat = 0
- lng = 0
+ lat = mapOpts.startLat
+ lng = mapOpts.startLng
accuracy = 9999
// Update coordinates and accuracy in store. |
777f78602ac3d875ae2ca3a56bdd8508c70d12ed | spa_ui/self_service/client/app/states/marketplace/details/details.state.js | spa_ui/self_service/client/app/states/marketplace/details/details.state.js | (function() {
'use strict';
angular.module('app.states')
.run(appRun);
/** @ngInject */
function appRun(routerHelper) {
routerHelper.configureStates(getStates());
}
function getStates() {
return {
'marketplace.details': {
url: '/:serviceTemplateId',
templateUrl: 'app/states/marketplace/details/details.html',
controller: StateController,
controllerAs: 'vm',
title: 'Service Template Details',
resolve: {
dialogs: resolveDialogs,
serviceTemplate: resolveServiceTemplate
}
}
};
}
/** @ngInject */
function resolveServiceTemplate($stateParams, CollectionsApi) {
var options = {attributes: ['picture', 'picture.image_href']};
return CollectionsApi.get('service_templates', $stateParams.serviceTemplateId, options);
}
/** @ngInject */
function resolveDialogs($stateParams, CollectionsApi) {
var options = {expand: true, attributes: 'content'};
return CollectionsApi.query('service_templates/' + $stateParams.serviceTemplateId + '/service_dialogs', options);
}
/** @ngInject */
function StateController(dialogs, serviceTemplate) {
var vm = this;
vm.title = 'Service Template Details';
vm.dialogs = dialogs.resources[0].content;
vm.serviceTemplate = serviceTemplate;
}
})();
| (function() {
'use strict';
angular.module('app.states')
.run(appRun);
/** @ngInject */
function appRun(routerHelper) {
routerHelper.configureStates(getStates());
}
function getStates() {
return {
'marketplace.details': {
url: '/:serviceTemplateId',
templateUrl: 'app/states/marketplace/details/details.html',
controller: StateController,
controllerAs: 'vm',
title: 'Service Template Details',
resolve: {
dialogs: resolveDialogs,
serviceTemplate: resolveServiceTemplate
}
}
};
}
/** @ngInject */
function resolveServiceTemplate($stateParams, CollectionsApi) {
var options = {attributes: ['picture', 'picture.image_href']};
return CollectionsApi.get('service_templates', $stateParams.serviceTemplateId, options);
}
/** @ngInject */
function resolveDialogs($stateParams, CollectionsApi) {
var options = {expand: 'resources', attributes: 'content'};
return CollectionsApi.query('service_templates/' + $stateParams.serviceTemplateId + '/service_dialogs', options);
}
/** @ngInject */
function StateController(dialogs, serviceTemplate) {
var vm = this;
vm.title = 'Service Template Details';
vm.dialogs = dialogs.resources[0].content;
vm.serviceTemplate = serviceTemplate;
}
})();
| Fix issue when API wasn't returning correct service dialog results | Fix issue when API wasn't returning correct service dialog results
| JavaScript | apache-2.0 | matobet/manageiq,KevinLoiseau/manageiq,romanblanco/manageiq,fbladilo/manageiq,jameswnl/manageiq,israel-hdez/manageiq,maas-ufcg/manageiq,lpichler/manageiq,matobet/manageiq,aufi/manageiq,romanblanco/manageiq,mresti/manageiq,lpichler/manageiq,ManageIQ/manageiq,fbladilo/manageiq,tzumainn/manageiq,maas-ufcg/manageiq,kbrock/manageiq,juliancheal/manageiq,jameswnl/manageiq,romaintb/manageiq,billfitzgerald0120/manageiq,syncrou/manageiq,NickLaMuro/manageiq,maas-ufcg/manageiq,billfitzgerald0120/manageiq,skateman/manageiq,tinaafitz/manageiq,borod108/manageiq,jameswnl/manageiq,matobet/manageiq,chessbyte/manageiq,gmcculloug/manageiq,fbladilo/manageiq,mkanoor/manageiq,durandom/manageiq,gerikis/manageiq,maas-ufcg/manageiq,israel-hdez/manageiq,ManageIQ/manageiq,romanblanco/manageiq,chessbyte/manageiq,djberg96/manageiq,KevinLoiseau/manageiq,ilackarms/manageiq,branic/manageiq,skateman/manageiq,yaacov/manageiq,agrare/manageiq,syncrou/manageiq,syncrou/manageiq,yaacov/manageiq,durandom/manageiq,mfeifer/manageiq,josejulio/manageiq,jntullo/manageiq,israel-hdez/manageiq,josejulio/manageiq,mresti/manageiq,josejulio/manageiq,skateman/manageiq,billfitzgerald0120/manageiq,pkomanek/manageiq,mkanoor/manageiq,mzazrivec/manageiq,ManageIQ/manageiq,juliancheal/manageiq,chessbyte/manageiq,branic/manageiq,aufi/manageiq,andyvesel/manageiq,andyvesel/manageiq,ailisp/manageiq,tzumainn/manageiq,jntullo/manageiq,mfeifer/manageiq,jameswnl/manageiq,yaacov/manageiq,billfitzgerald0120/manageiq,lpichler/manageiq,gmcculloug/manageiq,NaNi-Z/manageiq,syncrou/manageiq,jvlcek/manageiq,borod108/manageiq,borod108/manageiq,gerikis/manageiq,KevinLoiseau/manageiq,mresti/manageiq,mzazrivec/manageiq,chessbyte/manageiq,tinaafitz/manageiq,mfeifer/manageiq,tinaafitz/manageiq,branic/manageiq,NaNi-Z/manageiq,yaacov/manageiq,romaintb/manageiq,aufi/manageiq,juliancheal/manageiq,jvlcek/manageiq,hstastna/manageiq,durandom/manageiq,mzazrivec/manageiq,romanblanco/manageiq,andyvesel/manageiq,ilackarms/manageiq,gerikis/manageiq,jntullo/manageiq,jvlcek/manageiq,mfeifer/manageiq,ManageIQ/manageiq,israel-hdez/manageiq,NickLaMuro/manageiq,jvlcek/manageiq,gmcculloug/manageiq,agrare/manageiq,agrare/manageiq,mresti/manageiq,andyvesel/manageiq,gmcculloug/manageiq,maas-ufcg/manageiq,jntullo/manageiq,KevinLoiseau/manageiq,josejulio/manageiq,lpichler/manageiq,kbrock/manageiq,kbrock/manageiq,NaNi-Z/manageiq,jrafanie/manageiq,maas-ufcg/manageiq,kbrock/manageiq,pkomanek/manageiq,hstastna/manageiq,hstastna/manageiq,romaintb/manageiq,juliancheal/manageiq,NickLaMuro/manageiq,jrafanie/manageiq,NaNi-Z/manageiq,jrafanie/manageiq,ailisp/manageiq,hstastna/manageiq,skateman/manageiq,djberg96/manageiq,d-m-u/manageiq,tzumainn/manageiq,gerikis/manageiq,jrafanie/manageiq,tinaafitz/manageiq,NickLaMuro/manageiq,djberg96/manageiq,romaintb/manageiq,KevinLoiseau/manageiq,agrare/manageiq,fbladilo/manageiq,KevinLoiseau/manageiq,ailisp/manageiq,aufi/manageiq,pkomanek/manageiq,romaintb/manageiq,borod108/manageiq,mkanoor/manageiq,branic/manageiq,matobet/manageiq,tzumainn/manageiq,d-m-u/manageiq,mzazrivec/manageiq,pkomanek/manageiq,romaintb/manageiq,d-m-u/manageiq,mkanoor/manageiq,ilackarms/manageiq,ailisp/manageiq,d-m-u/manageiq,durandom/manageiq,ilackarms/manageiq,djberg96/manageiq | ---
+++
@@ -34,7 +34,7 @@
/** @ngInject */
function resolveDialogs($stateParams, CollectionsApi) {
- var options = {expand: true, attributes: 'content'};
+ var options = {expand: 'resources', attributes: 'content'};
return CollectionsApi.query('service_templates/' + $stateParams.serviceTemplateId + '/service_dialogs', options);
} |
596a5affa2f9411c6a4b0a1c28f3b0d917b5feee | Gruntfile.js | Gruntfile.js | /*
* grunt-liquibase
* https://github.com/chrisgreening/grunt-liquibase
*
* Copyright (c) 2014 Chris Greening
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Configuration to be run (and then tested).
liquibase: {
default_options: {
options: {
},
command : 'version'
},
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// By default, lint and run all tests.
grunt.registerTask('default', ['liquibase']);
};
| /*
* grunt-liquibase
* https://github.com/chrisgreening/grunt-liquibase
*
* Copyright (c) 2014 Chris Greening
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Configuration to be run (and then tested).
liquibase: {
version : {
options: {
},
command : 'version'
}
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// By default, lint and run all tests.
grunt.registerTask('test', ['liquibase']);
};
| Create test task to match package.json | Create test task to match package.json
| JavaScript | mit | cgreening/grunt-liquibase,MRN-Code/grunt-liquibase,idefy/grunt-liquibase,sameetn/grunt-liquibase | ---
+++
@@ -14,11 +14,11 @@
grunt.initConfig({
// Configuration to be run (and then tested).
liquibase: {
- default_options: {
+ version : {
options: {
},
command : 'version'
- },
+ }
}
});
@@ -26,6 +26,6 @@
grunt.loadTasks('tasks');
// By default, lint and run all tests.
- grunt.registerTask('default', ['liquibase']);
+ grunt.registerTask('test', ['liquibase']);
}; |
f7ea307e8c3e21e53801f1327c5beeddcaf6fb4a | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
options: {
ieCompat: true,
strictImports: false,
syncImport: false,
report: 'min'
},
css: {
options: {
compress: false,
yuicompress: false
},
files: {
'css/calendar.css': 'less/calendar.less',
}
},
css_min: {
options: {
compress: true,
yuicompress: true
},
files: {
'css/calendar.min.css': 'css/calendar.css'
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\nhttps://github.com/Serhioromano/bootstrap-calendar.git\n'
},
build: {
src: 'js/calendar.js',
dest: 'js/calendar.min.js'
}
}
});
// Load the plugin that provides the tasks.
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['less:css', 'less:css_min', 'uglify']);
}; | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
less: {
options: {
ieCompat: true,
strictImports: false,
syncImport: false,
report: 'min'
},
css: {
options: {
compress: false,
yuicompress: false
},
files: {
'css/calendar.css': 'less/calendar.less',
}
},
css_min: {
options: {
compress: true,
yuicompress: true
},
files: {
'css/calendar.min.css': 'css/calendar.css'
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> \n' +
'https://github.com/Serhioromano/bootstrap-calendar */\n'
},
build: {
src: 'js/calendar.js',
dest: 'js/calendar.min.js'
}
}
});
// Load the plugin that provides the tasks.
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
// Default task(s).
grunt.registerTask('default', ['less:css', 'less:css_min', 'uglify']);
}; | Add version to head of minified version | Add version to head of minified version
| JavaScript | mit | albertchau/Green,albertchau/Green | ---
+++
@@ -31,7 +31,9 @@
},
uglify: {
options: {
- banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\nhttps://github.com/Serhioromano/bootstrap-calendar.git\n'
+ banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
+ '<%= grunt.template.today("yyyy-mm-dd") %> \n' +
+ 'https://github.com/Serhioromano/bootstrap-calendar */\n'
},
build: {
src: 'js/calendar.js', |
d483635a68a46a53832c64d72b03a857700a52ad | app/assets/javascripts/tax-disc-ab-test.js | app/assets/javascripts/tax-disc-ab-test.js | //= require govuk/multivariate-test
/*jslint browser: true,
* indent: 2,
* white: true
*/
/*global $, GOVUK */
$(function () {
GOVUK.taxDiscBetaPrimary = function () {
$('.primary-apply').html($('#beta-primary').html());
$('.secondary-apply').html($('#dvla-secondary').html());
};
if(window.location.href.indexOf("/tax-disc") > -1) {
new GOVUK.MultivariateTest({
name: 'tax-disc',
customVarIndex: 20,
cohorts: {
tax_disc_beta_control1: { callback: function () { } },
tax_disc_beta1: { callback: GOVUK.taxDiscBetaPrimary }
}
});
}
});
| //= require govuk/multivariate-test
/*jslint browser: true,
* indent: 2,
* white: true
*/
/*global $, GOVUK */
$(function () {
GOVUK.taxDiscBetaPrimary = function () {
$('.primary-apply').html($('#beta-primary').html());
$('.secondary-apply').html($('#dvla-secondary').html());
};
if(window.location.href.indexOf("/tax-disc") > -1) {
new GOVUK.MultivariateTest({
name: 'tax-disc-50-50',
customVarIndex: 20,
cohorts: {
tax_disc_beta_control: { callback: function () { } },
tax_disc_beta: { callback: GOVUK.taxDiscBetaPrimary }
}
});
}
});
| Rename tax disc test and cohorts | Rename tax disc test and cohorts
This effectively creates a new A/B test using the
new weightings. | JavaScript | mit | alphagov/frontend,alphagov/frontend,alphagov/frontend,alphagov/frontend | ---
+++
@@ -14,11 +14,11 @@
if(window.location.href.indexOf("/tax-disc") > -1) {
new GOVUK.MultivariateTest({
- name: 'tax-disc',
+ name: 'tax-disc-50-50',
customVarIndex: 20,
cohorts: {
- tax_disc_beta_control1: { callback: function () { } },
- tax_disc_beta1: { callback: GOVUK.taxDiscBetaPrimary }
+ tax_disc_beta_control: { callback: function () { } },
+ tax_disc_beta: { callback: GOVUK.taxDiscBetaPrimary }
}
});
} |
36522ada53a64a129cb3519b4183da8084dced1c | app/assets/javascripts/services/dialog_editor_http_service.js | app/assets/javascripts/services/dialog_editor_http_service.js | ManageIQ.angular.app.service('DialogEditorHttp', ['$http', 'API', function($http, API) {
this.loadDialog = function(id) {
return API.get('/api/service_dialogs/' + id + '?attributes=content,buttons,label');
};
this.saveDialog = function(id, action, data) {
return API.post('/api/service_dialogs' + id, {
action: action,
resource: data,
}, {
skipErrors: [400],
});
};
this.treeSelectorLoadData = function(fqdn) {
var url = '/tree/automate_entrypoint' + (fqdn ? '?fqdn=' + encodeURIComponent(fqdn) : '');
return $http.get(url).then(function(response) {
return response.data;
});
};
this.treeSelectorLazyLoadData = function(node) {
return $http.get('/tree/automate_entrypoint?id=' + encodeURIComponent(node.key)).then(function(response) {
return response.data;
});
};
// Load categories data from API.
this.loadCategories = function() {
return API.get('/api/categories' +
'?expand=resources' +
'&attributes=id,name,description,single_value,children');
};
}]);
| ManageIQ.angular.app.service('DialogEditorHttp', ['$http', 'API', function($http, API) {
this.loadDialog = function(id) {
return API.get('/api/service_dialogs/' + id + '?attributes=content,buttons,label');
};
this.saveDialog = function(id, action, data) {
return API.post('/api/service_dialogs' + id, {
action: action,
resource: data,
}, {
skipErrors: [400],
});
};
this.treeSelectorLoadData = function(fqname) {
var url = '/tree/automate_entrypoint' + (fqname ? '?fqname=' + encodeURIComponent(fqname) : '');
return $http.get(url).then(function(response) {
return response.data;
});
};
this.treeSelectorLazyLoadData = function(node) {
return $http.get('/tree/automate_entrypoint?id=' + encodeURIComponent(node.key)).then(function(response) {
return response.data;
});
};
// Load categories data from API.
this.loadCategories = function() {
return API.get('/api/categories' +
'?expand=resources' +
'&attributes=id,name,description,single_value,children');
};
}]);
| Rename fqdn to fqname in DialogEditorHttpService | Rename fqdn to fqname in DialogEditorHttpService
https://bugzilla.redhat.com/show_bug.cgi?id=1553846
| JavaScript | apache-2.0 | ManageIQ/manageiq-ui-classic,ManageIQ/manageiq-ui-classic,ManageIQ/manageiq-ui-classic,ManageIQ/manageiq-ui-classic | ---
+++
@@ -12,8 +12,8 @@
});
};
- this.treeSelectorLoadData = function(fqdn) {
- var url = '/tree/automate_entrypoint' + (fqdn ? '?fqdn=' + encodeURIComponent(fqdn) : '');
+ this.treeSelectorLoadData = function(fqname) {
+ var url = '/tree/automate_entrypoint' + (fqname ? '?fqname=' + encodeURIComponent(fqname) : '');
return $http.get(url).then(function(response) {
return response.data;
}); |
b3b78ff3a18bdfcc533e9f76e4d9ed251c4e6245 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
jshint: {
grunt: {
src: ['Gruntfile.js']
},
main: {
src: ['tock.js'],
options: {
'browser': true,
'camelcase': true,
'curly': true,
'eqeqeq': true,
'indent': 2,
'newcap': true,
'quotmark': 'single',
'unused': true
}
},
},
uglify: {
options: {
banner: '// Tock.js (version <%= pkg.version %>) <%= pkg.homepage %>\n// License: <%= pkg.license %>\n'
},
main: {
src: '<%= jshint.main.src %>',
dest: 'tock.min.js'
}
},
watch: {
main: {
files: '<%= jshint.main.src %>',
tasks: ['jshint:main', 'uglify:main']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint', 'uglify']);
};
| module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
jshint: {
grunt: {
src: ['Gruntfile.js']
},
main: {
src: ['tock.js'],
options: {
'browser': true,
'camelcase': true,
'curly': true,
'devel': true,
'eqeqeq': true,
'newcap': true,
'quotmark': 'single',
'undef': true,
'unused': true
}
},
},
uglify: {
options: {
banner: '// Tock.js (version <%= pkg.version %>) <%= pkg.homepage %>\n// License: <%= pkg.license %>\n'
},
main: {
src: '<%= jshint.main.src %>',
dest: 'tock.min.js'
}
},
watch: {
main: {
files: '<%= jshint.main.src %>',
tasks: ['jshint:main', 'uglify:main']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint', 'uglify']);
};
| Add missing "devel" and "undef". Remove "indent" since it was moved to jscs. | Add missing "devel" and "undef". Remove "indent" since it was moved to jscs.
| JavaScript | mit | Falc/Tock.js | ---
+++
@@ -11,10 +11,11 @@
'browser': true,
'camelcase': true,
'curly': true,
+ 'devel': true,
'eqeqeq': true,
- 'indent': 2,
'newcap': true,
'quotmark': 'single',
+ 'undef': true,
'unused': true
}
}, |
4b2c8b781b824ebbc56376cd897a26d79bdfca4b | app/src/home/intro-animation/intro-anim.js | app/src/home/intro-animation/intro-anim.js | require('./intro-anim.sass');
const isTouchDevice = 'ontouchstart' in document.documentElement;
const ev = isTouchDevice ? 'touchend' : 'click';
const delay = isTouchDevice ? 1050 : 550;
document.getElementById('corners').addEventListener(ev, () => setTimeout(() => {
console.log('Animation finished');
}, delay));
| require('./intro-anim.sass');
const isTouchDevice = 'ontouchstart' in document.documentElement;
const ev = isTouchDevice ? 'touchend' : 'click';
const delay = isTouchDevice ? 1050 : 550;
document.getElementById('corners').addEventListener(ev, () => setTimeout(() => {
alert('You\'re in!');
}, delay));
| Implement user-visible alert after interaction | Implement user-visible alert after interaction
| JavaScript | mit | arkis/arkis.io,arkis/arkis.io | ---
+++
@@ -5,5 +5,5 @@
const delay = isTouchDevice ? 1050 : 550;
document.getElementById('corners').addEventListener(ev, () => setTimeout(() => {
- console.log('Animation finished');
+ alert('You\'re in!');
}, delay)); |
cb92a155868f4a46472f4061640d9a93cbbf2cb2 | bin/migrations/migrations/20161028050220-unnamed-migration.js | bin/migrations/migrations/20161028050220-unnamed-migration.js | 'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.addColumn(
'Rescues',
'type',
{
type: Sequelize.ENUM('success', 'failure', 'invalid', 'other'),
allowNull: false,
defaultValue: 'other'
}
)
queryInterface.addColumn(
'Rescues',
'status',
{
type: Sequelize.ENUM('open', 'inactive', 'closed'),
allowNull: false,
defaultValue: 'other'
}
)
},
down: function (queryInterface) {
queryInterface.removeColumn('Rescues', 'type')
queryInterface.removeColumn('Rescues', 'status')
}
}
| 'use strict'
module.exports = {
up: function (queryInterface, Sequelize) {
queryInterface.addColumn(
'Rescues',
'type',
{
type: Sequelize.ENUM('success', 'failure', 'invalid', 'other'),
allowNull: false,
defaultValue: 'other'
}
)
queryInterface.addColumn(
'Rescues',
'status',
{
type: Sequelize.ENUM('open', 'inactive', 'closed'),
allowNull: false,
defaultValue: 'open'
}
)
},
down: function (queryInterface) {
queryInterface.removeColumn('Rescues', 'type')
queryInterface.removeColumn('Rescues', 'status')
}
}
| Use correct default value for status enum in migration | Use correct default value for status enum in migration
| JavaScript | bsd-3-clause | FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com,FuelRats/api.fuelrats.com | ---
+++
@@ -19,7 +19,7 @@
{
type: Sequelize.ENUM('open', 'inactive', 'closed'),
allowNull: false,
- defaultValue: 'other'
+ defaultValue: 'open'
}
)
}, |
71c798ac47b0e1c8ad4e10fd4e5a01a429a273bc | app/assets/javascripts/core/pixelator.js | app/assets/javascripts/core/pixelator.js | var Pixelator = function(data, partner) {
this.data = data;
this.partner = partner;
};
Pixelator.prototype = {
defaults: function() {
var default_context = this.data.context || {};
default_context.timestamp = new Date().getTime();
return default_context;
},
picker: function(key, options) {
var self = this;
_.each(this.data.pixels[key], function(pixel) {
if (pixel.partner && self.partner !== pixel.partner) {
return;
}
var gp = new GenericPixel({ context: options, pixel: pixel });
gp.insert();
});
},
run: function(key, options) {
options = _(options || {}).extend(this.defaults());
this.picker(key, options);
}
}
| var Pixelator = function(data, partner) {
this.data = data;
this.partner = partner;
};
Pixelator.prototype = {
defaults: function() {
var default_context = this.data.context || {};
default_context.timestamp = new Date().getTime();
return default_context;
},
picker: function(key, options) {
var self = this;
var keys = self.data.pixels[key];
if (!keys) { return; }
_.each(keys, function(pixel) {
if (pixel.partner && self.partner !== pixel.partner) {
return;
}
var gp = new GenericPixel({ context: options, pixel: pixel });
gp.insert();
});
},
run: function(key, options) {
options = _(options || {}).extend(this.defaults());
this.picker(key, options);
}
}
| Return out of Pixelator.picker if no keys are provided | Return out of Pixelator.picker if no keys are provided
| JavaScript | mit | howaboutwe/pixelator,howaboutwe/pixelator | ---
+++
@@ -11,8 +11,11 @@
},
picker: function(key, options) {
var self = this;
- _.each(this.data.pixels[key], function(pixel) {
+ var keys = self.data.pixels[key];
+ if (!keys) { return; }
+
+ _.each(keys, function(pixel) {
if (pixel.partner && self.partner !== pixel.partner) {
return;
} |
d7327f575048b5735bf65fa0e0fc666601e26e25 | script/lib/lint-java-script-paths.js | script/lib/lint-java-script-paths.js | 'use strict'
const path = require('path')
const {spawn} = require('child_process')
const CONFIG = require('../config')
module.exports = async function () {
return new Promise((resolve, reject) => {
const eslint = spawn(
path.join('script', 'node_modules', '.bin', 'eslint'),
['--cache', '--format', 'json', '.'],
{ cwd: CONFIG.repositoryRootPath }
)
let output = ''
let errorOutput = ''
eslint.stdout.on('data', data => {
output += data.toString()
})
eslint.stderr.on('data', data => {
errorOutput += data.toString()
})
eslint.on('error', error => reject(error))
eslint.on('close', exitCode => {
const errors = []
let files
try {
files = JSON.parse(output)
} catch (_) {
reject(errorOutput)
return
}
for (const file of files) {
for (const error of file.messages) {
errors.push({
path: file.filePath,
message: error.message,
lineNumber: error.line,
rule: error.ruleId
})
}
}
resolve(errors)
})
})
}
| 'use strict'
const path = require('path')
const {spawn} = require('child_process')
const process = require('process')
const CONFIG = require('../config')
module.exports = async function () {
return new Promise((resolve, reject) => {
const eslintArgs = ['--cache', '--format', 'json']
if (process.argv.includes('--fix')) {
eslintArgs.push('--fix')
}
const eslint = spawn(
path.join('script', 'node_modules', '.bin', 'eslint'),
[...eslintArgs, '.'],
{ cwd: CONFIG.repositoryRootPath }
)
let output = ''
let errorOutput = ''
eslint.stdout.on('data', data => {
output += data.toString()
})
eslint.stderr.on('data', data => {
errorOutput += data.toString()
})
eslint.on('error', error => reject(error))
eslint.on('close', exitCode => {
const errors = []
let files
try {
files = JSON.parse(output)
} catch (_) {
reject(errorOutput)
return
}
for (const file of files) {
for (const error of file.messages) {
errors.push({
path: file.filePath,
message: error.message,
lineNumber: error.line,
rule: error.ruleId
})
}
}
resolve(errors)
})
})
}
| Add script/lint --fix which fixes some code formatting issues via eslint | Add script/lint --fix which fixes some code formatting issues via eslint
| JavaScript | mit | brettle/atom,PKRoma/atom,PKRoma/atom,brettle/atom,atom/atom,Mokolea/atom,atom/atom,PKRoma/atom,Mokolea/atom,Mokolea/atom,brettle/atom,atom/atom | ---
+++
@@ -2,14 +2,21 @@
const path = require('path')
const {spawn} = require('child_process')
+const process = require('process')
const CONFIG = require('../config')
module.exports = async function () {
return new Promise((resolve, reject) => {
+ const eslintArgs = ['--cache', '--format', 'json']
+
+ if (process.argv.includes('--fix')) {
+ eslintArgs.push('--fix')
+ }
+
const eslint = spawn(
path.join('script', 'node_modules', '.bin', 'eslint'),
- ['--cache', '--format', 'json', '.'],
+ [...eslintArgs, '.'],
{ cwd: CONFIG.repositoryRootPath }
)
|
78fa674d525f1165a26932c3b1dcb65da6f5f8e2 | scripts/get-latest-platform-tests.js | scripts/get-latest-platform-tests.js | "use strict";
if (process.env.NO_UPDATE) {
process.exit(0);
}
const path = require("path");
const fs = require("fs");
const request = require("request");
// Pin to specific version, reflecting the spec version in the readme.
// At the moment we are pinned to a branch.
//
// To get the latest commit:
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
const commitHash = "d93247d5cb7d70f80da8b154a171f4e3d50969f4";
const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`;
const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`;
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
request.get(sourceURL)
.pipe(fs.createWriteStream(path.resolve(targetDir, "urltestdata.json")));
request.get(setterSourceURL)
.pipe(fs.createWriteStream(path.resolve(targetDir, "setters_tests.json")));
| "use strict";
if (process.env.NO_UPDATE) {
process.exit(0);
}
const path = require("path");
const fs = require("fs");
const request = require("request");
// Pin to specific version, reflecting the spec version in the readme.
// At the moment we are pinned to a branch.
//
// To get the latest commit:
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
const commitHash = "1e1e80441b8d6a60f836de4005dba25698ecfe4a";
const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`;
const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`;
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
request.get(sourceURL)
.pipe(fs.createWriteStream(path.resolve(targetDir, "urltestdata.json")));
request.get(setterSourceURL)
.pipe(fs.createWriteStream(path.resolve(targetDir, "setters_tests.json")));
| Update to the latest web platform tests | Update to the latest web platform tests
These just add additional coverage.
| JavaScript | mit | jsdom/whatwg-url,jsdom/whatwg-url,jsdom/whatwg-url | ---
+++
@@ -15,7 +15,7 @@
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
-const commitHash = "d93247d5cb7d70f80da8b154a171f4e3d50969f4";
+const commitHash = "1e1e80441b8d6a60f836de4005dba25698ecfe4a";
const sourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/urltestdata.json`;
const setterSourceURL = `https://raw.githubusercontent.com/w3c/web-platform-tests/${commitHash}/url/setters_tests.json`; |
9fc4be566d1d4f7f68eafc35c4659cb246654936 | test/setup.js | test/setup.js | require('babel-register');
require('coffee-script/register');
| require('coffee-script/register');
require('babel-register');
require('source-map-support').install({ handleUncaughtExceptions: false, hookRequire: true });
| Fix stack traces for errors happening inside coffee-script tests. | fix: Fix stack traces for errors happening inside coffee-script tests.
Both `coffee-script` as well as `source-map-support` (loaded through `babel-register`) patch `Error.prepareStackTrace` to modify stack traces to point to correct error locations for transpiled code. Unfortunately, these two patches don't play well together.
But `coffee-script/register` automatically generates inline source maps, which `source-map-support` has support for via the `hookRequire` option. So in the end, we can make those two play together by configuring `source-map-support` correctly.
| JavaScript | mit | tediousjs/tedious,tediousjs/tedious,pekim/tedious | ---
+++
@@ -1,2 +1,3 @@
+require('coffee-script/register');
require('babel-register');
-require('coffee-script/register');
+require('source-map-support').install({ handleUncaughtExceptions: false, hookRequire: true }); |
1142e1ddb10699a59790b1a144ca3570a307cc8a | examples/official-storybook/stories/core/rendering.stories.js | examples/official-storybook/stories/core/rendering.stories.js | import React, { useRef } from 'react';
export default {
title: 'Core/Rendering',
};
// NOTE: in our example apps each component is mounted twice as we render in strict mode
let timesMounted = 0;
export const Counter = () => {
const countRef = useRef();
if (!countRef.current) timesMounted += 1;
countRef.current = (countRef.current || 0) + 1;
return (
<div>
Mounted: {timesMounted}, rendered (this mount): {countRef.current}
</div>
);
};
| import React, { useEffect, useRef } from 'react';
import { useArgs } from '@storybook/client-api';
export default {
title: 'Core/Rendering',
};
// NOTE: in our example apps each component is mounted twice as we render in strict mode
let timesCounterMounted = 0;
export const Counter = () => {
const countRef = useRef();
if (!countRef.current) timesCounterMounted += 1;
countRef.current = (countRef.current || 0) + 1;
return (
<div>
Mounted: {timesCounterMounted}, rendered (this mount): {countRef.current}
</div>
);
};
// An example to test what happens when the story is remounted due to argChanges
let timesArgsChangeMounted = 0;
export const ArgsChange = () => {
const countRef = useRef();
if (!countRef.current) timesArgsChangeMounted += 1;
countRef.current = true;
return (
<div>
Mounted: {timesArgsChangeMounted} (NOTE: we use strict mode so this number is 2x what you'd
expect -- it should be 2, not 4 though!)
</div>
);
};
ArgsChange.args = {
first: 0,
};
ArgsChange.decorators = [
(StoryFn) => {
const [args, updateArgs] = useArgs();
useEffect(() => {
if (args.first === 0) {
updateArgs({ first: 1 });
}
}, []);
return <StoryFn />;
},
];
| Add an example to highlight if a story renders too many times | Add an example to highlight if a story renders too many times
| JavaScript | mit | storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook | ---
+++
@@ -1,20 +1,55 @@
-import React, { useRef } from 'react';
+import React, { useEffect, useRef } from 'react';
+import { useArgs } from '@storybook/client-api';
export default {
title: 'Core/Rendering',
};
// NOTE: in our example apps each component is mounted twice as we render in strict mode
-let timesMounted = 0;
+let timesCounterMounted = 0;
export const Counter = () => {
const countRef = useRef();
- if (!countRef.current) timesMounted += 1;
+ if (!countRef.current) timesCounterMounted += 1;
countRef.current = (countRef.current || 0) + 1;
return (
<div>
- Mounted: {timesMounted}, rendered (this mount): {countRef.current}
+ Mounted: {timesCounterMounted}, rendered (this mount): {countRef.current}
</div>
);
};
+
+// An example to test what happens when the story is remounted due to argChanges
+let timesArgsChangeMounted = 0;
+export const ArgsChange = () => {
+ const countRef = useRef();
+
+ if (!countRef.current) timesArgsChangeMounted += 1;
+ countRef.current = true;
+
+ return (
+ <div>
+ Mounted: {timesArgsChangeMounted} (NOTE: we use strict mode so this number is 2x what you'd
+ expect -- it should be 2, not 4 though!)
+ </div>
+ );
+};
+
+ArgsChange.args = {
+ first: 0,
+};
+
+ArgsChange.decorators = [
+ (StoryFn) => {
+ const [args, updateArgs] = useArgs();
+
+ useEffect(() => {
+ if (args.first === 0) {
+ updateArgs({ first: 1 });
+ }
+ }, []);
+
+ return <StoryFn />;
+ },
+]; |
4f1c5dd238b101a57207708e84da229364572eb9 | app/index.js | app/index.js | 'use strict';
var generators = require('yeoman-generator'),
_ = require('lodash');
module.exports = generators.Base.extend({
constructor: function () {
generators.Base.apply(this, arguments);
this.argument('appname', { type: String, required: true });
// And you can then access it later on this way; e.g. CamelCased
this.viewName = _.startCase(this.appname);
this.appname = _.camelCase(this.appname);
this.kebabName = _.kebabCase(this.appname);
},
writing: function () {
this.copy('_bs-config.js', 'bs-config.js');
this.copy('_eslintrc', '.eslintrc');
// this.copy('_gulpfile.js', 'gulpfile.js');
this.copy('_package.json', 'package.json');
this.copy('_webpack.config.js', 'webpack.config.js');
this.copy('_karma.conf.js', 'karma.conf.js');
this.copy('gitignore', '.gitignore');
this.copy('src/_index.html', 'src/index.html');
// this.copy('src/_index.html', 'build/index.html');
this.copy('src/_app.js', 'src/app.js');
this.directory('src/common', 'src/common');
this.directory('src/assets', 'src/assets');
this.directory('src/home', 'src/home');
},
install: function() {
this.installDependencies({
bower: false,
npm: true
});
}
});
| 'use strict';
var generators = require('yeoman-generator'),
_ = require('lodash');
module.exports = generators.Base.extend({
constructor: function () {
generators.Base.apply(this, arguments);
this.argument('appname', { type: String, required: true });
this.viewName = _.startCase(this.appname);
this.appname = _.camelCase(this.appname);
this.kebabName = _.kebabCase(this.appname);
},
writing: function () {
this.copy('_bs-config.js', 'bs-config.js');
this.copy('_eslintrc', '.eslintrc');
this.copy('_package.json', 'package.json');
this.copy('_webpack.config.js', 'webpack.config.js');
this.copy('_karma.conf.js', 'karma.conf.js');
this.copy('gitignore', '.gitignore');
this.copy('_README.md', 'README.md');
this.directory('src', 'src');
},
install: function() {
this.installDependencies({
bower: false,
npm: true
});
}
});
| Copy entire src directory not file by file | Copy entire src directory not file by file
| JavaScript | isc | rudijs/generator-ngpack,rudijs/generator-ngpack,rudijs/generator-ngpack | ---
+++
@@ -10,7 +10,6 @@
this.argument('appname', { type: String, required: true });
- // And you can then access it later on this way; e.g. CamelCased
this.viewName = _.startCase(this.appname);
this.appname = _.camelCase(this.appname);
this.kebabName = _.kebabCase(this.appname);
@@ -19,18 +18,12 @@
writing: function () {
this.copy('_bs-config.js', 'bs-config.js');
this.copy('_eslintrc', '.eslintrc');
- // this.copy('_gulpfile.js', 'gulpfile.js');
this.copy('_package.json', 'package.json');
this.copy('_webpack.config.js', 'webpack.config.js');
this.copy('_karma.conf.js', 'karma.conf.js');
this.copy('gitignore', '.gitignore');
-
- this.copy('src/_index.html', 'src/index.html');
- // this.copy('src/_index.html', 'build/index.html');
- this.copy('src/_app.js', 'src/app.js');
- this.directory('src/common', 'src/common');
- this.directory('src/assets', 'src/assets');
- this.directory('src/home', 'src/home');
+ this.copy('_README.md', 'README.md');
+ this.directory('src', 'src');
},
install: function() { |
a4960ee0a4e0e95d86774bc7ebaaad74bf8695e6 | src/Read.js | src/Read.js | function getDocuments(path, email, key, projectId) {
const token = getAuthToken_(email, key);
const baseUrl = "https://firestore.googleapis.com/v1beta1/projects/" + projectId + "/databases/(default)/documents/" + path;
const options = {
'muteHttpExceptions' : true,
'headers': {'content-type': 'application/json', 'Authorization': 'Bearer ' + token}
};
return getObjectFromResponse(UrlFetchApp.fetch(baseUrl, options));
} | function get(path, email, key, projectId) {
const token = getAuthToken_(email, key);
const baseUrl = "https://firestore.googleapis.com/v1beta1/projects/" + projectId + "/databases/(default)/documents/" + path;
const options = {
'muteHttpExceptions' : true,
'headers': {'content-type': 'application/json', 'Authorization': 'Bearer ' + token}
};
return getObjectFromResponse(UrlFetchApp.fetch(baseUrl, options));
} | Update getDocuments function to be a general GET function | Update getDocuments function to be a general GET function
| JavaScript | mit | grahamearley/FirestoreGoogleAppsScript | ---
+++
@@ -1,4 +1,4 @@
-function getDocuments(path, email, key, projectId) {
+function get(path, email, key, projectId) {
const token = getAuthToken_(email, key);
const baseUrl = "https://firestore.googleapis.com/v1beta1/projects/" + projectId + "/databases/(default)/documents/" + path; |
2601075b3380a6488e8fe6adc45fcbf840d5897f | packages/accounts-google/google_client.js | packages/accounts-google/google_client.js | Meteor.loginWithGoogle = function (options, callback) {
// support both (options, callback) and (callback).
if (!callback && typeof options === 'function') {
callback = options;
options = {};
}
var config = Accounts.loginServiceConfiguration.findOne({service: 'google'});
if (!config) {
callback && callback(new Accounts.ConfigError("Service not configured"));
return;
}
var state = Random.id();
// always need this to get user id from google.
var requiredScope = ['https://www.googleapis.com/auth/userinfo.profile'];
var scope = ['https://www.googleapis.com/auth/userinfo.email'];
if (options && options.requestPermissions)
scope = options.requestPermissions;
scope = _.union(scope, requiredScope);
var flatScope = _.map(scope, encodeURIComponent).join('+');
// https://developers.google.com/accounts/docs/OAuth2WebServer#formingtheurl
var accessType = options.requestOfflineToken ? 'offline' : 'online';
var loginUrl =
'https://accounts.google.com/o/oauth2/auth' +
'?response_type=code' +
'&client_id=' + config.clientId +
'&scope=' + flatScope +
'&redirect_uri=' + Meteor.absoluteUrl('_oauth/google?close') +
'&state=' + state +
'&access_type=' + accessType;
Accounts.oauth.initiateLogin(state, loginUrl, callback);
};
| Meteor.loginWithGoogle = function (options, callback) {
// support both (options, callback) and (callback).
if (!callback && typeof options === 'function') {
callback = options;
options = {};
} else if (!options) {
options = {};
}
var config = Accounts.loginServiceConfiguration.findOne({service: 'google'});
if (!config) {
callback && callback(new Accounts.ConfigError("Service not configured"));
return;
}
var state = Random.id();
// always need this to get user id from google.
var requiredScope = ['https://www.googleapis.com/auth/userinfo.profile'];
var scope = ['https://www.googleapis.com/auth/userinfo.email'];
if (options.requestPermissions)
scope = options.requestPermissions;
scope = _.union(scope, requiredScope);
var flatScope = _.map(scope, encodeURIComponent).join('+');
// https://developers.google.com/accounts/docs/OAuth2WebServer#formingtheurl
var accessType = options.requestOfflineToken ? 'offline' : 'online';
var loginUrl =
'https://accounts.google.com/o/oauth2/auth' +
'?response_type=code' +
'&client_id=' + config.clientId +
'&scope=' + flatScope +
'&redirect_uri=' + Meteor.absoluteUrl('_oauth/google?close') +
'&state=' + state +
'&access_type=' + accessType;
Accounts.oauth.initiateLogin(state, loginUrl, callback);
};
| Fix error on Meteor.loginWithGoogle() with no args | Fix error on Meteor.loginWithGoogle() with no args | JavaScript | mit | papimomi/meteor,aramk/meteor,dev-bobsong/meteor,yiliaofan/meteor,brdtrpp/meteor,zdd910/meteor,AlexR1712/meteor,lieuwex/meteor,juansgaitan/meteor,codingang/meteor,cog-64/meteor,yiliaofan/meteor,4commerce-technologies-AG/meteor,nuvipannu/meteor,Hansoft/meteor,jenalgit/meteor,cog-64/meteor,planet-training/meteor,Jeremy017/meteor,lieuwex/meteor,henrypan/meteor,zdd910/meteor,jg3526/meteor,somallg/meteor,Jonekee/meteor,rozzzly/meteor,msavin/meteor,vacjaliu/meteor,alexbeletsky/meteor,pandeysoni/meteor,yonglehou/meteor,GrimDerp/meteor,meonkeys/meteor,SeanOceanHu/meteor,modulexcite/meteor,justintung/meteor,lassombra/meteor,jrudio/meteor,codedogfish/meteor,daltonrenaldo/meteor,mubassirhayat/meteor,karlito40/meteor,GrimDerp/meteor,fashionsun/meteor,yonas/meteor-freebsd,mauricionr/meteor,justintung/meteor,dev-bobsong/meteor,aramk/meteor,ashwathgovind/meteor,DAB0mB/meteor,cbonami/meteor,qscripter/meteor,allanalexandre/meteor,queso/meteor,alexbeletsky/meteor,daslicht/meteor,Ken-Liu/meteor,skarekrow/meteor,rabbyalone/meteor,newswim/meteor,yyx990803/meteor,yanisIk/meteor,deanius/meteor,sclausen/meteor,planet-training/meteor,shmiko/meteor,aramk/meteor,yinhe007/meteor,cbonami/meteor,aramk/meteor,namho102/meteor,newswim/meteor,oceanzou123/meteor,esteedqueen/meteor,ashwathgovind/meteor,imanmafi/meteor,dfischer/meteor,skarekrow/meteor,sdeveloper/meteor,rabbyalone/meteor,henrypan/meteor,TechplexEngineer/meteor,msavin/meteor,eluck/meteor,baiyunping333/meteor,planet-training/meteor,Puena/meteor,youprofit/meteor,LWHTarena/meteor,hristaki/meteor,l0rd0fwar/meteor,Jeremy017/meteor,cog-64/meteor,EduShareOntario/meteor,sitexa/meteor,TribeMedia/meteor,AnjirHossain/meteor,TechplexEngineer/meteor,meonkeys/meteor,calvintychan/meteor,aldeed/meteor,jdivy/meteor,judsonbsilva/meteor,Eynaliyev/meteor,jdivy/meteor,Eynaliyev/meteor,dfischer/meteor,shrop/meteor,SeanOceanHu/meteor,yiliaofan/meteor,shadedprofit/meteor,neotim/meteor,codingang/meteor,wmkcc/meteor,pjump/meteor,ashwathgovind/meteor,mubassirhayat/meteor,elkingtonmcb/meteor,alexbeletsky/meteor,paul-barry-kenzan/meteor,PatrickMcGuinness/meteor,ljack/meteor,iman-mafi/meteor,zdd910/meteor,JesseQin/meteor,arunoda/meteor,iman-mafi/meteor,AnjirHossain/meteor,LWHTarena/meteor,sclausen/meteor,stevenliuit/meteor,baiyunping333/meteor,stevenliuit/meteor,papimomi/meteor,udhayam/meteor,skarekrow/meteor,ericterpstra/meteor,HugoRLopes/meteor,zdd910/meteor,l0rd0fwar/meteor,Quicksteve/meteor,elkingtonmcb/meteor,vjau/meteor,shmiko/meteor,codedogfish/meteor,DCKT/meteor,IveWong/meteor,chmac/meteor,l0rd0fwar/meteor,cherbst/meteor,colinligertwood/meteor,chinasb/meteor,D1no/meteor,baysao/meteor,GrimDerp/meteor,daltonrenaldo/meteor,brettle/meteor,Paulyoufu/meteor-1,Prithvi-A/meteor,Ken-Liu/meteor,guazipi/meteor,tdamsma/meteor,williambr/meteor,colinligertwood/meteor,whip112/meteor,katopz/meteor,sdeveloper/meteor,kengchau/meteor,Profab/meteor,Urigo/meteor,yinhe007/meteor,Profab/meteor,GrimDerp/meteor,jdivy/meteor,karlito40/meteor,whip112/meteor,sitexa/meteor,ericterpstra/meteor,Profab/meteor,namho102/meteor,Prithvi-A/meteor,Paulyoufu/meteor-1,stevenliuit/meteor,chasertech/meteor,vacjaliu/meteor,framewr/meteor,guazipi/meteor,esteedqueen/meteor,meteor-velocity/meteor,brettle/meteor,newswim/meteor,chasertech/meteor,pandeysoni/meteor,IveWong/meteor,jenalgit/meteor,lorensr/meteor,4commerce-technologies-AG/meteor,imanmafi/meteor,shadedprofit/meteor,baiyunping333/meteor,ericterpstra/meteor,EduShareOntario/meteor,baysao/meteor,papimomi/meteor,fashionsun/meteor,AlexR1712/meteor,yalexx/meteor,LWHTarena/meteor,chiefninew/meteor,DAB0mB/meteor,udhayam/meteor,iman-mafi/meteor,justintung/meteor,jg3526/meteor,yyx990803/meteor,Ken-Liu/meteor,chiefninew/meteor,DCKT/meteor,elkingtonmcb/meteor,GrimDerp/meteor,jrudio/meteor,TribeMedia/meteor,jg3526/meteor,EduShareOntario/meteor,paul-barry-kenzan/meteor,framewr/meteor,kencheung/meteor,chmac/meteor,fashionsun/meteor,allanalexandre/meteor,justintung/meteor,cherbst/meteor,Prithvi-A/meteor,baiyunping333/meteor,pandeysoni/meteor,luohuazju/meteor,yonas/meteor-freebsd,meteor-velocity/meteor,lpinto93/meteor,Paulyoufu/meteor-1,benstoltz/meteor,TribeMedia/meteor,sdeveloper/meteor,papimomi/meteor,tdamsma/meteor,eluck/meteor,lassombra/meteor,Prithvi-A/meteor,jagi/meteor,justintung/meteor,jg3526/meteor,steedos/meteor,msavin/meteor,akintoey/meteor,saisai/meteor,chinasb/meteor,AnthonyAstige/meteor,lieuwex/meteor,paul-barry-kenzan/meteor,cherbst/meteor,paul-barry-kenzan/meteor,papimomi/meteor,somallg/meteor,emmerge/meteor,msavin/meteor,whip112/meteor,chengxiaole/meteor,D1no/meteor,baysao/meteor,luohuazju/meteor,mjmasn/meteor,pandeysoni/meteor,jenalgit/meteor,mauricionr/meteor,aleclarson/meteor,katopz/meteor,meteor-velocity/meteor,tdamsma/meteor,lawrenceAIO/meteor,eluck/meteor,michielvanoeffelen/meteor,jagi/meteor,johnthepink/meteor,pandeysoni/meteor,skarekrow/meteor,evilemon/meteor,codedogfish/meteor,JesseQin/meteor,sdeveloper/meteor,Theviajerock/meteor,AnthonyAstige/meteor,Quicksteve/meteor,chasertech/meteor,colinligertwood/meteor,TechplexEngineer/meteor,rozzzly/meteor,meonkeys/meteor,yalexx/meteor,youprofit/meteor,ashwathgovind/meteor,TribeMedia/meteor,luohuazju/meteor,l0rd0fwar/meteor,udhayam/meteor,rozzzly/meteor,yyx990803/meteor,whip112/meteor,stevenliuit/meteor,planet-training/meteor,shrop/meteor,shrop/meteor,brdtrpp/meteor,lieuwex/meteor,jenalgit/meteor,yyx990803/meteor,mubassirhayat/meteor,chengxiaole/meteor,Eynaliyev/meteor,sunny-g/meteor,dev-bobsong/meteor,TechplexEngineer/meteor,lieuwex/meteor,steedos/meteor,wmkcc/meteor,AnthonyAstige/meteor,pjump/meteor,johnthepink/meteor,tdamsma/meteor,oceanzou123/meteor,lieuwex/meteor,wmkcc/meteor,rozzzly/meteor,chengxiaole/meteor,johnthepink/meteor,lpinto93/meteor,HugoRLopes/meteor,Paulyoufu/meteor-1,4commerce-technologies-AG/meteor,judsonbsilva/meteor,michielvanoeffelen/meteor,cog-64/meteor,Eynaliyev/meteor,vjau/meteor,rabbyalone/meteor,TribeMedia/meteor,aramk/meteor,meteor-velocity/meteor,Profab/meteor,akintoey/meteor,luohuazju/meteor,Paulyoufu/meteor-1,kidaa/meteor,Jonekee/meteor,dboyliao/meteor,shmiko/meteor,ndarilek/meteor,dboyliao/meteor,cbonami/meteor,rozzzly/meteor,akintoey/meteor,whip112/meteor,jirengu/meteor,devgrok/meteor,lorensr/meteor,skarekrow/meteor,joannekoong/meteor,johnthepink/meteor,brdtrpp/meteor,meteor-velocity/meteor,benjamn/meteor,evilemon/meteor,alexbeletsky/meteor,colinligertwood/meteor,ashwathgovind/meteor,Paulyoufu/meteor-1,nuvipannu/meteor,vjau/meteor,henrypan/meteor,skarekrow/meteor,modulexcite/meteor,PatrickMcGuinness/meteor,daltonrenaldo/meteor,jirengu/meteor,jagi/meteor,mirstan/meteor,mauricionr/meteor,iman-mafi/meteor,lorensr/meteor,youprofit/meteor,oceanzou123/meteor,dev-bobsong/meteor,jeblister/meteor,cbonami/meteor,papimomi/meteor,servel333/meteor,l0rd0fwar/meteor,jagi/meteor,jagi/meteor,vjau/meteor,D1no/meteor,eluck/meteor,mjmasn/meteor,ljack/meteor,Profab/meteor,lassombra/meteor,queso/meteor,TechplexEngineer/meteor,yonas/meteor-freebsd,esteedqueen/meteor,benjamn/meteor,saisai/meteor,Hansoft/meteor,HugoRLopes/meteor,chasertech/meteor,qscripter/meteor,Jeremy017/meteor,planet-training/meteor,devgrok/meteor,D1no/meteor,sunny-g/meteor,dandv/meteor,evilemon/meteor,Puena/meteor,framewr/meteor,emmerge/meteor,brdtrpp/meteor,vacjaliu/meteor,Paulyoufu/meteor-1,Quicksteve/meteor,evilemon/meteor,allanalexandre/meteor,jeblister/meteor,tdamsma/meteor,saisai/meteor,framewr/meteor,ndarilek/meteor,benstoltz/meteor,somallg/meteor,deanius/meteor,udhayam/meteor,codingang/meteor,PatrickMcGuinness/meteor,pjump/meteor,sitexa/meteor,yonglehou/meteor,yinhe007/meteor,DCKT/meteor,aldeed/meteor,chengxiaole/meteor,lawrenceAIO/meteor,akintoey/meteor,jeblister/meteor,jrudio/meteor,mauricionr/meteor,codingang/meteor,esteedqueen/meteor,cherbst/meteor,codedogfish/meteor,dandv/meteor,yalexx/meteor,Puena/meteor,jirengu/meteor,Theviajerock/meteor,chiefninew/meteor,dboyliao/meteor,codedogfish/meteor,bhargav175/meteor,akintoey/meteor,alphanso/meteor,Hansoft/meteor,luohuazju/meteor,evilemon/meteor,brdtrpp/meteor,jdivy/meteor,jenalgit/meteor,emmerge/meteor,calvintychan/meteor,lorensr/meteor,kidaa/meteor,h200863057/meteor,DCKT/meteor,shrop/meteor,jagi/meteor,newswim/meteor,karlito40/meteor,modulexcite/meteor,HugoRLopes/meteor,brettle/meteor,judsonbsilva/meteor,meteor-velocity/meteor,nuvipannu/meteor,jrudio/meteor,Urigo/meteor,arunoda/meteor,joannekoong/meteor,Theviajerock/meteor,daslicht/meteor,newswim/meteor,chasertech/meteor,benstoltz/meteor,chmac/meteor,chmac/meteor,AnthonyAstige/meteor,JesseQin/meteor,jdivy/meteor,chengxiaole/meteor,ljack/meteor,h200863057/meteor,kencheung/meteor,udhayam/meteor,cherbst/meteor,PatrickMcGuinness/meteor,DAB0mB/meteor,sunny-g/meteor,AnjirHossain/meteor,deanius/meteor,oceanzou123/meteor,iman-mafi/meteor,yonas/meteor-freebsd,katopz/meteor,mubassirhayat/meteor,h200863057/meteor,sunny-g/meteor,elkingtonmcb/meteor,sunny-g/meteor,sdeveloper/meteor,joannekoong/meteor,daltonrenaldo/meteor,allanalexandre/meteor,jirengu/meteor,jdivy/meteor,mirstan/meteor,brettle/meteor,mjmasn/meteor,michielvanoeffelen/meteor,katopz/meteor,mirstan/meteor,DAB0mB/meteor,chasertech/meteor,guazipi/meteor,EduShareOntario/meteor,D1no/meteor,eluck/meteor,emmerge/meteor,h200863057/meteor,Hansoft/meteor,lassombra/meteor,sclausen/meteor,yyx990803/meteor,AnjirHossain/meteor,benjamn/meteor,evilemon/meteor,baiyunping333/meteor,neotim/meteor,pjump/meteor,ndarilek/meteor,somallg/meteor,alphanso/meteor,jeblister/meteor,imanmafi/meteor,kencheung/meteor,namho102/meteor,kidaa/meteor,bhargav175/meteor,ndarilek/meteor,mubassirhayat/meteor,yinhe007/meteor,rozzzly/meteor,Prithvi-A/meteor,calvintychan/meteor,henrypan/meteor,meteor-velocity/meteor,karlito40/meteor,Hansoft/meteor,EduShareOntario/meteor,ericterpstra/meteor,TechplexEngineer/meteor,fashionsun/meteor,aleclarson/meteor,eluck/meteor,Theviajerock/meteor,alphanso/meteor,luohuazju/meteor,SeanOceanHu/meteor,guazipi/meteor,michielvanoeffelen/meteor,sunny-g/meteor,shrop/meteor,daslicht/meteor,shadedprofit/meteor,guazipi/meteor,vacjaliu/meteor,qscripter/meteor,lpinto93/meteor,lpinto93/meteor,fashionsun/meteor,paul-barry-kenzan/meteor,juansgaitan/meteor,dboyliao/meteor,jrudio/meteor,servel333/meteor,somallg/meteor,aldeed/meteor,AnthonyAstige/meteor,mirstan/meteor,judsonbsilva/meteor,HugoRLopes/meteor,sitexa/meteor,JesseQin/meteor,msavin/meteor,qscripter/meteor,skarekrow/meteor,bhargav175/meteor,GrimDerp/meteor,yanisIk/meteor,namho102/meteor,qscripter/meteor,williambr/meteor,cog-64/meteor,IveWong/meteor,daltonrenaldo/meteor,deanius/meteor,dev-bobsong/meteor,jg3526/meteor,imanmafi/meteor,rabbyalone/meteor,williambr/meteor,AlexR1712/meteor,JesseQin/meteor,iman-mafi/meteor,servel333/meteor,joannekoong/meteor,yanisIk/meteor,jg3526/meteor,DCKT/meteor,queso/meteor,fashionsun/meteor,judsonbsilva/meteor,devgrok/meteor,yyx990803/meteor,steedos/meteor,youprofit/meteor,yonas/meteor-freebsd,aldeed/meteor,meonkeys/meteor,Puena/meteor,oceanzou123/meteor,alphanso/meteor,michielvanoeffelen/meteor,joannekoong/meteor,planet-training/meteor,whip112/meteor,shadedprofit/meteor,dandv/meteor,akintoey/meteor,cbonami/meteor,ljack/meteor,AlexR1712/meteor,lassombra/meteor,ashwathgovind/meteor,EduShareOntario/meteor,chiefninew/meteor,queso/meteor,zdd910/meteor,LWHTarena/meteor,elkingtonmcb/meteor,dfischer/meteor,saisai/meteor,baysao/meteor,servel333/meteor,joannekoong/meteor,mubassirhayat/meteor,vacjaliu/meteor,yanisIk/meteor,kencheung/meteor,4commerce-technologies-AG/meteor,Eynaliyev/meteor,Eynaliyev/meteor,JesseQin/meteor,mubassirhayat/meteor,esteedqueen/meteor,benjamn/meteor,Jonekee/meteor,karlito40/meteor,vacjaliu/meteor,benstoltz/meteor,Puena/meteor,karlito40/meteor,devgrok/meteor,jeblister/meteor,yalexx/meteor,aldeed/meteor,ericterpstra/meteor,yanisIk/meteor,DCKT/meteor,mirstan/meteor,DAB0mB/meteor,chinasb/meteor,dfischer/meteor,sclausen/meteor,alexbeletsky/meteor,yonglehou/meteor,kencheung/meteor,iman-mafi/meteor,bhargav175/meteor,joannekoong/meteor,lpinto93/meteor,Quicksteve/meteor,Urigo/meteor,chinasb/meteor,cbonami/meteor,sunny-g/meteor,karlito40/meteor,shrop/meteor,yiliaofan/meteor,daslicht/meteor,juansgaitan/meteor,h200863057/meteor,chengxiaole/meteor,guazipi/meteor,somallg/meteor,meonkeys/meteor,IveWong/meteor,deanius/meteor,Jeremy017/meteor,daslicht/meteor,vacjaliu/meteor,tdamsma/meteor,PatrickMcGuinness/meteor,imanmafi/meteor,AnthonyAstige/meteor,sitexa/meteor,benjamn/meteor,lassombra/meteor,esteedqueen/meteor,LWHTarena/meteor,alphanso/meteor,eluck/meteor,arunoda/meteor,oceanzou123/meteor,SeanOceanHu/meteor,codingang/meteor,shadedprofit/meteor,servel333/meteor,brettle/meteor,IveWong/meteor,dandv/meteor,steedos/meteor,saisai/meteor,mauricionr/meteor,alexbeletsky/meteor,alphanso/meteor,kengchau/meteor,D1no/meteor,sclausen/meteor,yinhe007/meteor,rabbyalone/meteor,henrypan/meteor,lpinto93/meteor,luohuazju/meteor,Ken-Liu/meteor,dboyliao/meteor,mjmasn/meteor,Quicksteve/meteor,baiyunping333/meteor,hristaki/meteor,yyx990803/meteor,emmerge/meteor,juansgaitan/meteor,shmiko/meteor,pjump/meteor,ndarilek/meteor,yalexx/meteor,kidaa/meteor,daslicht/meteor,williambr/meteor,HugoRLopes/meteor,katopz/meteor,SeanOceanHu/meteor,arunoda/meteor,yonas/meteor-freebsd,dandv/meteor,AlexR1712/meteor,youprofit/meteor,shmiko/meteor,sclausen/meteor,Theviajerock/meteor,lawrenceAIO/meteor,chasertech/meteor,ljack/meteor,Urigo/meteor,lorensr/meteor,lawrenceAIO/meteor,Urigo/meteor,saisai/meteor,henrypan/meteor,SeanOceanHu/meteor,baysao/meteor,devgrok/meteor,Ken-Liu/meteor,yiliaofan/meteor,jeblister/meteor,saisai/meteor,ljack/meteor,newswim/meteor,imanmafi/meteor,kengchau/meteor,rozzzly/meteor,chmac/meteor,arunoda/meteor,calvintychan/meteor,hristaki/meteor,chmac/meteor,Urigo/meteor,katopz/meteor,juansgaitan/meteor,papimomi/meteor,jagi/meteor,Urigo/meteor,emmerge/meteor,mubassirhayat/meteor,devgrok/meteor,AnthonyAstige/meteor,eluck/meteor,sclausen/meteor,kidaa/meteor,baiyunping333/meteor,youprofit/meteor,vjau/meteor,sunny-g/meteor,lorensr/meteor,framewr/meteor,steedos/meteor,namho102/meteor,judsonbsilva/meteor,lieuwex/meteor,DAB0mB/meteor,daltonrenaldo/meteor,yanisIk/meteor,stevenliuit/meteor,williambr/meteor,jirengu/meteor,ericterpstra/meteor,ashwathgovind/meteor,modulexcite/meteor,cherbst/meteor,wmkcc/meteor,Hansoft/meteor,modulexcite/meteor,bhargav175/meteor,Jeremy017/meteor,PatrickMcGuinness/meteor,Prithvi-A/meteor,AnjirHossain/meteor,Jeremy017/meteor,Jeremy017/meteor,D1no/meteor,jeblister/meteor,kengchau/meteor,cog-64/meteor,chinasb/meteor,mauricionr/meteor,mjmasn/meteor,codingang/meteor,neotim/meteor,alexbeletsky/meteor,ljack/meteor,SeanOceanHu/meteor,codingang/meteor,hristaki/meteor,chiefninew/meteor,queso/meteor,AlexR1712/meteor,servel333/meteor,LWHTarena/meteor,chinasb/meteor,ndarilek/meteor,yanisIk/meteor,arunoda/meteor,williambr/meteor,steedos/meteor,Theviajerock/meteor,benstoltz/meteor,codedogfish/meteor,4commerce-technologies-AG/meteor,brettle/meteor,JesseQin/meteor,johnthepink/meteor,zdd910/meteor,lassombra/meteor,udhayam/meteor,lorensr/meteor,rabbyalone/meteor,servel333/meteor,D1no/meteor,jenalgit/meteor,shmiko/meteor,hristaki/meteor,cbonami/meteor,whip112/meteor,shadedprofit/meteor,neotim/meteor,yinhe007/meteor,brdtrpp/meteor,l0rd0fwar/meteor,dfischer/meteor,arunoda/meteor,meonkeys/meteor,evilemon/meteor,TribeMedia/meteor,Hansoft/meteor,neotim/meteor,mirstan/meteor,Quicksteve/meteor,lawrenceAIO/meteor,servel333/meteor,karlito40/meteor,stevenliuit/meteor,kencheung/meteor,HugoRLopes/meteor,Jonekee/meteor,l0rd0fwar/meteor,colinligertwood/meteor,qscripter/meteor,4commerce-technologies-AG/meteor,AnjirHossain/meteor,dev-bobsong/meteor,PatrickMcGuinness/meteor,michielvanoeffelen/meteor,bhargav175/meteor,yiliaofan/meteor,yalexx/meteor,calvintychan/meteor,hristaki/meteor,AlexR1712/meteor,calvintychan/meteor,daltonrenaldo/meteor,tdamsma/meteor,IveWong/meteor,DCKT/meteor,lpinto93/meteor,yanisIk/meteor,yonglehou/meteor,justintung/meteor,wmkcc/meteor,allanalexandre/meteor,devgrok/meteor,jrudio/meteor,hristaki/meteor,mjmasn/meteor,brdtrpp/meteor,TribeMedia/meteor,planet-training/meteor,chiefninew/meteor,h200863057/meteor,elkingtonmcb/meteor,ndarilek/meteor,4commerce-technologies-AG/meteor,judsonbsilva/meteor,allanalexandre/meteor,namho102/meteor,allanalexandre/meteor,brettle/meteor,oceanzou123/meteor,LWHTarena/meteor,yiliaofan/meteor,dboyliao/meteor,kengchau/meteor,AnjirHossain/meteor,nuvipannu/meteor,cherbst/meteor,paul-barry-kenzan/meteor,codedogfish/meteor,shadedprofit/meteor,emmerge/meteor,elkingtonmcb/meteor,benjamn/meteor,benjamn/meteor,baysao/meteor,queso/meteor,Profab/meteor,yonglehou/meteor,dboyliao/meteor,esteedqueen/meteor,GrimDerp/meteor,TechplexEngineer/meteor,lawrenceAIO/meteor,aldeed/meteor,jg3526/meteor,fashionsun/meteor,aramk/meteor,yonas/meteor-freebsd,sdeveloper/meteor,framewr/meteor,deanius/meteor,justintung/meteor,sdeveloper/meteor,Eynaliyev/meteor,kidaa/meteor,ericterpstra/meteor,daslicht/meteor,udhayam/meteor,nuvipannu/meteor,Theviajerock/meteor,nuvipannu/meteor,imanmafi/meteor,johnthepink/meteor,kidaa/meteor,guazipi/meteor,benstoltz/meteor,sitexa/meteor,Quicksteve/meteor,wmkcc/meteor,daltonrenaldo/meteor,jirengu/meteor,HugoRLopes/meteor,dev-bobsong/meteor,Jonekee/meteor,alphanso/meteor,aldeed/meteor,johnthepink/meteor,pjump/meteor,namho102/meteor,katopz/meteor,shrop/meteor,kencheung/meteor,alexbeletsky/meteor,yinhe007/meteor,allanalexandre/meteor,aramk/meteor,Puena/meteor,rabbyalone/meteor,henrypan/meteor,cog-64/meteor,neotim/meteor,tdamsma/meteor,pandeysoni/meteor,baysao/meteor,lawrenceAIO/meteor,framewr/meteor,chiefninew/meteor,dboyliao/meteor,mirstan/meteor,Jonekee/meteor,meonkeys/meteor,juansgaitan/meteor,zdd910/meteor,shmiko/meteor,dfischer/meteor,AnthonyAstige/meteor,michielvanoeffelen/meteor,SeanOceanHu/meteor,jenalgit/meteor,EduShareOntario/meteor,pandeysoni/meteor,vjau/meteor,msavin/meteor,Puena/meteor,newswim/meteor,kengchau/meteor,aleclarson/meteor,DAB0mB/meteor,IveWong/meteor,jirengu/meteor,bhargav175/meteor,planet-training/meteor,yonglehou/meteor,ljack/meteor,kengchau/meteor,colinligertwood/meteor,akintoey/meteor,dandv/meteor,benstoltz/meteor,sitexa/meteor,wmkcc/meteor,pjump/meteor,Jonekee/meteor,neotim/meteor,deanius/meteor,chmac/meteor,colinligertwood/meteor,ndarilek/meteor,steedos/meteor,dandv/meteor,stevenliuit/meteor,Ken-Liu/meteor,modulexcite/meteor,Prithvi-A/meteor,somallg/meteor,williambr/meteor,chengxiaole/meteor,Ken-Liu/meteor,h200863057/meteor,modulexcite/meteor,youprofit/meteor,Profab/meteor,yalexx/meteor,jdivy/meteor,dfischer/meteor,vjau/meteor,juansgaitan/meteor,paul-barry-kenzan/meteor,calvintychan/meteor,Eynaliyev/meteor,mauricionr/meteor,mjmasn/meteor,yonglehou/meteor,chiefninew/meteor,somallg/meteor,nuvipannu/meteor,chinasb/meteor,msavin/meteor,brdtrpp/meteor,qscripter/meteor,queso/meteor | ---
+++
@@ -2,6 +2,8 @@
// support both (options, callback) and (callback).
if (!callback && typeof options === 'function') {
callback = options;
+ options = {};
+ } else if (!options) {
options = {};
}
@@ -16,7 +18,7 @@
// always need this to get user id from google.
var requiredScope = ['https://www.googleapis.com/auth/userinfo.profile'];
var scope = ['https://www.googleapis.com/auth/userinfo.email'];
- if (options && options.requestPermissions)
+ if (options.requestPermissions)
scope = options.requestPermissions;
scope = _.union(scope, requiredScope);
var flatScope = _.map(scope, encodeURIComponent).join('+'); |
f5ef0965335933ef9c0cf694f7340fca60b1fd49 | baseError.js | baseError.js | function BaseError(data){
var oldLimit = Error.stackTraceLimit,
error;
Error.stackTraceLimit = 20;
error = Error.apply(this, arguments);
Error.stackTraceLimit = oldLimit;
if(Error.captureStackTrace){
Error.captureStackTrace(this, BaseError);
}
this.__genericError = true;
if(typeof data === 'string'){
this.message = data;
} else {
for(var key in data){
this[key] = data[key];
}
if(!this.message && data && data.message){
this.message = data.message;
}
}
if(!this.message){
this.message = this.toString();
}
}
BaseError.prototype = Object.create(Error.prototype);
BaseError.prototype.constructor = BaseError;
BaseError.prototype.toString = function(){
return this.message || this.code + ': ' + this.constructor.name;
};
BaseError.prototype.valueOf = function(){
return this;
};
BaseError.prototype.toJSON = function() {
var result = {};
for(var key in this)
{
if(typeof this[key] !== 'function')
result[key] = this[key];
}
return result;
};
BaseError.prototype.code = 500;
BaseError.isGenericError = function(obj){
return obj instanceof BaseError || (obj != null && obj.__genericError);
};
module.exports = BaseError; | var captureStackTrace = require('capture-stack-trace');
function BaseError(data){
var oldLimit = Error.stackTraceLimit,
error;
Error.stackTraceLimit = 20;
error = Error.apply(this, arguments);
Error.stackTraceLimit = oldLimit;
captureStackTrace(this, BaseError);
this.__genericError = true;
if(typeof data === 'string'){
this.message = data;
} else {
for(var key in data){
this[key] = data[key];
}
if(!this.message && data && data.message){
this.message = data.message;
}
}
if(!this.message){
this.message = this.toString();
}
}
BaseError.prototype = Object.create(Error.prototype);
BaseError.prototype.constructor = BaseError;
BaseError.prototype.toString = function(){
return this.message || this.code + ': ' + this.constructor.name;
};
BaseError.prototype.valueOf = function(){
return this;
};
BaseError.prototype.toJSON = function() {
var result = {};
for(var key in this)
{
if(typeof this[key] !== 'function')
result[key] = this[key];
}
return result;
};
BaseError.prototype.code = 500;
BaseError.isGenericError = function(obj){
return obj instanceof BaseError || (obj != null && obj.__genericError);
};
module.exports = BaseError; | Use ponyfil for base error | Use ponyfil for base error
| JavaScript | mit | MauriceButler/generic-errors | ---
+++
@@ -1,3 +1,5 @@
+var captureStackTrace = require('capture-stack-trace');
+
function BaseError(data){
var oldLimit = Error.stackTraceLimit,
error;
@@ -8,9 +10,7 @@
Error.stackTraceLimit = oldLimit;
- if(Error.captureStackTrace){
- Error.captureStackTrace(this, BaseError);
- }
+ captureStackTrace(this, BaseError);
this.__genericError = true;
|
5323addedf2cfd1e42218d471b2ef96b70a64276 | example/tests/ntfjs.org.js | example/tests/ntfjs.org.js | var ntf = require('ntf')
, test = ntf.http('http://ntfjs.org')
exports.ntf = test.get('/', function(test) {
test.statusCode(200)
test.body('ntf')
test.done()
})
| var ntf = require('ntf')
, test = ntf.http('http://ntfjs.org')
exports.frontpage = test.get('/', function(test) {
test.statusCode(200)
test.body('ntf')
test.done()
})
exports.fail = test.get('/fail', function(test) {
test.statusCode(200)
test.done()
})
| Add failing test to example | Add failing test to example
| JavaScript | mit | shutterstock/ntfd | ---
+++
@@ -1,8 +1,13 @@
var ntf = require('ntf')
, test = ntf.http('http://ntfjs.org')
-exports.ntf = test.get('/', function(test) {
+exports.frontpage = test.get('/', function(test) {
test.statusCode(200)
test.body('ntf')
test.done()
})
+
+exports.fail = test.get('/fail', function(test) {
+ test.statusCode(200)
+ test.done()
+}) |
16c50fd316a43c2b934ee2d4d0434166101ad849 | src/indicator-parameter/ParameterSearchController.js | src/indicator-parameter/ParameterSearchController.js | 'use strict';
// @ngInject
var ParameterSearchController = function($scope, $location, $controller, npdcAppConfig, Parameter) {
// Extend NpolarApiBaseController
$controller("NpolarBaseController", {
$scope: $scope
});
$scope.resource = Parameter;
npdcAppConfig.cardTitle = 'Environmental monitoring parameters';
let query = function() {
let defaults = {
start: 0,
limit: 50,
"size-facet": 5,
format: "json",
variant: "atom",
facets: "systems,collection,species,themes,dataseries,label,warn,variable,unit,locations.placename,links.rel"
};
return Object.assign({}, defaults, $location.search());
};
let detail = function(p) {
let subtitle = '';
if (p.timeseries && p.timeseries.length > 0) {
subtitle = `Timeseries: ${p.timeseries.length}`;
}
//subtitle += `. Updates: ${ $filter('date')(t.updated)}`;
return subtitle;
};
npdcAppConfig.search.local.results.subtitle = function(p) { return p.species || ''; };
npdcAppConfig.search.local.results.detail = detail;
$scope.search(query());
$scope.$on('$locationChangeSuccess', (event, data) => {
$scope.search(query());
});
};
module.exports = ParameterSearchController; | 'use strict';
// @ngInject
var ParameterSearchController = function($scope, $location, $controller, npdcAppConfig, Parameter) {
// Extend NpolarApiBaseController
$controller("NpolarBaseController", {
$scope: $scope
});
$scope.resource = Parameter;
npdcAppConfig.cardTitle = 'Environmental monitoring parameters';
let query = function() {
let defaults = {
start: 0,
limit: 50,
"size-facet": 5,
format: "json",
variant: "atom",
sort: "-updated",
facets: "systems,collection,species,themes,dataseries,label,warn,variable,unit,locations.placename,links.rel"
};
return Object.assign({}, defaults, $location.search());
};
let detail = function(p) {
let subtitle = '';
if (p.timeseries && p.timeseries.length > 0) {
subtitle = `Timeseries: ${p.timeseries.length}`;
}
//subtitle += `. Updates: ${ $filter('date')(t.updated)}`;
return subtitle;
};
npdcAppConfig.search.local.results.subtitle = function(p) { return p.species || ''; };
npdcAppConfig.search.local.results.detail = detail;
$scope.search(query());
$scope.$on('$locationChangeSuccess', (event, data) => {
$scope.search(query());
});
};
module.exports = ParameterSearchController; | Sort on last updated first | Sort on last updated first
| JavaScript | mit | npolar/npdc-indicator,npolar/npdc-indicator | ---
+++
@@ -17,6 +17,7 @@
"size-facet": 5,
format: "json",
variant: "atom",
+ sort: "-updated",
facets: "systems,collection,species,themes,dataseries,label,warn,variable,unit,locations.placename,links.rel"
};
return Object.assign({}, defaults, $location.search()); |
2de4a243971aab231adbcab0e67e21570cdbd971 | index.js | index.js | /**
* Run the first test with "focus" tag.
*
* @param {Object} hydro
* @api public
*/
module.exports = function(hydro) {
if (!hydro.get('focus')) return;
var focus = false;
hydro.on('pre:test', function(test) {
if (focus) return test.skip();
if (test.meta.indexOf('focus') != -1) focus = true;
});
};
/**
* CLI flags.
*/
module.exports.flags = {
'--focus': 'run the first test with "focus" tag'
};
| /**
* Run the first test with "focus" tag.
*
* @param {Object} hydro
* @api public
*/
module.exports = function(hydro) {
if (!hydro.get('focus')) return;
var focus = false;
hydro.on('pre:test', function(test) {
if (focus || test.meta.indexOf('focus') == -1) return test.skip();
focus = true;
});
};
/**
* CLI flags.
*/
module.exports.flags = {
'--focus': 'run the first test with "focus" tag'
};
| Fix bug where it will run more tests than desired | Fix bug where it will run more tests than desired
| JavaScript | mit | hydrojs/focus | ---
+++
@@ -9,8 +9,8 @@
if (!hydro.get('focus')) return;
var focus = false;
hydro.on('pre:test', function(test) {
- if (focus) return test.skip();
- if (test.meta.indexOf('focus') != -1) focus = true;
+ if (focus || test.meta.indexOf('focus') == -1) return test.skip();
+ focus = true;
});
};
|
7dcdac1d7e2012090a7346ef764ea07f62b1f835 | index.js | index.js | 'use strict';
const naked = require('naked-string');
module.exports = function equalsish(stringOne, stringTwo) {
if (stringOne === undefined) {
throw new Error('No arguments provided.');
} else if (stringTwo === undefined) {
return (futureString) => equalsish(stringOne, futureString);
} else {
return naked(stringOne) === naked(stringTwo);
}
};
| 'use strict';
const naked = require('naked-string');
module.exports = function equalsish(stringOne, stringTwo) {
if (stringOne === undefined) {
throw new Error('No arguments provided.');
} else if (stringTwo === undefined) {
return futureString => equalsish(stringOne, futureString);
} else {
return naked(stringOne) === naked(stringTwo);
}
};
| Remove parentheses from around arrow function arg | Remove parentheses from around arrow function arg | JavaScript | apache-2.0 | dar5hak/equalsish | ---
+++
@@ -6,7 +6,7 @@
if (stringOne === undefined) {
throw new Error('No arguments provided.');
} else if (stringTwo === undefined) {
- return (futureString) => equalsish(stringOne, futureString);
+ return futureString => equalsish(stringOne, futureString);
} else {
return naked(stringOne) === naked(stringTwo);
} |
d64bd789940684d8f53ee41e9ac1a105c5eb9982 | problems/kata/001-todo-backend/001/app.js | problems/kata/001-todo-backend/001/app.js | var express = require('express');
var cors = require('cors');
var bodyParser = require('body-parser');
var nano = require('nano')('http://localhost:5984');
var todo = nano.db.use('todo');
var app = express();
app.use(cors());
app.use(bodyParser.json());
app.get('/', function(req, res, next) {
console.log('get triggered');
res.json([]);
});
app.post('/', function(req, res, next) {
console.log('post triggered');
var task = {title: req.body.title};
todo.insert(task, function(err, body) {
if (err) {
console.log(err);
}
console.log(JSON.stringify(body));
task._id = body.id;
task._rev = body.rev;
res.json(task);
});
});
app.delete('/', function(req, res, next) {
console.log('delete triggered');
res.json([]);
});
app.listen(3000, function() {
console.log('Cors enabled server listening on port 3000');
});
| var express = require('express');
var cors = require('cors');
var bodyParser = require('body-parser');
var nano = require('nano')('http://localhost:5984');
var todo = nano.db.use('todo');
var app = express();
app.use(cors());
app.use(bodyParser.json());
app.get('/', function(req, res, next) {
console.log('get triggered');
todo.view('todos', 'all_todos', function(err, body) {
res.json(body.rows);
});
});
app.post('/', function(req, res, next) {
console.log('post triggered');
var task = {title: req.body.title};
todo.insert(task, function(err, body) {
if (err) {
console.log(err);
}
console.log(JSON.stringify(body));
task._id = body.id;
task._rev = body.rev;
res.json(task);
});
});
app.delete('/', function(req, res, next) {
console.log('delete triggered');
res.json([]);
});
app.listen(3000, function() {
console.log('Cors enabled server listening on port 3000');
});
| Return database results in root GET (3/16). | Return database results in root GET (3/16).
| JavaScript | mit | PurityControl/uchi-komi-js | ---
+++
@@ -11,7 +11,9 @@
app.get('/', function(req, res, next) {
console.log('get triggered');
- res.json([]);
+ todo.view('todos', 'all_todos', function(err, body) {
+ res.json(body.rows);
+ });
});
app.post('/', function(req, res, next) { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.