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 |
|---|---|---|---|---|---|---|---|---|---|---|
39d265f663f47793ad4ac91216b848ec4da9a73a | app/scripts/main.js | app/scripts/main.js | 'use strict';
var localforage = require('localforage');
var $body = $('body');
['theme', 'mode'].forEach(function (property) {
localforage.getItem(property, function (value) {
if (!value) {
value = 'default';
localforage.setItem(property, value);
} else {
// For non-first time users, we want to see what modes/themes they are using.
if (property === 'theme') {
ga('send', 'event', 'Theme', 'Load page with theme', value);
}
if (property === 'mode') {
ga('send', 'event', 'Mode', 'Load page with mode', value);
}
}
$body.addClass(property + '-' + value);
$body.attr('data-' + property, value);
if (property === 'mode' && value !== 'default') {
$('#mode').attr('href', '/styles/' + value + '.min.css');
}
});
});
var App = require('./app');
App.start();
| 'use strict';
var localforage = require('localforage');
var $body = $('body');
['theme', 'mode'].forEach(function (property) {
localforage.getItem(property, function (value) {
if (!value) {
value = 'default';
localforage.setItem(property, value);
} else {
// For non-first time users, we want to see what modes/themes they are using.
if (property === 'theme') {
// Set theme custom dimension
ga('set', 'dimension3', value);
}
if (property === 'mode') {
// Set mode custom dimension
ga('set', 'dimension4', value);
}
}
$body.addClass(property + '-' + value);
$body.attr('data-' + property, value);
if (property === 'mode' && value !== 'default') {
$('#mode').attr('href', '/styles/' + value + '.min.css');
}
});
});
var App = require('./app');
App.start();
| Set mode and theme custom dimensions instead of sending event | Set mode and theme custom dimensions instead of sending event
| JavaScript | mit | zhouyichen/nusmods,Yunheng/nusmods,nusmodifications/nusmods,nusmodifications/nusmods,nathanajah/nusmods,chunqi/nusmods,chunqi/nusmods,chunqi/nusmods,nathanajah/nusmods,mauris/nusmods,chunqi/nusmods,nathanajah/nusmods,nathanajah/nusmods,nusmodifications/nusmods,zhouyichen/nusmods,Yunheng/nusmods,Yunheng/nusmods,nusmodifications/nusmods,mauris/nusmods,Yunheng/nusmods,zhouyichen/nusmods,Yunheng/nusmods,zhouyichen/nusmods,mauris/nusmods,mauris/nusmods | ---
+++
@@ -11,10 +11,12 @@
} else {
// For non-first time users, we want to see what modes/themes they are using.
if (property === 'theme') {
- ga('send', 'event', 'Theme', 'Load page with theme', value);
+ // Set theme custom dimension
+ ga('set', 'dimension3', value);
}
if (property === 'mode') {
- ga('send', 'event', 'Mode', 'Load page with mode', value);
+ // Set mode custom dimension
+ ga('set', 'dimension4', value);
}
}
$body.addClass(property + '-' + value); |
22ab2c05c83dc0855a878a34e45b08ebfe3c9f77 | blueprints/ember-cli-typescript/index.js | blueprints/ember-cli-typescript/index.js | /* eslint-env node */
const path = require('path');
module.exports = {
description: 'Initialize files needed for typescript compilation',
files() {
return [
path.join(this.path, 'files', 'tsconfig.json'),
path.join(this.path, 'files', 'app', 'config', 'environment.d.ts'),
];
},
mapFile() {
const result = this._super.mapFile.apply(this, arguments);
const tsconfigPattern = `${path.sep}tsconfig.json`;
const appPattern = `${path.sep}app${path.sep}`;
if (result.indexOf(tsconfigPattern) > -1) {
return 'tsconfig.json';
} else if (result.indexOf(appPattern) > -1) {
var pos = result.indexOf(appPattern);
return result.substring(pos + 1);
}
},
locals() {
return {
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || []
};
},
normalizeEntityName() {
// Entity name is optional right now, creating this hook avoids an error.
},
afterInstall() {
return this.addPackagesToProject([
{ name: 'typescript', target: '^2.4.2' },
{ name: '@types/ember', target: '^2.7.43' },
{ name: '@types/rsvp', target: '^3.3.0' },
{ name: '@types/ember-testing-helpers' },
]);
},
};
| /* eslint-env node */
const path = require('path');
module.exports = {
description: 'Initialize files needed for typescript compilation',
files() {
return [
path.join(this.path, 'files', 'tsconfig.json'),
path.join(this.path, 'files', 'app', 'config', 'environment.d.ts'),
];
},
mapFile() {
const result = this._super.mapFile.apply(this, arguments);
const tsconfigPattern = `${path.sep}tsconfig.json`;
const appPattern = `${path.sep}app${path.sep}`;
if (result.indexOf(tsconfigPattern) > -1) {
return 'tsconfig.json';
} else if (result.indexOf(appPattern) > -1) {
var pos = result.indexOf(appPattern);
return result.substring(pos + 1);
}
},
locals() {
return {
inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [],
};
},
normalizeEntityName() {
// Entity name is optional right now, creating this hook avoids an error.
},
afterInstall() {
return this.addPackagesToProject([
{ name: 'typescript', target: 'latest' },
{ name: '@types/ember', target: 'latest' },
{ name: '@types/rsvp', target: 'latest' },
{ name: '@types/ember-testing-helpers', target: 'latest' },
]);
},
};
| Use 'latest' for typing versions. | Use 'latest' for typing versions.
| JavaScript | mit | emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript,emberwatch/ember-cli-typescript | ---
+++
@@ -28,7 +28,7 @@
locals() {
return {
- inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || []
+ inRepoAddons: (this.project.pkg['ember-addon'] || {}).paths || [],
};
},
@@ -38,10 +38,10 @@
afterInstall() {
return this.addPackagesToProject([
- { name: 'typescript', target: '^2.4.2' },
- { name: '@types/ember', target: '^2.7.43' },
- { name: '@types/rsvp', target: '^3.3.0' },
- { name: '@types/ember-testing-helpers' },
+ { name: 'typescript', target: 'latest' },
+ { name: '@types/ember', target: 'latest' },
+ { name: '@types/rsvp', target: 'latest' },
+ { name: '@types/ember-testing-helpers', target: 'latest' },
]);
},
}; |
907620ba91313e95cabcc7104b0d52225cb77e28 | src/logger/steps/writing.js | src/logger/steps/writing.js | /**
* Step 5
* Where you write the generator specific files (routes, controllers, etc)
*/
const SOURCE_CONFIG = name => `${name}Config.js`;
const DESTINATION_CONFIG = `config/log.js`;
export default function () {
let logger = this['logger-name'];
this.template(SOURCE_CONFIG(logger), DESTINATION_CONFIG, {logger});
};
| /**
* Step 5
* Where you write the generator specific files (routes, controllers, etc)
*/
const SOURCE_CONFIG = name => `${name}Config.js`;
const DESTINATION_CONFIG = `config/log.js`;
export default function () {
let logger = this['logger-name'].toLowerCase();
this.template(SOURCE_CONFIG(logger), DESTINATION_CONFIG, {logger});
};
| Fix issue with lower-cased form of logger name | fix(logger): Fix issue with lower-cased form of logger name
| JavaScript | mit | ghaiklor/generator-sails-rest-api,konstantinzolotarev/generator-trails,italoag/generator-sails-rest-api,jaumard/generator-trails,ghaiklor/generator-sails-rest-api,tnunes/generator-trails,italoag/generator-sails-rest-api | ---
+++
@@ -8,7 +8,7 @@
const DESTINATION_CONFIG = `config/log.js`;
export default function () {
- let logger = this['logger-name'];
+ let logger = this['logger-name'].toLowerCase();
this.template(SOURCE_CONFIG(logger), DESTINATION_CONFIG, {logger});
}; |
1c8c0e06f8b6f89c1a06958a58f5b5e55be63b2b | checkCoverage.js | checkCoverage.js | var data = '';
process.stdin.on('data', function(chunk) { data += chunk; });
process.stdin.on('end', function() {
var regExp = /[0-9]+([.][0-9]+)?%/g;
var match;
do {
match = regExp.exec(data);
if (match) {
var percent = parseFloat(match[0].substring(0, match[0].length - 1));
if (percent < 80) {
console.error('Insufficient code coverage');
process.exit(1);
}
}
} while (match);
console.log('Code coverage OK');
process.exit(0);
});
| var MIN_METRIC_COVERAGE = 90.0;
var data = '';
process.stdin.on('data', function(chunk) { data += chunk; });
process.stdin.on('end', function() {
var regExp = /[0-9]+([.][0-9]+)?%/g;
var match;
do {
match = regExp.exec(data);
if (match) {
var percent = parseFloat(match[0].substring(0, match[0].length - 1));
if (percent < MIN_METRIC_COVERAGE) {
console.error('Insufficient code coverage');
process.exit(1);
}
}
} while (match);
console.log('Code coverage OK');
process.exit(0);
});
| Raise the bar on test coverage from 80% to 90% | Raise the bar on test coverage from 80% to 90%
| JavaScript | apache-2.0 | foam-framework/foam2,jacksonic/vjlofvhjfgm,jacksonic/vjlofvhjfgm,TanayParikh/foam2,foam-framework/foam2,TanayParikh/foam2,jacksonic/vjlofvhjfgm,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,TanayParikh/foam2,TanayParikh/foam2 | ---
+++
@@ -1,3 +1,5 @@
+var MIN_METRIC_COVERAGE = 90.0;
+
var data = '';
process.stdin.on('data', function(chunk) { data += chunk; });
process.stdin.on('end', function() {
@@ -7,7 +9,7 @@
match = regExp.exec(data);
if (match) {
var percent = parseFloat(match[0].substring(0, match[0].length - 1));
- if (percent < 80) {
+ if (percent < MIN_METRIC_COVERAGE) {
console.error('Insufficient code coverage');
process.exit(1);
} |
50d3aeafe00053c798d4049a0eafa07edb7a42c2 | server/src/main/webui/app/components/contextItem.js | server/src/main/webui/app/components/contextItem.js | import React from "react"
import { Nav, NavItem, Collapse } from "react-bootstrap"
var threadNavStyle = {
backgroundColor: 'rgb(220, 220, 220)',
color: 'black'
};
export default React.createClass({
getInitialState: function() {
return {}
},
render: function() {
var { title, ...other } = this.props;
return (
<NavItem {...other}>
<span>
{ this.props.title }
</span>
<Collapse in={this.props.active}>
<div>
<Nav bsStyle="link" activeKey={1} style={threadNavStyle}>
<NavItem eventKey={1}>
Thread 1 - src/main.c:1234
</NavItem>
<NavItem eventKey={2}>
Thread 2 - src/events.c:120
</NavItem>
</Nav>
</div>
</Collapse>
</NavItem>
);
}
});
| import React from "react"
import { Button, ButtonGroup, NavItem, Collapse } from "react-bootstrap"
export default React.createClass({
getInitialState: function() {
return {}
},
render: function() {
var { title, ...other } = this.props;
return (
<NavItem {...other}>
<span>
{ this.props.title }
</span>
<Collapse in={this.props.active}>
<div>
<ButtonGroup vertical block>
<Button bsStyle="info">
Thread 1 - src/main.c:1234
</Button>
<Button>
Thread 2 - src/events.c:120
</Button>
</ButtonGroup>
</div>
</Collapse>
</NavItem>
);
}
});
| Switch to using a button group for the context selector. | Switch to using a button group for the context selector.
| JavaScript | mpl-2.0 | mcnulty/udidb,mcnulty/udidb,mcnulty/udidb,mcnulty/udidb,mcnulty/udidb | ---
+++
@@ -1,10 +1,5 @@
import React from "react"
-import { Nav, NavItem, Collapse } from "react-bootstrap"
-
-var threadNavStyle = {
- backgroundColor: 'rgb(220, 220, 220)',
- color: 'black'
-};
+import { Button, ButtonGroup, NavItem, Collapse } from "react-bootstrap"
export default React.createClass({
getInitialState: function() {
@@ -20,14 +15,14 @@
</span>
<Collapse in={this.props.active}>
<div>
- <Nav bsStyle="link" activeKey={1} style={threadNavStyle}>
- <NavItem eventKey={1}>
+ <ButtonGroup vertical block>
+ <Button bsStyle="info">
Thread 1 - src/main.c:1234
- </NavItem>
- <NavItem eventKey={2}>
+ </Button>
+ <Button>
Thread 2 - src/events.c:120
- </NavItem>
- </Nav>
+ </Button>
+ </ButtonGroup>
</div>
</Collapse>
</NavItem> |
ed29712fac2ec580c3e0030f96a5c77bf1e1ece2 | spec/arethusa.core/directives/lang_specific_spec.js | spec/arethusa.core/directives/lang_specific_spec.js | "use strict";
describe('lang-specific directive', function() {
var element;
var documentStore;
function createDocumentStore() {
return {
store: {
treebank: {
json: {
treebank: {}
}
}
}
};
}
beforeEach(module('arethusa.core'));
var createElement = function() {
inject(function ($compile, $rootScope) {
var $scope = $rootScope.$new();
element = angular.element("<span lang-specific />");
$compile(element)($scope);
});
};
describe('Arabic', function() {
beforeEach(module(function($provide) {
documentStore = createDocumentStore();
documentStore.store.treebank.json.treebank["_xml:lang"] = "ara";
$provide.value('documentStore', documentStore);
}));
beforeEach(function() {
createElement();
});
it('sets the language on the html element', function() {
expect(element.attr('lang')).toEqual('ar');
});
it('sets the text direction on the html element', function() {
expect(element.attr('dir')).toEqual('rtl');
});
});
describe('unspecified language', function() {
beforeEach(module(function($provide) {
documentStore = createDocumentStore();
$provide.value('documentStore', documentStore);
}));
beforeEach(function() {
createElement();
});
it('does not set any language on the html element', function() {
expect(element.attr('lang')).toBeUndefined();
});
it('does not set dir on the html element', function() {
expect(element.attr('dir')).toBeUndefined();
});
});
});
| "use strict";
describe('lang-specific directive', function() {
var element;
var documentStore;
function createLanguageSettingsWith(settings) {
return {
getFor: function(doc) {
return settings;
}
};
}
beforeEach(module('arethusa.core'));
var createElement = function() {
inject(function ($compile, $rootScope) {
var $scope = $rootScope.$new();
element = angular.element("<span lang-specific />");
$compile(element)($scope);
});
};
describe('Arabic', function() {
var arabicSettings = {
lang: 'ar',
leftToRight: false
};
beforeEach(module(function($provide) {
$provide.value('languageSettings',
createLanguageSettingsWith(arabicSettings));
}));
beforeEach(function() {
createElement();
});
it('sets the language on the html element', function() {
expect(element.attr('lang')).toEqual('ar');
});
it('sets the text direction on the html element', function() {
expect(element.attr('dir')).toEqual('rtl');
});
});
describe('unspecified language', function() {
beforeEach(module(function($provide) {
$provide.value('languageSettings', createLanguageSettingsWith(undefined));
}));
beforeEach(function() {
createElement();
});
it('does not set any language on the html element', function() {
expect(element.attr('lang')).toBeUndefined();
});
it('does not set dir on the html element', function() {
expect(element.attr('dir')).toBeUndefined();
});
});
});
| Update lang-specific specs to stub languageSettings | Update lang-specific specs to stub languageSettings
| JavaScript | mit | alpheios-project/arethusa,PonteIneptique/arethusa,latin-language-toolkit/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,latin-language-toolkit/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa,Masoumeh/arethusa,PonteIneptique/arethusa | ---
+++
@@ -3,14 +3,10 @@
describe('lang-specific directive', function() {
var element;
var documentStore;
- function createDocumentStore() {
+ function createLanguageSettingsWith(settings) {
return {
- store: {
- treebank: {
- json: {
- treebank: {}
- }
- }
+ getFor: function(doc) {
+ return settings;
}
};
}
@@ -26,10 +22,13 @@
};
describe('Arabic', function() {
+ var arabicSettings = {
+ lang: 'ar',
+ leftToRight: false
+ };
beforeEach(module(function($provide) {
- documentStore = createDocumentStore();
- documentStore.store.treebank.json.treebank["_xml:lang"] = "ara";
- $provide.value('documentStore', documentStore);
+ $provide.value('languageSettings',
+ createLanguageSettingsWith(arabicSettings));
}));
beforeEach(function() {
@@ -47,8 +46,7 @@
describe('unspecified language', function() {
beforeEach(module(function($provide) {
- documentStore = createDocumentStore();
- $provide.value('documentStore', documentStore);
+ $provide.value('languageSettings', createLanguageSettingsWith(undefined));
}));
beforeEach(function() { |
7691964f1a2afd88154514548145d760778b71c4 | packages/soya-next/config/default.js | packages/soya-next/config/default.js | const config = require("config");
let basePath;
if (config.basePath) {
if (typeof config.basePath === "string") {
basePath = {
test: config.basePath
};
}
basePath = config.basePath;
}
config.assetPrefix = config.assetPrefix || basePath || "";
config.configOrigin = config.configOrigin || "default";
config.distDir = config.distDir || ".next";
config.useFileSystemPublicRoutes = config.useFileSystemPublicRoutes || true;
config.server = config.server || {};
config.server.host = config.server.host || "0.0.0.0";
config.server.port = config.server.port || 3000;
| const config = require("config");
let basePath;
if (config.basePath) {
if (typeof config.basePath === "string") {
basePath = config.basePath;
} else {
basePath = config.basePath && config.basePath.test;
}
}
config.assetPrefix = config.assetPrefix || basePath || "";
config.configOrigin = config.configOrigin || "default";
config.distDir = config.distDir || ".next";
config.useFileSystemPublicRoutes = config.useFileSystemPublicRoutes || true;
config.server = config.server || {};
config.server.host = config.server.host || "0.0.0.0";
config.server.port = config.server.port || 3000;
| Fix wrong assetPrefix when using basePath as object | Fix wrong assetPrefix when using basePath as object
| JavaScript | mit | traveloka/soya-next | ---
+++
@@ -2,11 +2,10 @@
let basePath;
if (config.basePath) {
if (typeof config.basePath === "string") {
- basePath = {
- test: config.basePath
- };
+ basePath = config.basePath;
+ } else {
+ basePath = config.basePath && config.basePath.test;
}
- basePath = config.basePath;
}
config.assetPrefix = config.assetPrefix || basePath || "";
config.configOrigin = config.configOrigin || "default"; |
41c4683e6b4c967aaeaa6a676dd252b6182dea52 | app/assets/javascripts/controllers/NavController.js | app/assets/javascripts/controllers/NavController.js | function NavController($scope, Auth) {
$scope.signedIn = Auth.isAuthenticated;
$scope.logout = Auth.logout;
Auth.currentUser().then(function (user) {
$scope.user = user;
});
$scope.$on('devise:new-registration', function (e, user) {
$scope.user = user;
});
$scope.$on('devise:login', function (e, user) {
$scope.user = user;
});
$scope.$on()('devise:logout', function (e, user) {
$scope.user = {};
});
}
NavController.$inject = ['$scope', 'Auth'];
angular
.module('app')
.controller('NavController', NavController);
| function NavController($scope, $state, Auth) {
$scope.signedIn = Auth.isAuthenticated;
$scope.logout = Auth.logout;
Auth.currentUser().then(function (user) {
$scope.user = user;
});
$scope.$on('devise:new-registration', function (e, user) {
$scope.user = user;
});
$scope.$on('devise:login', function (e, user) {
$scope.user = user;
});
$scope.$on('devise:logout', function (e, user) {
$scope.user = {};
$state.go('home');
});
}
NavController.$inject = ['$scope', '$state', 'Auth'];
angular
.module('app')
.controller('NavController', NavController);
| Load home page on logout | Load home page on logout
| JavaScript | mit | davdkm/whats-good,davdkm/whats-good,davdkm/whats-good | ---
+++
@@ -1,4 +1,4 @@
-function NavController($scope, Auth) {
+function NavController($scope, $state, Auth) {
$scope.signedIn = Auth.isAuthenticated;
$scope.logout = Auth.logout;
@@ -14,12 +14,13 @@
$scope.user = user;
});
- $scope.$on()('devise:logout', function (e, user) {
+ $scope.$on('devise:logout', function (e, user) {
$scope.user = {};
+ $state.go('home');
});
}
-NavController.$inject = ['$scope', 'Auth'];
+NavController.$inject = ['$scope', '$state', 'Auth'];
angular
.module('app')
.controller('NavController', NavController); |
2ddea6322f9f3a1522899c19903e49476346bac9 | js/components/developer/job-preview-screen/jobTypeCardPreview.js | js/components/developer/job-preview-screen/jobTypeCardPreview.js | import React, { Component } from 'react';
import { Card } from 'native-base';
import CardImageHeader from '../../common/card-image-header/cardImageHeader';
import SimpleCardBody from '../../common/simple-card-body/simpleCardBody';
export default class JobTypeCardPreview extends Component {
static propTypes = {
title: React.PropTypes.string.isRequired,
cover: React.PropTypes.string.isRequired,
icon: React.PropTypes.string.isRequired,
subtitle: React.PropTypes.string.isRequired,
};
render() {
return (
<Card>
<CardImageHeader cover={this.props.cover} icon={this.props.icon} />
<SimpleCardBody title={this.props.title} subtitle={this.props.subtitle} />
</Card>
);
}
}
| import React, { Component } from 'react';
import { Card } from 'native-base';
import CardImageHeader from '../../common/card-image-header/cardImageHeader';
import SimpleCardBody from '../../common/simple-card-body/simpleCardBody';
import { imageProp } from '../../common/propTypes';
export default class JobTypeCardPreview extends Component {
static propTypes = {
title: React.PropTypes.string.isRequired,
cover: imageProp.isRequired,
icon: imageProp.isRequired,
subtitle: React.PropTypes.string.isRequired,
};
render() {
return (
<Card>
<CardImageHeader cover={this.props.cover} icon={this.props.icon} />
<SimpleCardBody title={this.props.title} subtitle={this.props.subtitle} />
</Card>
);
}
}
| Make JobTypeCardPreview use imageProp from propTypes | Make JobTypeCardPreview use imageProp from propTypes
| JavaScript | mit | justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client,justarrived/p2p-client | ---
+++
@@ -3,12 +3,13 @@
import CardImageHeader from '../../common/card-image-header/cardImageHeader';
import SimpleCardBody from '../../common/simple-card-body/simpleCardBody';
+import { imageProp } from '../../common/propTypes';
export default class JobTypeCardPreview extends Component {
static propTypes = {
title: React.PropTypes.string.isRequired,
- cover: React.PropTypes.string.isRequired,
- icon: React.PropTypes.string.isRequired,
+ cover: imageProp.isRequired,
+ icon: imageProp.isRequired,
subtitle: React.PropTypes.string.isRequired,
};
|
f283ed1c9df5b8daee0fe32d9670d23100733d33 | test/style-examples.test.js | test/style-examples.test.js | var test = require('tape');
var tm = require('../lib/tm');
var style = require('../lib/style');
var source = require('../lib/source');
var mockOauth = require('../lib/mapbox-mock')(require('express')());
var tmppath = tm.join(require('os').tmpdir(), 'Examples ШЖФ -' + (+new Date));
var server;
test('setup', function(t) {
tm.config({
log: false,
db: tm.join(tmppath, 'app.db'),
cache: tm.join(tmppath, 'cache'),
fonts: tm.join(tmppath, 'fonts'),
mapboxauth: 'http://localhost:3001'
}, t.end);
});
test('setup: mockserver', function(t) {
tm.db.set('oauth', {
account: 'test',
accesstoken: 'testaccesstoken'
});
tm._config.mapboxauth = 'http://localhost:3001',
tm._config.mapboxtile = 'http://localhost:3001/v4';
server = mockOauth.listen(3001, t.end);
});
for (var key in style.examples) (function(key) {
test(key, function(t) {
style(style.examples[key], function(err, s) {
t.ifError(err);
t.end();
});
});
})(key);
test('cleanup', function(t) {
server.close(function() { t.end(); });
});
| var test = require('tape');
var tm = require('../lib/tm');
var style = require('../lib/style');
var source = require('../lib/source');
var mockOauth = require('../lib/mapbox-mock')(require('express')());
var tmppath = tm.join(require('os').tmpdir(), 'Examples ШЖФ -' + (+new Date));
var server;
test('setup', function(t) {
tm.config({
log: false,
db: tm.join(tmppath, 'app.db'),
cache: tm.join(tmppath, 'cache'),
fonts: tm.join(tmppath, 'fonts'),
mapboxauth: 'http://localhost:3001'
}, t.end);
});
test('setup: mockserver', function(t) {
tm.db.set('oauth', {
account: 'test',
accesstoken: 'testaccesstoken'
});
tm._config.mapboxauth = 'http://localhost:3001',
tm._config.mapboxtile = 'http://localhost:3001/v4';
server = mockOauth.listen(3001, t.end);
});
for (var key in style.examples) (function(key) {
test(key, function(t) {
style(style.examples[key], function(err, s) {
t.ifError(err);
t.ok(!s.data._prefs.mapid, 'no mapid set');
t.end();
});
});
})(key);
test('cleanup', function(t) {
server.close(function() { t.end(); });
});
| Test that no mapid is set on example styles. | Test that no mapid is set on example styles.
| JavaScript | bsd-3-clause | wakermahmud/mapbox-studio,tizzybec/mapbox-studio,wakermahmud/mapbox-studio,tizzybec/mapbox-studio,adozenlines/mapbox-studio,mapbox/mapbox-studio-classic,wakermahmud/mapbox-studio,crowdcover/mapbox-studio,danieljoppi/mapbox-studio,Zhao-Qi/mapbox-studio-classic,AbelSu131/mapbox-studio,Zhao-Qi/mapbox-studio-classic,ali/mapbox-studio,tizzybec/mapbox-studio,crowdcover/mapbox-studio,danieljoppi/mapbox-studio,mapbox/mapbox-studio,mapbox/mapbox-studio,ali/mapbox-studio,xrwang/mapbox-studio,tizzybec/mapbox-studio,wakermahmud/mapbox-studio,AbelSu131/mapbox-studio,mapbox/mapbox-studio-classic,xrwang/mapbox-studio,AbelSu131/mapbox-studio,mapbox/mapbox-studio,crowdcover/mapbox-studio,mapbox/mapbox-studio,ali/mapbox-studio,xrwang/mapbox-studio,mapbox/mapbox-studio,adozenlines/mapbox-studio,danieljoppi/mapbox-studio,wakermahmud/mapbox-studio,xrwang/mapbox-studio,tizzybec/mapbox-studio,mapbox/mapbox-studio-classic,xrwang/mapbox-studio,ali/mapbox-studio,Zhao-Qi/mapbox-studio-classic,mapbox/mapbox-studio-classic,AbelSu131/mapbox-studio,Zhao-Qi/mapbox-studio-classic,AbelSu131/mapbox-studio,ali/mapbox-studio,crowdcover/mapbox-studio,Zhao-Qi/mapbox-studio-classic,adozenlines/mapbox-studio,adozenlines/mapbox-studio,danieljoppi/mapbox-studio,crowdcover/mapbox-studio,danieljoppi/mapbox-studio,adozenlines/mapbox-studio | ---
+++
@@ -30,6 +30,7 @@
test(key, function(t) {
style(style.examples[key], function(err, s) {
t.ifError(err);
+ t.ok(!s.data._prefs.mapid, 'no mapid set');
t.end();
});
}); |
68b3c1b5a93b20ffcbeffb051b3c4fdf6c1eab23 | client/desktop/app/components/Profile.js | client/desktop/app/components/Profile.js | import React from 'react'
import {Route, RouteHandler, Link, Button} from 'react-router'
class Profile extends React.Component {
constructor(props){
super(props);
this.state = {
teacherData: {
name: 'Teachy McTeacherton',
email: 'teachy@teach.er'
}
};
}
render(){
return(
<div>
<h2 className='sectionHeading'>Settings</h2>
<div className='profile' style={{marginLeft: '20%'}}>
<div >
<span>Name: </span><span>{this.state.teacherData.name}</span>
</div>
<div>
<span>Email: </span><span>{this.state.teacherData.email}</span>
</div>
<li onClick={()=>{ auth.logout();
}}>
</li>
</div>
<button style={{marginLeft: '20%'}}>Logout</button>
</div>
)
}
}
module.exports = Profile; | import React from 'react'
import {Route, RouteHandler, Link, Button} from 'react-router'
var auth = require('./../utils/auth');
class Profile extends React.Component {
constructor(props){
super(props);
this.state = {
teacherData: {
name: 'Teachy McTeacherton',
email: 'teachy@teach.er'
}
};
}
handleLogout() {
auth.logout();
this.context.router.push({
pathname: '/login'
});
}
render(){
return(
<div>
<h2 className='sectionHeading'>Settings</h2>
<div className='profile' style={{marginLeft: '20%'}}>
<div >
<span>Name: </span><span>{this.state.teacherData.name}</span>
</div>
<div>
<span>Email: </span><span>{this.state.teacherData.email}</span>
</div>
<li onClick={this.handleLogout.bind(this)}>
</li>
</div>
<button style={{marginLeft: '20%'}}>Logout</button>
</div>
)
}
}
Profile.contextTypes = {
router: React.PropTypes.any.isRequired
};
module.exports = Profile; | Add functionality to logout button | Add functionality to logout button
| JavaScript | mit | absurdSquid/thumbroll,Jakeyrob/thumbroll,Jakeyrob/thumbroll,shanemcgraw/thumbroll,Jakeyrob/thumbroll,shanemcgraw/thumbroll,shanemcgraw/thumbroll,absurdSquid/thumbroll | ---
+++
@@ -1,5 +1,6 @@
import React from 'react'
import {Route, RouteHandler, Link, Button} from 'react-router'
+var auth = require('./../utils/auth');
class Profile extends React.Component {
constructor(props){
@@ -10,6 +11,13 @@
email: 'teachy@teach.er'
}
};
+ }
+
+ handleLogout() {
+ auth.logout();
+ this.context.router.push({
+ pathname: '/login'
+ });
}
render(){
@@ -25,9 +33,7 @@
<div>
<span>Email: </span><span>{this.state.teacherData.email}</span>
</div>
-
- <li onClick={()=>{ auth.logout();
- }}>
+ <li onClick={this.handleLogout.bind(this)}>
</li>
</div>
<button style={{marginLeft: '20%'}}>Logout</button>
@@ -36,5 +42,8 @@
}
}
+Profile.contextTypes = {
+ router: React.PropTypes.any.isRequired
+};
module.exports = Profile; |
459775e9dd3d8b0c0119315615d6a4583de43503 | test/test_dummy/test_api.js | test/test_dummy/test_api.js | var assert = require("assert");
var Q = require("q");
var api = require("../../lib/dummy/api");
var DummyApi = api.DummyApi;
var resources = require("../../lib/dummy/resources");
var DummyResource = resources.DummyResource;
var ToyResource = DummyResource.extend(function(self) {
DummyResource.call(self);
self.name = 'toy';
self.handlers.foo = function(cmd) {
return {
handler: 'foo',
cmd: cmd
};
};
});
describe("DummyApi", function () {
var api;
function api_request(name, data) {
var d = Q.defer();
api.request(name, data, function(reply) {
d.resolve(reply);
});
return d.promise;
}
beforeEach(function () {
api = new DummyApi();
});
// TODO remove when pending_calls_complete is removed
it.skip("should dispatch commands asynchronously", function() {
var has_reply = false;
api_request("kv.get", {key: "foo"}).then(function (reply) {
has_reply = true;
assert(reply.success);
assert.equal(reply.value, null);
});
// check reply wasn't called immediately
assert(!has_reply);
return api.pending_calls_complete().then(function () {
assert(has_reply);
});
});
it("should dispatch commands using its resource controller when possible",
function() {
api.resources.add(new ToyResource());
return api_request('toy.foo', {}).then(function(result) {
assert.deepEqual(result, {
handler: 'foo',
cmd: {cmd: 'toy.foo'}
});
});
});
describe(".find_contact", function() {
it("should fail for unknown address types", function() {
assert.throws(
function () { api.find_contact("unknown", "+12334"); },
"/Unsupported delivery class " +
"(got: unknown with address +12334)/");
});
});
});
| var assert = require("assert");
var vumigo = require("../../lib");
var test_utils = vumigo.test_utils;
var DummyApi = vumigo.dummy.api.DummyApi;
var DummyResource = vumigo.dummy.resources.DummyResource;
var ToyResource = DummyResource.extend(function(self) {
DummyResource.call(self);
self.name = 'toy';
self.handlers.foo = function(cmd) {
return {
handler: 'foo',
cmd: cmd
};
};
});
describe("DummyApi", function () {
var api;
var request;
beforeEach(function () {
api = new DummyApi();
request = test_utils.requester(api);
});
it("should dispatch commands using its resource controller", function() {
api.resources.add(new ToyResource());
return request('toy.foo', {}).then(function(result) {
assert.deepEqual(result, {
handler: 'foo',
cmd: {cmd: 'toy.foo'}
});
});
});
});
| Remove old parts of DummyApi tests | Remove old parts of DummyApi tests
| JavaScript | bsd-3-clause | GeekFreaker/vumi-jssandbox-toolkit,GeekFreaker/vumi-jssandbox-toolkit | ---
+++
@@ -1,11 +1,9 @@
var assert = require("assert");
-var Q = require("q");
-var api = require("../../lib/dummy/api");
-var DummyApi = api.DummyApi;
-
-var resources = require("../../lib/dummy/resources");
-var DummyResource = resources.DummyResource;
+var vumigo = require("../../lib");
+var test_utils = vumigo.test_utils;
+var DummyApi = vumigo.dummy.api.DummyApi;
+var DummyResource = vumigo.dummy.resources.DummyResource;
var ToyResource = DummyResource.extend(function(self) {
@@ -23,55 +21,20 @@
describe("DummyApi", function () {
var api;
-
- function api_request(name, data) {
- var d = Q.defer();
-
- api.request(name, data, function(reply) {
- d.resolve(reply);
- });
-
- return d.promise;
- }
+ var request;
beforeEach(function () {
api = new DummyApi();
+ request = test_utils.requester(api);
});
- // TODO remove when pending_calls_complete is removed
- it.skip("should dispatch commands asynchronously", function() {
- var has_reply = false;
-
- api_request("kv.get", {key: "foo"}).then(function (reply) {
- has_reply = true;
- assert(reply.success);
- assert.equal(reply.value, null);
- });
-
- // check reply wasn't called immediately
- assert(!has_reply);
- return api.pending_calls_complete().then(function () {
- assert(has_reply);
- });
- });
-
- it("should dispatch commands using its resource controller when possible",
- function() {
+ it("should dispatch commands using its resource controller", function() {
api.resources.add(new ToyResource());
- return api_request('toy.foo', {}).then(function(result) {
+ return request('toy.foo', {}).then(function(result) {
assert.deepEqual(result, {
handler: 'foo',
cmd: {cmd: 'toy.foo'}
});
});
});
-
- describe(".find_contact", function() {
- it("should fail for unknown address types", function() {
- assert.throws(
- function () { api.find_contact("unknown", "+12334"); },
- "/Unsupported delivery class " +
- "(got: unknown with address +12334)/");
- });
- });
}); |
583efbc9c4751605f63b5ec181e3328900c93b85 | app/javascript/src/componentLoader/index.js | app/javascript/src/componentLoader/index.js | import { createLoader } from 'react-hijack';
const componentLoader = createLoader((module) => import('' + module));
export default componentLoader;
| import { createLoader } from 'react-hijack';
const componentLoader = createLoader((module) => import('./components/' + module));
export default componentLoader;
| Add component path at module level | refactor(componentLoader): Add component path at module level
Instead of forcing this knowledge on the add-on, we inserted it here. The benefit is that we are able to point the core to whatever directory we choose, without modifying each addon in turn.
| JavaScript | mpl-2.0 | mlorb/scinote-web,Ducz0r/scinote-web,Ducz0r/scinote-web,Ducz0r/scinote-web,mlorb/scinote-web,mlorb/scinote-web | ---
+++
@@ -1,6 +1,5 @@
import { createLoader } from 'react-hijack';
-const componentLoader = createLoader((module) => import('' + module));
+const componentLoader = createLoader((module) => import('./components/' + module));
export default componentLoader;
- |
d095feef61adc341ec526414997031849517928e | src/client/webpack.config.js | src/client/webpack.config.js | const path = require('path');
const webpackConfig = {
entry: path.join(__dirname, 'index.js'),
output: {
path: path.join(__dirname, '../server/static'),
filename: 'bundle.js'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015', 'stage-0']
}
},
{
test: /\.(png|jpg|gif|svg|woff|woff2|eot|ttf)$/,
loader: 'url-loader'
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}
]
}
};
module.exports = webpackConfig;
| const path = require('path');
const webpackConfig = {
entry: path.join(__dirname, 'index.js'),
output: {
path: path.join(__dirname, '../server/static'),
filename: 'bundle.js'
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015', 'stage-0']
}
},
{
test: /\.(png|jpg|gif|svg|woff|woff2|eot|ttf)$/,
loader: 'url-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
}
]
}
};
module.exports = webpackConfig;
| Bring back regular css loading | Bring back regular css loading
| JavaScript | mit | hkal/timeworthy,hkal/timeworthy | ---
+++
@@ -22,6 +22,10 @@
loader: 'url-loader'
},
{
+ test: /\.css$/,
+ loader: 'style-loader!css-loader'
+ },
+ {
test: /\.scss$/,
loader: 'style-loader!css-loader!sass-loader'
} |
44f0851bc77e3469da2bd00dbe8fcd5ac2341691 | input/composites/line.js | input/composites/line.js | 'use strict';
var sepItems = require('es5-ext/array/#/sep-items')
, d = require('d/d')
, DOMInput = require('./_observable')
, resolveTriggers = require('dbjs/_setup/utils/resolve-static-triggers')
, Input;
module.exports = Input = function (document, ns/*, options*/) {
DOMInput.apply(this, arguments);
};
Input.prototype = Object.create(DOMInput.prototype, {
_render: d(function (options) {
var el = this.make, desc = options.dbOptions
, triggers = resolveTriggers(desc._value_)
, object = options.observable.object;
this.dom = el('div', sepItems.call(triggers.map(function (name) {
return this._get(name);
}, object).map(function (observable) {
var desc = observable.descriptor, opts = this.getOptions(desc);
if ((opts.placeholder == null) && desc.label) {
opts.placeholder = desc.label;
}
return this.addItem(observable.toDOMInput(this.document, opts),
observable.dbId);
}, this), (options.sep != null) ? options.sep : ' '));
})
});
| 'use strict';
var sepItems = require('es5-ext/array/#/sep-items')
, d = require('d/d')
, memoize = require('memoizee/lib/primitive')
, DOMInput = require('./_observable')
, resolveProps = require('esniff/accessed-properties')('this')
, re = new RegExp('^\\s*function\\s*(?:[\\0-\'\\)-\\uffff]+)*\\s*\\(\\s*' +
'(_observe[\\/*\\s]*)?\\)\\s*\\{([\\0-\\uffff]*)\\}\\s*$')
, Input, resolve;
resolve = memoize(function (fn) {
return resolveProps(String(fn).match(re)[2]).map(function (data) {
return data.name;
});
});
module.exports = Input = function (document, ns/*, options*/) {
DOMInput.apply(this, arguments);
};
Input.prototype = Object.create(DOMInput.prototype, {
_render: d(function (options) {
var el = this.make, desc = options.dbOptions
, triggers = resolve(desc._value_)
, object = options.observable.object;
this.dom = el('div', sepItems.call(triggers.map(function (name) {
return this._get(name);
}, object).map(function (observable) {
var desc = observable.descriptor, opts = this.getOptions(desc);
if ((opts.placeholder == null) && desc.label) {
opts.placeholder = desc.label;
}
return this.addItem(observable.toDOMInput(this.document, opts),
observable.dbId);
}, this), (options.sep != null) ? options.sep : ' '));
})
});
| Update up to changes in dbjs | Update up to changes in dbjs
| JavaScript | mit | medikoo/dbjs-dom | ---
+++
@@ -1,11 +1,20 @@
'use strict';
-var sepItems = require('es5-ext/array/#/sep-items')
- , d = require('d/d')
- , DOMInput = require('./_observable')
- , resolveTriggers = require('dbjs/_setup/utils/resolve-static-triggers')
+var sepItems = require('es5-ext/array/#/sep-items')
+ , d = require('d/d')
+ , memoize = require('memoizee/lib/primitive')
+ , DOMInput = require('./_observable')
+ , resolveProps = require('esniff/accessed-properties')('this')
- , Input;
+ , re = new RegExp('^\\s*function\\s*(?:[\\0-\'\\)-\\uffff]+)*\\s*\\(\\s*' +
+ '(_observe[\\/*\\s]*)?\\)\\s*\\{([\\0-\\uffff]*)\\}\\s*$')
+ , Input, resolve;
+
+resolve = memoize(function (fn) {
+ return resolveProps(String(fn).match(re)[2]).map(function (data) {
+ return data.name;
+ });
+});
module.exports = Input = function (document, ns/*, options*/) {
DOMInput.apply(this, arguments);
@@ -14,7 +23,7 @@
Input.prototype = Object.create(DOMInput.prototype, {
_render: d(function (options) {
var el = this.make, desc = options.dbOptions
- , triggers = resolveTriggers(desc._value_)
+ , triggers = resolve(desc._value_)
, object = options.observable.object;
this.dom = el('div', sepItems.call(triggers.map(function (name) { |
53ad668e0393db9f9aff42c86756a4dc8c5d21f4 | src/containers/search_bar.js | src/containers/search_bar.js | import React, { Component } from 'react';
export default class SearchBar extends Component {
render() {
return (
<form className='input-group'>
<input />
<span className='input-group-btn'>
<button type='submit' className='btn btn-secondary'>Submit</button>
</span>
</form>
);
}
} | import React, { Component } from 'react';
export default class SearchBar extends Component {
constructor(props) {
super(props);
this.state = {term: ''}
this.onInputChange = this.onInputChange.bind(this);
}
onInputChange(event) {
this.setState({term: event.target.value});
}
onFormSubmit(event) {
event.preventDefault();
// Go and fetch weather data from API
}
render() {
return (
<form onSubmit={this.onFormSubmit} className='input-group'>
<input
placeholder='Get a 5 day forecast in your favourite cities'
className='form-control'
value={this.state.term}
onChange={this.onInputChange} />
<span className='input-group-btn'>
<button type='submit' className='btn btn-secondary'>Submit</button>
</span>
</form>
);
}
} | Add Form submit handler to search bar | Add Form submit handler to search bar
| JavaScript | mit | StephanYu/modern_redux_weather_forecast,StephanYu/modern_redux_weather_forecast | ---
+++
@@ -1,10 +1,31 @@
import React, { Component } from 'react';
export default class SearchBar extends Component {
+ constructor(props) {
+ super(props);
+
+ this.state = {term: ''}
+ this.onInputChange = this.onInputChange.bind(this);
+ }
+
+ onInputChange(event) {
+ this.setState({term: event.target.value});
+ }
+
+ onFormSubmit(event) {
+ event.preventDefault();
+
+ // Go and fetch weather data from API
+ }
+
render() {
return (
- <form className='input-group'>
- <input />
+ <form onSubmit={this.onFormSubmit} className='input-group'>
+ <input
+ placeholder='Get a 5 day forecast in your favourite cities'
+ className='form-control'
+ value={this.state.term}
+ onChange={this.onInputChange} />
<span className='input-group-btn'>
<button type='submit' className='btn btn-secondary'>Submit</button>
</span> |
650881eeb7df87e5405fc964c17eea59f0d052af | public/javascripts/endless_scroll.js | public/javascripts/endless_scroll.js | var scroll_lock = false;
var last_page = false;
var current_page = 1;
function checkScroll()
{
if(!last_page && !scroll_lock && nearBottomOfPage())
{
scroll_lock = true;
current_page++;
var qs = $H(location.search.toQueryParams());
qs.each(function(pair)
{
qs.set(pair.key, pair.value.replace("+", " "));
});
var url = location.pathname + "?" + qs.merge({ 'page' : current_page }).toQueryString();
new Ajax.Request(url, { asynchronous: true, evalScripts: true, method: 'get', onSuccess: function(req)
{
setTimeout(function()
{
scroll_lock = false;
}, 500);
} });
}
}
function nearBottomOfPage() {
return scrollDistanceFromBottom() < 500;
}
function scrollDistanceFromBottom() {
return pageHeight() - (window.pageYOffset + self.innerHeight);
}
function pageHeight() {
return $$("body")[0].getHeight();
}
document.observe('dom:loaded', function()
{
setInterval("checkScroll()", 250);
}); | var scroll_lock = false;
var last_page = false;
var current_page = 1;
function checkScroll()
{
if(!last_page && !scroll_lock && nearBottomOfPage())
{
scroll_lock = true;
current_page++;
var qs = $H(location.search.toQueryParams());
qs.each(function(pair)
{
qs.set(pair.key, pair.value.replace("+", " "));
});
var url = location.pathname + "?" + qs.merge({ 'page' : current_page }).toQueryString();
new Ajax.Request(url, { asynchronous: true, evalScripts: true, method: 'get', onSuccess: function(req)
{
scroll_lock = false;
myLightWindow._setupLinks();
} });
}
}
function nearBottomOfPage() {
return scrollDistanceFromBottom() < 500;
}
function scrollDistanceFromBottom() {
return pageHeight() - (window.pageYOffset + self.innerHeight);
}
function pageHeight() {
return $$("body")[0].getHeight();
}
document.observe('dom:loaded', function()
{
setInterval("checkScroll()", 250);
}); | Make lightwindow work after ajax load | Make lightwindow work after ajax load
| JavaScript | mit | bloopletech/mangar,bloopletech/pictures,bloopletech/mangar,bloopletech/pictures,bloopletech/mangar,bloopletech/mangar | ---
+++
@@ -20,10 +20,8 @@
new Ajax.Request(url, { asynchronous: true, evalScripts: true, method: 'get', onSuccess: function(req)
{
- setTimeout(function()
- {
- scroll_lock = false;
- }, 500);
+ scroll_lock = false;
+ myLightWindow._setupLinks();
} });
}
} |
bee8d8033cd299ab8dea04168739bc09ee1bc17e | assets/javascript/controllers/chartsController.js | assets/javascript/controllers/chartsController.js | 'use strict';
var ChartsController = function($scope, $rootScope) {
$scope.drawChart = function() {
if ($scope.geoAggData && $scope.geoAggData.length > 0) {
console.log('$scope.geoAggData', $scope.geoAggData, 'length', $scope.geoAggData);
// instantiate d3plus
d3plus.viz()
.container('#viz') // container DIV to hold the visualization
.data($scope.geoAggData) // data to use with the visualization
.type('bubbles') // visualization type
.id(['group', 'name']) // nesting keys
.depth(1) // 0-based depth
.size('value') // key name to size bubbles
.color('name') // color by each group
.legend({value: false})
.margin('-40px 10px 0px 0px')
.width({value: 370})
.height({value: 320})
.draw() // finally, draw the visualization!
if (window._gaq) {
_gaq.push(['_trackEvent', 'police-uk', 'chart']);
}
}
}
}; | 'use strict';
var ChartsController = function($scope, $rootScope) {
$scope.drawChart = function() {
if ($scope.geoAggData && $scope.geoAggData.length > 0) {
var length = $scope.geoAggData.length;
var height = 320;
var width = 370;
var margin = '-40px 10px 0px 0px';
if (length == 1) {
height = 300;
width = 350;
margin = '40px 0px 0px 30px';
}
// instantiate d3plus
d3plus.viz()
.container('#viz') // container DIV to hold the visualization
.data($scope.geoAggData) // data to use with the visualization
.type('bubbles') // visualization type
.id(['group', 'name']) // nesting keys
.depth(1) // 0-based depth
.size('value') // key name to size bubbles
.color('name') // color by each group
.legend({value: false})
.margin(margin)
.width({value: width})
.height({value: height})
.draw() // finally, draw the visualization!
if (window._gaq) {
_gaq.push(['_trackEvent', 'police-uk', 'chart']);
}
}
}
}; | Reduce size of chart with query | Reduce size of chart with query
| JavaScript | apache-2.0 | gogeolbs/police-uk,gogeolbs/police-uk | ---
+++
@@ -3,7 +3,17 @@
var ChartsController = function($scope, $rootScope) {
$scope.drawChart = function() {
if ($scope.geoAggData && $scope.geoAggData.length > 0) {
- console.log('$scope.geoAggData', $scope.geoAggData, 'length', $scope.geoAggData);
+ var length = $scope.geoAggData.length;
+ var height = 320;
+ var width = 370;
+ var margin = '-40px 10px 0px 0px';
+
+ if (length == 1) {
+ height = 300;
+ width = 350;
+ margin = '40px 0px 0px 30px';
+ }
+
// instantiate d3plus
d3plus.viz()
.container('#viz') // container DIV to hold the visualization
@@ -14,9 +24,9 @@
.size('value') // key name to size bubbles
.color('name') // color by each group
.legend({value: false})
- .margin('-40px 10px 0px 0px')
- .width({value: 370})
- .height({value: 320})
+ .margin(margin)
+ .width({value: width})
+ .height({value: height})
.draw() // finally, draw the visualization!
if (window._gaq) { |
0739d7571aa85c9173486a4746579b660565c17e | assets/js/googlesitekit/widgets/util/constants.js | assets/js/googlesitekit/widgets/util/constants.js | /**
* Widgets layout constants.
*
* Site Kit by Google, Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Internal dependencies
*/
import { WIDGET_WIDTHS } from '../datastore/constants';
import ReportZero from '../../../components/ReportZero';
import CompleteModuleActivationCTA from '../../../components/CompleteModuleActivationCTA';
import ActivateModuleCTA from '../../../components/ActivateModuleCTA';
export const WIDTH_GRID_COUNTER_MAP = {
[ WIDGET_WIDTHS.QUARTER ]: 3,
[ WIDGET_WIDTHS.HALF ]: 6,
[ WIDGET_WIDTHS.FULL ]: 12,
};
export const HIDDEN_CLASS = 'googlesitekit-hidden';
export const SPECIAL_WIDGET_STATES = [
ActivateModuleCTA,
CompleteModuleActivationCTA,
ReportZero,
];
| /**
* Widgets layout constants.
*
* Site Kit by Google, Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Internal dependencies
*/
import { WIDGET_WIDTHS } from '../datastore/constants';
import ReportZero from '../../../components/ReportZero';
import RecoverableModules from '../../../components/RecoverableModules';
import CompleteModuleActivationCTA from '../../../components/CompleteModuleActivationCTA';
import ActivateModuleCTA from '../../../components/ActivateModuleCTA';
export const WIDTH_GRID_COUNTER_MAP = {
[ WIDGET_WIDTHS.QUARTER ]: 3,
[ WIDGET_WIDTHS.HALF ]: 6,
[ WIDGET_WIDTHS.FULL ]: 12,
};
export const HIDDEN_CLASS = 'googlesitekit-hidden';
export const SPECIAL_WIDGET_STATES = [
ActivateModuleCTA,
CompleteModuleActivationCTA,
ReportZero,
RecoverableModules,
];
| Add RecoverableModules as special widget state. | Add RecoverableModules as special widget state.
| JavaScript | apache-2.0 | google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp | ---
+++
@@ -21,6 +21,7 @@
*/
import { WIDGET_WIDTHS } from '../datastore/constants';
import ReportZero from '../../../components/ReportZero';
+import RecoverableModules from '../../../components/RecoverableModules';
import CompleteModuleActivationCTA from '../../../components/CompleteModuleActivationCTA';
import ActivateModuleCTA from '../../../components/ActivateModuleCTA';
@@ -35,4 +36,5 @@
ActivateModuleCTA,
CompleteModuleActivationCTA,
ReportZero,
+ RecoverableModules,
]; |
cc9217416427e9418c698ae61ff5366f148babc7 | src/stats/getChunkModules.js | src/stats/getChunkModules.js | /*
* @flow
*/
import type {RawStats, Module} from '../types/Stats';
import type {Child} from './getEntryHeirarchy';
import getModulesByChunk from './getModulesByChunk';
export default function getChunkModules(
stats: RawStats,
parentChunks: ?Array<Child>,
): ?Array<Module> {
if (!parentChunks) {
return null;
}
const modulesByChunk = getModulesByChunk(
stats,
parentChunks.map((chunk) => chunk.id),
);
return parentChunks.reduce(
(modules, chunk) => modules.concat(modulesByChunk[chunk.id].modules),
[],
);
}
| /*
* @flow
*/
import type {RawStats, Module} from '../types/Stats';
import type {Child} from './getEntryHeirarchy';
import getModulesByChunk from './getModulesByChunk';
export default function getChunkModules(
stats: RawStats,
parentChunks: ?Array<Child>,
): ?Array<Module> {
if (!parentChunks) {
return null;
}
const modulesByChunk = getModulesByChunk(
stats,
parentChunks.map((chunk) => chunk.id),
);
return parentChunks.reduce(
(modules, chunk) => {
const chunkWithModules = modulesByChunk[chunk.id] || {modules: []};
return modules.concat(chunkWithModules.modules);
},
[],
);
}
| Check for undefined when fetching a chunkWithModules by chunk.id | Check for undefined when fetching a chunkWithModules by chunk.id
| JavaScript | apache-2.0 | pinterest/bonsai,pinterest/bonsai,pinterest/bonsai | ---
+++
@@ -22,7 +22,10 @@
);
return parentChunks.reduce(
- (modules, chunk) => modules.concat(modulesByChunk[chunk.id].modules),
+ (modules, chunk) => {
+ const chunkWithModules = modulesByChunk[chunk.id] || {modules: []};
+ return modules.concat(chunkWithModules.modules);
+ },
[],
);
} |
71b03e948d5b28dd6f3b6fe5704682087e43d843 | scripts/webpack/webpack.dev.babel.js | scripts/webpack/webpack.dev.babel.js | /**
* In development we assume that the code generated is going to be consumed by
* webpack dev server and we are bundling into a single js file.
*/
import webpack from 'webpack';
import webpackConfigBase from './webpack.base.babel';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const plugins = [
new HtmlWebpackPlugin({
template: `index.html`
}),
new webpack.EnvironmentPlugin([
`CISCOSPARK_ACCESS_TOKEN`,
`MESSAGE_DEMO_CLIENT_ID`,
`MESSAGE_DEMO_CLIENT_SECRET`,
`SPACE_ID`,
`TO_PERSON_EMAIL`,
`TO_PERSON_ID`
])
];
export default webpackConfigBase({
entry: `./index.js`,
plugins,
devtool: `source-map`,
devServer: {
port: 8000,
stats: {
colors: true,
hash: false,
version: false,
timings: false,
assets: true,
chunks: false,
modules: false,
reasons: false,
children: false,
source: false,
errors: true,
errorDetails: true,
warnings: true,
publicPath: false
}
}
});
| /**
* In development we assume that the code generated is going to be consumed by
* webpack dev server and we are bundling into a single js file.
*/
import webpack from 'webpack';
import webpackConfigBase from './webpack.base.babel';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const plugins = [
new HtmlWebpackPlugin({
template: `index.html`
}),
new webpack.EnvironmentPlugin([
`CISCOSPARK_ACCESS_TOKEN`,
`MESSAGE_DEMO_CLIENT_ID`,
`MESSAGE_DEMO_CLIENT_SECRET`,
`SPACE_ID`,
`TO_PERSON_EMAIL`,
`TO_PERSON_ID`
])
];
export default webpackConfigBase({
entry: `./index.js`,
plugins,
devtool: `source-map`,
devServer: {
host: `0.0.0.0`,
port: 8000,
stats: {
colors: true,
hash: false,
version: false,
timings: false,
assets: true,
chunks: false,
modules: false,
reasons: false,
children: false,
source: false,
errors: true,
errorDetails: true,
warnings: true,
publicPath: false
}
}
});
| Allow any host connection to local dev | feat(tooling): Allow any host connection to local dev
| JavaScript | mit | adamweeks/react-ciscospark-1,bzang/react-ciscospark,bzang/react-ciscospark,ciscospark/react-ciscospark,adamweeks/react-ciscospark-1,Altocloud/alto-react-ciscospark,ciscospark/react-ciscospark,ciscospark/react-ciscospark,bzang/react-ciscospark,adamweeks/react-ciscospark-1,Altocloud/alto-react-ciscospark,Altocloud/alto-react-ciscospark | ---
+++
@@ -26,6 +26,7 @@
plugins,
devtool: `source-map`,
devServer: {
+ host: `0.0.0.0`,
port: 8000,
stats: {
colors: true, |
7438f9092bff0b6098a27c67f8af33dee8e61d30 | public/js/views/sidebar_view.js | public/js/views/sidebar_view.js | chorus.views.Sidebar = chorus.views.Base.extend({
constructorName: "SidebarView",
preRender:function () {
this._super("preRender", arguments);
// We don't want to deal with having multiple declarations of `events`,
// so we unbind click in preRender and bind it in postRender.
$("#sidebar_wrapper").find(".jump_to_top").unbind("click");
},
template:function () {
var result = this._super('template', arguments);
return "<div class='spacer'/>" + result;
},
postRender:function () {
this._super('postRender');
var sidebar = $(this.el).closest("#sidebar");
this.setupScrolling(sidebar, {
contentWidth: sidebar.width()
});
$("#sidebar_wrapper .jump_to_top").bind("click", function (e) {
var api = $("#sidebar").data("jsp")
if (api) {
api.scrollTo(0, 0);
$(this).removeClass("clickable");
}
});
},
onMouseWheel:function (event, d) {
var api = $("#sidebar").data("jsp")
$("#sidebar_wrapper .jump_to_top").toggleClass("clickable", api.getContentPositionY() > 10);
event.preventDefault();
return true;
},
recalculateScrolling : function() {
this._super("recalculateScrolling", [$(this.el).closest(".custom_scroll")])
}
}); | chorus.views.Sidebar = chorus.views.Base.extend({
constructorName: "SidebarView",
preRender:function () {
this._super("preRender", arguments);
// We don't want to deal with having multiple declarations of `events`,
// so we unbind click in preRender and bind it in postRender.
$("#sidebar_wrapper").find(".jump_to_top").unbind("click");
},
template:function () {
var result = this._super('template', arguments);
return "<div class='spacer'/>" + result;
},
postRender:function () {
this._super('postRender');
var sidebar = $(this.el).closest("#sidebar");
this.setupScrolling(sidebar, {
contentWidth: sidebar.width()
});
$("#sidebar_wrapper .jump_to_top").bind("click", function (e) {
var api = $("#sidebar").data("jsp")
if (api) {
api.scrollTo(0, 0);
$(this).removeClass("clickable");
}
});
if (chorus.isDevMode) {
$("#sidebar_wrapper").attr("data-sidebar-template", this.className);
}
},
onMouseWheel:function (event, d) {
var api = $("#sidebar").data("jsp")
$("#sidebar_wrapper .jump_to_top").toggleClass("clickable", api.getContentPositionY() > 10);
event.preventDefault();
return true;
},
recalculateScrolling : function() {
this._super("recalculateScrolling", [$(this.el).closest(".custom_scroll")])
}
}); | Add data attr for sidebar template higher up in DOM | Add data attr for sidebar template higher up in DOM
| JavaScript | apache-2.0 | hewtest/chorus,hewtest/chorus,prakash-alpine/chorus,atul-alpine/chorus,jamesblunt/chorus,prakash-alpine/chorus,jamesblunt/chorus,atul-alpine/chorus,mpushpav/chorus,jamesblunt/chorus,atul-alpine/chorus,atul-alpine/chorus,mpushpav/chorus,atul-alpine/chorus,jamesblunt/chorus,mpushpav/chorus,hewtest/chorus,mpushpav/chorus,hewtest/chorus,prakash-alpine/chorus,prakash-alpine/chorus,hewtest/chorus,lukepolo/chorus,lukepolo/chorus,hewtest/chorus,prakash-alpine/chorus,mpushpav/chorus,lukepolo/chorus,atul-alpine/chorus,jamesblunt/chorus,jamesblunt/chorus,lukepolo/chorus,lukepolo/chorus,jamesblunt/chorus,lukepolo/chorus,mpushpav/chorus,atul-alpine/chorus,hewtest/chorus,hewtest/chorus,lukepolo/chorus,mpushpav/chorus | ---
+++
@@ -28,6 +28,10 @@
$(this).removeClass("clickable");
}
});
+
+ if (chorus.isDevMode) {
+ $("#sidebar_wrapper").attr("data-sidebar-template", this.className);
+ }
},
onMouseWheel:function (event, d) { |
6810534719c1d413d132c1bef1ec90d94db9f48e | lib/config/type/starts.js | lib/config/type/starts.js | 'use babel'
export default {
eslintrc: {
config: {
description: '.eslint',
icons: [ 'ESLint' ],
title: 'ESLint',
},
match: [ '.eslint' ],
},
git: {
config: {
description: '.git',
icons: [ 'Git', 'GitHub', 'GitHubAlt' ],
title: 'Git',
},
match: [ '.git' ],
},
license: {
config: {
description: 'license',
icons: [ 'OSI', 'MIT' ],
title: 'License',
},
match: [ 'license' ],
},
}
| 'use babel'
export default {
eslintrc: {
config: {
description: '.eslint',
icons: [ 'ESLint' ],
title: 'ESLint',
},
match: [ '.eslint' ],
},
git: {
config: {
description: '.git',
icons: [ 'Git', 'GitHub', 'GitHubAlt' ],
title: 'Git',
},
match: [ '.git' ],
},
license: {
config: {
description: 'license',
icons: [ 'OSI', 'MIT' ],
title: 'License',
},
match: [ 'license' ],
},
npm: {
config: {
description: '.npm',
icons: [ 'npm', 'npmAlt' ],
title: 'npm',
},
match: [ '.npm' ],
},
}
| Add icon for .npm files | Add icon for .npm files
Refs #1
| JavaScript | mit | wyze/atom-flexicons | ---
+++
@@ -25,4 +25,12 @@
},
match: [ 'license' ],
},
+ npm: {
+ config: {
+ description: '.npm',
+ icons: [ 'npm', 'npmAlt' ],
+ title: 'npm',
+ },
+ match: [ '.npm' ],
+ },
} |
393c8b0632b71ed8f034f2f5bbc3e2d424eaf0e7 | src/components/BoardgameListItem/BoardgameListItem.js | src/components/BoardgameListItem/BoardgameListItem.js | import React, { Component, PropTypes } from 'react';
export default class BoardgameListItem extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
year: PropTypes.string
}
render() {
const { name, year } = this.props;
return (
<div className="media">
<div className="media-left media-middle">
<img src="http://placehold.it/80x80" alt={name} className="media-object" />
</div>
<div className="media-body">
<h4 className="media-heading">{name}</h4>
<p><em>{year}</em></p>
</div>
</div>
);
}
}
| import React, { Component, PropTypes } from 'react';
export default class BoardgameListItem extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
year: PropTypes.number,
thumbnail: PropTypes.string,
score: PropTypes.number
}
render() {
const { name, year, thumbnail, score } = this.props;
return (
<div className="media">
<div className="media-left media-middle">
{thumbnail ?
<img src={thumbnail} alt={name} className="media-object" /> :
<img src="http://placehold.it/80x80" alt={name} className="media-object" /> }
</div>
<div className="media-body">
<h4 className="media-heading">{name}</h4>
<p><em>{year}</em>, {score}</p>
</div>
</div>
);
}
}
| Update BoardgameListComponent to accept more input | Update BoardgameListComponent to accept more input
| JavaScript | mit | fuczak/pipsy | ---
+++
@@ -3,19 +3,23 @@
export default class BoardgameListItem extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
- year: PropTypes.string
+ year: PropTypes.number,
+ thumbnail: PropTypes.string,
+ score: PropTypes.number
}
render() {
- const { name, year } = this.props;
+ const { name, year, thumbnail, score } = this.props;
return (
<div className="media">
<div className="media-left media-middle">
- <img src="http://placehold.it/80x80" alt={name} className="media-object" />
+ {thumbnail ?
+ <img src={thumbnail} alt={name} className="media-object" /> :
+ <img src="http://placehold.it/80x80" alt={name} className="media-object" /> }
</div>
<div className="media-body">
<h4 className="media-heading">{name}</h4>
- <p><em>{year}</em></p>
+ <p><em>{year}</em>, {score}</p>
</div>
</div>
); |
bb75be39c8b74229f40d39c9a3c3ddf27dadc34e | shared/login/signup/success/index.js | shared/login/signup/success/index.js | /* @flow */
import React, {Component} from 'react'
import {connect} from 'react-redux'
import HiddenString from '../../../util/hidden-string'
import {sawPaperKey} from '../../../actions/signup'
import Render from './index.render'
class Success extends Component {
render () {
return (
<Render
title={this.props.title}
paperkey={this.props.paperkey}
onFinish={this.props.onFinish}
onBack={this.props.onBack}
/>
)
}
}
Success.propTypes = {
paperkey: React.PropTypes.instanceOf(HiddenString).isRequired,
onFinish: React.PropTypes.func.isRequired
}
export default connect(
state => ({paperkey: state.signup.paperkey}),
dispatch => ({
onFinish: dispatch(sawPaperKey()),
onBack: () => {}
})
)(Success)
| /* @flow */
import React, {Component} from 'react'
import {connect} from 'react-redux'
import HiddenString from '../../../util/hidden-string'
import {sawPaperKey} from '../../../actions/signup'
import Render from './index.render'
class Success extends Component {
render () {
return (
<Render
title={this.props.title}
paperkey={this.props.paperkey}
onFinish={this.props.onFinish}
onBack={this.props.onBack}
/>
)
}
}
Success.propTypes = {
paperkey: React.PropTypes.instanceOf(HiddenString).isRequired,
onFinish: React.PropTypes.func.isRequired
}
export default connect(
state => ({paperkey: state.signup.paperkey}),
dispatch => ({
onFinish: () => dispatch(sawPaperKey()),
onBack: () => {}
})
)(Success)
| Fix not waiting for paper key approval | Fix not waiting for paper key approval
| JavaScript | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client | ---
+++
@@ -28,7 +28,7 @@
export default connect(
state => ({paperkey: state.signup.paperkey}),
dispatch => ({
- onFinish: dispatch(sawPaperKey()),
+ onFinish: () => dispatch(sawPaperKey()),
onBack: () => {}
})
)(Success) |
302e046fc864e88380efb390521bc1ed0dbe98d7 | lib/loaders/typescript.js | lib/loaders/typescript.js | 'use strict';
module.exports = isAngularProject => ({
test: /\.tsx?$/,
exclude: /(node_modules)/,
loaders: [...isAngularProject ? ['ng-annotate'] : [], 'ts'],
query: {
logInfoToStdOut: true
}
});
| 'use strict';
module.exports = isAngularProject => ({
test: /\.tsx?$/,
exclude: /(node_modules)/,
loaders: [...isAngularProject ? ['ng-annotate'] : [], 'ts']
});
| Revert Lod ts-loader info to stdout | Revert Lod ts-loader info to stdout | JavaScript | mit | kupriyanenko/wix-node-build,kupriyanenko/wix-node-build | ---
+++
@@ -3,8 +3,5 @@
module.exports = isAngularProject => ({
test: /\.tsx?$/,
exclude: /(node_modules)/,
- loaders: [...isAngularProject ? ['ng-annotate'] : [], 'ts'],
- query: {
- logInfoToStdOut: true
- }
+ loaders: [...isAngularProject ? ['ng-annotate'] : [], 'ts']
}); |
670b7abfd5edeea6359f4ff3f66adc0b91648e06 | rcmet/src/main/ui/config/karma.conf.js | rcmet/src/main/ui/config/karma.conf.js | basePath = '../';
files = [
JASMINE,
JASMINE_ADAPTER,
'app/js/jquery-1.9.1.min.js',
'app/js/bootstrap.js',
'app/lib/angular/angular.js',
'app/lib/angular/angular-*.js',
'test/lib/angular/angular-mocks.js',
'app/js/leaflet.js',
'app/js/**/*.js',
'test/unit/**/*.js'
];
autoWatch = true;
browsers = ['Chrome'];
junitReporter = {
outputFile: 'test_out/unit.xml',
suite: 'unit'
};
| basePath = '../';
files = [
JASMINE,
JASMINE_ADAPTER,
'app/lib/jquery/jquery-1.10.1.js',
'app/lib/jquery/jquery-ui/jquery-ui-1.10.3.min.js',
'app/lib/bootstrap/bootstrap.js',
'app/lib/angular/angular.js',
'app/lib/angular/angular-*.js',
'test/lib/angular/angular-mocks.js',
'app/lib/jquery/jquery-ui/datepicker-wrapper/date.js',
'app/lib/leaflet/leaflet-0.5.js',
'app/js/app.js',
'app/js/controllers/*.js',
'app/js/directives/*.js',
'app/js/services/*.js',
'test/unit/**/*.js'
];
autoWatch = true;
browsers = ['Chrome'];
junitReporter = {
outputFile: 'test_out/unit.xml',
suite: 'unit'
};
| Resolve CLIMATE-112 - Unit tests don't run after refactoring | Resolve CLIMATE-112 - Unit tests don't run after refactoring
- The unit tests now run properly. That being said, they're still
outdated and useless. This will be addressed in a future issue.
git-svn-id: https://svn.apache.org/repos/asf/incubator/climate/trunk@1493995 13f79535-47bb-0310-9956-ffa450edef68
Former-commit-id: 52d600a7b7a6ba01ebe97456f63f91d2f4344788 | JavaScript | apache-2.0 | MBoustani/climate,kwhitehall/climate,apache/climate,lewismc/climate,pwcberry/climate,agoodm/climate,riverma/climate,huikyole/climate,MBoustani/climate,jarifibrahim/climate,huikyole/climate,jarifibrahim/climate,pwcberry/climate,kwhitehall/climate,apache/climate,kwhitehall/climate,riverma/climate,pwcberry/climate,agoodm/climate,MJJoyce/climate,MJJoyce/climate,riverma/climate,huikyole/climate,jarifibrahim/climate,MJJoyce/climate,agoodm/climate,Omkar20895/climate,Omkar20895/climate,apache/climate,Omkar20895/climate,riverma/climate,MBoustani/climate,MBoustani/climate,Omkar20895/climate,lewismc/climate,huikyole/climate,MBoustani/climate,Omkar20895/climate,agoodm/climate,MJJoyce/climate,lewismc/climate,MJJoyce/climate,kwhitehall/climate,pwcberry/climate,apache/climate,jarifibrahim/climate,riverma/climate,lewismc/climate,pwcberry/climate,lewismc/climate,apache/climate,jarifibrahim/climate,huikyole/climate,agoodm/climate | ---
+++
@@ -3,13 +3,18 @@
files = [
JASMINE,
JASMINE_ADAPTER,
- 'app/js/jquery-1.9.1.min.js',
- 'app/js/bootstrap.js',
+ 'app/lib/jquery/jquery-1.10.1.js',
+ 'app/lib/jquery/jquery-ui/jquery-ui-1.10.3.min.js',
+ 'app/lib/bootstrap/bootstrap.js',
'app/lib/angular/angular.js',
'app/lib/angular/angular-*.js',
'test/lib/angular/angular-mocks.js',
- 'app/js/leaflet.js',
- 'app/js/**/*.js',
+ 'app/lib/jquery/jquery-ui/datepicker-wrapper/date.js',
+ 'app/lib/leaflet/leaflet-0.5.js',
+ 'app/js/app.js',
+ 'app/js/controllers/*.js',
+ 'app/js/directives/*.js',
+ 'app/js/services/*.js',
'test/unit/**/*.js'
];
|
8d0020a666b26cbc577a19d82d3ae16153602f6f | ui/EditInlineNodeCommand.js | ui/EditInlineNodeCommand.js | import Command from './Command'
class EditInlineNodeCommand extends Command {
constructor(...args) {
super(...args)
if (!this.config.nodeType) {
throw new Error('Every AnnotationCommand must have a nodeType')
}
}
getCommandState(params) {
let sel = params.selection
let newState = {
disabled: true,
active: false
}
let annos = this._getAnnotationsForSelection(params)
if (annos.length === 1 && annos[0].getSelection().equals(sel)) {
newState.disabled = false
newState.node = annos[0]
}
return newState
}
execute(params) { // eslint-disable-line
}
_getAnnotationsForSelection(params) {
return params.selectionState.getAnnotationsForType(this.config.nodeType)
}
}
export default EditInlineNodeCommand
| import Command from './Command'
class EditInlineNodeCommand extends Command {
constructor(...args) {
super(...args)
if (!this.config.nodeType) {
throw new Error('Every AnnotationCommand must have a nodeType')
}
}
getCommandState(params) {
let sel = params.selection
let newState = {
disabled: true,
active: false
}
let annos = this._getAnnotationsForSelection(params)
if (annos.length === 1 && annos[0].getSelection().equals(sel)) {
newState.disabled = false
newState.nodeId = annos[0].id
}
return newState
}
execute(params) { // eslint-disable-line
}
_getAnnotationsForSelection(params) {
return params.selectionState.getAnnotationsForType(this.config.nodeType)
}
}
export default EditInlineNodeCommand
| Use primitive command state for EditInlineCommand. | Use primitive command state for EditInlineCommand.
| JavaScript | mit | michael/substance-1,substance/substance,michael/substance-1,substance/substance | ---
+++
@@ -17,7 +17,7 @@
let annos = this._getAnnotationsForSelection(params)
if (annos.length === 1 && annos[0].getSelection().equals(sel)) {
newState.disabled = false
- newState.node = annos[0]
+ newState.nodeId = annos[0].id
}
return newState
} |
27054c88376e37c69ef385346705f409adb5346b | source/assets/javascripts/enhance.js | source/assets/javascripts/enhance.js | import debug from 'debug';
const log = debug('app:enhance');
// ServiceWorker is a progressive technology. Ignore unsupported browsers
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then((registrations) => {
registrations.forEach(registration => registration.unregister());
});
} else {
log('service worker is not supported.');
}
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.top-bar-menu-button').forEach(el => {
el.addEventListener('click', (event) => {
event.stopPropagation();
toggleClass(document.querySelector('.top-bar-section'), 'hidden');
el.querySelectorAll('.icon').forEach(ic => toggleClass(ic, 'hidden'));
})
});
});
function toggleClass(el, className) {
if (el.classList.contains(className)) {
el.classList.remove(className)
} else {
el.classList.add(className)
}
}
| import debug from 'debug'
const log = debug('app:enhance')
// ServiceWorker is a progressive technology. Ignore unsupported browsers
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistrations().then(registrations => {
registrations.forEach(registration => registration.unregister())
})
} else {
log('service worker is not supported.')
}
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.top-bar-menu-button').forEach(el => {
el.addEventListener('click', event => {
event.stopPropagation()
toggleClass(document.querySelector('.top-bar-section'), 'hidden')
el.querySelectorAll('.icon').forEach(ic => toggleClass(ic, 'hidden'))
})
})
const slideInForm = document.querySelector('.formkit-slide-in')
if (slideInForm) {
log('slide in form detected')
} else {
log('slide in form NOT detected')
}
})
function toggleClass(el, className) {
if (el.classList.contains(className)) {
el.classList.remove(className)
} else {
el.classList.add(className)
}
}
const targetNode = document.querySelector('body')
// Options for the observer (which mutations to observe)
const config = { childList: true }
// Callback function to execute when mutations are observed
const callback = function(mutationsList, observer) {
for (let mutation of mutationsList) {
if (mutation.type === 'childList') {
mutation.addedNodes.forEach((node) => {
if (node.classList && node.classList.contains('formkit-slide-in')) {
log('formkit slide in', node)
const input = node.querySelector('input[name=\'email_address\']')
input.type = 'email'
log('input', input)
}
})
}
}
}
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback)
// Start observing the target node for configured mutations
observer.observe(targetNode, config)
// Later, you can stop observing
// observer.disconnect()
| Change async form input type | Change async form input type
| JavaScript | mit | rossta/rossta.github.com,rossta/rossta.github.com,rossta/rossta.github.com | ---
+++
@@ -1,26 +1,32 @@
-import debug from 'debug';
+import debug from 'debug'
-const log = debug('app:enhance');
+const log = debug('app:enhance')
// ServiceWorker is a progressive technology. Ignore unsupported browsers
if ('serviceWorker' in navigator) {
- navigator.serviceWorker.getRegistrations().then((registrations) => {
- registrations.forEach(registration => registration.unregister());
- });
+ navigator.serviceWorker.getRegistrations().then(registrations => {
+ registrations.forEach(registration => registration.unregister())
+ })
} else {
- log('service worker is not supported.');
+ log('service worker is not supported.')
}
-
window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.top-bar-menu-button').forEach(el => {
- el.addEventListener('click', (event) => {
- event.stopPropagation();
- toggleClass(document.querySelector('.top-bar-section'), 'hidden');
- el.querySelectorAll('.icon').forEach(ic => toggleClass(ic, 'hidden'));
+ el.addEventListener('click', event => {
+ event.stopPropagation()
+ toggleClass(document.querySelector('.top-bar-section'), 'hidden')
+ el.querySelectorAll('.icon').forEach(ic => toggleClass(ic, 'hidden'))
})
- });
-});
+ })
+
+ const slideInForm = document.querySelector('.formkit-slide-in')
+ if (slideInForm) {
+ log('slide in form detected')
+ } else {
+ log('slide in form NOT detected')
+ }
+})
function toggleClass(el, className) {
if (el.classList.contains(className)) {
@@ -29,3 +35,33 @@
el.classList.add(className)
}
}
+
+const targetNode = document.querySelector('body')
+
+// Options for the observer (which mutations to observe)
+const config = { childList: true }
+
+// Callback function to execute when mutations are observed
+const callback = function(mutationsList, observer) {
+ for (let mutation of mutationsList) {
+ if (mutation.type === 'childList') {
+ mutation.addedNodes.forEach((node) => {
+ if (node.classList && node.classList.contains('formkit-slide-in')) {
+ log('formkit slide in', node)
+ const input = node.querySelector('input[name=\'email_address\']')
+ input.type = 'email'
+ log('input', input)
+ }
+ })
+ }
+ }
+}
+
+// Create an observer instance linked to the callback function
+const observer = new MutationObserver(callback)
+
+// Start observing the target node for configured mutations
+observer.observe(targetNode, config)
+
+// Later, you can stop observing
+// observer.disconnect() |
4194e00f48567d7f4928e6d645ed2382791fad73 | bin/extension.js | bin/extension.js | const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, '../dist/devpanel.tmpl.html');
const distPath = path.join(__dirname, '../dist/devpanel.html');
const startRemoteDev = require('remotedev-server');
const html = fs.readFileSync(filePath, 'utf-8');
module.exports = function(argv) {
if (argv.runserver) {
argv.port = argv.port || 8000;
startRemoteDev(argv);
}
if (argv.hostname || argv.port) {
fs.writeFileSync(
distPath,
html.replace(
'// __remotedevOptionsSet__',
'window.remotedevOptions = ' + JSON.stringify({
hostname: argv.hostname,
port: argv.port || 8000,
autoReconnect: true
})
)
);
} else {
fs.writeFileSync(distPath, html);
}
};
| const fs = require('fs');
const path = require('path');
const filePath = path.join(__dirname, '../dist/devpanel.tmpl.html');
const distPath = path.join(__dirname, '../dist/devpanel.html');
const startRemoteDev = require('remotedev-server');
const html = fs.readFileSync(filePath, 'utf-8');
module.exports = argv => {
if (argv.hostname || argv.port) {
fs.writeFileSync(
distPath,
html.replace(
'// __remotedevOptionsSet__',
'window.remotedevOptions = ' + JSON.stringify({
hostname: argv.hostname,
port: argv.port || 8000,
autoReconnect: true
})
)
);
} else {
fs.writeFileSync(distPath, html);
}
if (argv.runserver) {
argv.port = argv.port || 8000;
return startRemoteDev(argv);
}
return { on: (status, cb) => cb() };
};
| Apply runserver option will return socketcluster server | Apply runserver option will return socketcluster server
| JavaScript | mit | jhen0409/remotedev-extension,jhen0409/remotedev-extension | ---
+++
@@ -6,11 +6,7 @@
const html = fs.readFileSync(filePath, 'utf-8');
-module.exports = function(argv) {
- if (argv.runserver) {
- argv.port = argv.port || 8000;
- startRemoteDev(argv);
- }
+module.exports = argv => {
if (argv.hostname || argv.port) {
fs.writeFileSync(
distPath,
@@ -26,4 +22,9 @@
} else {
fs.writeFileSync(distPath, html);
}
+ if (argv.runserver) {
+ argv.port = argv.port || 8000;
+ return startRemoteDev(argv);
+ }
+ return { on: (status, cb) => cb() };
}; |
97f57d91c2ee46e31dafe33eb4955261bb68fce3 | bin/pure-cjs.js | bin/pure-cjs.js | #!/usr/bin/env node
var program = require('commander'),
cjs = require(__dirname + '/../lib/');
program
.version(require(__dirname + '/../package.json').version)
.option('-i, --input <file>', 'input file (required)')
.option('-o, --output <file>', 'output file (defaults to <input>.out.js)')
.option('-x, --extension <ext>', 'default extension for requires (defaults to "js")')
.option('-m, --map [file]', 'file to store source map to (optional)')
.option('-c, --comments', 'preserve comments in output')
.option('-e, --exports <id>', 'top module exports destination (optional)')
.option('-s, --external [hash]', 'external modules (names or JSON hashes)', function (value, obj) {
try {
var add = JSON.parse(value);
for (var name in add) {
obj[name] = add[name];
}
} catch (e) {
obj[value] = true;
}
return obj;
}, {})
.parse(process.argv);
if (!program.input) {
program.help();
}
console.log('Building...');
cjs.transform(program).then(function (result) {
console.log('Built to:', result.options.output);
}, function (error) {
console.error(error.stack);
});
| #!/usr/bin/env node
var program = require('commander'),
cjs = require(__dirname + '/../lib/');
program
.version(require(__dirname + '/../package.json').version)
.option('-i, --input <file>', 'input file (required)')
.option('-o, --output <file>', 'output file (defaults to <input>.out.js)')
.option('-x, --extension <ext>', 'default extension for requires (defaults to "js")')
.option('-m, --map [file]', 'file to store source map to (optional)')
.option('-c, --comments', 'preserve comments in output')
.option('-e, --exports <id>', 'top module exports destination (optional)')
.option('-d, --module-dir <dir>', 'top level location to search for external modules (optional)')
.option('-s, --external [hash]', 'external modules (names or JSON hashes)', function (value, obj) {
try {
var add = JSON.parse(value);
for (var name in add) {
obj[name] = add[name];
}
} catch (e) {
obj[value] = true;
}
return obj;
}, {})
.parse(process.argv);
if (!program.input) {
program.help();
}
console.log('Building...');
cjs.transform(program).then(function (result) {
console.log('Built to:', result.options.output);
}, function (error) {
console.error(error.stack);
});
| Fix support for specifying module-dir | Fix support for specifying module-dir
| JavaScript | mit | RReverser/pure-cjs | ---
+++
@@ -11,6 +11,7 @@
.option('-m, --map [file]', 'file to store source map to (optional)')
.option('-c, --comments', 'preserve comments in output')
.option('-e, --exports <id>', 'top module exports destination (optional)')
+ .option('-d, --module-dir <dir>', 'top level location to search for external modules (optional)')
.option('-s, --external [hash]', 'external modules (names or JSON hashes)', function (value, obj) {
try {
var add = JSON.parse(value); |
6db20c4e950083fc9a91027f5d01e87b86d0a607 | test/app.js | test/app.js | var path = require('path'),
assert = require('yeoman-generator').assert,
helpers = require('yeoman-generator').test,
os = require('os');
describe('sails-rest-api:app', function () {
before(function (done) {
helpers.run(path.join(__dirname, '../app'))
.inDir(path.join(os.tmpdir(), './temp-test'))
.withOptions({"skip-all": true})
.on('end', done);
});
it('Should properly create root files', function () {
assert.file([
'.editorconfig',
'.gitignore',
'.sailsrc',
'app.js',
'package.json'
]);
});
});
| var path = require('path'),
assert = require('yeoman-generator').assert,
helpers = require('yeoman-generator').test,
os = require('os');
describe('sails-rest-api:app', function () {
before(function (done) {
helpers.run(path.join(__dirname, '../app'))
.inDir(path.join(os.tmpdir(), './temp-test'))
.withOptions({"skip-all": true})
.on('end', done);
});
// TODO: write normal tests for generator
it('Should properly create root files', function () {
assert.file([
'.editorconfig',
'.gitignore',
'.sailsrc',
'app.js',
'package.json'
]);
});
});
| Add todo in generator tests | Add todo in generator tests
| JavaScript | mit | ghaiklor/generator-sails-rest-api,italoag/generator-sails-rest-api,eithewliter5518/generator-sails-rest-api,mhipo1364/generator-sails-rest-api,jaumard/generator-trails,italoag/generator-sails-rest-api,synergycns/generator-sails-rest-api,ghaiklor/generator-sails-rest-api,konstantinzolotarev/generator-trails,tnunes/generator-trails,IncoCode/generator-sails-rest-api | ---
+++
@@ -11,6 +11,8 @@
.on('end', done);
});
+ // TODO: write normal tests for generator
+
it('Should properly create root files', function () {
assert.file([
'.editorconfig', |
80bb4337e39162c72ad6bbd00493d24dc9381588 | script/lib/dependencies-fingerprint.js | script/lib/dependencies-fingerprint.js | const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
const CONFIG = require('../config')
const FINGERPRINT_PATH = path.join(CONFIG.repositoryRootPath, 'node_modules', '.dependencies-fingerprint')
module.exports = {
write: function () {
const fingerprint = this.compute()
fs.writeFileSync(FINGERPRINT_PATH, fingerprint)
console.log('Wrote Dependencies Fingerprint:', FINGERPRINT_PATH, fingerprint)
},
read: function () {
return fs.existsSync(FINGERPRINT_PATH) ? fs.readFileSync(FINGERPRINT_PATH, 'utf8') : null
},
isOutdated: function () {
const fingerprint = this.read()
return fingerprint ? fingerprint !== this.compute() : false
},
compute: function () {
// Include the electron minor version in the fingerprint since that changing requires a re-install
const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '')
const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager']
const body = electronVersion + apmVersion + process.platform + process.version
return crypto.createHash('sha1').update(body).digest('hex')
}
}
| const crypto = require('crypto')
const fs = require('fs')
const path = require('path')
const CONFIG = require('../config')
const FINGERPRINT_PATH = path.join(CONFIG.repositoryRootPath, 'node_modules', '.dependencies-fingerprint')
module.exports = {
write: function () {
const fingerprint = this.compute()
fs.writeFileSync(FINGERPRINT_PATH, fingerprint)
console.log('Wrote Dependencies Fingerprint:', FINGERPRINT_PATH, fingerprint)
},
read: function () {
return fs.existsSync(FINGERPRINT_PATH) ? fs.readFileSync(FINGERPRINT_PATH, 'utf8') : null
},
isOutdated: function () {
const fingerprint = this.read()
return fingerprint ? fingerprint !== this.compute() : false
},
compute: function () {
// Include the electron minor version in the fingerprint since that changing requires a re-install
const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '')
const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager']
const body = electronVersion + apmVersion + process.platform + process.version + process.arch
return crypto.createHash('sha1').update(body).digest('hex')
}
}
| Include arch in dependency cache key | Include arch in dependency cache key
| JavaScript | mit | liuderchi/atom,me-benni/atom,sotayamashita/atom,stinsonga/atom,liuderchi/atom,stinsonga/atom,bsmr-x-script/atom,t9md/atom,andrewleverette/atom,atom/atom,bsmr-x-script/atom,Mokolea/atom,brettle/atom,brettle/atom,Mokolea/atom,bsmr-x-script/atom,decaffeinate-examples/atom,PKRoma/atom,AdrianVovk/substance-ide,xream/atom,kevinrenaers/atom,xream/atom,atom/atom,rlugojr/atom,AlexxNica/atom,AlexxNica/atom,Arcanemagus/atom,andrewleverette/atom,xream/atom,andrewleverette/atom,stinsonga/atom,CraZySacX/atom,tjkr/atom,ardeshirj/atom,ardeshirj/atom,kevinrenaers/atom,liuderchi/atom,rlugojr/atom,decaffeinate-examples/atom,FIT-CSE2410-A-Bombs/atom,atom/atom,me-benni/atom,PKRoma/atom,CraZySacX/atom,Arcanemagus/atom,brettle/atom,CraZySacX/atom,t9md/atom,Mokolea/atom,PKRoma/atom,me-benni/atom,decaffeinate-examples/atom,t9md/atom,decaffeinate-examples/atom,sotayamashita/atom,ardeshirj/atom,stinsonga/atom,tjkr/atom,AdrianVovk/substance-ide,tjkr/atom,FIT-CSE2410-A-Bombs/atom,kevinrenaers/atom,Arcanemagus/atom,rlugojr/atom,AlexxNica/atom,FIT-CSE2410-A-Bombs/atom,liuderchi/atom,AdrianVovk/substance-ide,sotayamashita/atom | ---
+++
@@ -22,7 +22,7 @@
// Include the electron minor version in the fingerprint since that changing requires a re-install
const electronVersion = CONFIG.appMetadata.electronVersion.replace(/\.\d+$/, '')
const apmVersion = CONFIG.apmMetadata.dependencies['atom-package-manager']
- const body = electronVersion + apmVersion + process.platform + process.version
+ const body = electronVersion + apmVersion + process.platform + process.version + process.arch
return crypto.createHash('sha1').update(body).digest('hex')
}
} |
91ece4ef4118eb2dc9dee0986bc046b73b86636e | server/auth/hawk/hawkAuth.js | server/auth/hawk/hawkAuth.js | /**
* Created by Omnius on 6/15/16.
*/
'use strict';
const Boom = require('boom');
exports.register = (server, options, next) => {
server.auth.strategy('hawk-login-auth-strategy', 'hawk', {
getCredentialsFunc: (sessionId, callback) => {
const redis = server.app.redis;
const methods = server.methods;
const dao = methods.dao;
const userCredentialDao = dao.userCredentialDao;
userCredentialDao.readUserCredential(redis, sessionId, (err, dbCredentials) => {
if (err) {
server.log(err);
return callback(Boom.serverUnavailable(err));
}
if (!Object.keys(dbCredentials).length) {
return callback(Boom.forbidden());
}
const credentials = {
hawkSessionToken: dbCredentials.hawkSessionToken,
algorithm: dbCredentials.algorithm,
userId: dbCredentials.userId,
key: dbCredentials.key,
id: dbCredentials.id
};
return callback(null, credentials);
});
},
hawk: {
port: 443
}
});
next();
};
exports.register.attributes = {
pkg: require('./package.json')
};
| /**
* Created by Omnius on 6/15/16.
*/
'use strict';
const Boom = require('boom');
exports.register = (server, options, next) => {
server.auth.strategy('hawk-login-auth-strategy', 'hawk', {
getCredentialsFunc: (sessionId, callback) => {
const redis = server.app.redis;
const methods = server.methods;
const dao = methods.dao;
const userCredentialDao = dao.userCredentialDao;
userCredentialDao.readUserCredential(redis, sessionId, (err, dbCredentials) => {
if (err) {
server.log(err);
return callback(Boom.serverUnavailable(err));
}
if (!Object.keys(dbCredentials).length) {
return callback(Boom.forbidden());
}
const credentials = {
hawkSessionToken: dbCredentials.hawkSessionToken,
algorithm: dbCredentials.algorithm,
userId: dbCredentials.userId,
key: dbCredentials.key,
id: dbCredentials.id
};
return callback(null, credentials);
});
},
hawk: {
port: ''
}
});
next();
};
exports.register.attributes = {
pkg: require('./package.json')
};
| Change to empty port in hapi-auth-hawk | Change to empty port in hapi-auth-hawk
| JavaScript | mit | identityclash/hapi-login-test,identityclash/hapi-login-test | ---
+++
@@ -38,7 +38,7 @@
});
},
hawk: {
- port: 443
+ port: ''
}
});
|
8667d03442552cc21eff51529d8d9860f3428ee8 | server/import/server_sync.js | server/import/server_sync.js | var Event = require('../models/Event.js');
exports.sync = function(events) {
events.map(function(evt) {
var query = {
'title': evt.title,
'startAt': evt.startAt
};
Event.findOne(
query,
function(err, doc) {
if(!doc){
Event.create(evt , function(err, doc){
if(err){
console.log("Something went wrong in creating new event");
}
}
);}
}
);
});
}
| var Event = require('../models/Event.js');
var Venue = require('../models/Venue.js');
exports.sync = function(events) {
events.map(function(evt) {
var eventquery = {
'title': evt.title,
'startAt': evt.startAt
};
Event.findOne(
eventquery,
function(err, doc) {
if(!doc){
Event.create(evt , function(err, doc){
if(err){
console.log("Something went wrong in creating new event");
}
}
);}
}
);
var venuequery = {
'name': evt.venue.name
};
Venue.findOne(
venuequery,
function(err, doc) {
if(!doc){
var venue = new Venue();
venue.name = evt.venue.name;
venue.address = evt.venue.address;
venue.latitude = evt.venue.latitude;
venue.longitude = evt.venue.longitude;
venue.save(function(err, doc){
if(err){
console.log("Something went wrong in creating new event");
}
}
);}
}
);
});
};
| Add support for getting venues from scripts | Add support for getting venues from scripts
| JavaScript | apache-2.0 | Studentmediene/Barteguiden,Studentmediene/Barteguiden | ---
+++
@@ -1,13 +1,14 @@
var Event = require('../models/Event.js');
+var Venue = require('../models/Venue.js');
exports.sync = function(events) {
events.map(function(evt) {
- var query = {
+ var eventquery = {
'title': evt.title,
'startAt': evt.startAt
};
Event.findOne(
- query,
+ eventquery,
function(err, doc) {
if(!doc){
Event.create(evt , function(err, doc){
@@ -19,6 +20,25 @@
}
);
-
+ var venuequery = {
+ 'name': evt.venue.name
+ };
+ Venue.findOne(
+ venuequery,
+ function(err, doc) {
+ if(!doc){
+ var venue = new Venue();
+ venue.name = evt.venue.name;
+ venue.address = evt.venue.address;
+ venue.latitude = evt.venue.latitude;
+ venue.longitude = evt.venue.longitude;
+ venue.save(function(err, doc){
+ if(err){
+ console.log("Something went wrong in creating new event");
+ }
+ }
+ );}
+ }
+ );
});
-}
+}; |
9cd1761826af0028568223343a58c34663c6c104 | main.js | main.js | const electron = require('electron')
const app = electron.app // Module to control application life.
const BrowserWindow = electron.BrowserWindow // Module to create native browser window.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false
})
mainWindow.loadURL(`file://${__dirname}/index.html`)
mainWindow.webContents.openDevTools() // Open the DevTools.
mainWindow.on('closed', function () {
mainWindow = null
})
}
app.on('ready', () => {
createWindow();
mainWindow.once('ready-to-show', () => {
mainWindow.show()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
require('./main-process/file-selection')
| const electron = require('electron')
const app = electron.app // Module to control application life.
const BrowserWindow = electron.BrowserWindow // Module to create native browser window.
let mainWindow
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
show: false
})
mainWindow.loadURL(`file://${__dirname}/index.html`)
// mainWindow.webContents.openDevTools() // Open the DevTools.
mainWindow.on('closed', function () {
mainWindow = null
})
}
app.on('ready', () => {
createWindow();
mainWindow.once('ready-to-show', () => {
mainWindow.show()
})
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
if (mainWindow === null) {
createWindow()
}
})
require('./main-process/file-selection')
| Stop opening devtools on launch | Stop opening devtools on launch
| JavaScript | agpl-3.0 | briandk/transcriptase,briandk/transcriptase | ---
+++
@@ -13,7 +13,7 @@
})
mainWindow.loadURL(`file://${__dirname}/index.html`)
- mainWindow.webContents.openDevTools() // Open the DevTools.
+ // mainWindow.webContents.openDevTools() // Open the DevTools.
mainWindow.on('closed', function () {
mainWindow = null |
b560a5710ca240a499c1bcfaf643dfab458fe59c | server/routes/subscribers.js | server/routes/subscribers.js | var Joi = require("joi");
var DB = require("../db");
exports.list = {
handler: function(request, reply) {
DB.smembers("subscribers", function(err, members) {
reply({
subscribers: members
});
})
}
};
exports.add = {
validate: {
payload: {
email: Joi.string().email()
}
},
handler: function (request, reply) {
var email = request.payload.email;
console.log("Subscribe: " + email);
DB.sadd("subscribers", email);
reply("OK");
}
}; | var Joi = require("joi");
var DB = require("../db");
var Hapi = require("hapi");
var Util = require("util");
exports.list = {
handler: function(request, reply) {
DB.smembers("subscribers", function(err, members) {
reply({
subscribers: members
});
})
}
};
exports.add = {
validate: {
payload: {
email: Joi.string().email()
}
},
handler: function (request, reply) {
var email = request.payload.email;
console.log("Subscribe: " + email);
DB.sadd("subscribers", email, function(error, result) {
if (error) {
console.error(Util.format('Error saving [%s] email address.', email), error);
reply(Hapi.error.internal('Error saving your email address. This has been logged and will be fixed shortly.', error));
return;
}
reply("OK");
});
}
};
| Handle errors trying to add email for subscriber action. | Handle errors trying to add email for subscriber action.
- Add callback for sadd to check for error.
- Return a 500 error to client.
- Log to stderr when there is an issue.
| JavaScript | mit | borwahs/natalieandrob.com,borwahs/natalieandrob.com | ---
+++
@@ -1,5 +1,7 @@
var Joi = require("joi");
var DB = require("../db");
+var Hapi = require("hapi");
+var Util = require("util");
exports.list = {
handler: function(request, reply) {
@@ -20,7 +22,15 @@
handler: function (request, reply) {
var email = request.payload.email;
console.log("Subscribe: " + email);
- DB.sadd("subscribers", email);
- reply("OK");
+ DB.sadd("subscribers", email, function(error, result) {
+ if (error) {
+ console.error(Util.format('Error saving [%s] email address.', email), error);
+
+ reply(Hapi.error.internal('Error saving your email address. This has been logged and will be fixed shortly.', error));
+ return;
+ }
+
+ reply("OK");
+ });
}
}; |
f4fd4985c77b5f24fc0e3db757376fd67a38c579 | main.js | main.js | if(!(/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera)){
skrollr.init({
forceHeight: false,
smoothScrolling: false
});
}
$(function(){
var windowH = $(window).height();
$(window).on('resize', function(){
windowH = $(window).height();
});
$(window).scroll(function() {
var scrollVal = $(this).scrollTop();
if ( scrollVal > windowH ) {
$('.navbar').addClass('navbar-fixed-top');
$('.main').css({'margin-top': '70px'});
} else {
$('.navbar').removeClass('navbar-fixed-top');
$('.main').css({'margin-top': 0});
}
});
});
$('#nav-brand').click(function() {
$('html, body').animate({
scrollTop: $(".logo").offset().top - 40
}, 400);
return false;
});
$("#nav-about").click(function() {
$('html, body').animate({
scrollTop: $(".about").offset().top - 70
}, 400);
return false;
});
$("#nav-faq").click(function() {
$('html, body').animate({
scrollTop: $(".faq").offset().top - 70
}, 400);
return false;
});
| if(!(/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera)){
skrollr.init({
forceHeight: false,
smoothScrolling: false
});
}
$(function(){
var windowH = $(window).height() - 60;
$(window).on('resize', function(){
windowH = $(window).height() - 60;
});
$(window).scroll(function() {
var scrollVal = $(this).scrollTop();
if ( scrollVal > windowH ) {
$('.navbar').addClass('navbar-fixed-top');
$('.main').css({'margin-top': '70px'});
} else {
$('.navbar').removeClass('navbar-fixed-top');
$('.main').css({'margin-top': 0});
}
});
});
$('#nav-brand').click(function() {
$('html, body').animate({
scrollTop: $(".logo").offset().top - 40
}, 400);
return false;
});
$("#nav-about").click(function() {
$('html, body').animate({
scrollTop: $(".about").offset().top - 70
}, 400);
return false;
});
$("#nav-faq").click(function() {
$('html, body').animate({
scrollTop: $(".faq").offset().top - 70
}, 400);
return false;
});
| Fix scroll transition for navbar | Fix scroll transition for navbar
| JavaScript | agpl-3.0 | BoilerCamp/site-F15,BoilerCamp/site-F15 | ---
+++
@@ -6,9 +6,9 @@
}
$(function(){
- var windowH = $(window).height();
+ var windowH = $(window).height() - 60;
$(window).on('resize', function(){
- windowH = $(window).height();
+ windowH = $(window).height() - 60;
});
$(window).scroll(function() { |
d30cb455eb066c5711b903b682f00dd752bedaf7 | main.js | main.js | const accounts = {};
$('#go').click(function () {
const networkId = $('#networkId').val();
const accessToken = $('#accessToken').val();
const filter = '!0S2A5ipm(pczxWJLGNzYzyy4l';
const key = 'c8aSGAR0rp5RUK)dVriyCA((';
$.getJSON(`http://api.stackexchange.com/2.2/users/${networkId}/associated`, function (j) {
for (let i = 0; i < j.items.length; i++) {
accounts[j.items[i]['site_url']] = j.items[i]['user_id'];
}
$.each(accounts, function (k, v) {
const site = k.replace(/http.?:\/\//, '');
$.getJSON(`https://api.stackexchange.com/2.2/users/${v}/posts?filter=${filter}&key=${key}&access_token=${accessToken}&site=${site}`, function (j2) {
for (let x = 0; x < j2.items.length; x++) {
$('#posts').append(j2.items[x]['score'] + ' - <a href="' + j2.items[x]['link'] + '">' + j2.items[x]['title'] + '</a><br>');
}
});
});
});
});
| function getPosts(user, site, page, cb) {
const accessToken = $('#accessToken').val();
const filter = '!0S2A5ipm(pczxWJLGNzYzyy4l';
const key = 'c8aSGAR0rp5RUK)dVriyCA((';
$.getJSON(`https://api.stackexchange.com/2.2/users/${user}/posts?filter=${filter}&key=${key}&access_token=${accessToken}&site=${site}&page=${page}&pagesize=100`, j => {
for (let x = 0; x < j.items.length; x++) {
$('#posts').append(j.items[x].score + ' - <a href="' + j.items[x].link + '">' + j.items[x].title + '</a><br>');
}
if (j.has_more) getPosts(user, site, page + 1, () => console.log('Fetched more posts'));
else return cb();
});
}
$('#go').click(() => {
const accounts = {};
const networkId = $('#networkId').val();
$.getJSON(`http://api.stackexchange.com/2.2/users/${networkId}/associated`, j => {
for (let i = 0; i < j.items.length; i++) {
accounts[j.items[i]['site_url']] = j.items[i]['user_id'];
}
$.each(accounts, (k, v) => {
const site = k.replace(/http.?:\/\//, '');
getPosts(v, site, 1, () => console.log('Fetched all posts'));
});
});
});
| Use more modern JS; Add pagination to SE API calls | Use more modern JS; Add pagination to SE API calls
| JavaScript | mit | shu8/SE-PostUrlDump,shu8/SE-PostUrlDump | ---
+++
@@ -1,23 +1,30 @@
-const accounts = {};
-
-$('#go').click(function () {
- const networkId = $('#networkId').val();
+function getPosts(user, site, page, cb) {
const accessToken = $('#accessToken').val();
const filter = '!0S2A5ipm(pczxWJLGNzYzyy4l';
const key = 'c8aSGAR0rp5RUK)dVriyCA((';
- $.getJSON(`http://api.stackexchange.com/2.2/users/${networkId}/associated`, function (j) {
+ $.getJSON(`https://api.stackexchange.com/2.2/users/${user}/posts?filter=${filter}&key=${key}&access_token=${accessToken}&site=${site}&page=${page}&pagesize=100`, j => {
+ for (let x = 0; x < j.items.length; x++) {
+ $('#posts').append(j.items[x].score + ' - <a href="' + j.items[x].link + '">' + j.items[x].title + '</a><br>');
+ }
+
+ if (j.has_more) getPosts(user, site, page + 1, () => console.log('Fetched more posts'));
+ else return cb();
+ });
+}
+
+$('#go').click(() => {
+ const accounts = {};
+ const networkId = $('#networkId').val();
+
+ $.getJSON(`http://api.stackexchange.com/2.2/users/${networkId}/associated`, j => {
for (let i = 0; i < j.items.length; i++) {
accounts[j.items[i]['site_url']] = j.items[i]['user_id'];
}
- $.each(accounts, function (k, v) {
+ $.each(accounts, (k, v) => {
const site = k.replace(/http.?:\/\//, '');
- $.getJSON(`https://api.stackexchange.com/2.2/users/${v}/posts?filter=${filter}&key=${key}&access_token=${accessToken}&site=${site}`, function (j2) {
- for (let x = 0; x < j2.items.length; x++) {
- $('#posts').append(j2.items[x]['score'] + ' - <a href="' + j2.items[x]['link'] + '">' + j2.items[x]['title'] + '</a><br>');
- }
- });
+ getPosts(v, site, 1, () => console.log('Fetched all posts'));
});
});
}); |
359b2349389e48bac826c37594ef13ae9eba0c64 | app.js | app.js | var express = require('express');
var mysql = require('mysql');
var app = express();
app.use(express.static('public'));
var connection = mysql.createConnection({
host : process.env.MYSQL_HOST,
user : process.env.MYSQL_USER,
password : process.env.MYSQL_PASS,
database : process.env.MYSQL_DB
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
app.get('/getVisits', function(req,res){
var nVisits = 0;
connection.query('SELECT visits FROM stats', function (error, results, fields) {
if (error) throw error;
nVisits = results + 1;
res.end(JSON.stringify(nVisits));
console.log("GetVisits: " + nVisits);
connection.query('UPDATE stats SET ?', {visits: nVisits}, function (error, results, fields) {
if (error) throw error;
});
});
});
var server = app.listen(process.env.PORT || 8080, function(){
var port = server.address().port;
var host = server.address().address;
console.log("Server running on http://" + host + ":" +port);
});
| var express = require('express');
var mysql = require('mysql');
var app = express();
app.use(express.static('public'));
var connection = mysql.createConnection({
host : process.env.MYSQL_HOST ||,
user : process.env.MYSQL_USER ||,
password : process.env.MYSQL_PASS ||,
database : process.env.MYSQL_DB ||
});
connection.connect(function(err) {
if (err) {
console.error('error connecting: ' + err.stack);
return;
}
console.log('connected as id ' + connection.threadId);
});
app.get('/getVisits', function(req,res){
var nVisits = 0;
connection.query('SELECT value FROM stats WHERE stats.id_stat=\'visits\'', function (error, results, fields) {
if (error) throw error;
console.log(results[0].value);
nVisits = results[0].value + 1;
res.send(JSON.stringify(nVisits));
var sql = 'UPDATE stats SET value=' + nVisits + ' WHERE id_stat=\'visits\'';
connection.query(sql, function (error, results, fields) {
if (error) throw error;
});
});
});
var server = app.listen(process.env.PORT || 8080, function(){
var port = server.address().port;
var host = server.address().address;
console.log("Server running on http://" + host + ":" +port);
});
| Correct code to match db scheme | Correct code to match db scheme
| JavaScript | mit | ProjectMOA/noTeRayesCo,ProjectMOA/noTeRayesCo | ---
+++
@@ -5,10 +5,10 @@
app.use(express.static('public'));
var connection = mysql.createConnection({
- host : process.env.MYSQL_HOST,
- user : process.env.MYSQL_USER,
- password : process.env.MYSQL_PASS,
- database : process.env.MYSQL_DB
+ host : process.env.MYSQL_HOST ||,
+ user : process.env.MYSQL_USER ||,
+ password : process.env.MYSQL_PASS ||,
+ database : process.env.MYSQL_DB ||
});
connection.connect(function(err) {
@@ -21,12 +21,13 @@
app.get('/getVisits', function(req,res){
var nVisits = 0;
- connection.query('SELECT visits FROM stats', function (error, results, fields) {
+ connection.query('SELECT value FROM stats WHERE stats.id_stat=\'visits\'', function (error, results, fields) {
if (error) throw error;
- nVisits = results + 1;
- res.end(JSON.stringify(nVisits));
- console.log("GetVisits: " + nVisits);
- connection.query('UPDATE stats SET ?', {visits: nVisits}, function (error, results, fields) {
+ console.log(results[0].value);
+ nVisits = results[0].value + 1;
+ res.send(JSON.stringify(nVisits));
+ var sql = 'UPDATE stats SET value=' + nVisits + ' WHERE id_stat=\'visits\'';
+ connection.query(sql, function (error, results, fields) {
if (error) throw error;
});
}); |
074e9ebddbd392ee68c117c1d69fdecb7730dddb | src/DataTable/utils/convertSchema.js | src/DataTable/utils/convertSchema.js | import { startCase } from "lodash";
export default schema => {
let schemaToUse = schema;
if (!schemaToUse.fields && Array.isArray(schema)) {
schemaToUse = {
fields: schema
};
}
schemaToUse = {
...schemaToUse
};
schemaToUse.fields = schemaToUse.fields.map((field, i) => {
let fieldToUse = field;
if (typeof field === "string") {
fieldToUse = {
displayName: startCase(field),
path: field,
type: "string"
};
} else if (!field.type) {
fieldToUse = {
...field,
type: "string"
};
}
if (!fieldToUse.displayName) {
fieldToUse = {
...fieldToUse,
displayName: startCase(fieldToUse.path)
};
}
// paths are needed for column resizing
if (!fieldToUse.path) {
fieldToUse = {
...fieldToUse,
path: "fake-path" + i
};
}
return fieldToUse;
});
return schemaToUse;
};
| import { startCase } from "lodash";
export default schema => {
let schemaToUse = schema;
if (!schemaToUse.fields && Array.isArray(schema)) {
schemaToUse = {
fields: schema
};
}
schemaToUse = {
...schemaToUse
};
schemaToUse.fields = schemaToUse.fields.map((field, i) => {
let fieldToUse = field;
if (typeof field === "string") {
fieldToUse = {
displayName: startCase(field),
path: field,
type: "string"
};
} else if (!field.type) {
fieldToUse = {
...field,
type: "string"
};
}
if (!fieldToUse.displayName) {
fieldToUse = {
...fieldToUse,
displayName: startCase(fieldToUse.path)
};
}
// paths are needed for column resizing
if (!fieldToUse.path) {
fieldToUse = {
...fieldToUse,
filterDisabled: true,
sortDisabled: true,
path: "fake-path" + i
};
}
return fieldToUse;
});
return schemaToUse;
};
| Disable filtering and sorting if not providing path | Disable filtering and sorting if not providing path
| JavaScript | mit | TeselaGen/teselagen-react-components,TeselaGen/teselagen-react-components | ---
+++
@@ -34,6 +34,8 @@
if (!fieldToUse.path) {
fieldToUse = {
...fieldToUse,
+ filterDisabled: true,
+ sortDisabled: true,
path: "fake-path" + i
};
} |
eb6c818767f671f02732267d7493c36749d5edf4 | config/models.js | config/models.js | /**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
// This is specified in config/env/development.js and config/env/production.js
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
* *
***************************************************************************/
migrate: 'safe',
schema: true,
autoPK: true,
autoCreatedAt: true,
autoUpdatedAt: true
};
| /**
* Default model configuration
* (sails.config.models)
*
* Unless you override them, the following properties will be included
* in each of your models.
*
* For more info on Sails models, see:
* http://sailsjs.org/#!/documentation/concepts/ORM
*/
module.exports.models = {
/***************************************************************************
* *
* Your app's default connection. i.e. the name of one of your app's *
* connections (see `config/connections.js`) *
* *
***************************************************************************/
// This is specified in config/env/development.js and config/env/production.js
/***************************************************************************
* *
* How and whether Sails will attempt to automatically rebuild the *
* tables/collections/etc. in your schema. *
* *
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
* *
***************************************************************************/
migrate: 'alter',
schema: true,
autoPK: true,
autoCreatedAt: true,
autoUpdatedAt: true
};
| Create missing tables when lifting sails | Create missing tables when lifting sails
| JavaScript | mit | joschaefer/online-shop-api | ---
+++
@@ -29,7 +29,7 @@
* *
***************************************************************************/
- migrate: 'safe',
+ migrate: 'alter',
schema: true,
autoPK: true, |
eba8df01c6ed74e1be4a1e03bf1160b1c8a2bcd3 | apps/storage/main.js | apps/storage/main.js | var handleRequest = loadModule('helma.simpleweb').handleRequest;
var render = loadModule('helma.skin').render;
var webapp = loadModule('helma.webapp');
// db model
var model = loadModule('model');
// the main action is invoked for http://localhost:8080/
// this also shows simple skin rendering
function main_action() {
if (req.data.save) {
createBook();
}
if (req.data.remove) {
removeBook();
}
var books = model.Book.all();
res.write(render('skins/index.html', {
title: 'Storage Demo',
books: function(/*tag, skin, context*/) {
for (var i in books) {
var book = books[i]
res.writeln(book.getFullTitle(), getDeleteLink(book), "<br>");
}
}
}));
}
function createBook() {
var author = new model.Author({name: req.data.author});
var book = new model.Book({author: author, title: req.data.title});
// author is saved transitively
book.save();
res.redirect('/');
}
function removeBook() {
var book = model.Book.get(req.data.remove);
// author is removed through cascading delete
book.remove();
res.redirect('/');
}
function getDeleteLink(book) {
return '<a href="/?remove=' + book._id + '">delete</a>';
}
if (__name__ == "__main__") {
webapp.start();
}
| var webapp = loadModule('helma.webapp');
var handleRequest = loadModule('helma.webapp.handler').handleRequest;
// db model
var model = loadModule('model');
// the main action is invoked for http://localhost:8080/
// this also shows simple skin rendering
function main_action(req, res) {
if (req.data.save) {
createBook(req, res);
}
if (req.data.remove) {
removeBook(req, res);
}
var books = model.Book.all();
res.render('skins/index.html', {
title: 'Storage Demo',
books: function(/*tag, skin, context*/) {
var buffer = [];
for (var i in books) {
var book = books[i]
buffer.push(book.getFullTitle(), getDeleteLink(book), "<br>\r\n");
}
return buffer.join(' ');
}
});
}
function createBook(req, res) {
var author = new model.Author({name: req.data.author});
var book = new model.Book({author: author, title: req.data.title});
// author is saved transitively
book.save();
res.redirect('/');
}
function removeBook(req, res) {
var book = model.Book.get(req.data.remove);
// author is removed through cascading delete
book.remove();
res.redirect('/');
}
function getDeleteLink(book) {
return '<a href="/?remove=' + book._id + '">delete</a>';
}
if (__name__ == "__main__") {
webapp.start();
}
| Update to new webapp and skin rendering (I like it better than before!) | Update to new webapp and skin rendering (I like it better than before!)
git-svn-id: fac99be8204c57f0935f741ea919b5bf0077cdf6@9248 688a9155-6ab5-4160-a077-9df41f55a9e9
| JavaScript | apache-2.0 | ringo/ringojs,ringo/ringojs,ringo/ringojs,oberhamsi/ringojs,Transcordia/ringojs,oberhamsi/ringojs,Transcordia/ringojs,Transcordia/ringojs,ashwinrayaprolu1984/ringojs,oberhamsi/ringojs,ashwinrayaprolu1984/ringojs,ringo/ringojs,ashwinrayaprolu1984/ringojs,ashwinrayaprolu1984/ringojs,Transcordia/ringojs | ---
+++
@@ -1,32 +1,33 @@
-var handleRequest = loadModule('helma.simpleweb').handleRequest;
-var render = loadModule('helma.skin').render;
var webapp = loadModule('helma.webapp');
+var handleRequest = loadModule('helma.webapp.handler').handleRequest;
// db model
var model = loadModule('model');
// the main action is invoked for http://localhost:8080/
// this also shows simple skin rendering
-function main_action() {
+function main_action(req, res) {
if (req.data.save) {
- createBook();
+ createBook(req, res);
}
if (req.data.remove) {
- removeBook();
+ removeBook(req, res);
}
var books = model.Book.all();
- res.write(render('skins/index.html', {
+ res.render('skins/index.html', {
title: 'Storage Demo',
books: function(/*tag, skin, context*/) {
+ var buffer = [];
for (var i in books) {
var book = books[i]
- res.writeln(book.getFullTitle(), getDeleteLink(book), "<br>");
+ buffer.push(book.getFullTitle(), getDeleteLink(book), "<br>\r\n");
}
+ return buffer.join(' ');
}
- }));
+ });
}
-function createBook() {
+function createBook(req, res) {
var author = new model.Author({name: req.data.author});
var book = new model.Book({author: author, title: req.data.title});
// author is saved transitively
@@ -34,7 +35,7 @@
res.redirect('/');
}
-function removeBook() {
+function removeBook(req, res) {
var book = model.Book.get(req.data.remove);
// author is removed through cascading delete
book.remove(); |
350cf06afe2d841fa309bf60155cb831235ae757 | landing/utils/auth/login/login.controller.js | landing/utils/auth/login/login.controller.js | (() => {
'use strict';
angular
.module('app')
.controller('LoginController', LoginController);
LoginController.$inject = ['growl', '$window', '$http', '$routeSegment', 'TokenService', 'Endpoints'];
function LoginController(growl, $window, $http, $routeSegment, TokenService, Endpoints) {
const vm = this;
vm.data = {};
vm.login = login;
////
function login() {
let req = {
email: vm.data.email,
password: vm.data.password
};
let config = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
let response = (res) => {
if (res.status == 200) {
if (res.data.success) {
TokenService.save(res.data.data.token);
$window.location.pathname = '/app/';
} else {
growl.info(res.data.data.message);
$routeSegment.chain[0].reload();
}
}
vm.form.$setUntouched();
vm.form.$setPristine();
vm.form.$setDirty();
};
$http.post(Endpoints.AUTH, req, config).then(response);
}
}
})();
| (() => {
'use strict';
angular
.module('app')
.controller('LoginController', LoginController);
LoginController.$inject = ['growl', '$window', '$http', '$routeSegment', 'TokenService', 'Endpoints', '$localStorage'];
function LoginController(growl, $window, $http, $routeSegment, TokenService, Endpoints, $localStorage) {
const vm = this;
vm.data = {};
vm.login = login;
////
// If we have token, we don`t need input mail and password
if ($localStorage.token) {
console.log($localStorage.token);
$window.location.pathname = '/app/';
}
function login() {
let req = {
email: vm.data.email,
password: vm.data.password
};
let config = {
'Content-Type': 'application/json',
'Accept': 'application/json'
};
let response = (res) => {
if (res.status == 200) {
if (res.data.success) {
TokenService.save(res.data.data.token);
$window.location.pathname = '/app/';
} else {
growl.info(res.data.data.message);
$routeSegment.chain[0].reload();
}
}
vm.form.$setUntouched();
vm.form.$setPristine();
vm.form.$setDirty();
};
$http.post(Endpoints.AUTH, req, config).then(response);
}
}
})();
| Add simple test for token on landig with redirect on app | Add simple test for token on landig with redirect on app
| JavaScript | mit | royalrangers-ck/rr-web-app,royalrangers-ck/rr-web-app,royalrangers-ck/rr-web-app,royalrangers-ck/rr-web-app | ---
+++
@@ -6,14 +6,19 @@
.module('app')
.controller('LoginController', LoginController);
- LoginController.$inject = ['growl', '$window', '$http', '$routeSegment', 'TokenService', 'Endpoints'];
- function LoginController(growl, $window, $http, $routeSegment, TokenService, Endpoints) {
+ LoginController.$inject = ['growl', '$window', '$http', '$routeSegment', 'TokenService', 'Endpoints', '$localStorage'];
+ function LoginController(growl, $window, $http, $routeSegment, TokenService, Endpoints, $localStorage) {
const vm = this;
vm.data = {};
vm.login = login;
////
+ // If we have token, we don`t need input mail and password
+ if ($localStorage.token) {
+ console.log($localStorage.token);
+ $window.location.pathname = '/app/';
+ }
function login() {
let req = { |
acc5692d93fb34fcb134165e966f0e18ab9d436b | lumify-web-war/src/main/webapp/js/service/config.js | lumify-web-war/src/main/webapp/js/service/config.js | define([
'service/serviceBase'
], function(ServiceBase) {
'use strict';
// Override in configuration.properties with `web.ui` prefix
var DEFAULTS = {
'vertex.loadRelatedMaxBeforePrompt': 50,
'vertex.loadRelatedMaxForceSearch': 250,
'ontology.iri.artifactHasEntity': 'http://lumify.io/dev#rawHasEntity',
'properties.multivalue.defaultVisibleCount': 2,
'map.provider': 'google',
'map.provider.osm.url': 'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png,' +
'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png,' +
'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
};
// Coerce all values to strings since that's what they will be from
// server
_.keys(DEFAULTS).forEach(function(key) {
DEFAULTS[key] = '' + DEFAULTS[key];
});
function ConfigService() {
ServiceBase.call(this);
return this;
}
ConfigService.prototype = Object.create(ServiceBase.prototype);
ConfigService.prototype.getProperties = function(refresh) {
if (!refresh && this.cachedProperties) return this.cachedProperties;
return (this.cachedProperties = $.get('configuration').then(this.applyDefaults));
};
ConfigService.prototype.applyDefaults = function(properties) {
return _.extend({}, DEFAULTS, properties);
};
return ConfigService;
});
| define([
'service/serviceBase'
], function(ServiceBase) {
'use strict';
// Override in configuration.properties with `web.ui` prefix
var DEFAULTS = {
'vertex.loadRelatedMaxBeforePrompt': 50,
'vertex.loadRelatedMaxForceSearch': 250,
'ontology.iri.artifactHasEntity': 'http://lumify.io/dev#rawHasEntity',
'properties.multivalue.defaultVisibleCount': 2,
'map.provider': 'google',
'map.provider.osm.url': 'https://a.tile.openstreetmap.org/${z}/${x}/${y}.png,' +
'https://b.tile.openstreetmap.org/${z}/${x}/${y}.png,' +
'https://c.tile.openstreetmap.org/${z}/${x}/${y}.png'
};
// Coerce all values to strings since that's what they will be from
// server
_.keys(DEFAULTS).forEach(function(key) {
DEFAULTS[key] = '' + DEFAULTS[key];
});
function ConfigService() {
ServiceBase.call(this);
return this;
}
ConfigService.prototype = Object.create(ServiceBase.prototype);
ConfigService.prototype.getProperties = function(refresh) {
if (!refresh && this.cachedProperties) {
return this.cachedProperties;
}
this.cachedProperties =
this._ajaxGet({ url: 'configuration' })
.then(this.applyDefaults);
return this.cachedProperties;
};
ConfigService.prototype.applyDefaults = function(properties) {
return _.extend({}, DEFAULTS, properties);
};
return ConfigService;
});
| Use service base get method | Use service base get method
| JavaScript | apache-2.0 | lumifyio/lumify,RavenB/lumify,bings/lumify,RavenB/lumify,dvdnglnd/lumify,dvdnglnd/lumify,Steimel/lumify,Steimel/lumify,lumifyio/lumify,Steimel/lumify,RavenB/lumify,RavenB/lumify,dvdnglnd/lumify,TeamUDS/lumify,bings/lumify,j-bernardo/lumify,bings/lumify,Steimel/lumify,j-bernardo/lumify,RavenB/lumify,lumifyio/lumify,bings/lumify,bings/lumify,Steimel/lumify,j-bernardo/lumify,TeamUDS/lumify,dvdnglnd/lumify,TeamUDS/lumify,lumifyio/lumify,TeamUDS/lumify,TeamUDS/lumify,dvdnglnd/lumify,lumifyio/lumify,j-bernardo/lumify,j-bernardo/lumify | ---
+++
@@ -29,9 +29,15 @@
ConfigService.prototype = Object.create(ServiceBase.prototype);
ConfigService.prototype.getProperties = function(refresh) {
- if (!refresh && this.cachedProperties) return this.cachedProperties;
+ if (!refresh && this.cachedProperties) {
+ return this.cachedProperties;
+ }
- return (this.cachedProperties = $.get('configuration').then(this.applyDefaults));
+ this.cachedProperties =
+ this._ajaxGet({ url: 'configuration' })
+ .then(this.applyDefaults);
+
+ return this.cachedProperties;
};
ConfigService.prototype.applyDefaults = function(properties) { |
99bdf00e945acc12c110fe2cd1fa941907153b54 | website/app/index/navbar.js | website/app/index/navbar.js | Application.Directives.directive("navbar", navbarDirective);
function navbarDirective() {
return {
scope: true,
restrict: "AE",
replace: true,
templateUrl: "index/navbar.html",
controller: "navbarDirectiveController"
};
}
Application.Controllers.controller("navbarDirectiveController",
["$scope", "ui", "current", "$state",
navbarDirectiveController]);
function navbarDirectiveController($scope, ui, current, $state) {
// This is needed to toggle the menu closed when an item is selected.
// This is a part of how ui-bootstrap interacts with the menus and
// the menu item does an ng-click.
$scope.status = {
isopen: false
};
$scope.create = function(action) {
var projectID = current.projectID();
var route = "projects.project." + action + ".create";
$scope.status = false;
$state.go(route, {id: projectID});
};
}
| Application.Directives.directive("navbar", navbarDirective);
function navbarDirective() {
return {
scope: true,
restrict: "AE",
replace: true,
templateUrl: "index/navbar.html",
controller: "navbarDirectiveController"
};
}
Application.Controllers.controller("navbarDirectiveController",
["$scope", "current", "$state", "projectState",
navbarDirectiveController]);
function navbarDirectiveController($scope, current, $state, projectState) {
// This is needed to toggle the menu closed when an item is selected.
// This is a part of how ui-bootstrap interacts with the menus and
// the menu item does an ng-click.
$scope.status = {
isopen: false
};
$scope.create = function(action) {
var projectID = current.projectID();
var route = "projects.project." + action + ".create";
var state = null;
var stateID = projectState.add(projectID, state);
$scope.status = false;
$state.go(route, {id: projectID, sid: stateID});
};
}
| Fix New menu to work with state. | Fix New menu to work with state.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -11,10 +11,10 @@
}
Application.Controllers.controller("navbarDirectiveController",
- ["$scope", "ui", "current", "$state",
+ ["$scope", "current", "$state", "projectState",
navbarDirectiveController]);
-function navbarDirectiveController($scope, ui, current, $state) {
+function navbarDirectiveController($scope, current, $state, projectState) {
// This is needed to toggle the menu closed when an item is selected.
// This is a part of how ui-bootstrap interacts with the menus and
// the menu item does an ng-click.
@@ -25,7 +25,9 @@
$scope.create = function(action) {
var projectID = current.projectID();
var route = "projects.project." + action + ".create";
+ var state = null;
+ var stateID = projectState.add(projectID, state);
$scope.status = false;
- $state.go(route, {id: projectID});
+ $state.go(route, {id: projectID, sid: stateID});
};
} |
759c0af7d313740b52da4e0fedf200b542e5b905 | bin/iterm-colors.js | bin/iterm-colors.js | #!/usr/bin/env node
// Requires
var _ = require('underscore');
var fs = require('fs');
// Comannder
var prog = require('commander');
// etcd-dump's package.json file
var pkg = require('../package.json');
// Dumper class
var parser = require('../');
// General options
prog
.version(pkg.version);
// Parse and fallback to help if no args
if(_.isEmpty(prog.parse(process.argv).args)) { return prog.help(); }
function convertFile(filename) {
// Output JSON color array
console.log(JSON.stringify(
parser(fs.readFileSync(filename)),
null,
4 // 4 spaces
));
}
// Parse files given on command line
prog.args.forEach(convertFile);
| #!/usr/bin/env node
// Requires
var _ = require('underscore');
var fs = require('fs');
var path = require('path');
// Comannder
var prog = require('commander');
// etcd-dump's package.json file
var pkg = require('../package.json');
// Dumper class
var parser = require('../');
// General options
prog
.version(pkg.version);
// Commands
prog
.command('compile [filename]')
.description('Compile an *.itermcolors file to a JSON scheme')
.action(function(filename, opts) {
// Output JSON color array
console.log(JSON.stringify(
parser(fs.readFileSync(filename)),
null,
4 // 4 spaces
));
});
prog
.command('bundle [dir]')
.description('Bundle a given directory of schemes to one json file')
.action(function(dir, opts) {
// Merge scheme's together and add name attribute based on filename
var bundle = fs.readdirSync(dir).map(function(filename) {
var name = filename.split('.')[0];
var data = require(path(dir, filename));
data.name = name;
return data;
}).reduce(function(bundle, data) {
bundle[name] = data;
return bundle;
}, {});
// Output bundle's JSON
console.log(JSON.stringify(bundle));
});
// Parse and fallback to help if no args
if(_.isEmpty(prog.parse(process.argv).args)) { return prog.help(); }
| Add bundle and compile commands to binary | Add bundle and compile commands to binary
| JavaScript | apache-2.0 | AaronO/iterm-colors,AaronO/iterm-colors | ---
+++
@@ -4,6 +4,7 @@
var _ = require('underscore');
var fs = require('fs');
+var path = require('path');
// Comannder
var prog = require('commander');
@@ -18,17 +19,41 @@
prog
.version(pkg.version);
-// Parse and fallback to help if no args
-if(_.isEmpty(prog.parse(process.argv).args)) { return prog.help(); }
-function convertFile(filename) {
+// Commands
+prog
+.command('compile [filename]')
+.description('Compile an *.itermcolors file to a JSON scheme')
+.action(function(filename, opts) {
// Output JSON color array
console.log(JSON.stringify(
parser(fs.readFileSync(filename)),
null,
4 // 4 spaces
));
-}
+});
-// Parse files given on command line
-prog.args.forEach(convertFile);
+prog
+.command('bundle [dir]')
+.description('Bundle a given directory of schemes to one json file')
+.action(function(dir, opts) {
+
+ // Merge scheme's together and add name attribute based on filename
+ var bundle = fs.readdirSync(dir).map(function(filename) {
+ var name = filename.split('.')[0];
+ var data = require(path(dir, filename));
+ data.name = name;
+
+ return data;
+ }).reduce(function(bundle, data) {
+ bundle[name] = data;
+ return bundle;
+ }, {});
+
+ // Output bundle's JSON
+ console.log(JSON.stringify(bundle));
+});
+
+
+// Parse and fallback to help if no args
+if(_.isEmpty(prog.parse(process.argv).args)) { return prog.help(); } |
6fe802feb9386289c62f13f1aef64bd5d5d866ad | test.js | test.js | var isArray = require('./');
var test = require('tape');
test('is array', function(t){
t.ok(isArray([]));
t.notOk(isArray({}));
t.notOk(isArray(null));
t.notOk(isArray(false));
t.notOk(isArray(""));
var obj = {};
obj[0] = true;
t.notOk(isArray(obj));
var arr = [];
arr.foo = 'bar';
t.ok(isArray(arr));
t.end();
});
| var isArray = require('./');
var test = require('tape');
var nativeIsArray = Array.isArray;
test('is array (only polyfill)', function(t){
delete Array.isArray;
t.ok(isArray([]));
t.notOk(isArray({}));
t.notOk(isArray(null));
t.notOk(isArray(false));
t.notOk(isArray(""));
var obj = {};
obj[0] = true;
t.notOk(isArray(obj));
var arr = [];
arr.foo = 'bar';
t.ok(isArray(arr));
t.end();
});
test('is array (native)', function(t){
Array.isArray = nativeIsArray;
t.ok(isArray([]));
t.notOk(isArray({}));
t.notOk(isArray(null));
t.notOk(isArray(false));
t.notOk(isArray(""));
var obj = {};
obj[0] = true;
t.notOk(isArray(obj));
var arr = [];
arr.foo = 'bar';
t.ok(isArray(arr));
t.end();
});
| Test the package with explicitly removed Array.isArray | Test the package with explicitly removed Array.isArray
try at making #3 mergeable | JavaScript | mit | juliangruber/isarray | ---
+++
@@ -1,7 +1,10 @@
var isArray = require('./');
var test = require('tape');
-test('is array', function(t){
+var nativeIsArray = Array.isArray;
+
+test('is array (only polyfill)', function(t){
+ delete Array.isArray;
t.ok(isArray([]));
t.notOk(isArray({}));
t.notOk(isArray(null));
@@ -19,3 +22,21 @@
t.end();
});
+test('is array (native)', function(t){
+ Array.isArray = nativeIsArray;
+ t.ok(isArray([]));
+ t.notOk(isArray({}));
+ t.notOk(isArray(null));
+ t.notOk(isArray(false));
+ t.notOk(isArray(""));
+
+ var obj = {};
+ obj[0] = true;
+ t.notOk(isArray(obj));
+
+ var arr = [];
+ arr.foo = 'bar';
+ t.ok(isArray(arr));
+
+ t.end();
+}); |
b630c298f89b51bd8319f9452548ab811232cdd3 | src/js/vendor/jquery.onfontresize.js | src/js/vendor/jquery.onfontresize.js | 'use strict';
(function($, window, document, undefined) {
$.onFontResize = {
delay: 250,
timer: null,
on: true,
box: null,
boxHeight: 0,
init: function() {
this.box = document.createElement('DIV');
$(this.box).html('Détection du zoom').css({
position: 'absolute',
top: '-999px',
left: '-9999px',
display: 'inline',
lineHeight: 1
}).appendTo('body');
this.boxHeight = $(this.box).height();
},
watch: function(delay) {
if (!this.box) this.init();
this.unwatch();
if (delay) this.delay = delay;
this.on = true;
this.check();
},
unwatch: function() {
this.on = false;
if (this.timer) clearTimeout(this.timer);
},
check: function() {
var that = $.onFontResize,
h = $(that.box).height();
if (h !== that.boxHeight) {
that.boxHeight = h;
$(document).triggerHandler('fontresize');
}
if (that.on) this.timer = setTimeout(that.check, that.delay);
}
};
$(function() {
$.onFontResize.watch();
});
})(jQuery, window, document);
| 'use strict';
(function($, window, document, undefined) {
$.onFontResize = {
delay: 250,
timer: null,
on: true,
box: null,
boxHeight: 0,
init: function() {
this.box = document.createElement('DIV');
$(this.box).html('Détection du zoom').css({
position: 'absolute',
top: '-999px',
left: '-9999px',
display: 'inline',
lineHeight: 1
}).attr('aria-hidden', 'true').appendTo('body');
this.boxHeight = $(this.box).height();
},
watch: function(delay) {
if (!this.box) this.init();
this.unwatch();
if (delay) this.delay = delay;
this.on = true;
this.check();
},
unwatch: function() {
this.on = false;
if (this.timer) clearTimeout(this.timer);
},
check: function() {
var that = $.onFontResize,
h = $(that.box).height();
if (h !== that.boxHeight) {
that.boxHeight = h;
$(document).triggerHandler('fontresize');
}
if (that.on) this.timer = setTimeout(that.check, that.delay);
}
};
$(function() {
$.onFontResize.watch();
});
})(jQuery, window, document);
| Add aria-hidden to zoom detection div | Add aria-hidden to zoom detection div | JavaScript | agpl-3.0 | libeo-vtt/vtt,libeo-vtt/vtt | ---
+++
@@ -15,7 +15,7 @@
left: '-9999px',
display: 'inline',
lineHeight: 1
- }).appendTo('body');
+ }).attr('aria-hidden', 'true').appendTo('body');
this.boxHeight = $(this.box).height();
}, |
9bd3040d14d5be10b9d32d017fb93b6ee31b5af1 | build/connect.js | build/connect.js | const rewrite = require('connect-modrewrite');
const serveIndex = require('serve-index');
const serveStatic = require('serve-static');
module.exports = function (grunt) {
return {
livereload: {
options: {
hostname : '127.0.0.1',
port : 443,
protocol : 'https',
base : 'dist',
open : 'https://localhost.localdomain',
middleware: (connect, options) => {
const middlewares = [
require('connect-livereload')(),
];
const rules = [
'^/binary-static/(.*)$ /$1',
];
middlewares.push(rewrite(rules));
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
options.base.forEach((base) => {
middlewares.push(serveStatic(base));
});
const directory = options.directory || options.base[options.base.length - 1];
middlewares.push(serveIndex(directory));
return middlewares;
}
}
},
};
};
| const rewrite = require('connect-modrewrite');
const serveIndex = require('serve-index');
const serveStatic = require('serve-static');
module.exports = function (grunt) {
return {
livereload: {
options: {
hostname : '127.0.0.1',
port : 443,
protocol : 'https',
base : 'dist',
open : 'https://localhost.localdomain',
middleware: (connect, options) => {
const middlewares = [
require('connect-livereload')(),
];
const rules = [
'^/binary-static/(.*)$ /$1',
];
middlewares.push(rewrite(rules));
if (!Array.isArray(options.base)) {
options.base = [options.base];
}
options.base.forEach((base) => {
middlewares.push(serveStatic(base));
});
const directory = options.directory || options.base[options.base.length - 1];
middlewares.push(serveIndex(directory));
middlewares.push((req, res) => {
const path_404 = `${options.base[0]}/404.html`;
if (grunt.file.exists(path_404)) {
require('fs').createReadStream(path_404).pipe(res);
return;
}
res.statusCode(404); // 404.html not found
res.end();
});
return middlewares;
}
}
},
};
};
| Handle 404 on local server | Handle 404 on local server
| JavaScript | apache-2.0 | 4p00rv/binary-static,negar-binary/binary-static,binary-com/binary-static,binary-static-deployed/binary-static,ashkanx/binary-static,ashkanx/binary-static,raunakkathuria/binary-static,negar-binary/binary-static,binary-com/binary-static,4p00rv/binary-static,raunakkathuria/binary-static,kellybinary/binary-static,binary-com/binary-static,ashkanx/binary-static,kellybinary/binary-static,binary-static-deployed/binary-static,4p00rv/binary-static,negar-binary/binary-static,binary-static-deployed/binary-static,raunakkathuria/binary-static,kellybinary/binary-static | ---
+++
@@ -32,6 +32,16 @@
const directory = options.directory || options.base[options.base.length - 1];
middlewares.push(serveIndex(directory));
+ middlewares.push((req, res) => {
+ const path_404 = `${options.base[0]}/404.html`;
+ if (grunt.file.exists(path_404)) {
+ require('fs').createReadStream(path_404).pipe(res);
+ return;
+ }
+ res.statusCode(404); // 404.html not found
+ res.end();
+ });
+
return middlewares;
}
} |
17d1f4b4fed07f5a0025041d68e9bfaf661aa495 | locales/en_US/company.js | locales/en_US/company.js | module.exports = {
whoshiring: {
title: "Who's Hiring?",
subtitle: "These companies are looking for JavaScript and Node.js developers",
addCompany: "To add your company to this list, email <a href='mailto:whoshiring@npmjs.org'>whoshiring@npmjs.org</a> for pricing options."
}
}
| module.exports = {
whoshiring: {
title: "Who's Hiring?",
subtitle: "These companies are looking for JavaScript and Node.js developers",
addCompany: "To add your company to this list, email <a href='mailto:whoshiring@npmjs.com'>whoshiring@npmjs.com</a> for pricing options."
}
}
| Update whoshiring email address to .com | Update whoshiring email address to .com | JavaScript | isc | kemitchell/newww,DanielBarnes/newww,marcellodesales/newww,AgtLucas/newww,tiandavis/newww,Constructor-io/newww,jonathanmarvens/npm-newww,AgtLucas/newww,rutaihwa/newww,rutaihwa/newww,Constructor-io/newww,imshivs/newww,nexdrew/newww,nexdrew/newww,whitneyit/newww,ChALkeR/newww,psalaets/newww,jonathanmarvens/npm-newww,zeusdeux/newww,amilaonbitlab/newww,ChALkeR/newww,seldo/newww,imshivs/newww,psalaets/newww,jonathanmarvens/npm-newww,zeusdeux/newww,pombredanne/newww,imshivs/newww,aredridel/newww,aks-/newww,psalaets/newww,geek/newww,rutaihwa/newww,aredridel/newww,kemitchell/newww,dancrumb/newww,dancrumb/newww,supriyantomaftuh/newww,watilde/newww,watilde/newww,nexdrew/newww,seldo/newww,n1889/newww,kemitchell/newww,marcellodesales/newww,pombredanne/newww,tiandavis/newww,n1889/newww,tiandavis/newww,geek/newww,marcellodesales/newww,DanielBarnes/newww,whitneyit/newww,Constructor-io/newww,pombredanne/newww,dancrumb/newww,aredridel/newww,n1889/newww,seldo/newww,whitneyit/newww,geek/newww,ChALkeR/newww,amilaonbitlab/newww,DanielBarnes/newww,watilde/newww,amilaonbitlab/newww,zeusdeux/newww,supriyantomaftuh/newww,AgtLucas/newww,aks-/newww,aks-/newww,supriyantomaftuh/newww | ---
+++
@@ -2,6 +2,6 @@
whoshiring: {
title: "Who's Hiring?",
subtitle: "These companies are looking for JavaScript and Node.js developers",
- addCompany: "To add your company to this list, email <a href='mailto:whoshiring@npmjs.org'>whoshiring@npmjs.org</a> for pricing options."
+ addCompany: "To add your company to this list, email <a href='mailto:whoshiring@npmjs.com'>whoshiring@npmjs.com</a> for pricing options."
}
} |
1b076fbce5ef391fcbbe813c7cde0906cc3278fd | src/Input/LevelController.js | src/Input/LevelController.js | function LevelController(onComplete, level) {
this.onComplete = onComplete;
this.level = level;
};
LevelController.prototype.left = function() {
if( this.index === 0 ) {
return;
}
this.level.index -= 1;
};
LevelController.prototype.right = function() {
if(this.index === this.level.puzzle.board.columns - 1) {
return;
}
this.level.index += 1;
};
LevelController.prototype.down = function() {
if(!this.level.puzzle.isComplete()) {
this.level.puzzle.playIndex(this.level.index);
}
if(this.level.puzzle.isComplete() && typeof this.onComplete === 'function') {
this.onComplete(this.level);
}
};
LevelController.prototype.up = function() {
this.level.puzzle.reset();
};
LevelController.prototype.onComplete = function() {};
| function LevelController(onComplete, level) {
this.onComplete = onComplete;
this.level = level;
};
LevelController.prototype.left = function() {
if(this.level.index === 0) {
return;
}
this.level.index -= 1;
};
LevelController.prototype.right = function() {
if(this.level.index === this.level.puzzle.board.columns - 1) {
return;
}
this.level.index += 1;
};
LevelController.prototype.down = function() {
if(!this.level.puzzle.isComplete()) {
this.level.puzzle.playIndex(this.level.index);
}
if(this.level.puzzle.isComplete() && typeof this.onComplete === 'function') {
this.onComplete(this.level);
}
};
LevelController.prototype.up = function() {
this.level.puzzle.reset();
};
LevelController.prototype.onComplete = function() {};
| Fix number going outside of level issue | Fix number going outside of level issue
| JavaScript | mit | mnito/factors-game,mnito/factors-game | ---
+++
@@ -4,14 +4,14 @@
};
LevelController.prototype.left = function() {
- if( this.index === 0 ) {
+ if(this.level.index === 0) {
return;
}
this.level.index -= 1;
};
LevelController.prototype.right = function() {
- if(this.index === this.level.puzzle.board.columns - 1) {
+ if(this.level.index === this.level.puzzle.board.columns - 1) {
return;
}
this.level.index += 1; |
af9ed6b7826b218d353b216517294f98549d5e0f | lib/themes/dosomething/paraneue_dosomething/tasks/options/copy.js | lib/themes/dosomething/paraneue_dosomething/tasks/options/copy.js | module.exports = {
assets: {
files: [
{expand: true, src: ["images/**"], dest: "dist/"},
{expand: true, src: ["bower_components/**"], dest: "dist/"},
]
}
}
| module.exports = {
assets: {
files: [
{expand: true, src: ["images/**"], dest: "dist/"},
{expand: true, src: ["bower_components/**"], dest: "dist/"},
]
},
source: {
files: [
{expand: true, src: ["scss/**"], dest: "dist/"},
{expand: true, src: ["js/**"], dest: "dist/"},
]
}
}
| Copy assets into dist build so they can be used for source maps. | Copy assets into dist build so they can be used for source maps.
| JavaScript | mit | chloealee/dosomething,jonuy/dosomething,DoSomething/dosomething,chloealee/dosomething,sergii-tkachenko/phoenix,chloealee/dosomething,angaither/dosomething,deadlybutter/phoenix,DoSomething/phoenix,jonuy/dosomething,DoSomething/phoenix,chloealee/dosomething,jonuy/dosomething,angaither/dosomething,sergii-tkachenko/phoenix,sbsmith86/dosomething,mshmsh5000/dosomething,DoSomething/dosomething,jonuy/dosomething,deadlybutter/phoenix,mshmsh5000/dosomething,chloealee/dosomething,mshmsh5000/dosomething,mshmsh5000/dosomething-1,DoSomething/dosomething,DoSomething/phoenix,jonuy/dosomething,mshmsh5000/dosomething-1,DoSomething/phoenix,angaither/dosomething,sbsmith86/dosomething,jonuy/dosomething,DoSomething/dosomething,mshmsh5000/dosomething-1,deadlybutter/phoenix,DoSomething/phoenix,sbsmith86/dosomething,chloealee/dosomething,sergii-tkachenko/phoenix,deadlybutter/phoenix,sbsmith86/dosomething,angaither/dosomething,sbsmith86/dosomething,sergii-tkachenko/phoenix,sergii-tkachenko/phoenix,deadlybutter/phoenix,sbsmith86/dosomething,mshmsh5000/dosomething-1,DoSomething/dosomething,angaither/dosomething,mshmsh5000/dosomething,mshmsh5000/dosomething-1,DoSomething/dosomething,angaither/dosomething | ---
+++
@@ -4,5 +4,11 @@
{expand: true, src: ["images/**"], dest: "dist/"},
{expand: true, src: ["bower_components/**"], dest: "dist/"},
]
+ },
+ source: {
+ files: [
+ {expand: true, src: ["scss/**"], dest: "dist/"},
+ {expand: true, src: ["js/**"], dest: "dist/"},
+ ]
}
} |
9b7b848544f84c19169098e503ae0f4779887d7d | src/reducers/initialState.js | src/reducers/initialState.js | export default {
oauths: {
oauthReturnedTempCode: "",
oauthReturnedToken: "",
authenticatedUser: {}
},
commitStatuses: [],
repos: null
};
| export default {
oauths: {
oauthReturnedTempCode: "",
oauthReturnedToken: "",
authenticatedUser: {}
},
commitStatuses: null,
repos: null
};
| Modify initial state for commitStatuses to be 'null' | Modify initial state for commitStatuses to be 'null'
| JavaScript | mit | compumike08/GitHub_Status_API_GUI,compumike08/GitHub_Status_API_GUI | ---
+++
@@ -4,6 +4,6 @@
oauthReturnedToken: "",
authenticatedUser: {}
},
- commitStatuses: [],
+ commitStatuses: null,
repos: null
}; |
2f07ce896e1d3d8d20ddd627c10b3e42ba0bac1a | src/actions/startup/win32.js | src/actions/startup/win32.js | let fs = require('fs')
let mkdirp = require('mkdirp')
let untildify = require('untildify')
let spawn = require('./spawn')
let dir = untildify('~\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup')
export function getFile (name) {
return `${dir}\\${name}.vbs`
}
export function create (name, cmd, args, out) {
let file = getFile(name)
let escapedCmd = `""${cmd}""`
let escapedArgs = args.map(a => `""${a}""`).join(' ')
let escapedOut = `""${out}""`
let command = `""${escapedCmd} ${escapedArgs} > ${escapedOut}""`
let data = `CreateObject("Wscript.Shell").Run "cmd /c ${command}", 0, true`
mkdirp.sync(dir)
fs.writeFileSync(file, data)
spawn(cmd, args, out)
}
export function remove (name) {
let file = getFile(name)
if (fs.existsSync(file)) fs.unlinkSync(file)
}
| let fs = require('fs')
let cp = require('child_process')
let mkdirp = require('mkdirp')
let untildify = require('untildify')
let dir = untildify('~\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup')
export function getFile (name) {
return `${dir}\\${name}.vbs`
}
export function create (name, cmd, args, out) {
let file = getFile(name)
let escapedCmd = `""${cmd}""`
let escapedArgs = args.map(a => `""${a}""`).join(' ')
let escapedOut = `""${out}""`
let command = `""${escapedCmd} ${escapedArgs} > ${escapedOut}""`
let data = `CreateObject("Wscript.Shell").Run "cmd /c ${command}", 0, true`
mkdirp.sync(dir)
fs.writeFileSync(file, data)
// Spawn vbscript
cp.spawn('cmd', ['/c', file], {
stdio: 'ignore',
detached: true
}).unref()
}
export function remove (name) {
let file = getFile(name)
if (fs.existsSync(file)) fs.unlinkSync(file)
}
| Fix hotel start on Windows | Fix hotel start on Windows
| JavaScript | mit | typicode/hotel,jhliberty/hotel,typicode/hotel,jhliberty/hotel,typicode/hotel | ---
+++
@@ -1,7 +1,7 @@
let fs = require('fs')
+let cp = require('child_process')
let mkdirp = require('mkdirp')
let untildify = require('untildify')
-let spawn = require('./spawn')
let dir = untildify('~\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup')
@@ -23,7 +23,11 @@
mkdirp.sync(dir)
fs.writeFileSync(file, data)
- spawn(cmd, args, out)
+ // Spawn vbscript
+ cp.spawn('cmd', ['/c', file], {
+ stdio: 'ignore',
+ detached: true
+ }).unref()
}
export function remove (name) { |
cca155e68433c146291343511d32e2002d7ef72b | js/app.js | js/app.js | (function (root, $) {
var $button = $('button.nav'),
$nav = $('.side ul');
$('.js').show();
$('.no-js').hide();
$button.on('click', function () {
$nav.slideToggle();
});
}(window, jQuery));
| (function (root, $) {
var $button = $('button.nav'),
$nav = $('.side ul');
$('.js-mobile').show();
$('.no-js-mobile').hide();
$button.on('click', function () {
$nav.slideToggle();
});
}(window, jQuery));
| Switch JS to use mobile class for hiding | Switch JS to use mobile class for hiding
| JavaScript | mit | jdavis/jdavis.github.com,jdavis/jdavis.github.com,jdavis/jdavis.github.com | ---
+++
@@ -2,8 +2,8 @@
var $button = $('button.nav'),
$nav = $('.side ul');
- $('.js').show();
- $('.no-js').hide();
+ $('.js-mobile').show();
+ $('.no-js-mobile').hide();
$button.on('click', function () {
$nav.slideToggle(); |
ec978cd0dd5da0019ce646a0654f072fbfe95d24 | wct.conf.js | wct.conf.js | var args = require('yargs').argv;
module.exports = {
extraScripts: args.dom === 'shadow' ? ['test/enable-shadow-dom.js'] : [],
registerHooks: function(context) {
// The Good
var crossPlatforms = [
'Windows 10/chrome@55',
'Windows 10/firefox@50'
];
// The Bad
var otherPlatforms = [
'OS X 10.11/iphone@9.3',
'OS X 10.11/ipad@9.3',
'Linux/android@5.1',
'Windows 10/microsoftedge@13',
'Windows 10/internet explorer@11',
'OS X 10.11/safari@10.0'
];
// run SauceLabs tests for pushes, except cases when branch contains 'quick/'
if (process.env.TRAVIS_EVENT_TYPE === 'push' && process.env.TRAVIS_BRANCH.indexOf('quick/') === -1) {
// crossPlatforms are not tested here, but in Selenium WebDriver (see .travis.yml)
context.options.plugins.sauce.browsers = otherPlatforms;
// Run SauceLabs for daily builds, triggered by cron
} else if (process.env.TRAVIS_EVENT_TYPE === 'cron') {
context.options.plugins.sauce.browsers = crossPlatforms.concat(otherPlatforms);
}
}
};
| var args = require('yargs').argv;
module.exports = {
extraScripts: args.dom === 'shadow' ? ['test/enable-shadow-dom.js'] : [],
registerHooks: function(context) {
// The Good
var crossPlatforms = [
'Windows 10/chrome@55',
'Windows 10/firefox@50'
];
// The Bad
var otherPlatforms = [
'OS X 10.11/iphone@9.3',
'OS X 10.11/ipad@9.3',
'Windows 10/microsoftedge@13',
'Windows 10/internet explorer@11',
'OS X 10.11/safari@10.0'
];
// run SauceLabs tests for pushes, except cases when branch contains 'quick/'
if (process.env.TRAVIS_EVENT_TYPE === 'push' && process.env.TRAVIS_BRANCH.indexOf('quick/') === -1) {
// crossPlatforms are not tested here, but in Selenium WebDriver (see .travis.yml)
context.options.plugins.sauce.browsers = otherPlatforms;
// Run SauceLabs for daily builds, triggered by cron
} else if (process.env.TRAVIS_EVENT_TYPE === 'cron') {
context.options.plugins.sauce.browsers = crossPlatforms.concat(otherPlatforms);
}
}
};
| Remove Linux/android@5.1 from automated tests | Remove Linux/android@5.1 from automated tests | JavaScript | apache-2.0 | vaadin/vaadin-combo-box,vaadin/vaadin-combo-box | ---
+++
@@ -13,7 +13,6 @@
var otherPlatforms = [
'OS X 10.11/iphone@9.3',
'OS X 10.11/ipad@9.3',
- 'Linux/android@5.1',
'Windows 10/microsoftedge@13',
'Windows 10/internet explorer@11',
'OS X 10.11/safari@10.0' |
c1fa71a64f4a14bb918c3e21aee32877f917f138 | namuhub/static/namuhub.js | namuhub/static/namuhub.js | var SearchBox = React.createClass({
getInitialState: function() {
return {
user: this.props.user
};
},
render: function() {
return (
<form className="ui">
<div className="ui action center aligned input">
<input type="text" placeholder="나무위키 아이디 입력" value={this.state.user} />
<button className="ui teal button">조회</button>
</div>
</form>
);
}
});
| var ContribBox = React.createClass({
render: function() {
return <div />;
}
});
var SearchBox = React.createClass({
getInitialState: function () {
console.log(this.props);
return {
user: this.props.user || ''
};
},
submit: function(e) {
var uri = '/' + this.state.user;
e.preventDefault();
var ps = window.history.pushState | 1 || 0;
[function(){location.replace(uri)},function(){window.history.pushState(null,null,uri)}][ps]();
},
updateUser: function(e) {
this.setState({
user: e.target.value
});
},
render: function() {
return (
<form className="ui" onSubmit={this.submit}>
<div className="ui action center aligned input">
<input type="text" placeholder="나무위키 아이디 입력" defaultValue={this.props.user} onChange={this.updateUser} />
<button className="ui teal button">조회</button>
</div>
</form>
);
}
});
| Add form submit event that replaces current page's uri | Add form submit event that replaces current page's uri
| JavaScript | apache-2.0 | ssut/namuhub,ssut/namuhub,ssut/namuhub | ---
+++
@@ -1,15 +1,36 @@
+var ContribBox = React.createClass({
+ render: function() {
+ return <div />;
+ }
+});
+
var SearchBox = React.createClass({
- getInitialState: function() {
+ getInitialState: function () {
+ console.log(this.props);
return {
- user: this.props.user
+ user: this.props.user || ''
};
+ },
+
+ submit: function(e) {
+ var uri = '/' + this.state.user;
+ e.preventDefault();
+
+ var ps = window.history.pushState | 1 || 0;
+ [function(){location.replace(uri)},function(){window.history.pushState(null,null,uri)}][ps]();
+ },
+
+ updateUser: function(e) {
+ this.setState({
+ user: e.target.value
+ });
},
render: function() {
return (
- <form className="ui">
+ <form className="ui" onSubmit={this.submit}>
<div className="ui action center aligned input">
- <input type="text" placeholder="나무위키 아이디 입력" value={this.state.user} />
+ <input type="text" placeholder="나무위키 아이디 입력" defaultValue={this.props.user} onChange={this.updateUser} />
<button className="ui teal button">조회</button>
</div>
</form> |
bdb66b3483aaaffefa61eaa1a52c886a08dc28ef | Gruntfile.js | Gruntfile.js | /* eslint-disable camelcase, global-require */
'use strict';
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jsonlint: {
all: ['*.json'],
},
eslint: {
all: {
src: ['*.js', 'test/*.js'],
ignore: '*.min.js',
},
},
mochaTest: {
test: {
src: 'test/*.js',
},
options: {
colors: true,
},
},
mocha_istanbul: {
coverage: {
src: 'test/*.js',
options: {
reportFormats: ['html'],
},
},
coveralls: {
src: 'test/*.js',
options: {
coverage: true,
reportFormats: ['lcovonly'],
},
},
options: {
mochaOptions: ['--colors'],
},
},
});
grunt.event.on('coverage', function(lcov, done) {
require('coveralls').handleInput(lcov, done);
});
// Register tasks
grunt.registerTask('lint', ['jsonlint', 'eslint']);
grunt.registerTask('test', [process.env.CI ? 'mocha_istanbul:coveralls' : 'mochaTest']);
grunt.registerTask('coverage', ['mocha_istanbul:coverage']);
grunt.registerTask('default', ['lint', 'test']);
};
| /* eslint-disable camelcase, global-require */
'use strict';
module.exports = function(grunt) {
require('jit-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jsonlint: {
all: ['*.json'],
},
eslint: {
all: {
src: '**/*.js',
ignore: '**/node_modules/**',
},
},
mochaTest: {
test: {
src: 'test/*.js',
},
options: {
colors: true,
},
},
mocha_istanbul: {
coverage: {
src: 'test/*.js',
options: {
reportFormats: ['html'],
},
},
coveralls: {
src: 'test/*.js',
options: {
coverage: true,
reportFormats: ['lcovonly'],
},
},
options: {
mochaOptions: ['--colors'],
},
},
});
grunt.event.on('coverage', function(lcov, done) {
require('coveralls').handleInput(lcov, done);
});
// Register tasks
grunt.registerTask('lint', ['jsonlint', 'eslint']);
grunt.registerTask('test', [process.env.CI ? 'mocha_istanbul:coveralls' : 'mochaTest']);
grunt.registerTask('coverage', ['mocha_istanbul:coverage']);
grunt.registerTask('default', ['lint', 'test']);
};
| Update glob for files to lint with ESLint | grunt: Update glob for files to lint with ESLint
Now linting .js files in benchmark/
| JavaScript | mit | woollybogger/string-natural-compare,nwoltman/string-natural-compare | ---
+++
@@ -14,8 +14,8 @@
eslint: {
all: {
- src: ['*.js', 'test/*.js'],
- ignore: '*.min.js',
+ src: '**/*.js',
+ ignore: '**/node_modules/**',
},
},
|
b1cd0b8560f5a64e806d6ae7bdc0d1c5f278b5dd | config/index.js | config/index.js | // see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')
module.exports = {
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
},
dev: {
env: require('./dev.env'),
port: 8080,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
}
}
| // see http://vuejs-templates.github.io/webpack for documentation.
var path = require('path')
module.exports = {
build: {
env: require('./prod.env'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
},
}
| Remove static folder from configs | :fire: Remove static folder from configs
| JavaScript | mit | kimuraz/vue-rest | ---
+++
@@ -4,9 +4,7 @@
module.exports = {
build: {
env: require('./prod.env'),
- index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
- assetsSubDirectory: 'static',
assetsPublicPath: '/',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
@@ -21,18 +19,4 @@
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
},
- dev: {
- env: require('./dev.env'),
- port: 8080,
- autoOpenBrowser: true,
- assetsSubDirectory: 'static',
- assetsPublicPath: '/',
- proxyTable: {},
- // CSS Sourcemaps off by default because relative paths are "buggy"
- // with this option, according to the CSS-Loader README
- // (https://github.com/webpack/css-loader#sourcemaps)
- // In our experience, they generally work as expected,
- // just be aware of this issue when enabling this option.
- cssSourceMap: false
- }
} |
e5467aed56658fc1e929226f3f8015efae213e59 | src/scripts/app/cms/concepts/directives/conceptForm.controller.js | src/scripts/app/cms/concepts/directives/conceptForm.controller.js | 'use strict';
module.exports =
/*
* This directive expects concept and processConceptForm
* to be set in scope.
*/
/*@ngInject*/
function ConceptsFormCtrl (
$scope, _, ConceptService
) {
if (_.isUndefined($scope.concept) || !_.isObject($scope.concept)) {
throw new Error('Please define concept object in controller scope');
}
if (_.isUndefined($scope.processConceptForm) || !_.isFunction($scope.processConceptForm)) {
throw new Error('Please define processConceptForm function in controller scope');
}
$scope.conceptTemplate = require('../models/concept.js');
ConceptService.get().then(function (concepts) {
$scope.concepts = concepts;
});
};
| 'use strict';
module.exports =
/*
* This directive expects concept and processConceptForm
* to be set in scope.
*/
/*@ngInject*/
function ConceptsFormCtrl (
$scope, _, ConceptService, StandardService,
StandardLevelService
) {
if (_.isUndefined($scope.concept) || !_.isObject($scope.concept)) {
throw new Error('Please define concept object in controller scope');
}
if (_.isUndefined($scope.processConceptForm) || !_.isFunction($scope.processConceptForm)) {
throw new Error('Please define processConceptForm function in controller scope');
}
$scope.conceptTemplate = require('../models/concept.js');
ConceptService.get().then(function (concepts) {
$scope.concepts = concepts;
});
StandardService.get().then(function (standards) {
$scope.standards = standards;
});
StandardLevelService.get().then(function (standardLevels) {
$scope.standard_levels = standardLevels;
});
};
| Add standards and standard levels to concepts create | Add standards and standard levels to concepts create
| JavaScript | agpl-3.0 | ddmck/Quill-Grammar,ddmck/Quill-Grammar,empirical-org/Quill-Grammar,empirical-org/Quill-Grammar,ddmck/Quill-Grammar,empirical-org/Quill-Grammar | ---
+++
@@ -9,7 +9,8 @@
/*@ngInject*/
function ConceptsFormCtrl (
- $scope, _, ConceptService
+ $scope, _, ConceptService, StandardService,
+ StandardLevelService
) {
if (_.isUndefined($scope.concept) || !_.isObject($scope.concept)) {
throw new Error('Please define concept object in controller scope');
@@ -24,4 +25,12 @@
ConceptService.get().then(function (concepts) {
$scope.concepts = concepts;
});
+
+ StandardService.get().then(function (standards) {
+ $scope.standards = standards;
+ });
+
+ StandardLevelService.get().then(function (standardLevels) {
+ $scope.standard_levels = standardLevels;
+ });
}; |
6b14d5f10c1550c43530484a73508ea87691d47e | src/dicebluff-client/app/main.js | src/dicebluff-client/app/main.js | ;(function(windowReference, documentReference) {
'use strict';
//
})(window, document);
| ;(function(windowReference, documentReference) {
'use strict';
var consoleNode = documentReference.querySelector('.console'),
console = new Console(consoleNode, 72, 18, (18 * 10)),
localPlayer = new LocalPlayer(console);
localPlayer.evaluateClaim(40, [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ], [ 1, 2, 3 ], true, function() {});
})(window, document);
| Add testing code for the local player evaluation method | Add testing code for the local player evaluation method
| JavaScript | mit | doubtingreality/dicebluff,doubtingreality/dicebluff | ---
+++
@@ -1,5 +1,9 @@
;(function(windowReference, documentReference) {
'use strict';
- //
+ var consoleNode = documentReference.querySelector('.console'),
+ console = new Console(consoleNode, 72, 18, (18 * 10)),
+ localPlayer = new LocalPlayer(console);
+
+ localPlayer.evaluateClaim(40, [ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ], [ 1, 2, 3 ], true, function() {});
})(window, document); |
5d09ecba94778245f2f59514786c58fbf4e406e1 | client/hubub.js | client/hubub.js | // HubBub client code
// From: https://github.com/almost/hubbub/
(function () {
// Just a very rough demo, needs a lot more work
var form = document.querySelector('form[data-hubbub]');
form.addEventListener('submit', function (evt) {
evt.preventDefault();
var comment = form.querySelector('[name=comment]').value;
var name = form.querySelector('[name=name]').value;
var xmlhttp = new XMLHttpRequest();
// TODO: Make this configurable!
xmlhttp.open("POST","https://hubbub.herokuapp.com/api/default/comments",true);
xmlhttp.setRequestHeader("Content-type", "application/json");
xmlhttp.onload = function (e) {
if (xmlhttp.readyState === 4) {
if (xmlhttp.status >= 200 && xmlhttp.status < 300) {
var response = JSON.parse(xhr.responseText);
var commentsContainer = document.querySelector('form[data-comments]');
if (commentsContainer) {
var commentEl = document.createElement('div');
commentEl.innerHTML = response.html;
commentsContainer.addChild(commentEl);
}
} else {
alert("Failed to send comment: " + xhr.statusText);
}
}
};
xmlhttp.onerror = function (e) {
alert("Failed to send comment: " + xhr.statusText);
};
// TOOD: Get post path from canonical meta tag if it's present
xmlhttp.send(JSON.stringify({metadata: {name: name}, comment: comment, post: window.location.path}));
});
})();
| // HubBub client code
// From: https://github.com/almost/hubbub/
(function () {
// Just a very rough demo, needs a lot more work
var form = document.querySelector('form[data-hubbub]');
form.addEventListener('submit', function (evt) {
evt.preventDefault();
var comment = form.querySelector('[name=comment]').value;
var name = form.querySelector('[name=name]').value;
var xmlhttp = new XMLHttpRequest();
// TODO: Make this configurable!
xmlhttp.open("POST","https://hubbub.herokuapp.com/api/default/comments",true);
xmlhttp.setRequestHeader("Content-type", "application/json");
xmlhttp.onload = function (e) {
if (xmlhttp.readyState === 4) {
if (xmlhttp.status >= 200 && xmlhttp.status < 300) {
var response = JSON.parse(xhr.responseText);
var commentsContainer = document.querySelector('form[data-pendingcomment]');
if (commentsContainer) {
var commentEl = document.createElement('div');
commentEl.innerHTML = response.html;
commentsContainer.addChild(commentEl);
}
} else {
alert("Failed to send comment: " + xhr.statusText);
}
}
};
xmlhttp.onerror = function (e) {
alert("Failed to send comment: " + xhr.statusText);
};
// TOOD: Get post path from canonical meta tag if it's present
xmlhttp.send(JSON.stringify({metadata: {name: name}, comment: comment, post: window.location.path}));
});
})();
| Add comment to special pendingcomments bit after its sent | Add comment to special pendingcomments bit after its sent
| JavaScript | mit | milessabin/hubbub,almost/hubbub | ---
+++
@@ -19,7 +19,7 @@
if (xmlhttp.readyState === 4) {
if (xmlhttp.status >= 200 && xmlhttp.status < 300) {
var response = JSON.parse(xhr.responseText);
- var commentsContainer = document.querySelector('form[data-comments]');
+ var commentsContainer = document.querySelector('form[data-pendingcomment]');
if (commentsContainer) {
var commentEl = document.createElement('div');
commentEl.innerHTML = response.html; |
a67b9d72030639923820c9a74636e360d27fe778 | .eslintrc.js | .eslintrc.js | module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
},
"globals": {}
};
| module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module"
},
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
]
},
"globals": {
"describe": true,
"context": true,
"it": true,
"specify": true,
"before": true,
"after": true,
"beforeEach": true,
"afterEach": true
}
};
| Update eslint globals to include mocha functions | Update eslint globals to include mocha functions
| JavaScript | mit | albertyw/base-flask,albertyw/base-flask,albertyw/base-flask,albertyw/base-flask | ---
+++
@@ -27,5 +27,14 @@
"always"
]
},
- "globals": {}
+ "globals": {
+ "describe": true,
+ "context": true,
+ "it": true,
+ "specify": true,
+ "before": true,
+ "after": true,
+ "beforeEach": true,
+ "afterEach": true
+ }
}; |
6e277b764fffcdbe17867409e6b3efded6e94662 | src/workers/ingress/index.js | src/workers/ingress/index.js | import BaseWorker from '../base'
import utils from 'async'
import uuid from 'uuid'
import redis from 'redis'
export class IngressWorker extends BaseWorker {
constructor (rsmq) {
super('ingress', rsmq)
this.rsmq = rsmq
this.redisClient = redis.createClient({
host: 'redis'
})
}
store (session, body) {
return new Promise((resolve, reject) => {
this.redisClient.set(`phonebox:ingress:${session}`, body, (err, reply) => {
if (err) return reject(err)
resolve(reply)
})
})
}
async process (message, next) {
const session = uuid.v1()
const body = this.render(`${__dirname}/${message.type}.ejs`, Object.assign(message, { session }))
await this.store(session, body)
utils.each(this.channels, (channel, cb) => {
this.rsmq.sendMessage({
qname: channel,
message: body
}, cb)
}, err => {
if (err) return next(err)
next()
})
}
}
export default IngressWorker
| import BaseWorker from '../base'
import redis from 'redis'
export class IngressWorker extends BaseWorker {
constructor (rsmq) {
super('ingress', rsmq)
this.rsmq = rsmq
this.redisClient = redis.createClient({
host: 'redis'
})
}
store (session, body) {
return new Promise((resolve, reject) => {
this.redisClient.set(`phonebox:ingress:${session}`, JSON.stringify(body), (err, reply) => {
if (err) return reject(err)
resolve(reply)
})
})
}
async process (message, next) {
const { session, type, attempts, channel } = message.meta
if (attempts >= 3) return next()
message.meta.attempts = message.meta.attempts + 1
await this.store(session, message)
const body = await this.render(`${__dirname}/${type}.ejs`, message)
this.rsmq.sendMessage({
qname: channel,
message: body,
delay: attempts * 180
}, next)
}
}
export default IngressWorker
| Update ingress to use new async render | Update ingress to use new async render
| JavaScript | mit | craftship/phonebox,craftship/phonebox,craftship/phonebox | ---
+++
@@ -1,6 +1,4 @@
import BaseWorker from '../base'
-import utils from 'async'
-import uuid from 'uuid'
import redis from 'redis'
export class IngressWorker extends BaseWorker {
@@ -15,7 +13,7 @@
store (session, body) {
return new Promise((resolve, reject) => {
- this.redisClient.set(`phonebox:ingress:${session}`, body, (err, reply) => {
+ this.redisClient.set(`phonebox:ingress:${session}`, JSON.stringify(body), (err, reply) => {
if (err) return reject(err)
resolve(reply)
})
@@ -23,19 +21,19 @@
}
async process (message, next) {
- const session = uuid.v1()
- const body = this.render(`${__dirname}/${message.type}.ejs`, Object.assign(message, { session }))
- await this.store(session, body)
+ const { session, type, attempts, channel } = message.meta
- utils.each(this.channels, (channel, cb) => {
- this.rsmq.sendMessage({
- qname: channel,
- message: body
- }, cb)
- }, err => {
- if (err) return next(err)
- next()
- })
+ if (attempts >= 3) return next()
+ message.meta.attempts = message.meta.attempts + 1
+
+ await this.store(session, message)
+ const body = await this.render(`${__dirname}/${type}.ejs`, message)
+
+ this.rsmq.sendMessage({
+ qname: channel,
+ message: body,
+ delay: attempts * 180
+ }, next)
}
}
|
808cabc32999237e3f278c8c0b56d7bfec43886d | client/src/utils.js | client/src/utils.js | import * as changeCase from 'change-case'
import pluralize from 'pluralize'
export default {
...changeCase,
pluralize,
resourceize: function(string) {
return pluralize(changeCase.camel(string))
}
}
Object.map = function(source, func) {
return Object.keys(source).map(key => {
let value = source[key]
return func(key, value)
})
}
Object.get = function(source, keypath) {
const keys = keypath.split('.')
let key
while (key = keys.shift()) {
source = source[key]
if (typeof source === 'undefined')
return source
}
return source
}
Object.without = function(source, ...keys) {
let copy = Object.assign({}, source)
let i = keys.length
while (i--) {
let key = keys[i]
copy[key] = undefined
delete copy[key]
}
return copy
}
// eslint-disable-next-line
Promise.prototype.log = function() {
return this.then(function(data) {
console.log(data)
return data
})
}
| import * as changeCase from 'change-case'
import pluralize from 'pluralize'
export default {
...changeCase,
pluralize,
resourceize: function(string) {
return pluralize(changeCase.camel(string))
}
}
Object.map = function(source, func) {
return Object.keys(source).map(key => {
let value = source[key]
return func(key, value)
})
}
Object.get = function(source, keypath) {
const keys = keypath.split('.')
while (keys[1]) {
let key = keys.shift()
source = source[key]
if (typeof source === 'undefined')
return source
}
return source
}
Object.without = function(source, ...keys) {
let copy = Object.assign({}, source)
let i = keys.length
while (i--) {
let key = keys[i]
copy[key] = undefined
delete copy[key]
}
return copy
}
// eslint-disable-next-line
Promise.prototype.log = function() {
return this.then(function(data) {
console.log(data)
return data
})
}
| Fix lint errors in Object.get | Fix lint errors in Object.get
| JavaScript | mit | NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet | ---
+++
@@ -18,8 +18,8 @@
Object.get = function(source, keypath) {
const keys = keypath.split('.')
- let key
- while (key = keys.shift()) {
+ while (keys[1]) {
+ let key = keys.shift()
source = source[key]
if (typeof source === 'undefined')
return source |
2f9b997f7138be1f6ab4243210ee039239e8bea6 | karma.conf.js | karma.conf.js | /*eslint-env node */
/*eslint no-var: 0 */
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha', 'coverage'],
coverageReporter: {
reporters: [
{
type: 'text-summary'
},
{
type: 'html',
dir: 'coverage'
}
]
},
browsers: ['PhantomJS'],
files: [
'test/browser/**.js',
'test/shared/**.js'
],
preprocessors: {
'test/**/*.js': ['webpack'],
'src/**/*.js': ['webpack'],
'**/*.js': ['sourcemap']
},
webpack: {
module: {
/* Transpile source and test files */
preLoaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
loose: 'all',
blacklist: ['es6.tailCall']
}
}
],
/* Only Instrument our source files for coverage */
loaders: [
{
test: /\.jsx?$/,
loader: 'isparta',
include: /src/
}
]
},
resolve: {
modulesDirectories: [__dirname, 'node_modules']
}
},
webpackMiddleware: {
noInfo: true
}
});
};
| /*eslint-env node */
/*eslint no-var: 0 */
var coverage = String(process.env.COVERAGE)!=='false';
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
reporters: ['mocha'].concat(coverage ? 'coverage' : []),
coverageReporter: {
reporters: [
{
type: 'text-summary'
},
{
type: 'html',
dir: 'coverage'
}
]
},
browsers: ['PhantomJS'],
files: [
'test/browser/**.js',
'test/shared/**.js'
],
preprocessors: {
'test/**/*.js': ['webpack'],
'src/**/*.js': ['webpack'],
'**/*.js': ['sourcemap']
},
webpack: {
module: {
/* Transpile source and test files */
preLoaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
loose: 'all',
blacklist: ['es6.tailCall']
}
}
],
/* Only Instrument our source files for coverage */
loaders: [].concat( coverage ? {
test: /\.jsx?$/,
loader: 'isparta',
include: /src/
} : [])
},
resolve: {
modulesDirectories: [__dirname, 'node_modules']
}
},
webpackMiddleware: {
noInfo: true
}
});
};
| Allow turning off coverage reporting for performance tests | Allow turning off coverage reporting for performance tests
| JavaScript | mit | neeharv/preact,developit/preact,neeharv/preact,developit/preact,gogoyqj/preact | ---
+++
@@ -1,11 +1,14 @@
/*eslint-env node */
/*eslint no-var: 0 */
+
+var coverage = String(process.env.COVERAGE)!=='false';
module.exports = function(config) {
config.set({
frameworks: ['mocha', 'chai-sinon'],
- reporters: ['mocha', 'coverage'],
+ reporters: ['mocha'].concat(coverage ? 'coverage' : []),
+
coverageReporter: {
reporters: [
{
@@ -46,13 +49,11 @@
}
],
/* Only Instrument our source files for coverage */
- loaders: [
- {
- test: /\.jsx?$/,
- loader: 'isparta',
- include: /src/
- }
- ]
+ loaders: [].concat( coverage ? {
+ test: /\.jsx?$/,
+ loader: 'isparta',
+ include: /src/
+ } : [])
},
resolve: {
modulesDirectories: [__dirname, 'node_modules'] |
bfceb2acdfc101fbf0f6448ffced75a36ae0ecab | client/app/movies/movies.js | client/app/movies/movies.js | 'use strict';
angular.module('mementoMovieApp')
.config(function ($stateProvider) {
$stateProvider
.state('movies', {
url: '/?year&director&actor',
templateUrl: 'app/movies/movies.html',
controller: 'MoviesCtrl',
resolve: {
PaginatedMovies: function(Movies, Pagination) {
return new Pagination(Movies);
}
}
});
});
| 'use strict';
angular.module('mementoMovieApp')
.config(function ($stateProvider) {
$stateProvider
.state('movies', {
url: '/?year&director&actor',
templateUrl: 'app/movies/movies.html',
controller: 'MoviesCtrl',
resolve: {
PaginatedMovies: ['Movies', 'Pagination', function(Movies, Pagination) {
return new Pagination(Movies);
}]
}
});
});
| Fix ui-router dependencies resolving in production. | Fix ui-router dependencies resolving in production.
| JavaScript | mit | ssidorchick/mementomovie | ---
+++
@@ -8,9 +8,9 @@
templateUrl: 'app/movies/movies.html',
controller: 'MoviesCtrl',
resolve: {
- PaginatedMovies: function(Movies, Pagination) {
+ PaginatedMovies: ['Movies', 'Pagination', function(Movies, Pagination) {
return new Pagination(Movies);
- }
+ }]
}
});
}); |
cfb399ab88b5201984e138f89602dc2f96bfbba2 | app/lib/initializePlugins.js | app/lib/initializePlugins.js | import plugins from '../main/plugins/'
import { send } from 'lib/rpc/events'
export default () => {
// Run plugin initializers only when main window is loaded
Object.keys(plugins).forEach(name => {
const { initializeAsync } = plugins[name]
if (!initializeAsync) return
initializeAsync(data => {
// Send message back to main window with initialization result
send('plugin.message', {
name,
data,
})
})
})
}
| import plugins from '../main/plugins/'
import { send } from 'lib/rpc/events'
export default () => {
// Run plugin initializers only when main window is loaded
Object.keys(plugins).forEach(name => {
const { initializeAsync } = plugins[name]
if (!initializeAsync) return
initializeAsync(data => {
// Send message back to main window with initialization result
send('plugin.message', {
name,
data,
})
})
})
return Promise.resolve()
}
| Fix error after plugins initialization in background window | Fix error after plugins initialization in background window
| JavaScript | mit | KELiON/cerebro,KELiON/cerebro | ---
+++
@@ -14,4 +14,5 @@
})
})
})
+ return Promise.resolve()
} |
e2c2efc7d38e4de0b9af7dfc87ff4deedab42cd8 | polyfills/duktape-isfastint.js | polyfills/duktape-isfastint.js | /*
* Helper to check if a number is internally represented as a fastint:
*
* if (Duktape.isFastint(x)) {
* print('fastint');
* } else {
* print('not a fastint (or not a number)');
* }
*
* NOTE: This helper depends on the internal tag numbering (defined in
* duk_tval.h) which is both version specific and depends on whether
* duk_tval is packed or not.
*/
if (typeof Duktape === 'object') {
if (typeof Duktape.fastintTag === 'undefined') {
Object.defineProperty(Duktape, 'fastintTag', {
/* Tag number depends on duk_tval packing. */
value: (Duktape.info(true)[1] >= 0xfff0) ?
0xfff1 /* tag for packed duk_tval */ :
1 /* tag for unpacked duk_tval */,
writable: false,
enumerable: false,
configurable: true
});
}
if (typeof Duktape.isFastint === 'undefined') {
Object.defineProperty(Duktape, 'isFastint', {
value: function (v) {
return Duktape.info(v)[0] === 4 && /* public type is DUK_TYPE_NUMBER */
Duktape.info(v)[1] === Duktape.fastintTag; /* internal tag is fastint */
},
writable: false,
enumerable: false,
configurable: true
});
}
}
| /*
* Helper to check if a number is internally represented as a fastint:
*
* if (Duktape.isFastint(x)) {
* print('fastint');
* } else {
* print('not a fastint (or not a number)');
* }
*
* NOTE: This helper depends on the internal tag numbering (defined in
* duk_tval.h) which is both version specific and depends on whether
* duk_tval is packed or not.
*/
if (typeof Duktape === 'object') {
if (typeof Duktape.fastintTag === 'undefined') {
Object.defineProperty(Duktape, 'fastintTag', {
/* Tag number depends on duk_tval packing. */
value: (Duktape.info(true).itag >= 0xfff0) ?
0xfff1 /* tag for packed duk_tval */ :
1 /* tag for unpacked duk_tval */,
writable: false,
enumerable: false,
configurable: true
});
}
if (typeof Duktape.isFastint === 'undefined') {
Object.defineProperty(Duktape, 'isFastint', {
value: function (v) {
return Duktape.info(v).type === 4 && /* public type is DUK_TYPE_NUMBER */
Duktape.info(v).itag === Duktape.fastintTag; /* internal tag is fastint */
},
writable: false,
enumerable: false,
configurable: true
});
}
}
| Fix isFastint() polyfill to use revised info() | Fix isFastint() polyfill to use revised info()
| JavaScript | mit | markand/duktape,markand/duktape,markand/duktape,harold-b/duktape,harold-b/duktape,markand/duktape,harold-b/duktape,markand/duktape,harold-b/duktape,svaarala/duktape,svaarala/duktape,svaarala/duktape,harold-b/duktape,harold-b/duktape,markand/duktape,svaarala/duktape,svaarala/duktape,harold-b/duktape,markand/duktape,svaarala/duktape,harold-b/duktape,markand/duktape,harold-b/duktape,svaarala/duktape,svaarala/duktape,harold-b/duktape,svaarala/duktape,markand/duktape,markand/duktape | ---
+++
@@ -16,7 +16,7 @@
if (typeof Duktape.fastintTag === 'undefined') {
Object.defineProperty(Duktape, 'fastintTag', {
/* Tag number depends on duk_tval packing. */
- value: (Duktape.info(true)[1] >= 0xfff0) ?
+ value: (Duktape.info(true).itag >= 0xfff0) ?
0xfff1 /* tag for packed duk_tval */ :
1 /* tag for unpacked duk_tval */,
writable: false,
@@ -27,8 +27,8 @@
if (typeof Duktape.isFastint === 'undefined') {
Object.defineProperty(Duktape, 'isFastint', {
value: function (v) {
- return Duktape.info(v)[0] === 4 && /* public type is DUK_TYPE_NUMBER */
- Duktape.info(v)[1] === Duktape.fastintTag; /* internal tag is fastint */
+ return Duktape.info(v).type === 4 && /* public type is DUK_TYPE_NUMBER */
+ Duktape.info(v).itag === Duktape.fastintTag; /* internal tag is fastint */
},
writable: false,
enumerable: false, |
96f1f5c0f0485f9e21ffd3de26e6e23937643de0 | app/routes/StoreRouter.js | app/routes/StoreRouter.js | import React from 'react';
import { ThemeProvider } from 'styled-components';
import { Switch, Route } from 'react-router-dom';
import defaultTheme from 'app/themes/store/default';
import HomeRoute from 'app/components/Store/Routes/HomeRoute';
export default () => (
<ThemeProvider theme={defaultTheme}>
<Switch>
{/* Home Route */}
<Route
exact
path='/'
component={HomeRoute}
/>
<Route
exact
path='/products'
component={() => <div>Products</div>}
/>
</Switch>
</ThemeProvider>
);
| import React from 'react';
import { ThemeProvider } from 'styled-components';
import { Switch, Route } from 'react-router-dom';
import defaultTheme from 'app/themes/store/default';
import BrandsRoute from 'app/components/Store/Routes/BrandsRoute';
import BrandRoute from 'app/components/Store/Routes/BrandRoute';
import CategoriesRoute from 'app/components/Store/Routes/CategoriesRoute';
import CategoryRoute from 'app/components/Store/Routes/CategoryRoute';
import ProductRoute from 'app/components/Store/Routes/ProductRoute';
import HomeRoute from 'app/components/Store/Routes/HomeRoute';
export default () => (
<ThemeProvider theme={defaultTheme}>
<Switch>
{/* Home Route */}
<Route
exact
path='/'
component={HomeRoute}
/>
{/* List brands Route */}
<Route
path='/brands'
component={BrandsRoute}
/>
{/* Show brand Route */}
<Route
exact
path='/brand/:brandId'
component={BrandRoute}
/>
{/* List categories Route */}
<Route
path='/categories'
component={CategoriesRoute}
/>
{/* Show category Route */}
<Route
exact
path='/category/:categoryId'
component={CategoryRoute}
/>
{/* Show product Route */}
<Route
exact
path='/product/:productId'
component={ProductRoute}
/>
<Route
exact
path='/products'
component={() => <div>Products</div>}
/>
</Switch>
</ThemeProvider>
);
| Add routes to store router | Add routes to store router
| JavaScript | mit | VineRelay/VineRelayStore,VineRelay/VineRelayStore | ---
+++
@@ -3,6 +3,11 @@
import { Switch, Route } from 'react-router-dom';
import defaultTheme from 'app/themes/store/default';
+import BrandsRoute from 'app/components/Store/Routes/BrandsRoute';
+import BrandRoute from 'app/components/Store/Routes/BrandRoute';
+import CategoriesRoute from 'app/components/Store/Routes/CategoriesRoute';
+import CategoryRoute from 'app/components/Store/Routes/CategoryRoute';
+import ProductRoute from 'app/components/Store/Routes/ProductRoute';
import HomeRoute from 'app/components/Store/Routes/HomeRoute';
export default () => (
@@ -14,6 +19,38 @@
path='/'
component={HomeRoute}
/>
+ {/* List brands Route */}
+ <Route
+ path='/brands'
+ component={BrandsRoute}
+ />
+ {/* Show brand Route */}
+ <Route
+ exact
+ path='/brand/:brandId'
+ component={BrandRoute}
+ />
+
+ {/* List categories Route */}
+ <Route
+ path='/categories'
+ component={CategoriesRoute}
+ />
+ {/* Show category Route */}
+ <Route
+ exact
+ path='/category/:categoryId'
+ component={CategoryRoute}
+ />
+
+ {/* Show product Route */}
+ <Route
+ exact
+ path='/product/:productId'
+ component={ProductRoute}
+ />
+
+
<Route
exact
path='/products' |
0ae469f1f501af8e2eaacef91973988594601dcf | src/containers/App/App.js | src/containers/App/App.js | import React from 'react';
import sharedStyles from 'components/shared/styles.scss';
export default ({ children }) => (
<div className={sharedStyles.fullSize}>
{ children }
</div>
);
| import React, { PropTypes } from 'react';
import sharedStyles from 'components/shared/styles.scss';
const App = ({ children }) => (
<div className={sharedStyles.fullSize}>
{ children }
</div>
);
App.propTypes = {
children: PropTypes.node,
};
export default App;
| Fix eslint error no proptypes for children | Fix eslint error no proptypes for children
| JavaScript | mit | inooid/react-redux-card-game,inooid/react-redux-card-game | ---
+++
@@ -1,8 +1,14 @@
-import React from 'react';
+import React, { PropTypes } from 'react';
import sharedStyles from 'components/shared/styles.scss';
-export default ({ children }) => (
+const App = ({ children }) => (
<div className={sharedStyles.fullSize}>
{ children }
</div>
);
+
+App.propTypes = {
+ children: PropTypes.node,
+};
+
+export default App; |
b5f81886a919cd45206295ecc81f7f231d6ca8aa | Home.js | Home.js | import React from 'react';
import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
import Login from './components/Login/Login.js';
// TODO Use prod server in prod mode
// const server = 'https://satoshi-api.herokuapp.com'
const server = 'http://localhost:8080'
export default class HomeScreen extends React.Component {
constructor(props) {
super(props);
this.state = { text: null };
}
onLogin = async (nickname) => {
const deviceId = 'TODO DeviceID'
console.log(`Login: (${nickname}, ${deviceId})`) // user credentials
let response = await fetch(`${server}/api/login`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
nickname: nickname,
deviceId: deviceId,
})
})
let json = await response.json();
switch (json.status) {
case 'STATUS_OK':
this.props.navigation.navigate('Profile', { nickname: nickname })
return;
}
console.log('Username does not exist');
// TODO Display Error
}
render() {
return (
<View>
<Text>Welcome to Satoshi</Text>
<Login onLogin={this.onLogin} />
</View>
);
}
} | import React from 'react';
import { StyleSheet, Text, View, TextInput, Button } from 'react-native';
import Login from './components/Login/Login.js';
// TODO Use prod server in prod mode
const server = 'https://satoshi-api.herokuapp.com'
// const server = 'http://localhost:8080'
export default class HomeScreen extends React.Component {
constructor(props) {
super(props);
this.state = { text: null };
}
onLogin = async (nickname) => {
const deviceId = 'TODO DeviceID'
console.log(`Login: (${nickname}, ${deviceId})`) // user credentials
let response = await fetch(`${server}/api/login`, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
nickname: nickname,
deviceId: deviceId,
})
})
let json = await response.json();
switch (json.status) {
case 'STATUS_OK':
this.props.navigation.navigate('Profile', { nickname: nickname })
return;
}
console.log('Username does not exist');
// TODO Display Error
}
render() {
return (
<View>
<Text>Welcome to Satoshi</Text>
<Login onLogin={this.onLogin} />
</View>
);
}
} | Use heroku api by default | Use heroku api by default
| JavaScript | mit | ripper234/satoshi | ---
+++
@@ -3,8 +3,8 @@
import Login from './components/Login/Login.js';
// TODO Use prod server in prod mode
-// const server = 'https://satoshi-api.herokuapp.com'
-const server = 'http://localhost:8080'
+const server = 'https://satoshi-api.herokuapp.com'
+// const server = 'http://localhost:8080'
export default class HomeScreen extends React.Component {
constructor(props) { |
01f8ab9dcc4cce24b401691a770ec42f973f5de2 | db/seedUtils.js | db/seedUtils.js | import uuid from 'uuid';
import flatten from 'ramda/src/flatten';
import times from 'ramda/src/times';
import createDBConnectionPool from '../server/db';
const db = createDBConnectionPool();
const generateValueBetween = (min, max) =>
// eslint-disable-next-line
Number((Math.random() * (max - min) + min).toFixed(2));
const generateViper = () => {
const nomisId = uuid().substring(0, 10);
const viperRating = generateValueBetween(0.01, 0.99);
return {
nomis_id: nomisId,
rating: viperRating,
};
};
const generateViperRows = (iterations, rows = []) => {
if (iterations === 0) return rows;
const viperData = generateViper();
const newRows = [...rows, viperData];
const iterationsLeft = iterations - 1;
return generateViperRows(iterationsLeft, newRows);
};
// Done to avoid call stack max size
const divideAndConquerGenerationOfViperRows = (iterations, chunkSize) => {
const quotient = Math.floor(iterations / chunkSize);
const reminder = iterations % chunkSize;
const quotientRows = times(() => generateViperRows(chunkSize), quotient);
const reminderRows = generateViperRows(reminder);
const rows = flatten(quotientRows.concat(reminderRows));
return rows;
};
const createViperData = (iterations) => {
const chunkSize = 1000;
const maxIteration = 5000;
const rows = iterations > maxIteration
? divideAndConquerGenerationOfViperRows(iterations, chunkSize)
: generateViperRows(iterations);
return db.batchInsert('viper', rows, chunkSize);
};
// eslint-disable-next-line
export const seedDbWithViperData = iterations => createViperData(iterations);
| import uuid from 'uuid';
import createDBConnectionPool from '../server/db';
const db = createDBConnectionPool();
const generateValueBetween = (min, max) =>
// eslint-disable-next-line
Number((Math.random() * (max - min) + min).toFixed(2));
const generateViper = () => {
const nomisId = uuid().substring(0, 10);
const viperRating = generateValueBetween(0.01, 0.99);
return {
nomis_id: nomisId,
rating: viperRating,
};
};
const generateViperRows = (iterations) => {
const viperRows = [];
// eslint-disable-next-line
for (let i = 0; i < iterations; i++) {
viperRows.push(generateViper());
}
return viperRows;
};
const createViperData = (iterations) => {
const chunkSize = 1000;
const rows = generateViperRows(iterations);
return db.batchInsert('viper', rows, chunkSize);
};
// eslint-disable-next-line
export const seedDbWithViperData = iterations => createViperData(iterations);
| Use a for loop instead of recursion | CSRA-496: Use a for loop instead of recursion
| JavaScript | mit | noms-digital-studio/csra-app,noms-digital-studio/csra-app,noms-digital-studio/csra-app | ---
+++
@@ -1,6 +1,4 @@
import uuid from 'uuid';
-import flatten from 'ramda/src/flatten';
-import times from 'ramda/src/times';
import createDBConnectionPool from '../server/db';
@@ -19,35 +17,20 @@
};
};
-const generateViperRows = (iterations, rows = []) => {
- if (iterations === 0) return rows;
+const generateViperRows = (iterations) => {
+ const viperRows = [];
- const viperData = generateViper();
- const newRows = [...rows, viperData];
- const iterationsLeft = iterations - 1;
+ // eslint-disable-next-line
+ for (let i = 0; i < iterations; i++) {
+ viperRows.push(generateViper());
+ }
- return generateViperRows(iterationsLeft, newRows);
-};
-
-// Done to avoid call stack max size
-const divideAndConquerGenerationOfViperRows = (iterations, chunkSize) => {
- const quotient = Math.floor(iterations / chunkSize);
- const reminder = iterations % chunkSize;
-
- const quotientRows = times(() => generateViperRows(chunkSize), quotient);
- const reminderRows = generateViperRows(reminder);
- const rows = flatten(quotientRows.concat(reminderRows));
-
- return rows;
+ return viperRows;
};
const createViperData = (iterations) => {
const chunkSize = 1000;
- const maxIteration = 5000;
-
- const rows = iterations > maxIteration
- ? divideAndConquerGenerationOfViperRows(iterations, chunkSize)
- : generateViperRows(iterations);
+ const rows = generateViperRows(iterations);
return db.batchInsert('viper', rows, chunkSize);
}; |
6b9efcf61bb32e89e6b5eddfda7aa410caa46254 | project/src/js/socket.js | project/src/js/socket.js | var StrongSocket = require('./StrongSocket');
var session = require('./session');
var i18n = require('./i18n');
var socketInstance;
function createGameSocket(url, version, receiveHandler) {
socketInstance = new StrongSocket(url, version, {
options: {
name: "game",
debug: true,
ignoreUnknownMessages: true,
onError: function() {
// probably opening a user game while logged out
if (!session.isConnected()) {
window.plugins.toast.show(i18n('unauthorizedError'), 'short', 'center');
m.route('/');
}
}
},
receive: receiveHandler
});
return socketInstance;
}
function createLobbySocket(lobbyVersion, onOpen, handlers) {
socketInstance = new StrongSocket(
'/lobby/socket/v1',
lobbyVersion, {
options: {
name: 'lobby',
pingDelay: 2000,
onOpen: onOpen
},
events: handlers
}
);
return socketInstance;
}
function onPause() {
if (socketInstance) socketInstance.destroy();
}
function onResume() {
if (socketInstance) socketInstance.connect();
}
document.addEventListener('pause', onPause, false);
document.addEventListener('resume', onResume, false);
module.exports = {
connectGame: createGameSocket,
connectLobby: createLobbySocket
};
| var StrongSocket = require('./StrongSocket');
var session = require('./session');
var i18n = require('./i18n');
var socketInstance;
function createGameSocket(url, version, receiveHandler) {
socketInstance = new StrongSocket(url, version, {
options: {
name: "game",
debug: true,
ignoreUnknownMessages: true,
onError: function() {
// TODO find a way to get the real error
// for now we assume it comes from opening a user game while logged out
if (!session.isConnected()) {
window.plugins.toast.show(i18n('unauthorizedError'), 'short', 'center');
m.route('/');
}
}
},
receive: receiveHandler
});
return socketInstance;
}
function createLobbySocket(lobbyVersion, onOpen, handlers) {
socketInstance = new StrongSocket(
'/lobby/socket/v1',
lobbyVersion, {
options: {
name: 'lobby',
pingDelay: 2000,
onOpen: onOpen
},
events: handlers
}
);
return socketInstance;
}
function onPause() {
if (socketInstance) socketInstance.destroy();
}
function onResume() {
if (socketInstance) socketInstance.connect();
}
document.addEventListener('pause', onPause, false);
document.addEventListener('resume', onResume, false);
module.exports = {
connectGame: createGameSocket,
connectLobby: createLobbySocket
};
| Add a todo comment in ws onerror | Add a todo comment in ws onerror
| JavaScript | mit | garawaa/lichobile,btrent/lichobile,garawaa/lichobile,garawaa/lichobile,btrent/lichobile,btrent/lichobile,btrent/lichobile | ---
+++
@@ -11,7 +11,8 @@
debug: true,
ignoreUnknownMessages: true,
onError: function() {
- // probably opening a user game while logged out
+ // TODO find a way to get the real error
+ // for now we assume it comes from opening a user game while logged out
if (!session.isConnected()) {
window.plugins.toast.show(i18n('unauthorizedError'), 'short', 'center');
m.route('/'); |
2f7dcc7770ceeffc419c0650bbb9ae1e9b88cf62 | client/index.js | client/index.js | module.exports = {
canvas: window.document.getElementById('gesso-target')
};
| function getCanvas() {
// TODO: Read the project settings use the right ID
var canvas = window.document.getElementById('gesso-target');
if (!canvas) {
var canvases = window.document.getElementsByTagName('canvas');
if (canvases.length === 1) {
canvas = canvases[0];
}
}
if (!canvas) {
throw new Error('Canvas not found.');
}
return canvas;
}
module.exports = {
getCanvas: getCanvas
};
| Switch to getCanvas to load canvases lazily. | Switch to getCanvas to load canvases lazily.
| JavaScript | mit | gessojs/gessojs,gessojs/gessojs | ---
+++
@@ -1,3 +1,22 @@
+function getCanvas() {
+ // TODO: Read the project settings use the right ID
+ var canvas = window.document.getElementById('gesso-target');
+
+ if (!canvas) {
+ var canvases = window.document.getElementsByTagName('canvas');
+ if (canvases.length === 1) {
+ canvas = canvases[0];
+ }
+ }
+
+ if (!canvas) {
+ throw new Error('Canvas not found.');
+ }
+
+ return canvas;
+}
+
+
module.exports = {
- canvas: window.document.getElementById('gesso-target')
+ getCanvas: getCanvas
}; |
4f6bc241aee80e1784c651c917964dadd1f853bf | server/bin/studio-bridge.js | server/bin/studio-bridge.js | #! /usr/bin/env node
const path = require('path');
const fs = require('fs');
const program = require('commander');
const pkg = require('../package.json');
const server = require('../lib/server.js');
function failWithHelp(msg) {
console.log(msg);
program.help();
process.exit(1);
}
program
.version(pkg.version)
.arguments('<dir>')
.option('-p, --port <port>', 'the port to run the server off of. defaults to 8080.', 8080)
.action(dir => {
const fullPath = path.resolve(dir);
if (fs.existsSync(fullPath)) {
server(fullPath, program.port);
} else {
failWithHelp(`Could not find a directory at ${fullPath}`)
}
});
program.parse(process.argv);
if (!program.args[0])
failWithHelp('The directory argument is required.');
| #! /usr/bin/env node
const path = require('path');
const fs = require('fs');
const program = require('commander');
const pkg = require('../package.json');
const server = require('../lib/server.js');
function failWithHelp(msg) {
console.log(msg);
program.help();
process.exit(1);
}
program
.version(pkg.version)
.arguments('<dir>')
.option('-p, --port <port>', 'the port to run the server off of. defaults ' +
'to 8080. you also need to change the port that the plugin uses.', 8080)
.action(dir => {
const fullPath = path.resolve(dir);
if (fs.existsSync(fullPath)) {
server(fullPath, program.port);
} else {
failWithHelp(`Could not find a directory at ${fullPath}`)
}
});
program.parse(process.argv);
if (!program.args[0])
failWithHelp('The directory argument is required.');
| Make note of the need to change the plugin's port when changing the server's | Make note of the need to change the plugin's port when changing the server's
| JavaScript | mit | vocksel/studio-bridge-cli | ---
+++
@@ -17,7 +17,8 @@
program
.version(pkg.version)
.arguments('<dir>')
- .option('-p, --port <port>', 'the port to run the server off of. defaults to 8080.', 8080)
+ .option('-p, --port <port>', 'the port to run the server off of. defaults ' +
+ 'to 8080. you also need to change the port that the plugin uses.', 8080)
.action(dir => {
const fullPath = path.resolve(dir);
|
7b87547701d24660b9d6c9895a10e17eaced5a62 | examples/add.js | examples/add.js | var solr = require('./../lib/solr');
var client = solr.createClient();
var callback = function(err,res){
if(err) console.log('Error:' + err);
if(res) console.log('res:' + res);
}
client.autoCommit = true;
client.updateEach = 4;
for(var i = 0; i <= 2 ; i++){
var doc = {
id : 82893 + i,
title : "Title "+ i,
description : "Text"+ i + "Alice"
}
client.add(doc,callback);
}
client.purgeAdd(callback);
| /**
* Load dependency
*/
var solr = require('./../lib/solr');
// Create a client
var client = solr.createClient();
// function executed when the Solr server responds
var callback = function(err,json){
if(err){
console.log(err);
}else{
console.log('JSON response:' + json);
}
}
// Auto commit document added.
client.autoCommit = true;
// Send a request every time there are 4 or more documents added with the function add()
client.updateEach = 4;
var docs = [];
for(var i = 0; i <= 10 ; i++){
var doc = {
id : 82893 + i,
title : "Title "+ i,
description : "Text"+ i + "Alice"
}
docs.push(doc);
}
// Add documents and flush added documents
client.add(docs,callback);
client.flushAdd(callback);
| Add comments to explain important LOC. | NEW: Add comments to explain important LOC.
| JavaScript | mit | kfitzgerald/solr-node-client,Bangsheng/solr-node-client,nicolasembleton/solr-node-client,chhams/solr-node-client,luketaverne/solr-node-client,godong9/solr-node-client,tpphu/solr-node-client,yanxi-com/solr-node-client,lbdremy/solr-node-client,lbdremy/solr-node-client,CondeNast/solr-node-client | ---
+++
@@ -1,21 +1,37 @@
- var solr = require('./../lib/solr');
+/**
+ * Load dependency
+ */
+var solr = require('./../lib/solr');
+// Create a client
var client = solr.createClient();
-var callback = function(err,res){
- if(err) console.log('Error:' + err);
- if(res) console.log('res:' + res);
+// function executed when the Solr server responds
+var callback = function(err,json){
+ if(err){
+ console.log(err);
+ }else{
+ console.log('JSON response:' + json);
+ }
}
+
+// Auto commit document added.
client.autoCommit = true;
+
+// Send a request every time there are 4 or more documents added with the function add()
client.updateEach = 4;
-for(var i = 0; i <= 2 ; i++){
+
+var docs = [];
+for(var i = 0; i <= 10 ; i++){
var doc = {
id : 82893 + i,
title : "Title "+ i,
description : "Text"+ i + "Alice"
}
- client.add(doc,callback);
+ docs.push(doc);
}
-client.purgeAdd(callback);
+// Add documents and flush added documents
+client.add(docs,callback);
+client.flushAdd(callback); |
8fdea24745ba5a9fa62fd955d15b2de837f8abf6 | client/lecturer/app/lecturer.factory.js | client/lecturer/app/lecturer.factory.js | (function() {
'use strict';
angular
.module('lecturer')
.factory('lecturerFactory', lecturerFactory);
/* @ngInject */
function lecturerFactory(lecturerService, $location) {
var username = '';
var observerCallbacks = [];
var Login = false;
var service = {
login: login,
checkUserToken: checkUserToken,
logout: logout,
registerObserverCallback: registerObserverCallback
};
return service;
function login(credentials) {
if (!Login) {
Login = lecturerService.login;
}
var SHA256 = new Hashes.SHA256();
SHA256.setUTF8(true);
// Prevent binding the hashed password into the input.
var form = {
email: credentials.email,
passsword: SHA256.hex(credentials.password)
};
Login.save(form, loginSuccess, logoutSuccess);
}
function checkUserToken(onError) {
if (!Login) {
Login = lectureService.login;
}
Login.get(loginSuccess, function() {
logoutSuccess();
onError();
});
}
function logout() {
lectureService.logout
.save(success);
function success() {
logoutSuccess();
$location.path('/');
}
}
function registerObserverCallback(callback) {
observerCallbacks.push(callback);
}
function loginSuccess(response) {
angular
.forEach(observerCallbacks, function(callback) {
callback(true, response.username);
});
}
function logoutSuccess() {
angular
.forEach(observerCallbacks, function(callback) {
callback(false);
});
}
}
})(); | (function() {
'use strict';
angular
.module('lecturer')
.factory('lecturerFactory', lecturerFactory);
/* @ngInject */
function lecturerFactory(lecturerService, $location) {
var username = '';
var observerCallbacks = [];
var Login = false;
var service = {
login: login,
checkUserToken: checkUserToken,
logout: logout,
registerObserverCallback: registerObserverCallback
};
return service;
function login(credentials) {
if (!Login) {
Login = lecturerService.login;
}
var SHA256 = new Hashes.SHA256();
SHA256.setUTF8(true);
// Prevent binding the hashed password into the input.
var form = {
email: credentials.email,
password: SHA256.hex(credentials.password)
};
Login.save(form, loginSuccess, logoutSuccess);
}
function checkUserToken(onError) {
if (!Login) {
Login = lectureService.login;
}
Login.get(loginSuccess, function() {
logoutSuccess();
onError();
});
}
function logout() {
lectureService.logout
.save(success);
function success() {
logoutSuccess();
$location.path('/');
}
}
function registerObserverCallback(callback) {
observerCallbacks.push(callback);
}
function loginSuccess(response) {
angular
.forEach(observerCallbacks, function(callback) {
callback(true, response.username);
});
}
function logoutSuccess() {
angular
.forEach(observerCallbacks, function(callback) {
callback(false);
});
}
}
})(); | Fix password being spelled wrong for the API call in lecturerFactory | Fix password being spelled wrong for the API call in lecturerFactory
| JavaScript | mit | MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS,MACSIFS/IFS | ---
+++
@@ -31,7 +31,7 @@
// Prevent binding the hashed password into the input.
var form = {
email: credentials.email,
- passsword: SHA256.hex(credentials.password)
+ password: SHA256.hex(credentials.password)
};
Login.save(form, loginSuccess, logoutSuccess); |
564216319c53b88f835c415ea81a744f0bab552a | test/spec/lateralus.component.js | test/spec/lateralus.component.js | /* global describe, it */
define([
'chai'
,'underscore'
,'backbone'
,'lateralus'
,'../utils'
], function (
chai
,_
,Backbone
,Lateralus
,utils
) {
'use strict';
var assert = chai.assert;
var getLateraralusApp = utils.getLateraralusApp;
return function () {
describe('Lateralus.Component', function () {
describe('Prototype', function () {
describe('dispose()', function () {
var App = getLateraralusApp();
var app = new App();
var component = app.addComponent(Lateralus.Component);
var beforeDisposeWasHeard = false;
component.on('beforeDispose', function () {
beforeDisposeWasHeard = true;
});
component.dispose();
it('Emitted beforeDispose event', function () {
assert.isTrue(beforeDisposeWasHeard);
});
});
});
});
};
});
| /* global describe, it */
define([
'chai'
,'underscore'
,'backbone'
,'lateralus'
,'../utils'
], function (
chai
,_
,Backbone
,Lateralus
,utils
) {
'use strict';
var assert = chai.assert;
var getLateraralusApp = utils.getLateraralusApp;
return function () {
describe('Lateralus.Component', function () {
describe('Prototype', function () {
describe('dispose()', function () {
var App = getLateraralusApp();
var app = new App();
var component = app.addComponent(Lateralus.Component);
var beforeDisposeWasHeard = false;
component.on('beforeDispose', function () {
beforeDisposeWasHeard = true;
});
component.dispose();
it('Emitted beforeDispose event', function () {
assert.isTrue(beforeDisposeWasHeard);
});
});
});
describe('mixins', function () {
describe('delegateLateralusEvents', function () {
describe('Inheritance', function () {
var App = getLateraralusApp();
var app = new App();
var testWasCalled = false;
var BaseComponent = Lateralus.Component.extend({
name: 'base'
,lateralusEvents: {
test: function () {
testWasCalled = true;
}
}
});
var ChildComponent = BaseComponent.extend({
name: 'child'
,lateralusEvents: {
foo: _.noop
}
});
app.addComponent(ChildComponent);
app.emit('test');
it('Inherited the parent component\'s lateralusEvents map',
function () {
assert.isTrue(testWasCalled);
});
});
});
});
});
};
});
| Add a breaking test for lateralusEvent map inheritance. | Add a breaking test for lateralusEvent map inheritance.
| JavaScript | mit | Jellyvision/lateralus,Jellyvision/lateralus | ---
+++
@@ -41,6 +41,40 @@
});
});
});
+
+ describe('mixins', function () {
+ describe('delegateLateralusEvents', function () {
+ describe('Inheritance', function () {
+ var App = getLateraralusApp();
+ var app = new App();
+ var testWasCalled = false;
+
+ var BaseComponent = Lateralus.Component.extend({
+ name: 'base'
+ ,lateralusEvents: {
+ test: function () {
+ testWasCalled = true;
+ }
+ }
+ });
+
+ var ChildComponent = BaseComponent.extend({
+ name: 'child'
+ ,lateralusEvents: {
+ foo: _.noop
+ }
+ });
+
+ app.addComponent(ChildComponent);
+ app.emit('test');
+
+ it('Inherited the parent component\'s lateralusEvents map',
+ function () {
+ assert.isTrue(testWasCalled);
+ });
+ });
+ });
+ });
});
};
}); |
52d1084cb1895326e072b5bc94a338488d57d795 | app/assets/javascripts/app/views/back_to_top_view.js | app/assets/javascripts/app/views/back_to_top_view.js | // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
app.views.BackToTop = Backbone.View.extend({
events: {
"click #back-to-top": "backToTop"
},
initialize: function() {
var throttledScroll = _.throttle(this.toggleVisibility, 250);
$(window).scroll(throttledScroll);
},
backToTop: function(evt) {
evt.preventDefault();
$("html, body").animate({scrollTop: 0});
},
toggleVisibility: function() {
if($("html, body").scrollTop() > 1000) {
$("#back-to-top").addClass("visible");
} else {
$("#back-to-top").removeClass("visible");
}
}
});
// @license-end
| // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
app.views.BackToTop = Backbone.View.extend({
events: {
"click #back-to-top": "backToTop"
},
initialize: function() {
var throttledScroll = _.throttle(this.toggleVisibility, 250);
$(window).scroll(throttledScroll);
},
backToTop: function(evt) {
evt.preventDefault();
$("html, body").animate({scrollTop: 0});
},
toggleVisibility: function() {
if($(document).scrollTop() > 1000) {
$("#back-to-top").addClass("visible");
} else {
$("#back-to-top").removeClass("visible");
}
}
});
// @license-end
| Fix back to top icon not appearing on webkit browsers | Fix back to top icon not appearing on webkit browsers
| JavaScript | agpl-3.0 | geraspora/diaspora,Muhannes/diaspora,Flaburgan/diaspora,Amadren/diaspora,spixi/diaspora,jhass/diaspora,despora/diaspora,jhass/diaspora,geraspora/diaspora,geraspora/diaspora,KentShikama/diaspora,spixi/diaspora,jhass/diaspora,Amadren/diaspora,diaspora/diaspora,KentShikama/diaspora,spixi/diaspora,diaspora/diaspora,SuperTux88/diaspora,jhass/diaspora,SuperTux88/diaspora,despora/diaspora,despora/diaspora,Flaburgan/diaspora,Muhannes/diaspora,Amadren/diaspora,Flaburgan/diaspora,SuperTux88/diaspora,Muhannes/diaspora,Flaburgan/diaspora,despora/diaspora,diaspora/diaspora,diaspora/diaspora,KentShikama/diaspora,Muhannes/diaspora,SuperTux88/diaspora,spixi/diaspora,KentShikama/diaspora,geraspora/diaspora,Amadren/diaspora | ---
+++
@@ -16,7 +16,7 @@
},
toggleVisibility: function() {
- if($("html, body").scrollTop() > 1000) {
+ if($(document).scrollTop() > 1000) {
$("#back-to-top").addClass("visible");
} else {
$("#back-to-top").removeClass("visible"); |
606afcb84b7c85f941d6b39c6a8cec96072e795f | lib/buster-util.js | lib/buster-util.js | if (typeof buster == "undefined") {
var buster = {};
}
buster.util = (function () {
var toString = Object.prototype.toString;
var div = typeof document != "undefined" && document.createElement("div");
return {
isNode: function (obj) {
if (!div) {
return false;
}
try {
div.appendChild(obj);
div.removeChild(obj);
} catch (e) {
return false;
}
return true;
},
isElement: function (obj) {
return obj && this.isNode(obj) && obj.nodeType === 1;
},
isArguments: function (obj) {
if (typeof obj != "object" || typeof obj.length != "number" ||
toString.call(obj) == "[object Array]") {
return false;
}
if (typeof obj.callee == "function") {
return true;
}
try {
obj[obj.length] = 6;
delete obj[obj.length];
} catch (e) {
return true;
}
return false;
}
};
}());
if (typeof module != "undefined") {
module.exports = buster.util;
}
| if (typeof buster == "undefined") {
var buster = {};
}
buster.util = (function () {
var toString = Object.prototype.toString;
var div = typeof document != "undefined" && document.createElement("div");
return {
isNode: function (obj) {
if (!div) {
return false;
}
try {
div.appendChild(obj);
div.removeChild(obj);
} catch (e) {
return false;
}
return true;
},
isElement: function (obj) {
return obj && this.isNode(obj) && obj.nodeType === 1;
},
isArguments: function (obj) {
if (typeof obj != "object" || typeof obj.length != "number" ||
toString.call(obj) == "[object Array]") {
return false;
}
if (typeof obj.callee == "function") {
return true;
}
try {
obj[obj.length] = 6;
delete obj[obj.length];
} catch (e) {
return true;
}
return false;
},
keys: Object.keys || function (object) {
var keys = [];
for (var prop in object) {
if (Object.prototype.hasOwnProperty.call(object, prop)) {
keys.push(prop);
}
}
return keys;
}
};
}());
if (typeof module != "undefined") {
module.exports = buster.util;
}
| Add util.keys as Object.keys shim | Add util.keys as Object.keys shim
| JavaScript | bsd-3-clause | busterjs/buster-core,busterjs/buster-core,geddski/buster-core | ---
+++
@@ -44,6 +44,18 @@
}
return false;
+ },
+
+ keys: Object.keys || function (object) {
+ var keys = [];
+
+ for (var prop in object) {
+ if (Object.prototype.hasOwnProperty.call(object, prop)) {
+ keys.push(prop);
+ }
+ }
+
+ return keys;
}
};
}()); |
704c3b1e773f3c807c45d1bbd234746f268b7ef0 | lib/ViewBase.js | lib/ViewBase.js | /*
* Base View. Defines the basic methods every view is expected to have so
* we can attach hooks to them.
*/
var hooks = require('hooks');
function ViewBase() {
this.data = function() {};
this.mode = function() {};
this.render = function() {};
for (var k in hooks) {
this[k] = hooks[k];
}
}
module.exports = ViewBase;
| /*
* Base View. Defines the basic methods every view is expected to have so
* we can attach hooks to them.
*/
var hooks = require('hooks');
function ViewBase() {
this.data = this.data || function() { return this; };
this.mode = this.mode || function() { return this; };
this.render = this.render || function(cb) {process.nextTick(function(){cb('');return this;})};
for (var k in hooks) {
this[k] = hooks[k];
}
}
module.exports = ViewBase;
| Stop clobbering view methods when they call the base constructor | Stop clobbering view methods when they call the base constructor
| JavaScript | mit | jay-depot/turnpike,jay-depot/turnpike | ---
+++
@@ -6,9 +6,9 @@
var hooks = require('hooks');
function ViewBase() {
- this.data = function() {};
- this.mode = function() {};
- this.render = function() {};
+ this.data = this.data || function() { return this; };
+ this.mode = this.mode || function() { return this; };
+ this.render = this.render || function(cb) {process.nextTick(function(){cb('');return this;})};
for (var k in hooks) {
this[k] = hooks[k]; |
a881668b389ab2ef8c830f3ef6200270004b96d4 | src/main/windows/about.js | src/main/windows/about.js | const about = module.exports = {
init,
win: null
}
const config = require('../../config')
const electron = require('electron')
function init () {
if (about.win) {
return about.win.show()
}
const win = about.win = new electron.BrowserWindow({
backgroundColor: '#ECECEC',
center: true,
fullscreen: false,
height: 170,
icon: getIconPath(),
maximizable: false,
minimizable: false,
resizable: false,
show: false,
skipTaskbar: true,
title: 'About ' + config.APP_WINDOW_TITLE,
useContentSize: true,
webPreferences: {
nodeIntegration: true,
enableBlinkFeatures: 'AudioVideoTracks'
},
width: 300
})
win.loadURL(config.WINDOW_ABOUT)
// No menu on the About window
win.setMenu(null)
win.once('ready-to-show', function () {
win.show()
})
win.once('closed', function () {
about.win = null
})
}
function getIconPath () {
return process.platform === 'win32'
? config.APP_ICON + '.ico'
: config.APP_ICON + '.png'
}
| const about = module.exports = {
init,
win: null
}
const config = require('../../config')
const electron = require('electron')
function init () {
if (about.win) {
return about.win.show()
}
const win = about.win = new electron.BrowserWindow({
backgroundColor: '#ECECEC',
center: true,
fullscreen: false,
height: 220,
icon: getIconPath(),
maximizable: false,
minimizable: false,
resizable: false,
show: false,
skipTaskbar: true,
title: 'About ' + config.APP_WINDOW_TITLE,
useContentSize: true,
webPreferences: {
nodeIntegration: true,
enableBlinkFeatures: 'AudioVideoTracks'
},
width: 300
})
win.loadURL(config.WINDOW_ABOUT)
// No menu on the About window
win.setMenu(null)
win.once('ready-to-show', function () {
win.show()
})
win.once('closed', function () {
about.win = null
})
}
function getIconPath () {
return process.platform === 'win32'
? config.APP_ICON + '.ico'
: config.APP_ICON + '.png'
}
| Increase height of 'About' window | Fix: Increase height of 'About' window
| JavaScript | mit | feross/webtorrent-app,webtorrent/webtorrent-desktop,feross/webtorrent-app,webtorrent/webtorrent-desktop,feross/webtorrent-app,webtorrent/webtorrent-desktop | ---
+++
@@ -15,7 +15,7 @@
backgroundColor: '#ECECEC',
center: true,
fullscreen: false,
- height: 170,
+ height: 220,
icon: getIconPath(),
maximizable: false,
minimizable: false, |
479fea5b3c0d971e2eebac0857f361264139f37a | lib/get-by-time.js | lib/get-by-time.js | 'use strict';
// To make id smaller we get microgseconds count from more recent date
var start = Date.UTC(2011, 8, 21) * 1000
// Prefix with number, it reduces chances of collision with variable names
// (helpful if used as property names on objects)
, prefix = String(Math.floor(Math.random() * 10))
// Make it more unique
, postfix = Math.floor(Math.random() * 36).toString(36);
module.exports = function (time) {
return prefix + (time - start).toString(36) + postfix;
};
| 'use strict';
// To make id smaller we get microseconds count from more recent date
var start = Date.UTC(2012, 12, 21, 12, 0, 0, 0) * 1000
// Prefix with number, it reduces chances of collision with variable names
// (helpful if used as property names on objects)
, prefix = String(Math.floor(Math.random() * 10))
// Make it more unique
, postfix = Math.floor(Math.random() * 36).toString(36);
module.exports = function (time) {
return prefix + (time - start).toString(36) + postfix;
};
| Make recent date even more recent | Make recent date even more recent
| JavaScript | mit | medikoo/time-uuid | ---
+++
@@ -1,7 +1,7 @@
'use strict';
-// To make id smaller we get microgseconds count from more recent date
-var start = Date.UTC(2011, 8, 21) * 1000
+// To make id smaller we get microseconds count from more recent date
+var start = Date.UTC(2012, 12, 21, 12, 0, 0, 0) * 1000
// Prefix with number, it reduces chances of collision with variable names
// (helpful if used as property names on objects) |
c1a80c6b9dab389a88f06bd99c58762e0bc3d92c | lib/mongoose.js | lib/mongoose.js | var mongoose = require('mongoose');
var log = require('lib/logger')(module);
var config = require('../config');
// Установим соединение с базой
log.info('Connecting to MongoDB uri: ' + config.get('mongoose:uri'));
mongoose.connect(config.get('mongoose:uri'), config.get('mongoose:options'));
mongoose.connection.on('connected', function() {
log.info('connected');
});
// TODO: die on error
mongoose.connection.on('error', function(err) {
console.error("Mongoose error", err);
});
log.info("DB initialized");
module.exports = mongoose;
| var mongoose = require('mongoose');
var log = require('lib/logger')(module);
var config = require('../config');
log.info('Connecting to MongoDB uri: ' + config.get('mongoose:uri'));
mongoose.connect(config.get('mongoose:uri'), config.get('mongoose:options'));
mongoose.connection.on('connected', function() {
log.info('Mongoose connected');
});
mongoose.connection.on('disconnected', function() {
log.info('Mongoose disconnected');
});
// TODO: die on error
mongoose.connection.on('error', function(err) {
console.error("Mongoose error", err);
});
module.exports = mongoose;
| Add logging on Mongoose 'disconnected' event | Add logging on Mongoose 'disconnected' event | JavaScript | apache-2.0 | koof90/srengine,ostinru/srengine,koof90/srengine,ostinru/srengine | ---
+++
@@ -2,13 +2,16 @@
var log = require('lib/logger')(module);
var config = require('../config');
-// Установим соединение с базой
log.info('Connecting to MongoDB uri: ' + config.get('mongoose:uri'));
mongoose.connect(config.get('mongoose:uri'), config.get('mongoose:options'));
mongoose.connection.on('connected', function() {
- log.info('connected');
+ log.info('Mongoose connected');
+});
+
+mongoose.connection.on('disconnected', function() {
+ log.info('Mongoose disconnected');
});
// TODO: die on error
@@ -16,6 +19,4 @@
console.error("Mongoose error", err);
});
-log.info("DB initialized");
-
module.exports = mongoose; |
411bd57a7b1f0f82cf17f18b214d003601676359 | src/foam/foamlink/FoamlinkNodeModelFileFetcher.js | src/foam/foamlink/FoamlinkNodeModelFileFetcher.js | /**
* @license
* Copyright 2019 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.foamlink',
name: 'FoamlinkNodeModelFileFetcher',
properties: [
'root',
'foamlinkData_'
],
methods: [
function init() {
// TODO: error handling in this method
var dataFile = foam.foamlink.dataFile;
var dataText = require('fs').readFileSync(dataFile, 'utf8');
this.foamlinkData_ = JSON.parse(dataText);
},
function getFile(id) {
var self = this;
return new Promise(function(ret, err) {
var path = self.foamlinkData_.classesToFiles[id];
if ( path === undefined ) {
ret(null);
return;
}
try {
var js = require('fs').readFileSync(path, 'utf8');
// TODO: anything but this terrible array thing
ret(['withsource', {
text: js,
source: path
}]);
} catch(e) {
console.error(e);
ret(null);
}
});
}
]
});
| /**
* @license
* Copyright 2019 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.foamlink',
name: 'FoamlinkNodeModelFileFetcher',
properties: [
'root',
'foamlinkData_'
],
methods: [
function init() {
// TODO: error handling in this method
var dataFile = foam.foamlink.dataFile;
var dataText = require('fs').readFileSync(dataFile, 'utf8');
this.foamlinkData_ = JSON.parse(dataText);
},
function getFile(id) {
var self = this;
return new Promise(function(ret, err) {
var path = self.foamlinkData_.classesToFiles[id];
if ( path === undefined ) {
ret(null);
return;
}
try {
var js = require('fs').readFileSync(path, 'utf8');
// TODO: anything but this terrible array thing
ret(['withsource', {
text: js,
source: require('path').relative(process.cwd(), path)
}]);
} catch(e) {
console.error(e);
ret(null);
}
});
}
]
});
| Fix foamlink ModelFileFetcher path resolution | Fix foamlink ModelFileFetcher path resolution
| JavaScript | apache-2.0 | jacksonic/vjlofvhjfgm,foam-framework/foam2,jacksonic/vjlofvhjfgm,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,jacksonic/vjlofvhjfgm | ---
+++
@@ -31,7 +31,7 @@
// TODO: anything but this terrible array thing
ret(['withsource', {
text: js,
- source: path
+ source: require('path').relative(process.cwd(), path)
}]);
} catch(e) {
console.error(e); |
9318dc748e011c3ff07a8f2e6d23e9f797484e9f | blueprints/model/files/__root__/__path__/__name__.js | blueprints/model/files/__root__/__path__/__name__.js | import DS from 'ember-data';
const { <%= importedModules %> } = DS;
export default Model.extend({
<%= attrs.length ? ' ' + attrs : '' %>
});
| import DS from 'ember-data';
const { <%= importedModules %> } = DS;
export default Model.extend({
<%= attrs.length ? attrs : '' %>
});
| Fix wrong indentation on Model Blueprint for Classic apps | Fix wrong indentation on Model Blueprint for Classic apps
| JavaScript | mit | HeroicEric/data,arenoir/data,HeroicEric/data,HeroicEric/data,arenoir/data,HeroicEric/data,arenoir/data,arenoir/data | ---
+++
@@ -2,5 +2,5 @@
const { <%= importedModules %> } = DS;
export default Model.extend({
-<%= attrs.length ? ' ' + attrs : '' %>
+<%= attrs.length ? attrs : '' %>
}); |
ae55f65c2d2822ad9f77e47fcbd2becd98dfbeda | server/main.js | server/main.js | import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
// Creating comment schema
CommentSchema = new SimpleSchema({
email: {
type: String,
unique: true
},
text: {
type: String
}
});
// Creating comments collection
Comments = new Mongo.Collection('Comments');
// Attaching CommentSchema to Comments collection
Comments.attachSchema(CommentSchema);
var obj = {
"email": "a@a.com",
"text": "test"
}
// Validating sample object
var isValid = Comments.simpleSchema().namedContext().validate(obj, { modifier: false });
console.log(isValid);
});
| import { Meteor } from 'meteor/meteor';
Meteor.startup(() => {
// code to run on server at startup
// Creating comment schema
CommentSchema = new SimpleSchema({
email: {
type: String,
unique: true
},
text: {
type: String
}
});
// Creating comments collection
Comments = new Mongo.Collection('Comments');
// Attaching CommentSchema to Comments collection
Comments.attachSchema(CommentSchema);
var commentObj = {
"email": "a@a.com",
"text": "test"
}
// Validating sample object
var isValid = Comments.simpleSchema().namedContext().validate(commentObj, { modifier: false });
console.log(isValid);
if(isValid) {
Comments.insert(commentObj);
}
console.log(Comments.find().fetch());
});
| Insert to collection - sample comment object | Insert to collection - sample comment object
| JavaScript | mit | ArunMichaelDsouza/meteor-discussion-board,ArunMichaelDsouza/meteor-discussion-board | ---
+++
@@ -20,13 +20,19 @@
// Attaching CommentSchema to Comments collection
Comments.attachSchema(CommentSchema);
- var obj = {
+ var commentObj = {
"email": "a@a.com",
"text": "test"
}
// Validating sample object
- var isValid = Comments.simpleSchema().namedContext().validate(obj, { modifier: false });
+ var isValid = Comments.simpleSchema().namedContext().validate(commentObj, { modifier: false });
console.log(isValid);
+ if(isValid) {
+ Comments.insert(commentObj);
+ }
+
+ console.log(Comments.find().fetch());
+
}); |
e758f14827b54a9ea7cf17190eca35b64c498170 | webapp/templates/thing.js | webapp/templates/thing.js | $(document).ready(function() {
%('#led_on').click(function() {
console.log('LED on!');
});
%('#led_off').click(function() {
console.log('LED off!');
});
});
| $(document).ready(function() {
$('#led_on').click(function() {
console.log('LED on!');
});
$('#led_off').click(function() {
console.log('LED off!');
});
});
| Fix syntax error change % to $ | Fix syntax error change % to $
| JavaScript | mit | beepscore/pi_thing,beepscore/pi_thing,beepscore/pi_thing | ---
+++
@@ -1,8 +1,8 @@
$(document).ready(function() {
- %('#led_on').click(function() {
+ $('#led_on').click(function() {
console.log('LED on!');
});
- %('#led_off').click(function() {
+ $('#led_off').click(function() {
console.log('LED off!');
});
}); |
ac1ce2e19868df6c0d96a626aeee83b70bf503dd | backend/server/resources/projects-routes.js | backend/server/resources/projects-routes.js | module.exports = function(model) {
'use strict';
let validateProjectAccess = require('./project-access')(model.access);
let schema = require('.././schema')(model);
let router = require('koa-router')();
let projects = require('./projects')(model.projects);
let samples = require('./samples')(model.samples, schema);
let processes = require('./processes')(model.processes, schema);
router.get('/projects2', projects.all);
router.post('/projects2/:project_id/processes', validateProjectAccess, processes.create);
router.post('/projects2/:project_id/samples', validateProjectAccess, samples.create);
router.put('/projects2/:project_id/samples/:sample_id', validateProjectAccess, samples.update);
router.get('/projects2/:project_id/dir/:directory_id', validateProjectAccess, projects.dirTree);
return router;
};
| module.exports = function(model) {
'use strict';
let validateProjectAccess = require('./project-access')(model.access);
let schema = require('.././schema')(model);
let router = require('koa-router')();
let projects = require('./projects')(model.projects);
let samples = require('./samples')(model.samples, schema);
let files = require('./files')(model.files);
let processes = require('./processes')(model.processes, schema);
router.get('/projects2', projects.all);
router.get('/projects2/:project_id/dir/:directory_id', validateProjectAccess, projects.dirTree);
router.post('/projects2/:project_id/processes', validateProjectAccess, processes.create);
router.post('/projects2/:project_id/samples', validateProjectAccess, samples.create);
router.put('/projects2/:project_id/samples/:sample_id', validateProjectAccess, samples.update);
router.get('/projects2/:project_id/files/:file_id', validateProjectAccess, files.get);
return router;
};
| Add REST call for files. | Add REST call for files.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -6,13 +6,18 @@
let router = require('koa-router')();
let projects = require('./projects')(model.projects);
let samples = require('./samples')(model.samples, schema);
+ let files = require('./files')(model.files);
let processes = require('./processes')(model.processes, schema);
router.get('/projects2', projects.all);
+ router.get('/projects2/:project_id/dir/:directory_id', validateProjectAccess, projects.dirTree);
+
router.post('/projects2/:project_id/processes', validateProjectAccess, processes.create);
+
router.post('/projects2/:project_id/samples', validateProjectAccess, samples.create);
router.put('/projects2/:project_id/samples/:sample_id', validateProjectAccess, samples.update);
- router.get('/projects2/:project_id/dir/:directory_id', validateProjectAccess, projects.dirTree);
+
+ router.get('/projects2/:project_id/files/:file_id', validateProjectAccess, files.get);
return router;
}; |
f019469201eebdbb85880f871101da65599557e0 | assets/js/jquery.ghostHunter-init.js | assets/js/jquery.ghostHunter-init.js | $("#search-field").ghostHunter({
results : "#search-results",
onKeyUp : true,
info_template : "<p>Found {{amount}} posts</p>",
result_template : "<a href='{{link}}'><p><h2>{{title}}</h2><h4>{{pubDate}}</h4>{{description}}</p></a>"
}); | $("#search-field").ghostHunter({
results : "#search-results",
onKeyUp : true,
info_template : "<p>Results: {{amount}}</p>",
result_template : "<a href='{{link}}'><p><h2>{{title}}</h2><h4>{{pubDate}}</h4>{{description}}</p></a>"
}); | Change search result count text | Change search result count text
| JavaScript | mit | dlecina/StayPuft,dlecina/StayPuft | ---
+++
@@ -1,6 +1,6 @@
$("#search-field").ghostHunter({
results : "#search-results",
onKeyUp : true,
- info_template : "<p>Found {{amount}} posts</p>",
+ info_template : "<p>Results: {{amount}}</p>",
result_template : "<a href='{{link}}'><p><h2>{{title}}</h2><h4>{{pubDate}}</h4>{{description}}</p></a>"
}); |
b670c79377c6a4dc7cbfbf0a73418992f2bf09a7 | src/ggrc/assets/javascripts/components/lazy_open_close.js | src/ggrc/assets/javascripts/components/lazy_open_close.js | /*!
Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
Created By: ivan@reciprocitylabs.com
Maintained By: ivan@reciprocitylabs.com
*/
(function (can, $) {
'use strict';
can.Component.extend({
tag: 'lazy-openclose',
scope: {
show: false
},
content: '<content/>',
init: function () {
this._control.element.closest('.tree-item').find('.openclose')
.bind('click', function () {
this.scope.attr('show', true);
}.bind(this));
}
});
})(window.can, window.can.$);
| /*!
Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
Created By: ivan@reciprocitylabs.com
Maintained By: ivan@reciprocitylabs.com
*/
(function (can, $) {
'use strict';
GGRC.Components('lazyOpenClose', {
tag: 'lazy-openclose',
scope: {
show: false
},
content: '<content/>',
init: function () {
this._control.element.closest('.tree-item').find('.openclose')
.bind('click', function () {
this.scope.attr('show', true);
}.bind(this));
}
});
})(window.can, window.can.$);
| Move lazy-openclose component to GGRC.Component | Move lazy-openclose component to GGRC.Component
| JavaScript | apache-2.0 | prasannav7/ggrc-core,josthkko/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,andrei-karalionak/ggrc-core,andrei-karalionak/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,VinnieJohns/ggrc-core,kr41/ggrc-core,plamut/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,prasannav7/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,edofic/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,NejcZupec/ggrc-core,VinnieJohns/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core | ---
+++
@@ -8,7 +8,7 @@
(function (can, $) {
'use strict';
- can.Component.extend({
+ GGRC.Components('lazyOpenClose', {
tag: 'lazy-openclose',
scope: {
show: false |
4fbd03a93149df18f10610214926284a39447d22 | services.js | services.js | function confirmReboot () {
if (confirm('Are you sure you want to reboot the system?')) {
window.location.href = 'shellscripts/reboot.php?system=y';
}
else {
// Do nothing
}
}
function checkUpdate () {
document.getElementById('update_display').style.display = "block";
document.getElementById('check_update_button').onclick = hideUpdate;
document.getElementById('check_update_button').innerHTML = "Hide Updates";
}
function hideUpdate () {
document.getElementById('update_display').src = "";
document.getElementById('update_display').style.display = "none";
} | function confirmReboot () {
if (confirm('Are you sure you want to reboot the system?')) {
window.location.href = 'shellscripts/reboot.php?system=y';
}
else {
// Do nothing
}
}
function checkUpdate () {
document.getElementById('update_display').style.display = "block";
document.getElementById('check_update_button').onclick = hideUpdate;
document.getElementById('check_update_button').innerHTML = "Hide Updates";
}
function hideUpdate () {
document.getElementById('update_display').src = "";
document.getElementById('update_display').style.display = "none";
document.getElementById('check_update_button').onclick = checkUpdate;
document.getElementById('check_update_button').innerHTML = "Check for updates";
} | Check updates button trial II | Check updates button trial II
| JavaScript | mit | virajchitnis/linux-webui,virajchitnis/linux-webui,virajchitnis/linux-webui | ---
+++
@@ -16,4 +16,6 @@
function hideUpdate () {
document.getElementById('update_display').src = "";
document.getElementById('update_display').style.display = "none";
+ document.getElementById('check_update_button').onclick = checkUpdate;
+ document.getElementById('check_update_button').innerHTML = "Check for updates";
} |
9a2cc7d6763f822cc86deae5a28395e9e9b35546 | settings.js | settings.js | module.exports = {
HOST: process.env.HOST || null,
PORT: process.env.PORT || 5000,
DEFAULT_SHOT_WIDTH: process.env.DEFAULT_SHOT_WIDTH || 768,
DEFAULT_SHOT_MIN_HEIGHT: process.env.DEFAULT_SHOT_MIN_HEIGHT || 700,
WEBSHOTS_QUALITY: process.env.WEBSHOTS_QUALITY || 75,
};
| module.exports = {
HOST: process.env.HOST || null,
PORT: process.env.PORT || 5000,
DEFAULT_SHOT_WIDTH: process.env.DEFAULT_SHOT_WIDTH || 768,
DEFAULT_SHOT_MIN_HEIGHT: process.env.DEFAULT_SHOT_MIN_HEIGHT || 1,
WEBSHOTS_QUALITY: process.env.WEBSHOTS_QUALITY || 75,
};
| Use min height of 1px. | Use min height of 1px.
| JavaScript | mit | joeyespo/iwidgets.aggrenda.com | ---
+++
@@ -2,6 +2,6 @@
HOST: process.env.HOST || null,
PORT: process.env.PORT || 5000,
DEFAULT_SHOT_WIDTH: process.env.DEFAULT_SHOT_WIDTH || 768,
- DEFAULT_SHOT_MIN_HEIGHT: process.env.DEFAULT_SHOT_MIN_HEIGHT || 700,
+ DEFAULT_SHOT_MIN_HEIGHT: process.env.DEFAULT_SHOT_MIN_HEIGHT || 1,
WEBSHOTS_QUALITY: process.env.WEBSHOTS_QUALITY || 75,
}; |
ff5365a0f50527aa6e73b3c0874977d677b5a0eb | pulsar.js | pulsar.js | var p5 = require('p5');
var sketch = function (p) {
var Receiver = require('./Receiver.js');
var receiver = new Receiver();
var Processor = require('./Processor.js');
var processor = new Processor();
var DrawingManager = require('./DrawingManager.js');
var dM = new DrawingManager(p);
p.setup = function() {
receiver.connect();
receiver.on('received', function(data) {
console.log("Pulsar: received: " + data);
var drawing = processor.createDrawing(data);
dM.add(drawing);
// give to drawing manager
})
p.createCanvas(p.windowWidth, p.windowHeight);
}
p.draw = function() {
dM.drawAll();
p.background(0);
p.textSize(15);
p.fill(150);
p.textStyle(p.BOLD);
var verWidth = p.textWidth("PULSAR - v0.0.1");
p.text("PULSAR - v0.0.1", p.windowWidth - verWidth - 10, p.windowHeight - 10);
}
p.windowResized = function() {
p.resizeCanvas(p.windowWidth, p.windowHeight);
}
}
var myp5 = new p5(sketch); | var p5 = require('p5');
var sketch = function (p) {
var Receiver = require('./Receiver.js');
var receiver = new Receiver();
var Processor = require('./Processor.js');
var processor = new Processor();
var DrawingManager = require('./DrawingManager.js');
var dM = new DrawingManager(p);
p.setup = function() {
receiver.connect();
receiver.on('received', function(data) {
console.log("Pulsar: received: " + data);
var drawing = processor.createDrawing(data);
dM.add(drawing);
// give to drawing manager
})
p.createCanvas(p.windowWidth, p.windowHeight);
}
p.draw = function() {
p.background(0);
p.textSize(15);
p.fill(175);
p.textStyle(p.BOLD);
var verWidth = p.textWidth("PULSAR - v0.0.1");
p.text("PULSAR - v0.0.1", p.windowWidth - verWidth - 10, p.windowHeight - 10);
dM.drawAll();
}
p.windowResized = function() {
p.resizeCanvas(p.windowWidth, p.windowHeight);
}
}
var myp5 = new p5(sketch); | Move drawing manager call to be in front of the background | Move drawing manager call to be in front of the background
| JavaScript | mit | Dermah/pulsar,Dermah/pulsar | ---
+++
@@ -27,15 +27,16 @@
}
p.draw = function() {
- dM.drawAll();
p.background(0);
p.textSize(15);
- p.fill(150);
+ p.fill(175);
p.textStyle(p.BOLD);
var verWidth = p.textWidth("PULSAR - v0.0.1");
p.text("PULSAR - v0.0.1", p.windowWidth - verWidth - 10, p.windowHeight - 10);
+
+ dM.drawAll();
}
p.windowResized = function() { |
3d9ef5c648f8ee9d10ea2221d4b86101264cac50 | lib/websocket-wrapper.js | lib/websocket-wrapper.js | const EventEmitter = require('events');
// wrapper around the Node.js ws module
// for use in browsers
class WebSocketWrapper extends EventEmitter {
constructor(url) {
super();
this._ws = new WebSocket(url);
this._ws.onopen = () => {
this.emit('open');
};
this._ws.onclose = () => {
this.emit('close');
};
this._ws.onmessage = (event) => {
this.emit('message', event.data);
};
this._ws.onerror = () => {
this.emit('error', new Error('WebSocket error'));
};
}
close() {
this._ws.close();
}
send(data) {
this._ws.send(data);
}
}
module.exports = WebSocketWrapper;
| const EventEmitter = require('events');
// wrapper around the Node.js ws module
// for use in browsers
class WebSocketWrapper extends EventEmitter {
constructor(url) {
super();
this._ws = new WebSocket(url);
this._ws.onopen = () => {
this.emit('open');
};
this._ws.onclose = () => {
this.emit('close');
};
this._ws.onmessage = (event) => {
this.emit('message', event.data);
};
this._ws.onerror = () => {
this.emit('error', new Error('WebSocket error'));
};
}
close() {
this._ws.close();
}
send(data, callback) {
try {
this._ws.send(data);
callback();
} catch (err) {
callback(err);
}
}
}
module.exports = WebSocketWrapper;
| Add missing callback to WebSocket 'send' wrapper | Add missing callback to WebSocket 'send' wrapper
Fix #301.
| JavaScript | mit | cyrus-and/chrome-remote-interface,cyrus-and/chrome-remote-interface | ---
+++
@@ -24,8 +24,13 @@
this._ws.close();
}
- send(data) {
- this._ws.send(data);
+ send(data, callback) {
+ try {
+ this._ws.send(data);
+ callback();
+ } catch (err) {
+ callback(err);
+ }
}
}
|
d810081c17d8eb3adcfce7621a014d7aed51a9af | site.js | site.js | L.Control.Attribution.prototype.options.prefix = '';
var map = L.map('map', {minZoom: 14}).setView([38.9, -76.99], 13);
var attr = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors (this is <a href="http://github.com/tmcw/gpstile/">gpstile, and it is open source</a>)';
map.addHash();
(new mapbox.geocoderControl('tmcw.map-nlcg49tr')).addTo(map);
if (L.Browser.retina) {
L.tileLayer('http://a.tiles.mapbox.com/v3/tmcw.map-8py9u67o/{z}/{x}/{y}.png', {
attribution: attr
}).addTo(map);
} else {
L.tileLayer('http://a.tiles.mapbox.com/v3/tmcw.map-nlcg49tr/{z}/{x}/{y}.png', {
attribution: attr
}).addTo(map);
}
LgpsTile.addTo(map);
| L.Control.Attribution.prototype.options.prefix = '';
var map = L.map('map', {minZoom: 14}).setView([38.9, -76.99], 13);
var attr = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors (this is <a href="https://github.com/osmlab/osm-gpx-tile/">gpstile, and it is open source</a>)';
map.addHash();
(new mapbox.geocoderControl('tmcw.map-nlcg49tr')).addTo(map);
if (L.Browser.retina) {
L.tileLayer('http://a.tiles.mapbox.com/v3/tmcw.map-8py9u67o/{z}/{x}/{y}.png', {
attribution: attr
}).addTo(map);
} else {
L.tileLayer('http://a.tiles.mapbox.com/v3/tmcw.map-nlcg49tr/{z}/{x}/{y}.png', {
attribution: attr
}).addTo(map);
}
LgpsTile.addTo(map);
| Change github like to point to osmlab org | Change github like to point to osmlab org | JavaScript | bsd-3-clause | osmlab/osm-gpx-tile,osmlab/osm-gpx-tile | ---
+++
@@ -1,6 +1,6 @@
L.Control.Attribution.prototype.options.prefix = '';
var map = L.map('map', {minZoom: 14}).setView([38.9, -76.99], 13);
-var attr = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors (this is <a href="http://github.com/tmcw/gpstile/">gpstile, and it is open source</a>)';
+var attr = '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors (this is <a href="https://github.com/osmlab/osm-gpx-tile/">gpstile, and it is open source</a>)';
map.addHash();
(new mapbox.geocoderControl('tmcw.map-nlcg49tr')).addTo(map);
|
54f5f70204b4dd26613f8f9a36757d5c3dc38474 | lib/models/PayInPaymentDetailsCard.js | lib/models/PayInPaymentDetailsCard.js | var _ = require('underscore');
var PayInPaymentDetails = require('./PayInPaymentDetails');
var PayInPaymentDetailsCard = PayInPaymentDetails.extend({
defaults: {
/**
* CardType { CB_VISA_MASTERCARD, AMEX }
*/
CardType: null,
CardId: null
}
});
module.exports = PayInPaymentDetailsCard; | var _ = require('underscore');
var PayInPaymentDetails = require('./PayInPaymentDetails');
var PayInPaymentDetailsCard = PayInPaymentDetails.extend({
defaults: {
/**
* CardType { CB_VISA_MASTERCARD, AMEX }
*/
CardType: null,
CardId: null,
StatementDescriptor: null
}
});
module.exports = PayInPaymentDetailsCard;
| Add StatementDescriptor for card payins | Add StatementDescriptor for card payins | JavaScript | mit | Mangopay/mangopay2-nodejs-sdk,Mangopay/mangopay2-nodejs-sdk | ---
+++
@@ -7,7 +7,8 @@
* CardType { CB_VISA_MASTERCARD, AMEX }
*/
CardType: null,
- CardId: null
+ CardId: null,
+ StatementDescriptor: null
}
});
|
7e1b3afc32af4e72fa2c6feb043d36f395cfa5c4 | apps/store/themes/store/js/asset.js | apps/store/themes/store/js/asset.js | $(function () {
$('#btn-add-gadget').click(function () {
var elem = $(this);
asset.process(elem.data('type'), elem.data('aid'), location.href, elem);
});
$('#btn-remove-subscribe').click(function () {
var elem = $(this);
asset.unsubscribeBookmark(elem.data('type'), elem.data('aid'), location.href, elem);
});
$("a[data-toggle='tooltip']").tooltip();
$('.embed-snippet').hide();
$('.btn-embed').click(function () {
$('.embed-snippet').toggle(400);
return false;
});
var el = $('.user-rating'),
rating = el.data('rating');
$($('input', el)[rating - 1]).attr('checked', 'checked');
$('.auto-submit-star').rating({
callback: function (value, link) {
if (value == undefined) {
value = 0;
}
$('.rate-num-assert').html('(' + value + ')');
caramel.post('/apis/rate', {
asset: $('#assetp-tabs').data('aid'),
value: value || 0
}, function (data) {
});
}
});
});
| $(function () {
$('#btn-add-gadget').click(function () {
var elem = $(this);
asset.process(elem.data('type'), elem.data('aid'), location.href, elem);
});
$('#btn-remove-subscribe').click(function () {
var elem = $(this);
asset.unsubscribeBookmark(elem.data('type'), elem.data('aid'), location.href, elem);
});
$('#btn-remove-subscribe').hover(
function () {
$(this).find("i").removeClass().addClass("fa fa-remove");
},
function () {
$(this).find("i").removeClass().addClass("fw fw-bookmark");
});
$("a[data-toggle='tooltip']").tooltip();
$('.embed-snippet').hide();
$('.btn-embed').click(function () {
$('.embed-snippet').toggle(400);
return false;
});
var el = $('.user-rating'),
rating = el.data('rating');
$($('input', el)[rating - 1]).attr('checked', 'checked');
$('.auto-submit-star').rating({
callback: function (value, link) {
if (value == undefined) {
value = 0;
}
$('.rate-num-assert').html('(' + value + ')');
caramel.post('/apis/rate', {
asset: $('#assetp-tabs').data('aid'),
value: value || 0
}, function (data) {
});
}
});
});
| Fix for STORE-1330: Add hover method to impiles that bookmark is removable | Fix for STORE-1330: Add hover method to impiles that bookmark is removable
| JavaScript | apache-2.0 | prasa7/carbon-store,Rajith90/carbon-store,Rajith90/carbon-store,jeradrutnam/carbon-store,splinter/carbon-store,cnapagoda/carbon-store,thushara35/carbon-store,Rajith90/carbon-store,jeradrutnam/carbon-store,madawas/carbon-store,splinter/carbon-store,wso2/carbon-store,madawas/carbon-store,wso2/carbon-store,wso2/carbon-store,prasa7/carbon-store,cnapagoda/carbon-store,thushara35/carbon-store,cnapagoda/carbon-store,splinter/carbon-store,daneshk/carbon-store,prasa7/carbon-store,thushara35/carbon-store,daneshk/carbon-store,daneshk/carbon-store,jeradrutnam/carbon-store,madawas/carbon-store | ---
+++
@@ -8,6 +8,14 @@
var elem = $(this);
asset.unsubscribeBookmark(elem.data('type'), elem.data('aid'), location.href, elem);
});
+
+ $('#btn-remove-subscribe').hover(
+ function () {
+ $(this).find("i").removeClass().addClass("fa fa-remove");
+ },
+ function () {
+ $(this).find("i").removeClass().addClass("fw fw-bookmark");
+ });
$("a[data-toggle='tooltip']").tooltip();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.