commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
ba07dd9b0a47b64ee02c86eda0e3c6089c07d78f | addon/components/file-field.js | addon/components/file-field.js | import Ember from 'ember';
export default Ember.Component.extend(Ember.Evented, {
tagName: 'input',
type: 'file',
attributeBindings: ['type', 'multiple', 'accept'],
multiple: false,
change (event) {
const input = event.target;
if (!Ember.isEmpty(input.files)) {
this.trigger('filesDidChange', in... | import Ember from 'ember';
export default Ember.Component.extend(Ember.Evented, {
tagName: 'input',
type: 'file',
attributeBindings: [
'name',
'disabled',
'form',
'type',
'accept',
'autofocus',
'required',
'multiple'
],
multiple: false,
change (event) {
const input = eve... | Add attributeBindings for W3 permitted attributes | Add attributeBindings for W3 permitted attributes
| JavaScript | mit | benefitcloud/ember-uploader,benefitcloud/ember-uploader |
eaa63d9988844f492f50a6b528b81e168be32df2 | packages/eslint-config-webservices-base/rules/base.js | packages/eslint-config-webservices-base/rules/base.js | module.exports = {
extends: [
'eslint-config-airbnb-base',
],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 6,
},
rules: {
// Airbnb rules overrides
'comma-dangle': ['warn', 'always-multiline'],
'no-use-before-define': ['error', 'nofunc'],
'object-curly-spacing': ['error',... | module.exports = {
extends: [
'eslint-config-airbnb-base',
],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 6,
},
rules: {
// Airbnb rules overrides
'comma-dangle': ['warn', 'always-multiline'],
'no-use-before-define': ['error', 'nofunc'],
'object-curly-spacing': ['error',... | Increase max line length to 120 symbols | Increase max line length to 120 symbols
| JavaScript | mit | MacPaw/eslint-config-webservices |
d5db1d41718812d4165dfc237c066e356e91a1f4 | app/models/codeable-concept.js | app/models/codeable-concept.js | import CodeableConcept from 'ember-fhir-adapter/models/codeable-concept';
let IECodeableConcept = CodeableConcept.extend({
hasCode: function(code){
let matchedCodes = this.get('coding').map(function(c){
return c.get('system') === code.system && c.get('code') === code.code;
});
return matchedCodes.a... | import CodeableConcept from 'ember-fhir-adapter/models/codeable-concept';
let IECodeableConcept = CodeableConcept.extend({
hasCode: function(code){
let matchedCodes = this.get('coding').map(function(c){
return c.get('system') === code.system && c.get('code') === code.code;
});
return matchedCodes.a... | Fix toString on codeable concept | Fix toString on codeable concept | JavaScript | apache-2.0 | intervention-engine/frontend,intervention-engine/frontend,intervention-engine/frontend |
6c2e6bd9937e148ee8f305ce82cab3d4666c5b2f | src/Utils.js | src/Utils.js | import moment from 'moment'
import 'moment-duration-format'
export function BigNumWeiToDisplayString(bignum, unit='ether') {
return window.web3.fromWei(bignum, unit).toFixed()
}
export function secondsToDisplayString(seconds) {
if (seconds < 60 * 60 * 24) // less than one day?
return m... | import moment from 'moment'
import 'moment-duration-format'
export function BigNumWeiToDisplayString(bignum, unit='ether') {
// Following code does not work in webpack production build:
//
// return window.web3.fromWei(bignum, unit).toFixed()
//
// Contrary to documentation, "f... | Implement workaround for faulty fromWei() in production build. | Implement workaround for faulty fromWei() in production build.
| JavaScript | mit | TripleSpeeder/StandingOrderDapp,TripleSpeeder/StandingOrderDapp |
23a71227cd3490f3ec7f309ed026458d6eac38c9 | buildconfig.js | buildconfig.js | /* global rm, mkdir, exec, ls*/
require('shelljs/global');
var fs = require('fs');
var ms = require('ms');
var start = new Date();
console.log('Building config...');
exec('webpack --entry \'./config.app.js\' --output-library \'config\' --output-file \'config.[hash].js\' --colors --progress');
function getBundleFilen... | /* global rm, mkdir, exec, ls, mv*/
require('shelljs/global');
var fs = require('fs');
var crypto = require('crypto');
var ms = require('ms');
var start = new Date();
// NOTE: Webpack's hash also uses the absolute path on the filesystem
// Since config is built in `start.sh` and apps can be on different
// servers an... | Fix config file hashing on app start | Fix config file hashing on app start
| JavaScript | bsd-2-clause | tidepool-org/blip,tidepool-org/blip,hichameyessou/blip,hichameyessou/blip,tidepool-org/blip,hichameyessou/blip |
b6f8542375714b11d29184861b72644c96351c65 | src/index.js | src/index.js | // Test
| import { Datepicker } from './datepicker/datepicker'
import { Apptmnt } from './apptmnt/apptmnt'
const components = [
Datepicker,
Apptmnt
];
components.forEach(component => customElements.define(component.selector, component));
| Add components to entry file | Add components to entry file
| JavaScript | mit | bitclaw/apptmnt,bitclaw/apptmnt |
9a1238409d4100f619d53bc6a88eae1e8b100c19 | src/index.js | src/index.js | const colors = ['red', 'blue', 'green']
// Stringify styles
function stringify(obj) {
return Object.keys(obj)
.map(key => {
return `${key}:${obj[key]}`
})
.join(';')
}
function cholk(text) {
return {
style: cholk._style,
text,
}
}
cholk._style = {}
cholk.log = (...args) => {
const r... | // Stringify styles
function stringify(style) {
if (typeof style === 'string') {
return style
}
return Object.keys(style)
.map(key => {
return `${key}:${style[key]}`
})
.join(';')
}
function cholk(text) {
return {
style: stringify(cholk._style),
text,
}
}
cholk._style = {}
cho... | Add `style` method for custom style | Add `style` method for custom style
| JavaScript | mit | pd4d10/tiza |
681a4f361290f73d9f725b499b066f516c529947 | src/client/components/StickyHeader.js | src/client/components/StickyHeader.js | import React from "react";
import {animateScroll} from "react-scroll";
import {Sticky} from "react-sticky";
export default class StickyHeader extends React.Component {
constructor(props) {
super(props);
this.state = {
isVisible: false
}
}
onStickyChange() {
this.setState({isVisible: !this... | import React from "react";
import {animateScroll} from "react-scroll";
import {Sticky} from "react-sticky";
export default class StickyHeader extends React.Component {
constructor(props) {
super(props);
this.state = {
isVisible: false
}
}
onStickyChange() {
this.setState({isVisible: !this... | Remove text from the 'sticky' header | Remove text from the 'sticky' header
| JavaScript | bsd-3-clause | dtekcth/dfotose,dtekcth/dfotose,dtekcth/dfotose |
0eafca8d65440f512d75d761472217cf259f12ea | config/production.js | config/production.js | const env = process.env
const config = {
token: {
secret: env.ARROW_TOKEN_SECRET
},
database: {
host: env.ARROW_DATABASE_HOST,
port: env.ARROW_DATABASE_PORT,
user: env.ARROW_DATABASE_USER,
password: env.ARROW_DATABASE_PASSWORD
},
adminPassword: env.ARROW_ADMIN_PASSWORD,
port: env.ARROW_L... | const env = process.env
const config = {
token: {
secret: env.ARROW_TOKEN_SECRET
},
database: {
host: env.ARROW_DATABASE_HOST,
port: env.ARROW_DATABASE_PORT,
dbName: env.ARROW_DATABASE_DBNAME,
user: env.ARROW_DATABASE_USER,
password: env.ARROW_DATABASE_PASSWORD
},
adminPassword: env.AR... | Use environment variable for config.database.dbName. | Use environment variable for config.database.dbName.
| JavaScript | agpl-3.0 | amos-ws16/amos-ws16-arrowjs-server,amos-ws16/amos-ws16-arrowjs-server |
8539bf5fbe109a0b45eb52b71a51ebe72cb7522d | questionnaire/static/js/finalize_questionnaire.js | questionnaire/static/js/finalize_questionnaire.js | function makePostRequest(url, data) {
console.log(url);
console.log(data);
var jForm = $('<form></form>');
jForm.attr('action', url);
jForm.attr('method', 'post');
for (name in data) {
var jInput = $("<input>");
jInput.attr('name', name);
jInput.attr('value', data[name]);... | function makePostRequest(url, data) {
var jForm = $('<form></form>');
jForm.attr('action', url);
jForm.attr('method', 'post');
for (name in data) {
var jInput = $("<input/>");
jInput.attr({'name' : name, 'value': data[name], 'type': 'hidden'});
jForm.append(jInput);
}
var... | Fix finalize for safari, firefox. | Fix finalize for safari, firefox.
| JavaScript | bsd-3-clause | eJRF/ejrf,eJRF/ejrf,eJRF/ejrf,eJRF/ejrf |
d7e9d0d6495a9b7bc36c497bef378db961983fcf | test/switchStatement/aggressiveintoff.js | test/switchStatement/aggressiveintoff.js | function opt() {
for (let i = 0; i < 100; i++) {
let j = i - 2;
switch (i) {
case 2:
case 4:
case 6:
case 8:
case 10:
case 12:
case 14:
case 16:
case 18:
case 20:
... | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//------------------------------------------------------... | Add copyright notice to test case | Add copyright notice to test case
| JavaScript | mit | mrkmarron/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,mrkmarron/ChakraCore,Microsoft/ChakraCore,Microsoft/ChakraCore,Microsoft/ChakraCore,Microsoft/ChakraCore |
6aba8b7d4ce5ae25e992041f1261e7d228f2ab11 | app/js/constants/phishingExpressions.js | app/js/constants/phishingExpressions.js | 'use strict';
angular.module('ddsCommon').constant('phishingExpressions', [
]);
| (function() {
'use strict';
var phishingExpressions = [
/acusticanapoli\.com/,
];
/* Export either through Angular loader or CommonJS */
if (typeof module != 'undefined') { // we're in Node
module.exports = phishingExpressions;
} else { // we're in the browser
angular.module('ddsCommon').constant('phish... | Allow phishing expression usage from NodeJS | Allow phishing expression usage from NodeJS
| JavaScript | agpl-3.0 | sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui,sgmap/mes-aides-ui |
4c9c5125183e5b12fe7aa22e1bdfd7d077db015a | src/main/web/florence/js/functions/_handleApiError.js | src/main/web/florence/js/functions/_handleApiError.js | /**
* Generic error handler method for ajax responses.
* Apply your specific requirements for an error response and then call this method to take care of the rest.
* @param response
*/
function handleApiError(response) {
if (!response || response.status === 200)
return;
if (response.status === 403... | /**
* Generic error handler method for ajax responses.
* Apply your specific requirements for an error response and then call this method to take care of the rest.
* @param response
*/
function handleApiError(response) {
if (!response || response.status === 200)
return;
if (response.status === 403... | Call logout to clear authentication data when an unauthorised response is returned. | Call logout to clear authentication data when an unauthorised response is returned.
| JavaScript | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence |
e6845e0cf1d77aefb35f7eeafb04d73d1b2f5432 | src/components/containers/FuelSavingsPage.spec.js | src/components/containers/FuelSavingsPage.spec.js | import React from "react";
import { shallow } from "enzyme";
import * as actions from "../../actions/fuelSavingsActions";
import ConnectedFuelSavingsPage, { FuelSavingsPage } from "./FuelSavingsPage";
import FuelSavingsForm from "../FuelSavingsForm";
import { fuelSavings } from "../../types/index";
describe("<FuelSavi... | import React from "react";
import { shallow } from "enzyme";
import {FuelSavingsPage} from "./FuelSavingsPage";
import FuelSavingsForm from "../FuelSavingsForm";
describe("<FuelSavingsPage />", () => {
it("should contain <FuelSavingsForm />", () => {
const actions = {
saveFuelSavings: () => {},
calcu... | Remove experimental test - accidentally committed | Remove experimental test - accidentally committed
| JavaScript | mit | coryhouse/react-slingshot,coryhouse/react-slingshot |
c8a1a82c021a3012ce89d109da3b070ec8358b3d | dependument.js | dependument.js | #!/usr/bin/env node
(function() {
console.log("Hello from Dependument!");
})();
| #!/usr/bin/env node
(function() {
const CONFIG_FILE = "package.json";
console.log("Hello from Dependument!");
})();
| Store the config file as a const... for now | Store the config file as a const... for now
| JavaScript | unlicense | Jameskmonger/dependument,dependument/dependument,Jameskmonger/dependument,dependument/dependument |
852fd1c11a46454092933e9b0e98dd89357d1b5d | matchmaker/config.js | matchmaker/config.js | module.exports = {
services: [
{
url: 'http://localhost:9870',
type: 'presence'
},
{
url: 'http://localhost:9871',
type: 'realtime'
},
]
};
| module.exports = {
services: [
{
url: 'http://presence.unichat.eu',
type: 'presence'
},
{
url: 'http://realtime.unichat.eu',
type: 'realtime'
},
]
};
| Use presence/realtime subdomains in matchmaker | Use presence/realtime subdomains in matchmaker
| JavaScript | mit | dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet,dimkarakostas/unimeet |
66f4b95e5c9ff60668df9e9446794ef1609f702f | __tests__/code_snippets/objects.js | __tests__/code_snippets/objects.js | /* eslint-disable */
// input: property access
a['a'];
a[a];
a[b()];
a[b[c[0]]];
'abc'[1];
// output:
a['a'];
a[a];
a[b()];
a[b[c[0]]];
'abc'[1];
// input: declaration
// config: {"max-len": 30}
let a = {
b: function() {
return c;
},
c: a.b.c.d.e.f,
d: 1,
e: 'abc',
f: this,
[a]: u... | /* eslint-disable */
// input: property access
a['a'];
a[a];
a[b()];
a[b[c[0]]];
'abc'[1];
// output:
a['a'];
a[a];
a[b()];
a[b[c[0]]];
'abc'[1];
// input: declaration
// config: {"max-len": 30}
let a = {
b: function() {
return c;
},
c: a.b.c.d.e.f,
d: 1,
e: 'abc',
f: this,
[a]: u... | Add test for multiline object destructing | Add test for multiline object destructing
| JavaScript | bsd-3-clause | dmitriiabramov/esfmt |
5440725986a77073e0b130c09bc6fb4185cef607 | frontend/app/controllers/modalCtrl.js | frontend/app/controllers/modalCtrl.js | ;(function(){
'use strict';
var modalCtrl = function($scope, $uibModalInstance, $http, messageParts){
$scope.modalTitle = messageParts.title;
$scope.modalHeading = messageParts.heading;
$scope.message = messageParts.message;
$scope.messageTemplate = messageParts.messageTemplate;
... | ;(function(){
'use strict';
var modalCtrl = function($scope, $uibModalInstance, $http, messageParts){
$scope.modalTitle = messageParts.title;
$scope.modalHeading = messageParts.heading;
$scope.message = messageParts.message;
$scope.messageTemplate = messageParts.messageTemplate;
... | Use env var for API URL when adding bookmarks | Use env var for API URL when adding bookmarks
| JavaScript | mit | hellsgate1001/waypoints,hellsgate1001/waypoints,hellsgate1001/waypoints |
91f3e6cdbd82cc5ca7927fd1dd0380d7fc5efef4 | src/components/GroupMembersView.js | src/components/GroupMembersView.js | import _ from 'lodash'
import React from 'react'
import {connect} from 'react-redux'
import {compose, withHandlers, withProps, withState} from 'recompose'
import GroupMembersList from './GroupMembersList'
import {addMemberToGroup} from '../actions/groups'
const mapStateToProps = ({groups}) => ({
groups
})
const en... | import _ from 'lodash'
import React from 'react'
import {connect} from 'react-redux'
import {compose, withHandlers, withProps, withState} from 'recompose'
import GroupMembersList from './GroupMembersList'
import {addMemberToGroup} from '../actions/groups'
const mapStateToProps = ({groups}) => ({
groups
})
const en... | Update format for group members view | Update format for group members view
| JavaScript | mit | mg4tv/mg4tv-web,mg4tv/mg4tv-web |
455fa363c584c37a23e42f39de19add8ec8b2d7d | android/ScriptForAndroidTemplate/assets/android.js | android/ScriptForAndroidTemplate/assets/android.js | var Android = function() {
this._callbacks = [],
this._id = 0,
this._call = function(method, params) {
this._id += 1;
var request = JSON.stringify({'id': this._id, 'method': method, 'params': params});
var response = _rpc_wrapper.call(request);
return eval("(" + response + ")");
},
th... | var Android = function() {
this._callbacks = [],
this._id = 0,
this._call = function(method, params) {
this._id += 1;
var request = JSON.stringify({'id': this._id, 'method': method, 'params': params});
var response = _rpc_wrapper.call(request);
return eval("(" + response + ")");
},
th... | Add a wrapper into SL4A JS API to close WebView | Add a wrapper into SL4A JS API to close WebView
| JavaScript | apache-2.0 | cristiana214/cristianachavez214-cristianachavez,liamgh/liamgreenhughes-sl4a-tf101,vlinhd11/vlinhd11-android-scripting,olapaola/olapaola-android-scripting,cristiana214/cristianachavez214-cristianachavez,liamgh/liamgreenhughes-sl4a-tf101,olapaola/olapaola-android-scripting,liamgh/liamgreenhughes-sl4a-tf101,vlinhd11/vlinh... |
c02fbb605d62baf4e5201f467928b545796eb30b | src/data/ui/breakpoints/actions.js | src/data/ui/breakpoints/actions.js | //@flow
export default (component: string, newLayout: string) => ({
type: "CHANGE_MAIN_LAYOUT",
component,
newLayout
});
| //@flow
export default (component: string, query: { [string]: string }) => ({
type: "CHANGE_MAIN_LAYOUT",
component,
query
});
| Update breakpoint action to pass query object | Update breakpoint action to pass query object
| JavaScript | mit | slightly-askew/portfolio-2017,slightly-askew/portfolio-2017 |
9c7fa79b99dd4d4a7c233fab29ec8c0790f7f102 | es2015/topic-reply-counter.js | es2015/topic-reply-counter.js | "use strict";
class TopicReplyCounter {
constructor(topicId, replies) {
this.topicId = topicId;
this.replies = replies;
this.replyCount = this.replies.length;
}
addReply(reply) {
}
totalReplies() {
return this.replies.filter(reply => !reply.isAbuse);
}
totalCount() {
ret... | "use strict";
class TopicReplyCounter {
constructor(topicId, replies) {
this.topicId = topicId;
this.replies = replies || [];
this.replyCount = this.replies.length;
}
addReply(reply) {
this.replies.push(reply);
this.replyCount = this.totalReplies().length;
}
totalReplies() {
ret... | Add default value for this.replies. Complete addReply | Add default value for this.replies. Complete addReply
| JavaScript | mit | var-bin/reactjs-training,var-bin/reactjs-training,var-bin/reactjs-training |
16b1c61780a43ecf735b446ca376954649f6ba29 | lib/vertical-align.js | lib/vertical-align.js | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-vertical-align/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-vertical-align/tachyons-vertical-align.min.css', 'ut... | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-vertical-align/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-vertical-align/tachyons-vertical-align.min.css', 'ut... | Add site footer to each documentation generator | Add site footer to each documentation generator
| JavaScript | mit | topherauyeung/portfolio,topherauyeung/portfolio,tachyons-css/tachyons,topherauyeung/portfolio,matyikriszta/moonlit-landing-page,fenderdigital/css-utilities,getfrank/tachyons,fenderdigital/css-utilities,cwonrails/tachyons,pietgeursen/pietgeursen.github.io |
b3d73030ee76b9ba7382feec05d3bd4ec9b43fa1 | app/assets/javascripts/updateContent.js | app/assets/javascripts/updateContent.js | (function(Modules) {
"use strict";
var queues = {};
var dd = new diffDOM();
var getRenderer = $component => response => dd.apply(
$component.get(0),
dd.diff($component.get(0), $(response[$component.data('key')]).get(0))
);
var getQueue = resource => (
queues[resource] = queues[resource] || []... | (function(Modules) {
"use strict";
var queues = {};
var dd = new diffDOM();
var getRenderer = $component => response => dd.apply(
$component.get(0),
dd.diff($component.get(0), $(response[$component.data('key')]).get(0))
);
var getQueue = resource => (
queues[resource] = queues[resource] || []... | Remove use of spread operator | Remove use of spread operator
This is a temporary fix for the fact that the
babel plugin for the spread operator calls a
function called `_iterableToArray` which assumes
the JavaScript runtime supports Symbols.
IE11 doesn't support Symbols so this causes an
error when it runs our JS.
This swaps out use of the spread... | JavaScript | mit | alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin |
c008a271ffd3069502100c0286e94d9a5cad44a3 | main.js | main.js | var app = require('app')
var BrowserWindow = require('browser-window')
var crashReporter = require('crash-reporter')
var Menu = require('menu')
var ipc = require('ipc')
var dialog = require('dialog')
var darwinTemplate = require('./darwin-menu.js')
var otherTemplate = require('./other-menu.js')
var mainWindow = null
... | var app = require('app')
var BrowserWindow = require('browser-window')
var crashReporter = require('crash-reporter')
var Menu = require('menu')
var ipc = require('ipc')
var dialog = require('dialog')
var darwinTemplate = require('./darwin-menu.js')
var otherTemplate = require('./other-menu.js')
var mainWindow = null
... | Define event in the open file dialog callback | Define event in the open file dialog callback
The `event` definition was missing and an error was being thrown.
Now verifying the repository works well. | JavaScript | bsd-2-clause | jlord/git-it-electron,vongola12324/git-it-electron,jlord/git-it-electron,countryoven/git-it-electron,jlord/git-it-electron,rets5s/git-it-electron,dice/git-it-electron,shiftkey/git-it-electron,IonicaBizauKitchen/git-it-electron,rets5s/git-it-electron,dice/git-it-electron,countryoven/git-it-electron,dice/git-it-electron,... |
cd6738fd9d90b6ab14ac89582f65d174f6f89bd6 | main.js | main.js | var LOCK = false;
function print(text, nextAction) {
if (text) {
LOCK = true;
var display = document.getElementById("display");
display.innerHTML = display.innerHTML + text.substr(0, 1);
display.scrollTop = display.scrollHeight;
var newText = text.substring(1, text.length);
... | var LOCK = false;
function print(text, nextAction) {
if (text) {
LOCK = true;
var display = document.getElementById("display");
display.innerHTML = display.innerHTML + text.substr(0, 1);
display.scrollTop = display.scrollHeight;
var newText = text.substring(1, text.length);
... | Change symbols generation and checks | Change symbols generation and checks | JavaScript | bsd-3-clause | dev-brutus/427,dev-brutus/427 |
782dd02c82bbd709654a40f198a7fb15af6791b6 | app/mixins/routes/authenticated.js | app/mixins/routes/authenticated.js | import Ember from 'ember';
// Pre-loading user roles minimizes the number of HTTP
// requests we have to make later when checking a user's ability
// to read/manage/etc a stack
function loadUserRoles(route){
var user = route.session.get('currentUser');
return user.get('roles');
}
export default Ember.Mixin.create... | import Ember from 'ember';
// Pre-loading user roles minimizes the number of HTTP
// requests we have to make later when checking a user's ability
// to read/manage/etc a stack
function loadUserRoles(route){
var user = route.session.get('currentUser');
return user.get('roles');
}
export default Ember.Mixin.create... | Return accessDenied return value to routes | Return accessDenied return value to routes
| JavaScript | mit | mixonic/ember-cli-aptible-shared,gib/ember-cli-aptible-shared,aptible/dashboard.aptible.com,blakepettersson/dashboard.aptible.com,chasballew/dashboard.aptible.com,blakepettersson/dashboard.aptible.com,blakepettersson/ember-cli-aptible-shared,aptible/ember-cli-aptible-shared,chasballew/dashboard.aptible.com,aptible/dash... |
1eb687d49a4027839df04d4fdfcb8b933fb38c0a | app/scripts/configs/base-config.js | app/scripts/configs/base-config.js | 'use strict';
angular.module('ncsaas')
.constant('ENV', {
// general config
name: '',
apiEndpoint: 'http://localhost:8080/',
// auth config
googleClientId: 'google client id',
googleEndpointUrl: 'api-auth/google/',
facebookClientId: 'facebook client id',
facebookEndpointUrl: 'api-aut... | 'use strict';
angular.module('ncsaas')
.constant('ENV', {
// general config
name: '',
apiEndpoint: 'http://localhost:8080/',
// auth config
googleClientId: 'google client id',
googleEndpointUrl: 'api-auth/google/',
facebookClientId: 'facebook client id',
facebookEndpointUrl: 'api-aut... | Add showImport variable in base config. | Add showImport variable in base config.
– SAAS-379
| JavaScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport |
0794f0186a3df56808a3f2b868dd5d1068671a79 | scripts/prepublish.js | scripts/prepublish.js | #!/usr/bin/env node
/**
* @fileoverview
* Compiles our icons into static .js files that can be imported in the browser
* and are tree-shakeable.
* The static .js files go in icons/{filename}.js.
* Also generates an index.js that exports all icons by title, but is not tree-shakeable
*/
const dataFile = "../_data/... | #!/usr/bin/env node
/**
* @fileoverview
* Compiles our icons into static .js files that can be imported in the browser
* and are tree-shakeable.
* The static .js files go in icons/{filename}.js.
* Also generates an index.js that exports all icons by title, but is not tree-shakeable
*/
const dataFile = "../_data/... | Add backwards compatability for Adobe Lightroom | Add backwards compatability for Adobe Lightroom
Because it was renamed it may result in unexpected errors --> breaking
changes.
This is a temporary solution to circumvent the problem. This can be
removed once some other breaking changes are also present and a major
new version is released. I propose removing this ... | JavaScript | cc0-1.0 | danleech/simpleicons.org,danleech/simple-icons,simple-icons/simple-icons,simple-icons/simple-icons,danleech/simpleicons.org |
18de849a1a6078a4ac99fc878c71394d31f8f9f3 | server/models/user.js | server/models/user.js | 'use strict';
module.exports = function(sequelize, DataTypes) {
var User = sequelize.define('User', {
username: DataTypes.STRING,
password: DataTypes.STRING,
email: DataTypes.STRING
}, {
classMethods: {
associate: function(models) {
// associations can be defined here
}
}
}... | module.exports = (sequelize, DataTypes) => {
const User = sequelize.define('User', {
username: DataTypes.STRING,
password: DataTypes.STRING,
email: DataTypes.STRING
}, {
classMethods: {
associate(models) {
// associations can be defined here
}
}
});
return User;
}; | Refactor code using es6 syntax | Refactor code using es6 syntax
| JavaScript | mit | 3m3kalionel/PostIt,3m3kalionel/PostIt |
e056282e1ce60138912f8f2f293a226cddba5c31 | source/lib/reduced-url.js | source/lib/reduced-url.js | // This can't be replaced with `new URL()` because browsers don't support git+http urls
const protocol = '(?:([^:]+:)?(?://)?)?';
const auth = '(?:(\\S+(?::\\S*)?)@)?';
const host = '([^/:]*)';
const path = '([/]?[^#]*)';
const hash = '(#.+)?';
const urlLaxRegex = new RegExp(protocol + auth + host + path + hash);
exp... | // This can't be replaced with `new URL()` because browsers don't support git+http urls
const protocol = '(?:([^:]+:)?(?://)?)?';
const auth = '(?:(\\S+(?::\\S*)?)@)?';
const host = '([^/:]*)';
const path = '([/]?[^#]*)';
const hash = '(#.+)?';
const urlLaxRegex = new RegExp(protocol + auth + host + path + hash);
exp... | Enable parsing of more modules | Enable parsing of more modules
This was failing due to having a `git@` URL in the `repository` field
https://github.com/sveltejs/svelte-loader/blob/d4e2c2025e8cf0cf448d61a5f5206d6e77ee0d9a/package.json#L35
| JavaScript | mit | npmhub/npmhub,npmhub/npmhub,npmhub/npmhub |
d3c5163fd4bdc83b46910e30bbb2f23f0523ae91 | src/components/page.js | src/components/page.js | import React from 'react';
import KataGroups from './katagroups';
import Katas from './katas.js';
import Kata from './kata.js';
export default class Page extends React.Component {
render() {
const {kataGroups} = this.props;
const {selectedGroup=kataGroups[0]} = kataGroups;
return <div>
<div id="la... | import React from 'react';
import KataGroups from './katagroups';
import Katas from './katas.js';
import Kata from './kata.js';
import {default as KataGroupsData} from '../katagroups.js';
export default class Page extends React.Component {
static propTypes = {
kataGroups: React.PropTypes.instanceOf(KataGroupsDa... | Move the propTypes as a static property. | Move the propTypes as a static property. | JavaScript | mit | wolframkriesing/es6-react-workshop,wolframkriesing/es6-react-workshop |
702c3570d55169af51304adfd05675c778ab4e34 | index.js | index.js | /**
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = require('./lib/Fluxible');
module.exports.FluxibleContext = require('./lib/FluxibleContext');
module.exports.Mixin = require('./mixins/FluxibleMixin');
| /**
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = require('./lib/Fluxible');
module.exports.Mixin = require('./mixins/FluxibleMixin');
| Remove FluxibleContext from exports since it is internal | Remove FluxibleContext from exports since it is internal
| JavaScript | bsd-3-clause | YoussefTaghlabi/fluxible,pablolmiranda/fluxible,localnerve/fluxible,v2018z/fluxible,kelsadita/fluxible,koulmomo/fluxible,ali1k/fluxible,koulmomo/fluxible,mdressman/fluxible,IveWong/fluxible,DelvarWorld/fluxible,gpbl/fluxible,turadg/fluxible,kwangkim/fluxible,mdressman/fluxible |
41e00267f10eb1b7b7d4a07434832c0730c92392 | src/index.js | src/index.js | import initialize from './initialize';
import register from './register';
import unregister from './unregister';
import { core } from './commands/lfsCommands';
import { loadGitattributeFiltersFromRepo, repoHasLfs } from './helpers';
import checkout from './commands/checkout';
import push from './commands/push';
import ... | import initialize from './initialize';
import register from './register';
import unregister from './unregister';
import { core } from './commands/lfsCommands';
import { loadGitattributeFiltersFromRepo, repoHasLfs } from './helpers';
import checkout from './commands/checkout';
import push from './commands/push';
import ... | Allow passing in the node binary path on init | Allow passing in the node binary path on init
| JavaScript | mit | Axosoft/nodegit-lfs,Axosoft/nodegit-lfs |
8d43eb375f5420690d19b7398668e01dab83d161 | src/index.js | src/index.js | import detectIt from 'detect-it';
import addListener from 'the-listener';
function setupCurrentInput() {
}
(() => {
const body = document.querySelector('body');
if (body) setupCurrentInput();
else document.addEventListener('DOMContentLoaded', setupCurrentInput);
})();
| import detectIt from 'detect-it';
import addListener from 'the-listener';
function setupCurrentInput() {
const body = document.querySelector('body');
let currentInput = undefined;
function updateCurrentInput(input) {
if (input !== currentInput) {
body.classList.remove(`current-input-${currentInput}`);... | Add setup current input function | Add setup current input function
| JavaScript | mit | rafrex/current-input |
1d9219fda8fd086f7b5a993a8bb05c2be474420c | src/index.js | src/index.js | import React from 'react';
import ReactDOM from 'react-dom';
// import App from './components/app.jsx';
class App extends React.Component {
render () {
return (
<h1>{"JIM"}</h1>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('mountpoint')
);
| import React from 'react';
import ReactDOM from 'react-dom';
import data from './data/5e-SRD-Monsters';
import App from './components/app.jsx';
ReactDOM.render(
<App data={data} />,
document.getElementById('mountpoint')
);
| Move app into its own file. | Move app into its own file.
| JavaScript | mit | jkrayer/summoner,jkrayer/summoner |
041691536561344862d94ca5d72be2388b4c71b3 | app/assets/javascripts/sulten/duration.js | app/assets/javascripts/sulten/duration.js | //If occation is food, set minimum value to 90 minutes
//Formtastic initialises sulten_reservation_reservation_duration selectoren with :collector
$("#sulten_reservation_reservation_type_id").change(function(){
var preValue = parseInt($("#sulten_reservation_reservation_duration").find(":selected").val())
var durationO... | //If occation is food, set minimum value to 90 minutes
//Formtastic initialises sulten_reservation_reservation_duration selectoren with :collector
$("#sulten_reservation_reservation_type_id").change(function(){
var preValue = parseInt($("#sulten_reservation_reservation_duration").find(":selected").val())
var durationO... | Add more documentation for easier testing | Add more documentation for easier testing
| JavaScript | mit | Samfundet/Samfundet,Samfundet/Samfundet,Samfundet/Samfundet,Samfundet/Samfundet |
9cb73c977435682a5971d949079272bf3245424c | src/bin/commit-link-dependencies.js | src/bin/commit-link-dependencies.js | import {exec} from 'node-promise-es6/child-process';
import fs from 'node-promise-es6/fs';
async function run() {
const {linkDependencies = {}} = await fs.readJson('package.json');
for (const dependencyName of Object.keys(linkDependencies)) {
const dependencyPath = linkDependencies[dependencyName];
const ... | import {exec} from 'node-promise-es6/child-process';
import fs from 'node-promise-es6/fs';
async function run() {
const {linkDependencies = {}} = await fs.readJson('package.json');
for (const dependencyName of Object.keys(linkDependencies)) {
const dependencyPath = linkDependencies[dependencyName];
const ... | Add logging to debug failure on Travis CI | Add logging to debug failure on Travis CI
| JavaScript | mit | vinsonchuong/npm-integration |
e1743da8e93875a707ba24294644e9c51b3a2254 | test/fixtures/attributes/actual.js | test/fixtures/attributes/actual.js | function render() {
return (<root>
<div class="my-class"></div>
<div class={"my-class"}></div>
<div class={myClass}></div>
<div class={props.myClass}></div>
<div prop={x ? <span /> : <span />}></div>
<div prop={<span attr={i++}/>}></div>
<div prop={<span>{i++}</span>}></div>
</root>);
}
| function render() {
var test = <div grand={i++}>
<div parent={i++}>
{i++}
</div>
</div>;
return (<root>
<div class="my-class"></div>
<div class={"my-class"}></div>
<div class={myClass}></div>
<div class={props.myClass}></div>
<div prop={x ? <span /> : <span />}></div>
... | Test eager attribute and children | Test eager attribute and children
| JavaScript | mit | jridgewell/babel-plugin-incremental-dom,babel-plugins/babel-plugin-incremental-dom,jridgewell/babel-plugin-transform-incremental-dom |
72275547e2c4a685ab1c80b227c6fb8c12273a29 | ember-cli-build.js | ember-cli-build.js | /*jshint node:true*/
/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
// Add options here
});
/*
This build file specifies the options for the dummy test app of this
addon, located ... | /*jshint node:true*/
/* global require, module */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
// Add options here
... | Add basic bootstrap styling for table in dummy app | Add basic bootstrap styling for table in dummy app
| JavaScript | unknown | caxiam/ember-table-jsonapi,caxiam/ember-table-jsonapi,caxiam/ember-tabular,caxiam/ember-tabular |
a24602ef050567eb96b697296af9a88728772bd1 | lib/Execute.js | lib/Execute.js | const { exec } = require('child_process');
const EventEmitter = require('events');
class Execute extends EventEmitter {
constructor(options) {
super();
let { fullCmd, params } = options;
this.fullCmd = fullCmd;
this.params = params;
}
run() {
RunCmd(BuildCmd(this.fullCmd, this.params))
... | const { exec } = require('child_process');
const EventEmitter = require('events');
class Execute extends EventEmitter {
constructor(options) {
super();
let { fullCmd, params } = options;
this.fullCmd = fullCmd;
this.params = params;
}
run() {
RunCmd(BuildCmd(this.fullCmd, this.params))
... | Move returning promise up to test if it resolves messaging issue | Move returning promise up to test if it resolves messaging issue
| JavaScript | mit | stetsmando/pi-camera |
9af33202e9b522d5482cb5cd5778f4fd8e47d2d6 | tasks/htmlmin.js | tasks/htmlmin.js | /*
* grunt-contrib-htmlmin
* http://gruntjs.com/
*
* Copyright (c) 2014 Sindre Sorhus, contributors
* Licensed under the MIT license.
*/
'use strict';
var chalk = require('chalk');
var prettyBytes = require('pretty-bytes');
var minify = require('html-minifier').minify;
module.exports = function (grunt) {
grun... | /*
* grunt-contrib-htmlmin
* http://gruntjs.com/
*
* Copyright (c) 2014 Sindre Sorhus, contributors
* Licensed under the MIT license.
*/
'use strict';
var chalk = require('chalk');
var prettyBytes = require('pretty-bytes');
var minify = require('html-minifier').minify;
module.exports = function (grunt) {
grun... | Add input file name on error | Add input file name on error
This commit adds the name of the potential output file which is not written
because there are no characters saved and thus the output does not differ from
the input file.
| JavaScript | mit | gruntjs/grunt-contrib-htmlmin,gruntjs/grunt-contrib-htmlmin |
a853a51a0ba0976e8e28f368bd88717611b3c477 | test/page.js | test/page.js | var mock = require('./mock');
describe('Page', function() {
var book;
before(function() {
return mock.setupDefaultBook({
'heading.md': '# Hello\n\n## World'
})
.then(function(_book) {
book = _book;
return book.summary.load();
});
});
... | var mock = require('./mock');
describe('Page', function() {
var book;
before(function() {
return mock.setupDefaultBook({
'heading.md': '# Hello\n\n## World'
})
.then(function(_book) {
book = _book;
return book.summary.load();
});
});
... | Complete test for heading IDs | Complete test for heading IDs
| JavaScript | apache-2.0 | gencer/gitbook,tshoper/gitbook,strawluffy/gitbook,ryanswanson/gitbook,GitbookIO/gitbook,gencer/gitbook,tshoper/gitbook |
95747e5dbac265d3cd6c051e825da2a710bf98ff | lib/config/env/all.js | lib/config/env/all.js | 'use strict';
var path = require('path');
var rootPath = path.normalize(__dirname + '/../../..');
module.exports = {
root: rootPath,
port: process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 3000,
hostname: process.env.OPENSHIFT_NODEJS_IP || "localhost",
mongo: {
options: {
db: {
safe:... | 'use strict';
var path = require('path');
var rootPath = path.normalize(__dirname + '/../../..');
module.exports = {
root: rootPath,
port: process.env.PORT || process.env.OPENSHIFT_NODEJS_PORT || 3000,
hostname: process.env.OPENSHIFT_NODEJS_IP || undefined,
mongo: {
options: {
db: {
safe: t... | Fix issue that was blocking incoming connections in production. | Fix issue that was blocking incoming connections in production.
| JavaScript | apache-2.0 | Splaktar/hub,gdg-x/hub,Splaktar/hub,gdg-x/hub |
1abead9efd62f53921de948663d6d9c92bd4a644 | lib/plurals.js | lib/plurals.js | module.exports = {
add: add,
get: get,
isSupported: isSupported
};
var rules = {};
// Functions should return the string to be appended to a key to find the pluralized
// form for the count given.
function add(lng, fn) {
fn.memo = [];
rules[lng] = function(count) {
return fn.memo[count] ||... | module.exports = {
add: add,
get: get,
isSupported: isSupported
};
var rules = {};
// Functions should return the string to be appended to a key to find the pluralized
// form for the count given.
function add(lng, fn) {
fn.memo = [];
rules[lng] = function(count) {
return fn.memo[count] ||... | Check before calling a function | Check before calling a function
| JavaScript | mit | k-components/k-i18n |
7379094408e565faf29a31dbd8ab1b8a1a195377 | lib/get-class-name.js | lib/get-class-name.js | "use strict";
function getClassName(value) {
return value.constructor ? value.constructor.name : null;
}
module.exports = getClassName;
| "use strict";
var re = /function (\w+)\s*\(/;
function getClassName(value) {
if (value.constructor && "name" in value.constructor) {
return value.constructor.name;
}
if (typeof value.constructor === "function") {
var match = value.constructor.toString().match(re);
if (match.length... | Fix failing Class tests in IE11 | Fix failing Class tests in IE11
These were introduced in https://github.com/sinonjs/samsam/pull/38
| JavaScript | bsd-3-clause | busterjs/samsam |
2570ec94bdaabea423aca4e7e7a0624ba01adb19 | cartoon.js | cartoon.js | function setCarouselSize() {
var wWidth = $(window).width();
var wHeight = $(window).height();
if (wHeight > wWidth) {
var containerHeight = wHeight * $('.img-cartoon').width() / wWidth;
} else {
$('#carousel-example-generic').height($(window).height()-$('#panel-title').height())... | function setCarouselSize() {
var wWidth = $(window).width();
var wHeight = $(window).height();
var originalImageHeight = 1080;
var originalImageWidth = 1920;
if (wHeight > wWidth) {
var containerHeight = originalImageHeight * wWidth / originalImageWidth;
$('#caro... | Add logic to handle vertical screens | Add logic to handle vertical screens
| JavaScript | mit | theghostbel/capture-asteroid,theghostbel/capture-asteroid |
be4467bf4d1dd6772aa7427b3906da38b13067a8 | test/unit/ArgumentTest.js | test/unit/ArgumentTest.js |
define(
[
'chai',
'fixtures',
'argumenta/widgets/Argument',
'argumenta/widgets/Base'
],
function(chai, fixtures, Argument, Base) {
var assert = chai.assert;
describe('Argument', function() {
it('should be a function', function() {
assert.isFunction(Argument);
});
... |
define(
[
'chai',
'fixtures',
'argumenta/widgets/Argument',
'argumenta/widgets/Base'
],
function(chai, fixtures, Argument, Base) {
var assert = chai.assert;
describe('Argument', function() {
it('should be a function', function() {
assert.isFunction(Argument);
});
... | Add test for Argument setter. | Add test for Argument setter.
| JavaScript | mit | argumenta/argumenta-widgets,argumenta/argumenta-widgets |
4c6070b163612ae78d7bcc204f8b281579e8ed3e | imports/server/seed-data/seed-users.js | imports/server/seed-data/seed-users.js | import { Accounts } from 'meteor/accounts-base';
const seedUsers = () => {
const userCount = Meteor.users.find().count();
if (userCount === 0) {
Accounts.createUser({
username: 'evancorl',
email: 'info@evancorl.com',
password: 'password',
profile: {},
});
}
};
export default see... | import { Accounts } from 'meteor/accounts-base';
const seedUsers = () => {
const user = Meteor.users.findOne();
if (!user) {
Accounts.createUser({
username: 'evancorl',
email: 'info@evancorl.com',
password: 'password',
profile: {},
});
}
};
export default seedUsers;
| Write faster query for seeding users | Write faster query for seeding users
| JavaScript | apache-2.0 | evancorl/skate-scenes,evancorl/portfolio,evancorl/portfolio,evancorl/portfolio,evancorl/skate-scenes,evancorl/skate-scenes |
3c551ba10f00600178a0b6476ee9823c1b8516ed | lib/models/user.js | lib/models/user.js | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var bcrypt = require('bcrypt');
var SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
"email": { type: String, required: true },
"username": { type: String, unique: true, required: true },
"password": { type: String, required: true },
"comme... | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var bcrypt = require('bcrypt');
var SALT_WORK_FACTOR = 10;
var UserSchema = new Schema({
"email": { type: String, required: true },
"username": { type: String, unique: true, required: true },
"password": { type: String, required: true },
"comme... | Add location and arrays for notifications | Add location and arrays for notifications
| JavaScript | mit | davidmogar/gimme-a-hug-server |
1e94670c02239e46afdb45f49f371201d4b34754 | lib/ngts-module.js | lib/ngts-module.js | #!/usr/bin/env node
const program = require("commander");
const _ = require("lodash");
const utils = require("./utils");
var dest = "";
program
.usage("<module-name> [options]")
.arguments("<module-name>")
.action(function (moduleName) {
cmdModuleName = moduleName;
})
.option("-a, --ctrl-a... | #!/usr/bin/env node
const program = require("commander");
const _ = require("lodash");
const utils = require("./utils");
var dest = "";
program
.usage("<module-name> [options]")
.arguments("<module-name>")
.action(function (moduleName) {
cmdModuleName = moduleName;
})
.option("-a, --ctrl-a... | Add an option to create just the module file | Add an option to create just the module file
| JavaScript | mit | Kurtz1993/ngts-cli,Kurtz1993/ngts-cli,Kurtz1993/ngts-cli |
952f2ae7000417262433997f10702eaed4bcddc2 | src/DataLinkMixin.js | src/DataLinkMixin.js | "use strict";
/**
* Since only a single constructor is being exported as module.exports this comment isn't documented.
* The class and module are the same thing, the contructor comment takes precedence.
* @module DataLinkMixin
*/
var EventEmitter = require('wolfy87-eventemitter');
var eventEmitter = new E... | "use strict";
/**
* Since only a single constructor is being exported as module.exports this comment isn't documented.
* The class and module are the same thing, the contructor comment takes precedence.
* @module DataLinkMixin
*/
var EventEmitter = require('wolfy87-eventemitter');
var eventEmitter = new E... | Fix copy paste error on new mixin | Fix copy paste error on new mixin
| JavaScript | mit | chad-autry/data-chains |
719d1fe8fb2fc65d454df9297c20af4d29800b02 | configurations/node.js | configurations/node.js | module.exports = {
"extends": "chiton/configurations/default",
"env": {
"node": true
},
"rules": {
"callback-return": 2,
"handle-callback-err": 2,
"no-mixed-requires": 2,
"no-new-require": 2,
"no-path-concat": 2
}
};
| module.exports = {
"extends": "chiton/configurations/default",
"env": {
"node": true
},
"ecmaFeatures": {
"arrowFunctions": true
},
"rules": {
"arrow-body-style": [2, "as-needed"],
"arrow-parens": [2, "as-needed"],
"arrow-spacing": [2, {"after": true, "before": true}],
"callback-retu... | Allow the use of arrow functions in Node | Allow the use of arrow functions in Node | JavaScript | mit | justinlocsei/eslint-config-chiton |
b23fcf4b78608f0a7de687eb35b4d9e585396f80 | src/ai/getWinners.js | src/ai/getWinners.js | import { filter, head } from 'ramda';
import { emptyValue } from './constants';
import getPosition from './getPosition';
const positionsToCheck = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
];
/**
* Check winners for 3 winning positions
* @param {Number... | import { filter, head } from 'ramda';
import { emptyValue } from './constants';
import getPosition from './getPosition';
const positionsToCheck = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[2, 4, 6]
];
/**
* Check winners for 3 winning positions
* @param {Number... | Add const winner to improve readability | Add const winner to improve readability
| JavaScript | mit | angeloocana/tic-tac-toe-ai |
dfb99df0ac1ceafef30f4eeb1c9a3850d2bd2c96 | webpack-cfg/postcss.js | webpack-cfg/postcss.js | const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const {ENV} = require('./paths')
const cssLoader = {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
minimize: ENV === 'production',
localIdentName: '[hash:base6... | const webpack = require('webpack')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const {ENV} = require('./paths')
const cssLoader = {
loader: 'css-loader',
options: {
modules: true,
sourceMap: true,
importLoaders: 1,
minimize: ENV === 'production',
localIdentName:
ENV ==... | Use longer class name in development | Use longer class name in development
| JavaScript | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc |
778acc184d0bded9410f98b9e85242084d528d4d | src/javascript/app_2/App/Components/Elements/ToggleButton/__tests__/helpers.spec.js | src/javascript/app_2/App/Components/Elements/ToggleButton/__tests__/helpers.spec.js | import { expect } from 'chai';
import { isButtonSelected } from '../helpers.js';
describe('isButtonSelected', () => {
it('should return false when the value or the candidate is null', () => {
expect(isButtonSelected(null, 'xyz')).be.false;
expect(isButtonSelected([], null)).be.false;
... | import { expect } from 'chai';
import { isButtonSelected } from '../helpers.js';
describe('ToggleButton:Helpers', () => {
describe('isButtonSelected', () => {
it('should return false when the value or the candidate is null', () => {
expect(isButtonSelected(null, 'xyz')).be.false;
... | Change the ToggleButton helpers test to ToggleButton:Helpers | Change the ToggleButton helpers test to ToggleButton:Helpers
| JavaScript | apache-2.0 | binary-com/binary-static,binary-com/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,kellybinary/binary-static,ashkanx/binary-static,binary-static-deployed/binary-static,kellybinary/binary-static,4p00rv/binary-static,4p00rv/binary-static,4p00rv/binary-static,binary-com/... |
6e2f02f48395bad6cff0df14919a6cf91b028596 | src/entities/Clan.js | src/entities/Clan.js | class Clan {
removePlayer(player) {
for (var i = 0; i < this.members.length; ++i) {
if (this.members[i].player.sid === player.player.sid) {
this.members.splice(i, 1);
return true;
}
}
return false;
}
addPlayer(player) {
... | class Clan {
removePlayer(player) {
for (var i = 0; i < this.members.length; ++i) {
if (this.members[i].player.sid === player.player.sid) {
this.members[i].player.team = null;
this.members.splice(i, 1);
return true;
}
}
... | Modify player teams upon clan add/remove | Modify player teams upon clan add/remove
| JavaScript | mit | wwwwwwwwwwwwwwwwwwwwwwwwwwwwww/m.io |
9ad4086f932bd0fb9c46b98e4bb94ac29c785f15 | src/js/math/color.js | src/js/math/color.js | /*jshint bitwise:false*/
'use strict';
var lerp = require( './utils' ).lerp;
// RGB values are ints from [0, 255].
function Color( r, g, b ) {
this.r = r || 0;
this.g = g || 0;
this.b = b || 0;
}
Color.prototype.toString = function() {
return 'rgb(' +
( this.r | 0 ) + ', ' +
( this.g | 0 ) + ', ' +
... | /*jshint bitwise:false*/
'use strict';
var lerp = require( './utils' ).lerp;
// RGB values are ints from [0, 255].
function Color( r, g, b ) {
this.r = r || 0;
this.g = g || 0;
this.b = b || 0;
}
Color.prototype.toString = function() {
return 'rgb(' +
( this.r | 0 ) + ', ' +
( this.g | 0 ) + ', ' +
... | Add Color math operations (add, multiply, multiplyScalar). | Add Color math operations (add, multiply, multiplyScalar).
| JavaScript | mit | razh/neptune-blue-js13k-2014 |
4ebfa87909ea94aca9cc358e7366f685f50190bb | utils/random.test.js | utils/random.test.js | const random = require('./random');
describe('getNumberBetween', () => {
test('is exclusive', () => {
let number = random.getNumberBetween(0, 1);
expect(number).toBeGreaterThan(0);
expect(number).toBeLessThan(1);
});
});
| const random = require('./random');
describe('getNumberBetween', () => {
test('is exclusive', () => {
let number = random.getNumberBetween(0, 1);
expect(number).toBeGreaterThan(0);
expect(number).toBeLessThan(1);
});
});
| Replace some CRLFs with LFs. | Replace some CRLFs with LFs.
| JavaScript | mit | Exide/top-down-arena-shooter,Exide/top-down-arena-shooter,Exide/top-down-arena-shooter |
bff371bf0adefed5d7c88d49bbfd3dac6d1d4f05 | src/extractors/zcr.js | src/extractors/zcr.js | export default function() {
if (typeof arguments[0].signal !== 'object') {
throw new TypeError();
}
var zcr = 0;
for (var i = 1; i < arguments[0].signal.length; i++) {
if ((arguments[0].signal[i-1] >= 0 && arguments[0].signal[i] < 0) ||
(arguments[0].signal[i-1] < 0 && arguments[0].signal[i] >... | export default function() {
if (typeof arguments[0].signal !== 'object') {
throw new TypeError();
}
var zcr = 0;
for (var i = 0; i < arguments[0].signal.length; i++) {
if ((arguments[0].signal[i] >= 0 && arguments[0].signal[i + 1] < 0) ||
(arguments[0].signal[i] < 0 && arguments[0].signal[i + ... | Revert "Fix bug in ZCR" | Revert "Fix bug in ZCR"
This reverts commit 4f39a3a91626354f993ba3f0590529c311bc1000.
| JavaScript | mit | hughrawlinson/meyda,meyda/meyda,meyda/meyda,meyda/meyda |
bde78be425d579a763f8e59f0f5a5ae11b4b3901 | background.js | background.js | chrome.commands.onCommand.addListener(dispatch);
function dispatch(command, tab) {
if (command === "movetab") {
moveTab(tab);
}
}
function moveTab(tab) {
chrome.storage.local.get('savedWindow', function(storage) {
var savedToWindow = storage.savedWindow;
if (savedToWindow == undefined) {
alert... | chrome.commands.onCommand.addListener(dispatch);
function dispatch(command, tab) {
if (command === "movetab") {
moveTab(tab);
}
}
function moveTab(tab) {
chrome.storage.local.get('savedWindow', function(storage) {
var savedToWindow = storage.savedWindow;
if (savedToWindow == undefined) {
alert... | Fix moves across monitors acting funny | Fix moves across monitors acting funny
When moving a tab to a different monitor, the tab would not render using
the new window size. This change fixes that bug by creating a new tab on
the target window and removing the old one (chrome.tabs.create,
chrome.tabs.remove) rather than moving the tab (chrome.tabs.move).
| JavaScript | unlicense | maxrothman/movetab,maxrothman/movetab |
a7ce82409e9c8f2f313d939259a13cc8bc8a74d8 | background.js | background.js | /**
* StopFlash
*
* https://github.com/JWhile/StopFlash
*
* background.js
*/
var flashElements = {}; // :Map<chrome.Tab, Object>
chrome.runtime.onConnect.addListener(function(port)
{
if(port.sender.tab != null)
{
port.onMessage.addListener(function(rep)
{
if(rep['stopflashIni... | /**
* StopFlash
*
* https://github.com/JWhile/StopFlash
*
* background.js
*/
function BackgroundFlashData(id)
{
this.id = id; // :int
this.changed = false; // :boolean
this.data = null; // :Object
}
// function setData(Object data):void
BackgroundFlashData.prototype.setData = function(data)
{
th... | Add class BackgroundFlashData + small fix | Add class BackgroundFlashData + small fix
| JavaScript | mit | Julow/StopFlash,Julow/StopFlash |
9336e09b89b1aa31ed6f3d7984f209bc840f5e30 | app/serializers/site.js | app/serializers/site.js | import DS from 'ember-data';
var SiteSerializer = DS.RESTSerializer.extend({
serialize: function(site, options) {
var fields = [ 'name', 'tagline', 'description', 'moreDesc', 'joinText' ];
var result = { };
fields.forEach(function(field) {
result[field] = site.get(field);
});
if (options ... | import DS from 'ember-data';
var SITE_SERIALIZER_FIELDS = [ 'name', 'tagline', 'description', 'moreDesc', 'joinText' ];
var SiteSerializer = DS.RESTSerializer.extend({
serialize: function(site, options) {
var result = site.getProperties(SITE_SERIALIZER_FIELDS);
if (options && options.includeId) {
res... | Use more idiomatic ember api | Use more idiomatic ember api
| JavaScript | mit | aymerick/kowa-client,aymerick/kowa-client |
969d29d16b83debc477488b1b40ab54113fe6203 | static/js/filters.js | static/js/filters.js | 'use strict';
// Filters
var filters = angular.module('martianblogFilters', ['ngSanitize']);
filters.filter('calendar', function() {
return function (input) {
console.log(input);
return moment(input, 'YYYY-MM-DD').calendar();
};
});
filters.filter('markdown', function ($sce) {
return function (input) {
ret... | 'use strict';
// Filters
var filters = angular.module('martianblogFilters', ['ngSanitize']);
filters.filter('calendar', function() {
return function (input) {
return moment(input, 'YYYY-MM-DD').calendar();
};
});
filters.filter('markdown', function ($sce) {
return function (input) {
return $sce.trustAsHtml(m... | Solve an error when input is undefined in ‘markdown’ filter. | Solve an error when input is undefined in ‘markdown’ filter.
| JavaScript | mit | dyzdyz010/MartianBlog,jmptrader/MartianBlog,dyzdyz010/MartianBlog,jmptrader/MartianBlog,jmptrader/MartianBlog,jmptrader/MartianBlog,dyzdyz010/MartianBlog |
c845d371e5b80e20aca9a0f5fef8d522942b6605 | rpc/create/test.js | rpc/create/test.js | const create = require('./index')
describe('rpc/create', () => {
it('should create a new user', async () => {
const email = 'test@test.com'
const id = '12345'
const insertResult = {
insertedId: id
}
const db = {
insertOne: jest.fn(() => Promise.resolve(insertResult))
}
const r... | const create = require('./index')
describe('rpc/create', () => {
it('should create a new user', async () => {
const email = 'test@test.com'
const id = '12345'
const insertResult = {
insertedId: id
}
const db = {
insertOne: jest.fn(() => Promise.resolve(insertResult))
}
const r... | Make sure error is a handled error | Make sure error is a handled error
| JavaScript | mit | hharnisc/user-svc |
c19e7a5d2cd43a1a43ed9ab94a5fec9a16f70a55 | js/skeleton.js | js/skeleton.js | $('<section class="min-chat"> \
<header class="min-chat__header"> \
<b class="min-chat__header__title">\
<img src="http://i.imgur.com/RKJMsl8.png" class="min-chat__icon" >\
Czatrepajr</b> \
<button id="min-chat-switch" class="min-chat__header__switch">Wyłącz</button> \
</header> \
<div id="... | $(`<section class="min-chat">
<header class="min-chat__header">
<b class="min-chat__header__title">
<img src="http://i.imgur.com/RKJMsl8.png" class="min-chat__icon" >
Czatrepajr</b>
<button id="min-chat-switch" class="min-chat__header__switch" title="Wyłącz">↓</button>
</header>
<div id="m... | Change syntax to template strings. | Change syntax to template strings.
| JavaScript | mit | CodersCommunity/czatrepajr |
56a3d26e85cb6649e3ef4b66d07ac70b3db5ea70 | iexdomain/iexdomain.js | iexdomain/iexdomain.js | Strophe.addConnectionPlugin('iexdomain', {
init: function(conn) {
// replace Strophe.Request._newXHR with new IE CrossDomain version
var nativeXHR = new XMLHttpRequest();
if (window.XDomainRequest && ! ("withCredentials" in nativeXHR)) {
Strophe.Request.prototype._newXHR = functi... | Strophe.addConnectionPlugin('iexdomain', {
init: function(conn) {
// replace Strophe.Request._newXHR with new IE CrossDomain version
var nativeXHR = new XMLHttpRequest();
if (window.XDomainRequest && ! ("withCredentials" in nativeXHR)) {
Strophe.Request.prototype._newXHR = functi... | Replace non-standard prependArg with bind | Replace non-standard prependArg with bind
bind is not supported on IE8, but we have it in the Strophe.js polyfills.
More info here: https://groups.google.com/forum/#!topic/strophe/TkEpQQK37PM
| JavaScript | mit | st-gwerner/strophejs-plugins,st-gwerner/strophejs-plugins |
9a04c70bd31b7530c13d30cb432a608eacd81ebb | gatsby-config.js | gatsby-config.js | module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-typescript... | module.exports = {
siteMetadata: {
title: `fmoliveira.dev`,
description: `I'm a Freelance Software Engineer who loves writing clean and well-tested code. My favourite tech stack at the moment is React, TypeScript, Jest and Testing Library. Always hungry for learning and happy to help!`,
author: `@fmolivei... | Replace initial config for personal info. | Replace initial config for personal info.
| JavaScript | mit | fmoliveira/fmoliveira.github.io,fmoliveira/fmoliveira.github.io |
fe7117c7e0b6e812535713f997fdc666686c7e04 | src/ringo-server.js | src/ringo-server.js |
var config = {
server_port: 5000,
server_opts: {}
};
var server = require('http').Server();
var serverio = require('socket.io').listen(server, config.server_opts);
server.listen(config.server_port);
var players = [];
var data = require('../data/apples.json');
var red = data.red,
green = data.green;
serverio.... |
var config = {
server_port: 5000,
server_opts: {}
};
var server = require('http').Server();
var serverio = require('socket.io').listen(server, config.server_opts);
server.listen(config.server_port);
var _ = require('_');
var players = [];
var data = require('../data/apples.json');
var red = data.red,
green = ... | Add players to server on connect | Add players to server on connect
| JavaScript | mit | Alphadelta14/ringo-ni-ringo |
6732c4705caf7816423bc42c6f9b7db9079e61d6 | routes/login/index.js | routes/login/index.js | var express = require('express');
var router = express.Router();
// Login a user with basic auth
router.post('/', function (req, res, next) {});
module.exports = router;
| var express = require('express');
var router = express.Router();
var auth = require('../../utils/auth');
var _ = require('lodash');
var JsonDB = require('node-json-db');
var crypto = require('crypto');
// Login a user with basic auth
router.post('/', auth.basic, function (req, res, next) {
var db = new JsonDB('db', ... | Add section 6.1 code to provide login for users | Add section 6.1 code to provide login for users
| JavaScript | mit | adamsea/recipes-api |
15730941f0b3515ab8c990ac486136b12c41a272 | src/util/average.js | src/util/average.js | import boundary from './boundary'
export default function average(x, y, factor) {
factor = boundary(factor, 0, 1)
return Math.floor(((1 - factor) * x + 2 * factor * y) / 2)
}
| import boundary from './boundary'
export default function average(x, y, factor) {
factor = boundary(factor, 0, 1)
return Math.floor((1 - factor) * x + factor * y)
}
| Fix averaging / mixing of colours | Fix averaging / mixing of colours
No, I don't know why it took me such a long time to spot this bug :D
| JavaScript | unknown | philplckthun/goethe,philpl/goethe |
0023d4dd7e27e57b20e12f5fa2542da2fd0c1a91 | app/store/configureStore.development.js | app/store/configureStore.development.js | import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import { hashHistory } from 'react-router';
import { routerMiddleware } from 'react-router-redux';
import rootReducer from '../reducers';
const logger = createLogger({
level: 'info... | import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import { hashHistory } from 'react-router';
import { routerMiddleware, push } from 'react-router-redux';
import rootReducer from '../reducers';
import * as counterActions from '../ac... | Add actionCreators option for window.devToolsExtension() | Add actionCreators option for window.devToolsExtension()
add counter actions & push action of `react-router-redux`
| JavaScript | mit | kivo360/ECC-GUI,Byte-Code/lm-digitalstore,xuandeng/base_app,runandrew/memoriae,JoaoCnh/picto-pc,kaunio/gloso,joshuef/peruse,jaytrepka/kryci-jmena,baublet/lagniappe,xiplias/github-browser,ycai2/visual-git-stats,espenbjorkeng/Rabagast,nantaphop/redd,cosio55/app-informacion-bitso,surrealroad/electron-react-boilerplate,ale... |
70fa3a2dd8da7644dcbdc25f331b4d2a26aa2c7a | test/cli.js | test/cli.js | var cp = require('child_process');
var expect = require('expect.js');
module.exports = function () {
describe('CLI', function () {
it('should error if task file does not exist', function (done) {
cp.exec('node bin/automaton something-that-will-never-exist', function (err, stdout, stderr) {
... | var cp = require('child_process');
var expect = require('expect.js');
module.exports = function () {
describe('CLI', function () {
this.timeout(10000); // Increase the timeout to let the update-notifier do it's job
it('should error if task file does not exist', function (done) {
cp... | Increase timeout of CLI tests to let the update notifier do the job. | Increase timeout of CLI tests to let the update notifier do the job.
| JavaScript | mit | IndigoUnited/automaton |
c59bc1bd6e1735d2c676a1ac914dcd191b7fec31 | src/ensure-data.js | src/ensure-data.js | import { select } from 'd3-selection'
export function ensureData(d, i) {
if (!d) select(this).datum([])
}
| import { select } from 'd3-selection'
export function ensureData(d, i) {
let rows = d || []
rows.rows = null
select(this).datum(rows)
}
| Fix stale data: Encapsulate initial pre-processed row cleanup. | Fix stale data: Encapsulate initial pre-processed row cleanup.
| JavaScript | mit | zambezi/grid |
0c900cbfc27ed111a7697cdc25956a26e1a15c28 | types/algos.js | types/algos.js | 'use strict';
var _ = require('lodash');
var algos = {
'eddsa': 'eddsa',
'curve25519': 'curve25519',
'triplesec-v3': 'triplesec-v3',
'scrypt': 'scrypt',
'nacl easybox': 'nacl-easybox',
'nacl secretbox': 'nacl-secretbox',
};
algos.name = function(b) {
b = ''+b; // coerce to string
var found = _.findKey... | 'use strict';
var _ = require('lodash');
var algos = {
'eddsa': 'eddsa',
'curve25519': 'curve25519',
'triplesec-v3': 'triplesec-v3',
'scrypt': 'scrypt',
'nacl easybox': 'easybox',
'nacl secretbox': 'secretbox',
};
algos.name = function(b) {
b = ''+b; // coerce to string
var found = _.findKey(algos, fu... | Rename alg value for easybox/secretbox | Rename alg value for easybox/secretbox
| JavaScript | agpl-3.0 | arigatomachine/common |
4000ac248a85dbe5c7e904874e673cc62ebc57a1 | src/webservices.js | src/webservices.js | import fetch from 'isomorphic-fetch'
import config from './config'
async function fetchJson(url, options) {
const response = await fetch(url, options)
if (response.status < 200 || response.status >= 300) {
throw new Error(`'${url}' returned the unexpected return code: '${response.status}'.`)
}
const data... | import fetch from 'isomorphic-fetch'
import config from './config'
async function fetchJson(url, options) {
const response = await fetch(url, options)
.catch(() => { throw new Error(`Could not fetch '${url}'.`)})
if (response.status < 200 || response.status >= 300) {
throw new Error(`'${url}' returned th... | Improve error is API is dead | Improve error is API is dead
| JavaScript | agpl-3.0 | openfisca/legislation-explorer |
24dad1ed8b00f063eed1b31e3b361d847278bf4b | streamer/server.js | streamer/server.js | var sys = require('sys');
var http = require('http');
var base64 = require('./vendor/base64');
// Command line args
var USERNAME = process.ARGV[2];
var PASSWORD = process.ARGV[3];
var SERVER = process.ARGV[4];
if (!USERNAME || !PASSWORD || !SERVER)
return sys.puts("Usage: node server.js <twitter_username> <... | var sys = require('sys'),
http = require('http'),
base64 = require('./vendor/base64');
// Command line args
var USERNAME = process.ARGV[2];
var PASSWORD = process.ARGV[3];
var SERVER = process.ARGV[4];
if (!USERNAME || !PASSWORD || !SERVER)
return sys.puts("Usage: node server.js <twitter_username> <twitte... | Convert to POST, clean formatting | Convert to POST, clean formatting
| JavaScript | mit | lstoll/twitter-chat |
c48c444a0c6cf22fcafc12310881c9851f05cfcc | Urlchecker.botplug.js | Urlchecker.botplug.js | 'use strict';
var request = require( 'request' ),
cheerio = require( 'cheerio' ),
urlChecker = {
bot : false,
setup : function( bot ){
var _this = this,
channel;
_this.bot = bot;
for( channel in _this.bot.opt.channels ){
if( _t... | 'use strict';
var request = require( 'request' ),
cheerio = require( 'cheerio' ),
urlChecker = {
bot : false,
setup : function( bot ){
var _this = this,
channel;
_this.bot = bot;
for( channel in _this.bot.opt.channels ){
if( _t... | Add user agent so we don't get bounced by sites requiring it (e.g. SoundCloud) | Add user agent so we don't get bounced by sites requiring it (e.g. SoundCloud)
| JavaScript | mit | kokarn/KokBot |
6cbd3104d19e54ec6f673e4dc5bb16d49c8cdbde | test/parserSpec.js | test/parserSpec.js | const
labyParser = require('../lib/parser'),
expect = require('chai').expect;
describe('Icarus', function(){
it('should throw an error if there is a line which has indents gap more than 2.', function(){
var errorStr = '\t\tCONTEXT: should not have gap more than 2.';
var labyStr = 'DESCRIBE: Inden... | const
labyParser = require('../lib/parser'),
expect = require('chai').expect;
describe('Icarus', function(){
it('should throw an error if there is a line which has indents gap more than 2.', function(){
var errorStr = '\t\tCONTEXT: should not have gap more than 2.';
var labyStr = 'DESCRIBE: Inden... | Modify test specs with correct error messages. | Modify test specs with correct error messages.
| JavaScript | mit | Wooooo/test-daedalus |
7df79d0ea629e8610e3b2ba7b74acdc06305f805 | test/testHelper.js | test/testHelper.js | const jsdom = require('jsdom');
global.document = jsdom.jsdom("<!doctype html><html><body><div data-current_user='{ \"admin\": false, \"id\": null }' id='react_root'></div></body></html>", {
url: 'http://localhost',
skipWindowCheck: true
});
global.window = document.defaultView;
global.navigator = global.window.na... | const jsdom = require('jsdom');
global.document = jsdom.jsdom("<!doctype html><html><body><div data-current_user='{ \"admin\": false, \"id\": null }' id='react_root'></div></body></html>", {
url: 'http://localhost',
skipWindowCheck: true
});
global.window = document.defaultView;
global.navigator = global.window.na... | Work around gulp error during i18n asset rebuilding | Work around gulp error during i18n asset rebuilding
The test file requires built assets, so linting fails with an unresolved require while the i18n assets are being built.
| JavaScript | mit | sejalkhatri/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,sejalkhatri/WikiEduDashboard,majakomel/WikiEduDashboard,alpha721/WikiEduDashboard,majakomel/WikiEduDashboard,KarmaHater/WikiEduDashboard,KarmaHater/WikiEduDashboard,WikiEducationFoundation/WikiEduDashboard,KarmaHater/WikiEduDashboard,alpha721/WikiEdu... |
99b46203b9277627704a66d7162448cd4a177d36 | pdp/index.js | pdp/index.js | var api = require('./api');
var pap = require('../pap');
// TODO: Check how to share app with PAP
function init(settings) {
return new Promise(function(resolve, reject) {
pap.init(settings.pap).then(function() {
api.init(settings.pdp, pap).then(function(fresh) {
resolve(fresh);
... | var api = require('./api');
var pap = require('../pap');
var Promise = require("bluebird");
var initialized = false;
function init(settings, _pap) {
if(initialized) {
// console.log(process.pid + ": PDP has already been initialized. Skip");
return Promise.resolve(this);
} else {
// co... | Allow PDP to be initialized with existing PAP and export new API | Allow PDP to be initialized with existing PAP and export new API
| JavaScript | mit | SEDARI/UPFROnt |
d76e1ac240f1f1aa8c9841029db810783b3acabe | index.js | index.js | var CLIEngine = require('eslint').CLIEngine;
var chalk = require('chalk');
var globAll = require('glob-all');
var cli = new CLIEngine({});
function test(p, opts) {
it('should have no errors in ' + p, function () {
var format, warn;
if (opts && opts.timeout) {
this.timeout(opts.timeout);
}
if... | var CLIEngine = require('eslint').CLIEngine;
var chalk = require('chalk');
var globAll = require('glob-all');
var cli = new CLIEngine({});
function test(p, opts) {
it('should have no errors in ' + p, function () {
var format, warn;
if (opts && opts.timeout) {
this.timeout(opts.timeout);
}
if... | Replace absolute paths with relative paths | Replace absolute paths with relative paths
This is a workaround for https://github.com/mochajs/mocha/issues/2126 but since
relative paths are usually much nicer to look at it also has its own advantages
| JavaScript | mit | eagleeye/mocha-eslint,BadgeLabs/mocha-eslint |
614a38f11b7fe788d90eea6b1f281952898755b0 | webpackfile.js | webpackfile.js | var path = require("path");
var components = path.resolve(__dirname, "remoteappmanager/static/components");
var js = path.resolve(__dirname, "remoteappmanager/static/js");
module.exports = {
entry: {
admin: path.resolve(js, "admin/main.js"),
user: path.resolve(js, "home/controller.js")
},
o... | var path = require("path");
var components = path.resolve(__dirname, "remoteappmanager/static/components");
var js = path.resolve(__dirname, "remoteappmanager/static/js");
module.exports = {
entry: {
admin: path.resolve(js, "admin/main.js"),
user: path.resolve(js, "home/controller.js")
},
... | Add aliases for vue-router and vue-form | Add aliases for vue-router and vue-form
| JavaScript | bsd-3-clause | simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote,simphony/simphony-remote |
a0d887b87f507cc425aa11e451fc28089847c1a7 | index.js | index.js | 'use strict';
var a11y = require('./lib/a11y');
var cssStats = require('./lib/css-stats');
var pageSpeed = require('./lib/page-speed');
var humanizeUrl = require('humanize-url');
var normalizeUrl = require('normalize-url');
module.exports = function scrutinize(url, options, callback) {
if (typeof url != 'string') ... | 'use strict';
var a11y = require('./lib/a11y');
var cssStats = require('./lib/css-stats');
var pageSpeed = require('./lib/page-speed');
var humanizeUrl = require('humanize-url');
var normalizeUrl = require('normalize-url');
module.exports = function scrutinize(url, options, callback) {
if (typeof url != 'string') ... | Handle a lack of key more elegantly | Handle a lack of key more elegantly
| JavaScript | mit | johnotander/scrutinize |
17742c7b669bd991d575e3812789d1087d6d87af | index.js | index.js | var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var through = require('through');
function pluginError (message) {
return new PluginError('gulp-jade-template-concat', message);
}
module.exports = function jadeConcat(fileName, _opts) {
if (!fileName) {
throw pluginError('Missing filenam... | var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var through = require('through');
function pluginError (message) {
return new PluginError('gulp-jade-template-concat', message);
}
module.exports = function jadeConcat(fileName, _opts) {
if (!fileName) {
throw pluginError('Missing filenam... | Replace \\ to -- on windows and / to -- on linux | Replace \\ to -- on windows and / to -- on linux | JavaScript | mit | shark0der/gulp-jade-template-concat |
d4fb4ea82124cf153f6962b9e25c78067198835e | index.js | index.js | #!/usr/bin/env node
var program = require('commander'),
globalify = require('./globalify'),
packageJson = require('./package.json'),
fs = require('fs');
program
.version(packageJson.version)
.usage('<module> [options]')
.arguments('<module>')
.option('-o, --out <outputFileName>', 'the outpu... | #!/usr/bin/env node
var program = require('commander'),
globalify = require('./globalify'),
packageJson = require('./package.json'),
fs = require('fs');
program
.version(packageJson.version)
.usage('<module> [options]')
.arguments('<module>')
.option('-o, --out <outputFileName>', 'the outpu... | Add support for scoped package | Add support for scoped package
| JavaScript | mit | KoryNunn/globalify |
9d1f17c848cd967993bda71d094e81718b7c7e23 | index.js | index.js | /**
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = require('./lib/Fluxible');
module.exports.Mixin = require('./mixins/FluxibleMixin');
| /**
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
module.exports = require('./lib/Fluxible');
module.exports.Mixin = require('./mixins/FluxibleMixin');
module.exports.FluxibleMixin = module.exports.Mixin;
| Add FluxibleMixin as an export to facilitate ES6 module import | Add FluxibleMixin as an export to facilitate ES6 module import | JavaScript | bsd-3-clause | mdressman/fluxible,ali1k/fluxible,kelsadita/fluxible,mdressman/fluxible,v2018z/fluxible,DelvarWorld/fluxible,koulmomo/fluxible,YoussefTaghlabi/fluxible,pablolmiranda/fluxible,gpbl/fluxible,koulmomo/fluxible,localnerve/fluxible,kwangkim/fluxible,IveWong/fluxible,turadg/fluxible |
0f398c9eecc83a923c6e7742a92b5f97899c21dc | app/scripts/routes.js | app/scripts/routes.js | import React from 'react';
import { Route, DefaultRoute, NotFoundRoute } from 'react-router';
import App from './pages/app.jsx';
import Lobby from './pages/lobby.jsx';
import Game from './pages/game.jsx';
import NotFound from './pages/notFound.jsx';
var routes = (
<Route name="app" path="/" handler={ App }>
<... | import React from 'react';
import { Route, DefaultRoute, NotFoundRoute } from 'react-router';
import App from './pages/app.jsx';
import Lobby from './pages/lobby.jsx';
import Game from './pages/game.jsx';
import NotFound from './pages/notFound.jsx';
var routes = (
<Route name="app" path="/" handler={ App }>
<... | Add path to game in router | Add path to game in router
| JavaScript | mit | gnidan/foodtastechess-client,gnidan/foodtastechess-client |
6afd1871af3943f8efa797f59c1c25dc0125e249 | index.js | index.js | var fs = require('fs');
var formidable = require('formidable');
var git = require('./lib/git')(__dirname);
var http = require('http');
var hyperglue = require('hyperglue');
var _ = require('lodash');
var html = fs.readFileSync(__dirname + '/index.html');
var port = process.env.PORT || 8080;
function handlePost (req, r... | #! /usr/bin/env node
var fs = require('fs');
var formidable = require('formidable');
var git = require('./lib/git')(__dirname);
var http = require('http');
var hyperglue = require('hyperglue');
var _ = require('lodash');
var html = fs.readFileSync(__dirname + '/index.html');
var port = process.env.PORT || 8080;
funct... | Add env line to script | Add env line to script
| JavaScript | mit | derekr/git-branch-d-ui |
2a6e9596100fbbd5c41bfaac69756238d3b32aad | index.js | index.js | 'use strict'
var entities = require('entities');
var util = require('hexo-util');
var cheerio = require('cheerio');
var asciidoctor = require('asciidoctor.js')();
var processor = asciidoctor.Asciidoctor(true);
var options = {
auto_detect: false,
lang: 'plain',
gutter: false,
wrap: false
};
var cheerio_load_o... | 'use strict'
var entities = require('entities');
var util = require('hexo-util');
var cheerio = require('cheerio');
var asciidoctor = require('asciidoctor.js')();
var processor = asciidoctor.Asciidoctor(true);
var options = {
auto_detect: false,
lang: 'plain',
gutter: false,
wrap: false
};
var cheerio_load_o... | Allow multiple level-0 headings by setting asciidoc's "doctype" option to "book" | Allow multiple level-0 headings by setting asciidoc's "doctype" option to "book" | JavaScript | isc | hcoona/hexo-renderer-asciidoc |
fc5d0fda50b598586edc352c0a3e0b4c69c3e4c1 | index.js | index.js | let express = require('express');
let app = express();
app.use(express.static('public'));
app.listen(3000, () => {
console.log("http://localhost:3000/");
});
| let express = require('express');
let app = express();
app.use(express.static('public'));
app.listen(process.env.PORT, () => {
console.log("http://localhost:" + process.env.PORT + "/");
});
| Change port to use env variable. | Change port to use env variable.
| JavaScript | mit | nvladimiroff/CSUSeniorProject,nvladimiroff/CSUSeniorProject,nvladimiroff/CSUSeniorProject,nvladimiroff/CSUSeniorProject |
eacd003d94fd486a66f775a6b7f410c5acb37b42 | index.js | index.js | 'use strict';
var through = require('through2')
, pumpify = require('pumpify')
, split = require('split')
, regex = /^[ \t]+$/;
//
// Expose the transform.
//
module.exports = condenseify;
/**
* Browserify transform to condense multiple blank lines
* into a single blank line.
*
* @param {String} file File ... | 'use strict';
var through = require('through2')
, pumpify = require('pumpify')
, split = require('split');
//
// Expose the transform.
//
module.exports = condenseify;
/**
* Browserify transform to condense multiple blank lines
* into a single blank line.
*
* @param {String} file File name
* @param {Object}... | Use buffers to prevent node from doing unwanted checks | [minor] Use buffers to prevent node from doing unwanted checks
| JavaScript | mit | primus/condenseify |
a1aaeb07a906e00bee0acf1c9446d6b2efdbef55 | index.js | index.js | (function() {
try {
return new KeyboardEvent(eventType, init);
} catch (error) {
global.window.KeyboardEvent = function(eventType, init) {
var modKeys = [
init.ctrlKey ? 'Control' : '',
init.shiftKey ? 'Shift' : '',
init.altKey ? 'Alt' : '',
init.altGrKey ? 'AltGr' : ''... | (function() {
// critically in Phantom JS it is an object so can't be used as a constructor.
if (typeof KeyboardEvent !== 'function') {
global.window.KeyboardEvent = function(eventType, init) {
var modKeys = [
init.ctrlKey ? 'Control' : '',
init.shiftKey ? 'Shift' : '',
init.altKey... | Check for type then fill. | Check for type then fill.
| JavaScript | mit | justingrayston/basic-keyboard-event-polyfill |
d7bfedb290c996e75c5eef8127ded2a8eddf5edb | index.js | index.js | function install(globalObject) {
if (!globalObject.jasmine) {
throw new Error(
'It looks like you\'re trying to install jasmine-pit before installing ' +
'jasmine! Make sure there is a `jasmine` property on the global object ' +
'(window/global/etc) before calling install().'
);
}
var j... | function install(globalObject) {
if (!globalObject.jasmine) {
throw new Error(
'It looks like you\'re trying to install jasmine-pit before installing ' +
'jasmine! Make sure there is a `jasmine` property on the global object ' +
'(window/global/etc) before calling install().'
);
}
var j... | Update pit() to keep same context as it() | Update pit() to keep same context as it()
This way you can call this.fail() from within the pit function. | JavaScript | mit | johnhaley81/jasmine-pit,jeffmo/jasmine-pit,gagoman/jasmine-pit |
908b0b47d2f775997f4ab5cac26455306c886dc2 | git-deploy.js | git-deploy.js | /*
@method gitPull
Takes a flightplan instance and transport
@param remote {Object} Flightplan transport instance
@param webRoot {string} path to run git pull on the remote server
e.g. /var/www/project
*/
var gitPull = function (remote, webRoot) {
// git pull
remote.with('cd ' + webRoot, function() {
... | /*
@method gitPull
Takes a flightplan instance and transport
@param remote {Object} Flightplan transport instance
@param webRoot {string} path to run git pull on the remote server
e.g. /var/www/project
*/
var gitPull = function (remote, webRoot) {
// git pull
remote.with('cd ' + webRoot, function() {
... | Fix unchanged function name for gitPull | Fix unchanged function name for gitPull | JavaScript | mit | grahamgilchrist/flightplan-git-deploy |
9d4635d9a4306279a8abceea26b7a402ac133b05 | app/authenticated/cluster/notifier/index/controller.js | app/authenticated/cluster/notifier/index/controller.js | import { get } from '@ember/object';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
export default Controller.extend({
modalService: service('modal'),
globalStore: service(),
queryParams: ['type'],
currentType: '... | import { get } from '@ember/object';
import { alias } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
export default Controller.extend({
modalService: service('modal'),
globalStore: service(),
queryParams: ['type'],
currentType: '... | Fix js error: currentType is undefined | Fix js error: currentType is undefined
https://github.com/rancher/rancher/issues/23437
| JavaScript | apache-2.0 | vincent99/ui,rancher/ui,rancherio/ui,rancher/ui,westlywright/ui,westlywright/ui,vincent99/ui,westlywright/ui,vincent99/ui,rancherio/ui,rancherio/ui,rancher/ui |
4a33f1dd62015f61cead8cec289b13f3a1792564 | bin/cmd/serve-sass.js | bin/cmd/serve-sass.js | /**
* Created by doug.schroeder on 2/10/16.
*/
module.exports = {
run: function () {
require('../../lib/spawn-gulp')(['watch-res-sass'].concat(process.argv.splice(3)));
},
help: 'Compiles and serves SCSS files for the responsive skin selected with li set-responsive-options.' +
'\nSaved changes to local S... | /**
* Created by doug.schroeder on 2/10/16.
*/
'use strict';
module.exports = {
run: function () {
require('../../lib/spawn-gulp')(['watch-res-sass local-server'].concat(process.argv.splice(3)));
},
help: 'Compiles and serves SCSS files for the responsive skin selected with li set-responsive-options.' +
... | Update server-sass command to use local-server gulp task. | Update server-sass command to use local-server gulp task.
| JavaScript | apache-2.0 | lithiumtech/lithium-sdk,lithiumtech/lithium-sdk |
cad2d3481f4f9b443923a32dbb8f9ba56c2c906f | blueprints/emberfire/files/app/adapters/application.js | blueprints/emberfire/files/app/adapters/application.js | import Ember from 'ember';
import FirebaseAdapter from 'emberfire/adapters/firebase';
const {inject, computed} = Ember;
export default FirebaseAdapter.extend({
firebase: inject.service(),
});
| import Ember from 'ember';
import FirebaseAdapter from 'emberfire/adapters/firebase';
const { inject } = Ember;
export default FirebaseAdapter.extend({
firebase: inject.service(),
});
| Remove unused `computed` var in blueprint app adapter | Remove unused `computed` var in blueprint app adapter
| JavaScript | mit | FirebaseExtended/emberfire,IsaiahJTurner/emberfire,rtablada/emberfire,leifcr/emberfire,FirebaseExtended/emberfire,leifcr/emberfire,rtablada/emberfire,FirebaseExtended/emberfire,IsaiahJTurner/emberfire,FirebaseExtended/emberfire |
6d9e42126659a958742b83e8fba18555db34c7e8 | docker/conf/settings.js | docker/conf/settings.js | /*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation
Contributors:
Jeff Bryner jbryner@mozilla.com
Anthony Verez averez@mozilla.com
*/
/... | /*
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (c) 2014 Mozilla Corporation
Contributors:
Jeff Bryner jbryner@mozilla.com
Anthony Verez averez@mozilla.com
*/
/... | Use password auth in single docker container config | Use password auth in single docker container config
| JavaScript | mpl-2.0 | gdestuynder/MozDef,gdestuynder/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mozilla/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mozilla/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,mozilla/MozDe... |
3bc4c15bffb09e7490f7798b2109d95eac374650 | js/twee-fi.js | js/twee-fi.js | /* global SolidAuthClient, SolidUtils, $rdf */
TweeFiUtils = {
TweetUri: class {
constructor(value) {
// Regex-pattern to check URLs against:
// https://twitter.com/<twitteruser>/status/<long number>
var urlRegex = /^https:\/\/twitter.com\/([a-zA-Z _.,!"'/$]+)\/status\... | /* global SolidAuthClient, SolidUtils, $rdf */
TweeFiUtils = {
TweetUri: class {
constructor(value) {
// Regex-pattern to check URLs against:
// https://twitter.com/<twitteruser>/status/<long number>
var urlRegex = /^https:\/\/twitter.com\/([a-zA-Z _.,!"'/$]+)\/status\... | Check when session is null | Check when session is null | JavaScript | mit | factsmission/twee-fi,factsmission/twee-fi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.