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 |
|---|---|---|---|---|---|---|---|---|---|---|
aa967b9335eb12b9af42abf9ee248b2c7b3aa9d9 | apps/global-game-jam-2021/routes.js | apps/global-game-jam-2021/routes.js | const routeRegex = /^\/(global-game-jam-2021|globalgamejam2021|ggj2021|ggj21)(?:\/.*)?$/;
const githubUrl = 'https://levilindsey.github.io/global-game-jam-2021';
// Attaches the route handlers for this app.
exports.attachRoutes = (server, appPath, config) => {
server.get(routeRegex, handleRequest);
// --- --- //
// Handles a request for this app.
function handleRequest(req, res, next) {
// Check whether this request was directed to the games subdomain.
if (config.gamesDomains.indexOf(req.hostname) < 0) {
next();
return;
}
const dirs = req.path.split('/');
if (dirs[2] === '' || dirs.length === 2) {
res.redirect(githubUrl);
} else {
next();
}
}
};
| const routeRegex = /^\/(global-game-jam-2021|globalgamejam2021|ggj2021|ggj21)(?:\/.*)?$/;
const githubUrl = 'https://levilindsey.github.io/global-game-jam-2021';
// Attaches the route handlers for this app.
exports.attachRoutes = (server, appPath, config) => {
server.get(routeRegex, handleRequest);
// --- --- //
// Handles a request for this app.
function handleRequest(req, res, next) {
// Check whether this request was directed to the portfolio.
if (config.portfolioDomains.indexOf(req.hostname) < 0) {
next();
return;
}
const dirs = req.path.split('/');
if (dirs[2] === '' || dirs.length === 2) {
res.redirect(githubUrl);
} else {
next();
}
}
};
| Fix the ggj route setup | Fix the ggj route setup
| JavaScript | mit | levilindsey/levi.sl,levilindsey/levi.sl | ---
+++
@@ -10,8 +10,8 @@
// Handles a request for this app.
function handleRequest(req, res, next) {
- // Check whether this request was directed to the games subdomain.
- if (config.gamesDomains.indexOf(req.hostname) < 0) {
+ // Check whether this request was directed to the portfolio.
+ if (config.portfolioDomains.indexOf(req.hostname) < 0) {
next();
return;
} |
e325455147e4a0d9a02c10729a2cc45a66f149e9 | client/js/models/shipment.js | client/js/models/shipment.js | define(['backbone'], function(Backbone) {
return Backbone.Model.extend({
idAttribute: 'SHIPPINGID',
urlRoot: '/shipment/shipments',
/*
Validators for shipment, used for both editables and new shipments
*/
validation: {
SHIPPINGNAME: {
required: true,
pattern: 'wwsdash',
},
'FCODES[]': {
required: false,
pattern: 'fcode',
},
SENDINGLABCONTACTID: {
required: true,
},
RETURNLABCONTACTID: {
required: true,
},
DELIVERYAGENT_AGENTCODE: {
required: true,
},
DELIVERYAGENT_AGENTNAME: {
required: true,
},
},
})
})
| define(['backbone'], function(Backbone) {
return Backbone.Model.extend({
idAttribute: 'SHIPPINGID',
urlRoot: '/shipment/shipments',
/*
Validators for shipment, used for both editables and new shipments
*/
validation: {
SHIPPINGNAME: {
required: true,
pattern: 'wwsdash',
},
'FCODES[]': {
required: false,
pattern: 'fcode',
},
SENDINGLABCONTACTID: {
required: true,
},
RETURNLABCONTACTID: {
required: true,
},
DELIVERYAGENT_AGENTCODE: {
required: true,
},
DELIVERYAGENT_AGENTNAME: {
required: true,
pattern: 'wwsdash'
},
},
})
})
| Add validator for courier name | Add validator for courier name
| JavaScript | apache-2.0 | DiamondLightSource/SynchWeb,DiamondLightSource/SynchWeb,tcspain/SynchWeb,DiamondLightSource/SynchWeb,tcspain/SynchWeb,tcspain/SynchWeb,tcspain/SynchWeb,tcspain/SynchWeb,tcspain/SynchWeb,DiamondLightSource/SynchWeb,DiamondLightSource/SynchWeb,DiamondLightSource/SynchWeb | ---
+++
@@ -32,6 +32,7 @@
DELIVERYAGENT_AGENTNAME: {
required: true,
+ pattern: 'wwsdash'
},
},
|
80e679cd33528d8050097e681bad0020c2cf0a4c | tests/integration/components/search-result-test.js | tests/integration/components/search-result-test.js | import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-result', 'Integration | Component | search result', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{search-result}}`);
assert.equal(this.$().text().trim(), '');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-result', 'Integration | Component | search result', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
let result = {
providers: []
};
this.set('result', result);
this.render(hbs`{{search-result result=result}}`);
assert.equal(this.$().text().trim(), '');
});
| Fix CI failure due to missing thing the component needs to render | Fix CI failure due to missing thing the component needs to render
[ci skip]
[#PREP-135]
| JavaScript | apache-2.0 | laurenrevere/ember-preprints,pattisdr/ember-preprints,laurenrevere/ember-preprints,baylee-d/ember-preprints,pattisdr/ember-preprints,CenterForOpenScience/ember-preprints,caneruguz/ember-preprints,caneruguz/ember-preprints,CenterForOpenScience/ember-preprints,hmoco/ember-preprints,baylee-d/ember-preprints,hmoco/ember-preprints | ---
+++
@@ -2,15 +2,19 @@
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('search-result', 'Integration | Component | search result', {
- integration: true
+ integration: true
});
test('it renders', function(assert) {
- // Set any properties with this.set('myProperty', 'value');
- // Handle any actions with this.on('myAction', function(val) { ... });
+ // Set any properties with this.set('myProperty', 'value');
+ // Handle any actions with this.on('myAction', function(val) { ... });
- this.render(hbs`{{search-result}}`);
+ let result = {
+ providers: []
+ };
+ this.set('result', result);
+ this.render(hbs`{{search-result result=result}}`);
- assert.equal(this.$().text().trim(), '');
+ assert.equal(this.$().text().trim(), '');
}); |
75000c3d890987385e0c3a832dc0f8a5bc247146 | app/models/chart.js | app/models/chart.js | import Model from 'ember-data/model';
import DS from 'ember-data';
import { validator, buildValidations } from 'ember-cp-validations';
const Validations = buildValidations({
title: validator('presence', true),
composers: validator('presence', true),
lyricists: validator('presence', true),
arrangers: validator('presence', true),
});
export default Model.extend(Validations, {
nomen: DS.attr('string'),
status: DS.attr('chart-status'),
title: DS.attr('string'),
arrangers: DS.attr('string'),
composers: DS.attr('string'),
lyricists: DS.attr('string'),
holders: DS.attr('string', {defaultValue:''}),
repertories: DS.hasMany('repertory', {async: true}),
songs: DS.hasMany('song', {async: true}),
permissions: DS.attr(),
});
| import Model from 'ember-data/model';
import DS from 'ember-data';
import { validator, buildValidations } from 'ember-cp-validations';
import {memberAction} from 'ember-api-actions';
const Validations = buildValidations({
title: validator('presence', true),
composers: validator('presence', true),
lyricists: validator('presence', true),
arrangers: validator('presence', true),
});
export default Model.extend(Validations, {
nomen: DS.attr('string'),
status: DS.attr('chart-status'),
title: DS.attr('string'),
arrangers: DS.attr('string'),
composers: DS.attr('string'),
lyricists: DS.attr('string'),
holders: DS.attr('string', {defaultValue:''}),
repertories: DS.hasMany('repertory', {async: true}),
songs: DS.hasMany('song', {async: true}),
permissions: DS.attr(),
activate: memberAction({path: 'activate', type: 'post'}),
deactivate: memberAction({path: 'deactivate', type: 'post'}),
statusOptions: [
'New',
'Active',
'Inactive',
],
statusSort: Ember.computed(
'status',
'statusOptions',
function() {
return this.get('statusOptions').indexOf(this.get('status'));
}
),
});
| Update status and Chart transitions | Update status and Chart transitions
| JavaScript | bsd-2-clause | barberscore/barberscore-web,barberscore/barberscore-web,barberscore/barberscore-web | ---
+++
@@ -1,6 +1,7 @@
import Model from 'ember-data/model';
import DS from 'ember-data';
import { validator, buildValidations } from 'ember-cp-validations';
+import {memberAction} from 'ember-api-actions';
const Validations = buildValidations({
title: validator('presence', true),
@@ -20,4 +21,20 @@
repertories: DS.hasMany('repertory', {async: true}),
songs: DS.hasMany('song', {async: true}),
permissions: DS.attr(),
+
+ activate: memberAction({path: 'activate', type: 'post'}),
+ deactivate: memberAction({path: 'deactivate', type: 'post'}),
+
+ statusOptions: [
+ 'New',
+ 'Active',
+ 'Inactive',
+ ],
+ statusSort: Ember.computed(
+ 'status',
+ 'statusOptions',
+ function() {
+ return this.get('statusOptions').indexOf(this.get('status'));
+ }
+ ),
}); |
aa58e823ae5f6ce86b71996a1014ad9aca01ea2b | config/strategies/spotify.js | config/strategies/spotify.js | 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
refresh = require('passport-oauth2-refresh'),
SpotifyStrategy = require('passport-spotify').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use spotify strategy
var strategy = new SpotifyStrategy({
clientID: config.spotify.clientID,
clientSecret: config.spotify.clientSecret,
callbackURL: config.spotify.callbackURL,
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
/**
* NOTE: There is a bug in passport where the accessToken and
* refresh token and swapped. I am patching this in the strategy
* so I don't have to apply this backwards logic throughout the app
*/
providerData.accessToken = refreshToken.access_token;
providerData.refreshToken = accessToken;
// Create the user OAuth profile
var providerUserProfile = {
displayName: profile.displayName,
username: profile.id,
provider: 'spotify',
providerIdentifierField: 'id',
providerData: providerData
};
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
);
passport.use(strategy);
refresh.use(strategy);
}; | 'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
refresh = require('passport-oauth2-refresh'),
SpotifyStrategy = require('passport-spotify').Strategy,
config = require('../config'),
users = require('../../app/controllers/users.server.controller');
module.exports = function() {
// Use spotify strategy
var strategy = new SpotifyStrategy({
clientID: config.spotify.clientID,
clientSecret: config.spotify.clientSecret,
callbackURL: config.spotify.callbackURL,
},
function(req, accessToken, refreshToken, profile, done) {
// Set the provider data and include tokens
var providerData = profile._json;
/**
* NOTE: There is a bug in passport where the accessToken and
* refresh token and swapped. I am patching this in the strategy
* so I don't have to apply this backwards logic throughout the app
*/
providerData.accessToken = refreshToken.access_token;
providerData.refreshToken = accessToken;
// Create the user OAuth profile
var providerUserProfile = {
displayName: profile.displayName || profile.id,
username: profile.id,
provider: 'spotify',
providerIdentifierField: 'id',
providerData: providerData
};
// Save the user OAuth profile
users.saveOAuthUserProfile(req, providerUserProfile, done);
}
);
passport.use(strategy);
refresh.use(strategy);
};
| Use profile id if display name is null | Use profile id if display name is null
- closes #54
| JavaScript | mit | mbukosky/SpotifyUnchained,mbukosky/SpotifyUnchained,mbukosky/SpotifyUnchained,mbukosky/SpotifyUnchained | ---
+++
@@ -30,7 +30,7 @@
// Create the user OAuth profile
var providerUserProfile = {
- displayName: profile.displayName,
+ displayName: profile.displayName || profile.id,
username: profile.id,
provider: 'spotify',
providerIdentifierField: 'id', |
b6a7938d97dfcbceca256292ad8f3d68742d576d | tests/content/cookies/6547/issue6547.js | tests/content/cookies/6547/issue6547.js | function runTest()
{
FBTest.sysout("issue6547.START");
FBTest.openNewTab(basePath + "cookies/6547/issue6547.php", function(win)
{
FBTest.openFirebug();
FBTest.selectPanel("net");
FBTestFireCookie.enableCookiePanel();
FBTest.enableNetPanel(function(win)
{
var options =
{
tagName: "tr",
classes: "netRow category-html hasHeaders loaded"
};
FBTest.waitForDisplayedElement("net", options, function(row)
{
var panelNode = FBTest.selectPanel("net").panelNode;
FBTest.click(row);
FBTest.expandElements(panelNode, "netInfoCookiesTab");
var selector = ".netInfoReceivedCookies .cookieRow .cookieMaxAgeLabel";
var label = panelNode.querySelector(selector);
FBTest.compare("0", label.textContent, "Max age must be zero");
FBTest.testDone("issue6547.DONE");
});
});
});
}
| function runTest()
{
FBTest.sysout("issue6547.START");
FBTest.openNewTab(basePath + "cookies/6547/issue6547.php", function(win)
{
FBTest.openFirebug();
FBTest.selectPanel("net");
FBTestFireCookie.enableCookiePanel();
FBTest.enableNetPanel(function(win)
{
var options =
{
tagName: "tr",
classes: "netRow category-html hasHeaders loaded"
};
FBTest.waitForDisplayedElement("net", options, function(row)
{
var panelNode = FBTest.selectPanel("net").panelNode;
FBTest.click(row);
FBTest.expandElements(panelNode, "netInfoCookiesTab");
var selector = ".netInfoReceivedCookies .cookieRow .cookieMaxAgeLabel";
var label = panelNode.querySelector(selector);
FBTest.compare("0ms", label.textContent, "Max age must be zero");
FBTest.testDone("issue6547.DONE");
});
});
});
}
| Fix 6547 test case to account for new formatTime return | Fix 6547 test case to account for new formatTime return
| JavaScript | bsd-3-clause | firebug/tracing-console,firebug/tracing-console | ---
+++
@@ -26,7 +26,7 @@
var selector = ".netInfoReceivedCookies .cookieRow .cookieMaxAgeLabel";
var label = panelNode.querySelector(selector);
- FBTest.compare("0", label.textContent, "Max age must be zero");
+ FBTest.compare("0ms", label.textContent, "Max age must be zero");
FBTest.testDone("issue6547.DONE");
}); |
644fa033779995474b353d452c4384faaa3917a4 | lib/reduce-statuses.js | lib/reduce-statuses.js | module.exports = function (context, statusChain) {
context.log.debug(`Reducing status chain ${statusChain}`);
const reduced = statusChain.reduce((overallStatus, currentStatus) => {
if (currentStatus === 'error' || overallStatus === 'error') {
return 'error';
}
if (overallStatus === 'failure') {
return 'failure';
}
return currentStatus;
});
context.log.debug(`Reduced status chain to ${reduced}`);
return reduced;
};
| module.exports = function (context, statusChain) {
context.log.debug(`Reducing status chain [${statusChain.join(', ')}]`);
const reduced = statusChain.reduce((overallStatus, currentStatus) => {
if (currentStatus === 'error' || overallStatus === 'error') {
return 'error';
}
if (overallStatus === 'failure') {
return 'failure';
}
return currentStatus;
});
context.log.debug(`Reduced status chain to ${reduced}`);
return reduced;
};
| Improve status chain logging output | Improve status chain logging output
| JavaScript | mit | jarrodldavis/probot-gpg | ---
+++
@@ -1,5 +1,5 @@
module.exports = function (context, statusChain) {
- context.log.debug(`Reducing status chain ${statusChain}`);
+ context.log.debug(`Reducing status chain [${statusChain.join(', ')}]`);
const reduced = statusChain.reduce((overallStatus, currentStatus) => {
if (currentStatus === 'error' || overallStatus === 'error') { |
29b811034c553c20275231167c1c005d619be346 | templates/urls.js | templates/urls.js | "use strict";
var URLS = (function() {
var BASE = 'https://raw.githubusercontent.com/robertpainsi/robertpainsi.github.data/master/';
return {
BASE: BASE,
PROGRAM_STATISTICS: BASE + 'catrobat/statistics/statistics.json'
};
}());
| "use strict";
var URLS = (function() {
var BASE = 'https://raw.githubusercontent.com/robertpainsi/robertpainsi.github.data/master/';
if (location.hostname === 'robertpainsi.localhost.io') {
BASE = 'http://localhost/robertpainsi.github.data/';
}
return {
BASE: BASE,
PROGRAM_STATISTICS: BASE + 'catrobat/statistics/statistics.json'
};
}());
| Add local base url (only used for hostname robertpainsi.localhost.io) | Add local base url (only used for hostname robertpainsi.localhost.io)
| JavaScript | mit | robertpainsi/robertpainsi.github.io,robertpainsi/robertpainsi.github.io | ---
+++
@@ -2,6 +2,9 @@
var URLS = (function() {
var BASE = 'https://raw.githubusercontent.com/robertpainsi/robertpainsi.github.data/master/';
+ if (location.hostname === 'robertpainsi.localhost.io') {
+ BASE = 'http://localhost/robertpainsi.github.data/';
+ }
return {
BASE: BASE, |
b0e05495d46f45bea07de5bbdf359fdf8416c7f3 | test/conjoiner.js | test/conjoiner.js | 'use strict';
var conjoiners = require('../lib/conjoiners');
exports['simple inter-process communication'] = function(test) {
test.expect(3);
var value = 'test_value';
var cj1 = {};
var cj1Name = 'test';
var cj2 = {
onTransenlightenment: function (event) {
test.equal(event.property, 'val');
test.equal(this[event.property], value);
}
};
conjoiners.implant(cj1, 'test/conf.json', cj1Name).then(function() {
return conjoiners.implant(cj2, 'test/conf.json', 'test2');
}).then(function () {
cj1.val = value;
setTimeout(function() {
test.equal(cj2.val, value);
test.done();
}, 1500);
}).done();
};
| 'use strict';
var conjoiners = require('../lib/conjoiners');
exports['simple inter-process communication'] = function(test) {
test.expect(3);
var value = 'test_value';
var cj1 = {};
var cj1Name = 'test';
var cj2 = {
onTransenlightenment: function (event) {
test.equal(event.property, 'val');
test.equal(this[event.property], value);
test.equal(cj2.val, value);
test.done();
}
};
conjoiners.implant(cj1, 'test/conf.json', cj1Name).then(function() {
return conjoiners.implant(cj2, 'test/conf.json', 'test2');
}).then(function () {
cj1.val = value;
}).done();
};
| Test should not rely on setTimeout | Test should not rely on setTimeout | JavaScript | apache-2.0 | conjoiners/conjoiners-node.js | ---
+++
@@ -12,6 +12,8 @@
onTransenlightenment: function (event) {
test.equal(event.property, 'val');
test.equal(this[event.property], value);
+ test.equal(cj2.val, value);
+ test.done();
}
};
@@ -19,10 +21,5 @@
return conjoiners.implant(cj2, 'test/conf.json', 'test2');
}).then(function () {
cj1.val = value;
-
- setTimeout(function() {
- test.equal(cj2.val, value);
- test.done();
- }, 1500);
}).done();
}; |
0445f6472b615cd0915ed5b681dff162986e4903 | models/Captions.js | models/Captions.js | var mongoose = require('mongoose');
var captionSchema = new mongoose.Schema({
_id: { type: String, unique: true},
url: String,
captions: [{
start: Number,
dur: Number,
value: String,
extra_data: Array
}]
});
module.exports = mongoose.model('Caption', captionSchema); | var mongoose = require('mongoose');
var captionSchema = new mongoose.Schema({
_id: { type: String, unique: true},
title: String,
url: String,
captions: [{
start: Number,
dur: Number,
value: String,
extra_data: Array
}]
});
module.exports = mongoose.model('Caption', captionSchema); | Add title to mongoose caption schema | Add title to mongoose caption schema
| JavaScript | mit | yaskyj/fastcaption,yaskyj/fastcaption,yaskyj/fastcaptions,yaskyj/fastcaptions | ---
+++
@@ -2,6 +2,7 @@
var captionSchema = new mongoose.Schema({
_id: { type: String, unique: true},
+ title: String,
url: String,
captions: [{
start: Number, |
21e134c3d11e3ce688735bf1b59d37f847c19b3c | core/filter-options/index.js | core/filter-options/index.js | "use strict";
const dedent = require("dedent");
module.exports = filterOptions;
function filterOptions(yargs) {
// Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands
const opts = {
scope: {
describe: "Include only packages with names matching the given glob.",
type: "string",
},
ignore: {
describe: "Exclude packages with names matching the given glob.",
type: "string",
},
private: {
describe: "Include private packages.\nPass --no-private to exclude private packages.",
type: "boolean",
default: true,
},
since: {
describe: dedent`
Only include packages that have been updated since the specified [ref].
If no ref is passed, it defaults to the most-recent tag.
`,
type: "string",
},
"include-filtered-dependents": {
describe: dedent`
Include all transitive dependents when running a command
regardless of --scope, --ignore, or --since.
`,
type: "boolean",
},
"include-filtered-dependencies": {
describe: dedent`
Include all transitive dependencies when running a command
regardless of --scope, --ignore, or --since.
`,
type: "boolean",
},
};
return yargs.options(opts).group(Object.keys(opts), "Filter Options:");
}
| "use strict";
const dedent = require("dedent");
module.exports = filterOptions;
function filterOptions(yargs) {
// Only for 'run', 'exec', 'clean', 'ls', and 'bootstrap' commands
const opts = {
scope: {
describe: "Include only packages with names matching the given glob.",
type: "string",
},
ignore: {
describe: "Exclude packages with names matching the given glob.",
type: "string",
},
private: {
describe: "Include private packages.\nPass --no-private to exclude private packages.",
type: "boolean",
defaultDescription: "true",
},
since: {
describe: dedent`
Only include packages that have been updated since the specified [ref].
If no ref is passed, it defaults to the most-recent tag.
`,
type: "string",
},
"include-filtered-dependents": {
describe: dedent`
Include all transitive dependents when running a command
regardless of --scope, --ignore, or --since.
`,
type: "boolean",
},
"include-filtered-dependencies": {
describe: dedent`
Include all transitive dependencies when running a command
regardless of --scope, --ignore, or --since.
`,
type: "boolean",
},
};
return yargs.options(opts).group(Object.keys(opts), "Filter Options:");
}
| Allow --private to be configured from file | fix(filter-options): Allow --private to be configured from file
| JavaScript | mit | lerna/lerna,sebmck/lerna,lerna/lerna,kittens/lerna,evocateur/lerna,lerna/lerna,evocateur/lerna | ---
+++
@@ -18,7 +18,7 @@
private: {
describe: "Include private packages.\nPass --no-private to exclude private packages.",
type: "boolean",
- default: true,
+ defaultDescription: "true",
},
since: {
describe: dedent` |
3483929b3b5610bc2ff17369bdcf356c1d05cc9e | cdn/src/app.js | cdn/src/app.js | import express from 'express';
import extensions from './extensions';
const app = express();
app.use('/extensions', extensions);
export default app;
| import express from 'express';
import extensions from './extensions';
const app = express();
app.use('/extensions', extensions);
app.get('/', function (req, res) {
res.send('The CDN is working');
});
export default app;
| Add text to test the server is working | Add text to test the server is working
| JavaScript | mit | worona/worona-dashboard,worona/worona,worona/worona,worona/worona-core,worona/worona-dashboard,worona/worona-core,worona/worona | ---
+++
@@ -4,5 +4,8 @@
const app = express();
app.use('/extensions', extensions);
+app.get('/', function (req, res) {
+ res.send('The CDN is working');
+});
export default app; |
764258718d976aa826e16fd470954f18f8eabf65 | packages/core/src/Rules/CopyTargetsToRoot.js | packages/core/src/Rules/CopyTargetsToRoot.js | /* @flow */
import path from 'path'
import State from '../State'
import File from '../File'
import Rule from '../Rule'
import type { Command, OptionsInterface, Phase } from '../types'
export default class CopyTargetsToRoot extends Rule {
static parameterTypes: Array<Set<string>> = [new Set(['*'])]
static description: string = 'Copy targets to root directory.'
static alwaysEvaluate: boolean = true
static async appliesToParameters (state: State, command: Command, phase: Phase, options: OptionsInterface, ...parameters: Array<File>): Promise<boolean> {
return !!options.copyTargetsToRoot &&
parameters.every(file => state.targets.has(file.filePath) && path.dirname(file.filePath) !== '.')
}
async initialize () {
this.removeTarget(this.firstParameter.filePath)
await this.addResolvedTarget('$BASE_0')
}
async run () {
const filePath = this.resolvePath('$ROOTDIR/$BASE_0')
await this.firstParameter.copy(filePath)
await this.getOutput(filePath)
return true
}
}
| /* @flow */
import path from 'path'
import State from '../State'
import File from '../File'
import Rule from '../Rule'
import type { Command, OptionsInterface, Phase } from '../types'
export default class CopyTargetsToRoot extends Rule {
static parameterTypes: Array<Set<string>> = [new Set(['*'])]
static description: string = 'Copy targets to root directory.'
static alwaysEvaluate: boolean = true
static async appliesToParameters (state: State, command: Command, phase: Phase, options: OptionsInterface, ...parameters: Array<File>): Promise<boolean> {
return !!options.copyTargetsToRoot &&
parameters.every(file => !file.virtual && state.targets.has(file.filePath) && path.dirname(file.filePath) !== '.')
}
async initialize () {
// Remove the old target and replace with the new one.
this.removeTarget(this.firstParameter.filePath)
await this.addResolvedTarget('$BASE_0')
}
async run () {
// Copy the target to it's new location and add the result as an output.
const filePath = this.resolvePath('$ROOTDIR/$BASE_0')
await this.firstParameter.copy(filePath)
await this.getOutput(filePath)
return true
}
}
| Add comments and check for virtual files | Add comments and check for virtual files
| JavaScript | mit | yitzchak/ouroboros,yitzchak/ouroboros,yitzchak/dicy,yitzchak/dicy,yitzchak/dicy | ---
+++
@@ -15,15 +15,17 @@
static async appliesToParameters (state: State, command: Command, phase: Phase, options: OptionsInterface, ...parameters: Array<File>): Promise<boolean> {
return !!options.copyTargetsToRoot &&
- parameters.every(file => state.targets.has(file.filePath) && path.dirname(file.filePath) !== '.')
+ parameters.every(file => !file.virtual && state.targets.has(file.filePath) && path.dirname(file.filePath) !== '.')
}
async initialize () {
+ // Remove the old target and replace with the new one.
this.removeTarget(this.firstParameter.filePath)
await this.addResolvedTarget('$BASE_0')
}
async run () {
+ // Copy the target to it's new location and add the result as an output.
const filePath = this.resolvePath('$ROOTDIR/$BASE_0')
await this.firstParameter.copy(filePath)
await this.getOutput(filePath) |
a75aa8e8c07652d7e4910b6d2e70e3d7f08fe569 | app/scripts/move-popup/dimItemTag.directive.js | app/scripts/move-popup/dimItemTag.directive.js |
(function() {
'use strict';
angular.module('dimApp').component('dimItemTag', {
controller: ItemTagController,
bindings: {
item: '='
},
template: `
<select ng-options="tag as tag.label | translate for tag in $ctrl.settings.itemTags track by tag.type" ng-model="$ctrl.selected" ng-change="$ctrl.updateTag()"></select>
`
});
ItemTagController.$inject = ['$scope', '$rootScope', 'dimSettingsService'];
function ItemTagController($scope, $rootScope, dimSettingsService) {
var vm = this;
vm.settings = dimSettingsService;
$scope.$watch(() => vm.item.dimInfo.tag, function() {
vm.selected = _.find(vm.settings.itemTags, function(tag) {
return tag.type === vm.item.dimInfo.tag;
});
});
vm.updateTag = function() {
vm.item.dimInfo.tag = vm.selected.type;
$rootScope.$broadcast('dim-filter-invalidate');
vm.item.dimInfo.save();
};
$scope.$on('dim-item-tag', (e, args) => {
if (vm.item.dimInfo.tag === args.tag) {
delete vm.item.dimInfo.tag;
} else {
vm.item.dimInfo.tag = args.tag;
}
$rootScope.$broadcast('dim-filter-invalidate');
vm.item.dimInfo.save();
});
}
})();
|
(function() {
'use strict';
angular.module('dimApp').component('dimItemTag', {
controller: ItemTagController,
bindings: {
item: '='
},
template: `
<select ng-options="tag as tag.label | translate for tag in $ctrl.settings.itemTags track by tag.type" ng-model="$ctrl.selected" ng-change="$ctrl.updateTag()"></select>
`
});
ItemTagController.$inject = ['$scope', '$rootScope', 'dimSettingsService'];
function ItemTagController($scope, $rootScope, dimSettingsService) {
var vm = this;
vm.settings = dimSettingsService;
$scope.$watch('$ctrl.item.dimInfo.tag', function() {
vm.selected = _.find(vm.settings.itemTags, function(tag) {
return tag.type === vm.item.dimInfo.tag;
});
});
vm.updateTag = function() {
vm.item.dimInfo.tag = vm.selected.type;
$rootScope.$broadcast('dim-filter-invalidate');
vm.item.dimInfo.save();
};
$scope.$on('dim-item-tag', (e, args) => {
if (vm.item.dimInfo.tag === args.tag) {
delete vm.item.dimInfo.tag;
} else {
vm.item.dimInfo.tag = args.tag;
}
$rootScope.$broadcast('dim-filter-invalidate');
vm.item.dimInfo.save();
});
}
})();
| Fix tag update when there's no tag | Fix tag update when there's no tag
| JavaScript | mit | chrisfried/DIM,bhollis/DIM,DestinyItemManager/DIM,delphiactual/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM,chrisfried/DIM,48klocs/DIM,bhollis/DIM,bhollis/DIM,DestinyItemManager/DIM,bhollis/DIM,chrisfried/DIM,LouisFettet/DIM,LouisFettet/DIM,48klocs/DIM,delphiactual/DIM,delphiactual/DIM,chrisfried/DIM,48klocs/DIM,delphiactual/DIM | ---
+++
@@ -18,7 +18,7 @@
var vm = this;
vm.settings = dimSettingsService;
- $scope.$watch(() => vm.item.dimInfo.tag, function() {
+ $scope.$watch('$ctrl.item.dimInfo.tag', function() {
vm.selected = _.find(vm.settings.itemTags, function(tag) {
return tag.type === vm.item.dimInfo.tag;
}); |
01694cf1a26b9c869960a498e07c358f85cb7c71 | web_app/routes/socket.js | web_app/routes/socket.js | /*
* Serve content over a socket
*/
module.exports = function (socket) {
socket.emit('send:name', {
name: 'Bob'
});
};
| /*
* Serve content over a socket
*/
module.exports = function (socket) {
// socket.emit('send:name', {
// name: 'Bob'
// });
};
| Comment this out for now | Comment this out for now
| JavaScript | mit | projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox,projectweekend/Pi-Jukebox | ---
+++
@@ -3,7 +3,7 @@
*/
module.exports = function (socket) {
- socket.emit('send:name', {
- name: 'Bob'
- });
+ // socket.emit('send:name', {
+ // name: 'Bob'
+ // });
}; |
49f1da05920d4ab335ffcd7d1be9604845f23da5 | lib/logging.js | lib/logging.js | var Tracer = require('tracer');
function Logger (options) {
this.options = options;
this.tracer = this._setupTracer(options.enabled);
}
Logger.prototype.info = function () {
this.tracer.info.apply(this.tracer, arguments);
};
Logger.prototype.error = function (message) {
this.tracer.error(message);
}
Logger.prototype._setupTracer = function (enabled) {
var noopTransport = function () {};
var options = {};
options.format = "{{message}}";
if (!enabled) {
options.transport = noopTransport;
}
return Tracer.colorConsole(options);
}
function initTheLogger (options) {
return new Logger(options);
}
var logger;
exports.logger = function (options) {
if (!logger) {
logger = initTheLogger(options);
}
return logger;
}
| 'use strict';
var Tracer = require('tracer');
function Logger (options) {
this.options = options;
this.tracer = this._setupTracer(options.enabled);
}
Logger.prototype.info = function () {
this.tracer.info.apply(this.tracer, arguments);
};
Logger.prototype.error = function (message) {
this.tracer.error(message);
};
Logger.prototype._setupTracer = function (enabled) {
var noopTransport = function () {};
var options = {};
options.format = '{{message}}';
if (!enabled) {
options.transport = noopTransport;
}
return Tracer.colorConsole(options);
};
function initTheLogger (options) {
return new Logger(options);
}
var logger;
exports.logger = function (options) {
if (!logger) {
logger = initTheLogger(options);
}
return logger;
};
| Make the syntax checker happy | Make the syntax checker happy
| JavaScript | mit | madtrick/spr | ---
+++
@@ -1,3 +1,5 @@
+'use strict';
+
var Tracer = require('tracer');
function Logger (options) {
@@ -11,20 +13,20 @@
Logger.prototype.error = function (message) {
this.tracer.error(message);
-}
+};
Logger.prototype._setupTracer = function (enabled) {
var noopTransport = function () {};
var options = {};
- options.format = "{{message}}";
+ options.format = '{{message}}';
if (!enabled) {
options.transport = noopTransport;
}
return Tracer.colorConsole(options);
-}
+};
function initTheLogger (options) {
return new Logger(options);
@@ -37,4 +39,4 @@
}
return logger;
-}
+}; |
599c9c809d160f0562a5e6ca69d27332585e5bc4 | packages/core/strapi/lib/services/entity-service/attributes/transforms.js | packages/core/strapi/lib/services/entity-service/attributes/transforms.js | 'use strict';
const { getOr, toNumber } = require('lodash/fp');
const bcrypt = require('bcrypt');
const transforms = {
password(value, context) {
const { action, attribute } = context;
if (action !== 'create' && action !== 'update') {
return value;
}
const rounds = toNumber(getOr(10, 'encryption.rounds', attribute));
return bcrypt.hashSync(value, rounds);
},
};
module.exports = transforms;
| 'use strict';
const { getOr, toNumber, isString, isBuffer } = require('lodash/fp');
const bcrypt = require('bcrypt');
const transforms = {
password(value, context) {
const { action, attribute } = context;
if (!isString(value) && !isBuffer(value)) {
return value;
}
if (action !== 'create' && action !== 'update') {
return value;
}
const rounds = toNumber(getOr(10, 'encryption.rounds', attribute));
return bcrypt.hashSync(value, rounds);
},
};
module.exports = transforms;
| Handle non-string & non-buffer scenarios for the password transform | Handle non-string & non-buffer scenarios for the password transform
| JavaScript | mit | wistityhq/strapi,wistityhq/strapi | ---
+++
@@ -1,11 +1,15 @@
'use strict';
-const { getOr, toNumber } = require('lodash/fp');
+const { getOr, toNumber, isString, isBuffer } = require('lodash/fp');
const bcrypt = require('bcrypt');
const transforms = {
password(value, context) {
const { action, attribute } = context;
+
+ if (!isString(value) && !isBuffer(value)) {
+ return value;
+ }
if (action !== 'create' && action !== 'update') {
return value; |
f06ce668d3c3fb8e05139cf46e0d714f5e28aa35 | packages/react-jsx-highcharts/test/components/BaseChart/BaseChart.spec.js | packages/react-jsx-highcharts/test/components/BaseChart/BaseChart.spec.js | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import BaseChart from '../../../src/components/BaseChart';
import { createMockChart } from '../../test-utils';
describe('<BaseChart />', function () {
describe('on mount', function () {
let clock;
let chart;
beforeEach(function () {
chart = createMockChart();
this.chartCreationFunc = sinon.stub();
this.chartCreationFunc.returns(chart);
clock = sinon.useFakeTimers();
});
afterEach(function () {
clock.restore();
});
describe('when mounted', function () {
it('should create a Highcharts chart', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
expect(this.chartCreationFunc).to.have.been.calledWith(wrapper.getDOMNode());
});
it('should create a chart context', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
const context = wrapper.instance().getChildContext();
expect(context.chart).to.eql(chart);
});
});
describe('when unmounted', function () {
it('destroys the chart instance', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
expect(chart.destroy).not.to.have.been.called;
wrapper.unmount();
clock.tick(1);
expect(chart.destroy).to.have.been.called;
});
});
});
});
| import React, { Component } from 'react';
import BaseChart from '../../../src/components/BaseChart';
import { createMockChart } from '../../test-utils';
describe('<BaseChart />', function () {
let clock;
let chart;
beforeEach(function () {
chart = createMockChart();
this.chartCreationFunc = sinon.stub();
this.chartCreationFunc.returns(chart);
clock = sinon.useFakeTimers();
});
afterEach(function () {
clock.restore();
});
describe('when mounted', function () {
it('should create a Highcharts chart', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
expect(this.chartCreationFunc).to.have.been.calledWith(wrapper.getDOMNode());
});
it('should create a chart context', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
const context = wrapper.instance().getChildContext();
expect(context.chart).to.eql(chart);
});
});
describe('when unmounted', function () {
it('destroys the chart instance', function () {
const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
clock.tick(1);
expect(chart.destroy).not.to.have.been.called;
wrapper.unmount();
clock.tick(1);
expect(chart.destroy).to.have.been.called;
});
});
});
| Remove unnecessary BaseChart test code | Remove unnecessary BaseChart test code
| JavaScript | mit | whawker/react-jsx-highcharts,whawker/react-jsx-highcharts | ---
+++
@@ -1,48 +1,45 @@
-import React, { PureComponent } from 'react';
-import PropTypes from 'prop-types';
+import React, { Component } from 'react';
import BaseChart from '../../../src/components/BaseChart';
import { createMockChart } from '../../test-utils';
describe('<BaseChart />', function () {
- describe('on mount', function () {
- let clock;
- let chart;
+ let clock;
+ let chart;
- beforeEach(function () {
- chart = createMockChart();
- this.chartCreationFunc = sinon.stub();
- this.chartCreationFunc.returns(chart);
- clock = sinon.useFakeTimers();
+ beforeEach(function () {
+ chart = createMockChart();
+ this.chartCreationFunc = sinon.stub();
+ this.chartCreationFunc.returns(chart);
+ clock = sinon.useFakeTimers();
+ });
+
+ afterEach(function () {
+ clock.restore();
+ });
+
+ describe('when mounted', function () {
+ it('should create a Highcharts chart', function () {
+ const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
+ clock.tick(1);
+ expect(this.chartCreationFunc).to.have.been.calledWith(wrapper.getDOMNode());
});
- afterEach(function () {
- clock.restore();
+ it('should create a chart context', function () {
+ const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
+ clock.tick(1);
+ const context = wrapper.instance().getChildContext();
+ expect(context.chart).to.eql(chart);
});
+ });
- describe('when mounted', function () {
- it('should create a Highcharts chart', function () {
- const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
- clock.tick(1);
- expect(this.chartCreationFunc).to.have.been.calledWith(wrapper.getDOMNode());
- });
-
- it('should create a chart context', function () {
- const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
- clock.tick(1);
- const context = wrapper.instance().getChildContext();
- expect(context.chart).to.eql(chart);
- });
- });
-
- describe('when unmounted', function () {
- it('destroys the chart instance', function () {
- const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
- clock.tick(1);
- expect(chart.destroy).not.to.have.been.called;
- wrapper.unmount();
- clock.tick(1);
- expect(chart.destroy).to.have.been.called;
- });
+ describe('when unmounted', function () {
+ it('destroys the chart instance', function () {
+ const wrapper = mount(<BaseChart chartCreationFunc={this.chartCreationFunc} />);
+ clock.tick(1);
+ expect(chart.destroy).not.to.have.been.called;
+ wrapper.unmount();
+ clock.tick(1);
+ expect(chart.destroy).to.have.been.called;
});
});
}); |
8b15314c71e91b5c6f210915d53fb6c11a5cbce2 | lib/assets/javascripts/cartodb3/deep-insights-integration/legend-manager.js | lib/assets/javascripts/cartodb3/deep-insights-integration/legend-manager.js | var LegendFactory = require('../editor/layers/layer-content-views/legend/legend-factory');
var onChange = function (layerDefModel) {
var styleModel = layerDefModel.styleModel;
var canSuggestLegends = LegendFactory.hasMigratedLegend(layerDefModel);
var fill;
var color;
var size;
if (!styleModel) return;
if (!canSuggestLegends) return;
LegendFactory.removeAllLegend(layerDefModel);
fill = styleModel.get('fill');
color = fill.color;
size = fill.size;
if (size && size.attribute !== undefined) {
LegendFactory.createLegend(layerDefModel, 'bubble');
}
if (color && color.attribute !== undefined) {
if (color.attribute_type && color.attribute_type === 'string') {
LegendFactory.createLegend(layerDefModel, 'category');
} else {
LegendFactory.createLegend(layerDefModel, 'choropleth');
}
}
};
module.exports = {
track: function (layerDefModel) {
layerDefModel.on('change:cartocss', onChange);
layerDefModel.on('destroy', function () {
layerDefModel.off('change:cartocss', onChange);
});
}
};
| var LegendFactory = require('../editor/layers/layer-content-views/legend/legend-factory');
var onChange = function (layerDefModel) {
var styleModel = layerDefModel.styleModel;
var canSuggestLegends = !LegendFactory.hasMigratedLegend(layerDefModel);
var fill;
var color;
var size;
if (!styleModel) return;
if (!canSuggestLegends) return;
LegendFactory.removeAllLegend(layerDefModel);
fill = styleModel.get('fill');
if (!fill) return;
color = fill.color;
size = fill.size;
if (size && size.attribute !== undefined) {
LegendFactory.createLegend(layerDefModel, 'bubble');
}
if (color && color.attribute !== undefined) {
if (color.attribute_type && color.attribute_type === 'string') {
LegendFactory.createLegend(layerDefModel, 'category');
} else {
LegendFactory.createLegend(layerDefModel, 'choropleth');
}
}
};
module.exports = {
track: function (layerDefModel) {
layerDefModel.on('change:cartocss', onChange);
layerDefModel.on('destroy', function () {
layerDefModel.off('change:cartocss', onChange);
});
}
};
| Fix bug in legends magic. | Fix bug in legends magic.
| JavaScript | bsd-3-clause | splashblot/dronedb,splashblot/dronedb,CartoDB/cartodb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb,splashblot/dronedb | ---
+++
@@ -2,7 +2,7 @@
var onChange = function (layerDefModel) {
var styleModel = layerDefModel.styleModel;
- var canSuggestLegends = LegendFactory.hasMigratedLegend(layerDefModel);
+ var canSuggestLegends = !LegendFactory.hasMigratedLegend(layerDefModel);
var fill;
var color;
var size;
@@ -13,6 +13,9 @@
LegendFactory.removeAllLegend(layerDefModel);
fill = styleModel.get('fill');
+
+ if (!fill) return;
+
color = fill.color;
size = fill.size;
|
881a22edcb6438f9d65a8794b17ae710ee44c089 | listentotwitter/static/js/keyword-box.js | listentotwitter/static/js/keyword-box.js | function redirectKeyword(keyword) {
document.location.href = '/keyword/' + keyword;
}
$(document).ready(function() {
$('#keyword-form #keyword-input').focus();
$('#keyword-form').submit(function() {
redirectKeyword($('#keyword-form #keyword-input').val());
});
$('#keyword-form #keyword-input').focus(function() {
if (this.setSelectionRange) {
var len = $(this).val().length * 2;
this.setSelectionRange(len, len);
} else {
$(this).val($(this).val());
}
});
$('#keyword-form #keyword-input').trigger('focus');
});
| function redirectKeyword(keyword) {
document.location.href = '/keyword/' + keyword;
}
$(document).ready(function() {
$('#keyword-form #keyword-input').focus();
$('#keyword-form').submit(function() {
redirectKeyword($('#keyword-form #keyword-input').val());
});
$('#keyword-form #keyword-input').focus(function() {
$(this).select();
});
$('#keyword-form #keyword-input').trigger('focus');
});
| Select text instead of move cursor to the end | Select text instead of move cursor to the end
| JavaScript | agpl-3.0 | musalbas/listentotwitter,musalbas/listentotwitter,musalbas/listentotwitter | ---
+++
@@ -10,12 +10,7 @@
});
$('#keyword-form #keyword-input').focus(function() {
- if (this.setSelectionRange) {
- var len = $(this).val().length * 2;
- this.setSelectionRange(len, len);
- } else {
- $(this).val($(this).val());
- }
+ $(this).select();
});
$('#keyword-form #keyword-input').trigger('focus'); |
3a642093d2344c91f1ebdbfcc73cbc2b74125fef | nls/Strings.js | nls/Strings.js | define( function( require, exports, module ) {
'use strict';
module.exports = {
root: true,
de: true,
es: true,
fr: true,
gl: true,
it: true,
sv: true,
uk: true,
ru: true
};
} );
| define( function( require, exports, module ) {
'use strict';
module.exports = {
root: true,
de: true,
es: true,
fr: true,
gl: true,
it: true,
ru: true,
sv: true,
uk: true
};
} );
| Use alphabetic ordering of nls. | Use alphabetic ordering of nls.
| JavaScript | mit | sensuigit/brackets-autoprefixer,sensuigit/brackets-autoprefixer,mikaeljorhult/brackets-autoprefixer,mikaeljorhult/brackets-autoprefixer | ---
+++
@@ -8,8 +8,8 @@
fr: true,
gl: true,
it: true,
+ ru: true,
sv: true,
- uk: true,
- ru: true
+ uk: true
};
} ); |
23644c40350c07a5266d4f1242dd8665a076ee53 | tests/CoreSpec.js | tests/CoreSpec.js | describe("Core Bliss", function () {
"use strict";
before(function() {
fixture.setBase('tests/fixtures');
});
beforeEach(function () {
this.fixture = fixture.load('core.html');
});
// testing setup
it("has the fixture on the dom", function () {
expect($('#fixture-container')).to.not.be.null;
});
it("is a valid testing environment", function () {
// PhantomJS fails this one by default
expect(Element.prototype.matches).to.not.be.undefined;
});
it("has global methods and aliases", function() {
expect(Bliss).to.exist;
expect($).to.exist;
expect($$).to.exist;
expect($).to.equal(Bliss);
expect($$).to.equal($.$);
});
});
| describe("Core Bliss", function () {
"use strict";
before(function() {
fixture.setBase('tests/fixtures');
});
beforeEach(function () {
this.fixture = fixture.load('core.html');
});
// testing setup
it("has the fixture on the dom", function () {
expect($('#fixture-container')).to.not.be.null;
});
it("has global methods and aliases", function() {
expect(Bliss).to.exist;
expect($).to.exist;
expect($$).to.exist;
expect($).to.equal(Bliss);
expect($$).to.equal($.$);
});
});
| Revert "Check testing environment has appropriate features" | Revert "Check testing environment has appropriate features"
This reverts commit dbb0a79af0c061b1de7acb0d609b05a438d52cae.
| JavaScript | mit | LeaVerou/bliss,LeaVerou/bliss,dperrymorrow/bliss,dperrymorrow/bliss | ---
+++
@@ -14,11 +14,6 @@
expect($('#fixture-container')).to.not.be.null;
});
- it("is a valid testing environment", function () {
- // PhantomJS fails this one by default
- expect(Element.prototype.matches).to.not.be.undefined;
- });
-
it("has global methods and aliases", function() {
expect(Bliss).to.exist;
expect($).to.exist; |
574d8ec4bb13661372284f703caa48e7b387feb2 | gulpfile.js/util/pattern-library/lib/parseDocumentation.js | gulpfile.js/util/pattern-library/lib/parseDocumentation.js | var path = require('path')
var marked = require('marked')
var nunjucks = require('nunjucks')
var parseDocumentation = function (files) {
files.forEach(function (file) {
nunjucks.configure([
path.join(__dirname, '..', 'macros'),
path.parse(file.path).dir
])
marked.setOptions({
gfm: false
})
var fileContents = [
`{% from 'example.html' import example %}`,
`{% from 'markup.html' import markup %}`,
file.contents.toString()
].join('\n')
var markdown = nunjucks.renderString(fileContents)
var html = marked(markdown)
file.contents = Buffer.from(html)
})
return files
}
module.exports = parseDocumentation
| var path = require('path')
var marked = require('marked')
var nunjucks = require('nunjucks')
var parseDocumentation = function (files) {
files.forEach(function (file) {
nunjucks.configure([
path.join(__dirname, '..', 'macros'),
path.parse(file.path).dir
])
var fileContents = [
`{% from 'example.html' import example %}`,
`{% from 'markup.html' import markup %}`,
file.contents.toString()
].join('\n')
var markdown = nunjucks.renderString(fileContents)
var html = marked(markdown)
file.contents = Buffer.from(html)
})
return files
}
module.exports = parseDocumentation
| Use github flavoured markdown as before | Use github flavoured markdown as before
| JavaScript | apache-2.0 | hmrc/assets-frontend,hmrc/assets-frontend,hmrc/assets-frontend | ---
+++
@@ -8,10 +8,6 @@
path.join(__dirname, '..', 'macros'),
path.parse(file.path).dir
])
-
- marked.setOptions({
- gfm: false
- })
var fileContents = [
`{% from 'example.html' import example %}`, |
f7bd33c7211ed3d79f91da700c51379a26e64196 | app/map/map.utils.js | app/map/map.utils.js | function clearEOIMarkers(scope) {
// Remove existing markers.
scope.placesOfInterestMarkers.forEach(function (markerObj) {
scope.map.removeLayer(markerObj.marker);
});
scope.placesOfInterestMarkers = [];
}
function clampWithinBounds(value, lowerBound, upperBound) {
value = Math.max(value, lowerBound);
value = Math.min(value, upperBound);
return value;
}
function createPoiPopupContent(poiAndMarkerObj, scope, compile) {
var content = compile(angular.element('<span>{{poi.DisplayName}}<br>'
+ '<a href="" ng-click="removePlaceOfInterest(poi)">'
+ 'Remove</a>'
+ '</span>'));
var tempScope = scope.$new();
tempScope.poi = poiAndMarkerObj.poi;
return content(tempScope)[0];
}
function updateOrigin(latlng, scope) {
scope.originMarker.setLatLng(latlng).update();
// If have already drawn radius circle then remove it and re-set radius.
if (scope.map.hasLayer(scope.circleOverlay)) {
scope.map.removeLayer(scope.circleOverlay);
scope.radius = 0;
scope.$root.$broadcast('searchAreaCleared');
}
} | function clearEOIMarkers(scope) {
// Remove existing markers.
scope.placesOfInterestMarkers.forEach(function (markerObj) {
scope.map.removeLayer(markerObj.marker);
});
scope.placesOfInterestMarkers = [];
}
function clampWithinBounds(value, lowerBound, upperBound) {
value = Math.max(value, lowerBound);
value = Math.min(value, upperBound);
return value;
}
function createPoiPopupContent(poiAndMarkerObj, scope, compile) {
var content = compile(angular.element('<span>{{poi.DisplayName}}<br>'
+ '<a href="" ng-click="removePlaceOfInterest(poi)">'
+ 'Remove</a>'
+ '</span>'));
var tempScope = scope.$new();
tempScope.poi = poiAndMarkerObj.poi;
return content(tempScope)[0];
}
function updateOrigin(latlng, scope) {
scope.originMarker.setLatLng(latlng).update();
// If have already drawn radius circle then remove it and re-set radius.
if (scope.map.hasLayer(scope.circleOverlay)) {
scope.map.removeLayer(scope.circleOverlay);
scope.radius = 0;
scope.circleOverlay.setRadius(0);
scope.$root.$broadcast('searchAreaCleared');
}
} | Set search area circle size to 0 on reset. | Set search area circle size to 0 on reset.
| JavaScript | mit | joseph-iussa/tour-planner,joseph-iussa/tour-planner,joseph-iussa/tour-planner | ---
+++
@@ -33,6 +33,7 @@
if (scope.map.hasLayer(scope.circleOverlay)) {
scope.map.removeLayer(scope.circleOverlay);
scope.radius = 0;
+ scope.circleOverlay.setRadius(0);
scope.$root.$broadcast('searchAreaCleared');
}
} |
483b0240eedfc44bb8105f0bdc218d16f754ccde | conf/buster-coverage.js | conf/buster-coverage.js | module.exports.unit = {
environment: 'node',
rootPath: process.cwd(),
sources: [
'lib/**/*.js'
],
tests: [
'test/**/*.js'
],
extensions: [
require('buster-istanbul')
],
'buster-istanbul': {
outputDirectory: '.bob/report/coverage'
}
};
| module.exports.unit = {
environment: 'node',
rootPath: process.cwd(),
sources: [
'lib/**/*.js'
],
tests: [
'test/**/*.js'
],
extensions: [
require('buster-istanbul')
],
'buster-istanbul': {
outputDirectory: '.bob/report/coverage/buster-istanbul/'
}
};
| Add buster-istanbul subdir as output directory. | Add buster-istanbul subdir as output directory.
| JavaScript | mit | cliffano/bob | ---
+++
@@ -11,6 +11,6 @@
require('buster-istanbul')
],
'buster-istanbul': {
- outputDirectory: '.bob/report/coverage'
+ outputDirectory: '.bob/report/coverage/buster-istanbul/'
}
}; |
5124587953b57db865ec3a63af138e7e43ba6a9a | app/app.js | app/app.js | (function() {
var app = angular.module('notely', [
'ui.router',
'notely.notes',
'notely.notes.service'
]);
function config($urlRouterProvider) {
$urlRouterProvider.otherwise('/notes');
}
config['$inject'] = ['$urlRouterProvider'];
app.config(config);
})();
| (function() {
var app = angular.module('notely', [
'ui.router',
'notely.notes',
'notely.notes.service'
]);
function config($urlRouterProvider) {
$urlRouterProvider.otherwise('/notes/');
}
config['$inject'] = ['$urlRouterProvider'];
app.config(config);
})();
| Update default route to include trailing slash. | Update default route to include trailing slash.
| JavaScript | mit | FretlessBecks/notely,williamrulon/notely-1,FretlessBecks/notely,williamrulon/notely-1 | ---
+++
@@ -6,7 +6,7 @@
]);
function config($urlRouterProvider) {
- $urlRouterProvider.otherwise('/notes');
+ $urlRouterProvider.otherwise('/notes/');
}
config['$inject'] = ['$urlRouterProvider']; |
46d12bb8b5a302922d9ef2c6e305c78a99876701 | app/javascript/app/components/footer/site-map-footer/site-map-footer-data.js | app/javascript/app/components/footer/site-map-footer/site-map-footer-data.js | export const siteMapData = [
{
title: 'Tools',
links: [
{ title: 'Country Profiles', href: '/countries' },
{ title: 'NDCs', href: '/ndcs-content' },
{ title: 'NDC-SDG Linkages', href: '/ndcs-sdg' },
{ title: 'Historical GHG Emissions', href: '/ghg-emissions' },
{ title: 'Pathways', href: '/pathways' }
]
},
{
title: 'Data',
links: [
{ title: 'Explore Datasets', href: '/data-explorer' },
{ title: 'My Climate Watch', href: '/my-climate-watch' }
]
},
{
title: 'Country Platforms',
links: [
// { title: 'India', href: '/' },
// { title: 'Indonesia', href: '/' },
{ title: 'South Africa', href: 'http://southafricaclimateexplorer.org/' }
]
},
{
title: 'About',
links: [
{ title: 'About Climate Watch', href: '/about' },
{ title: 'Climate Watch Partners', href: '/about/partners' },
{ title: 'Contact Us & Feedback', href: '/about/contact' },
{ title: 'Permissions & Licensing', href: '/about/permissions' },
{ title: 'FAQ', href: '/about/faq' }
]
}
];
| export const siteMapData = [
{
title: 'Tools',
links: [
{ title: 'Country Profiles', href: '/countries' },
{ title: 'NDCs', href: '/ndcs-content' },
{ title: 'NDC-SDG Linkages', href: '/ndcs-sdg' },
{ title: 'Historical GHG Emissions', href: '/ghg-emissions' },
{ title: 'Pathways', href: '/pathways' }
]
},
{
title: 'Data',
links: [
{ title: 'Explore Datasets', href: '/data-explorer' },
{ title: 'My Climate Watch', href: '/my-climate-watch' }
]
},
{
title: 'Country Platforms',
links: [
// { title: 'India', href: '/' },
// { title: 'Indonesia', href: '/' },
{ title: 'South Africa', href: 'http://southafricaclimateexplorer.org/' }
]
},
{
title: 'About',
links: [
{ title: 'About Climate Watch', href: '/about' },
{ title: 'Climate Watch Partners', href: '/about/partners' },
{ title: 'Contact Us & Feedback', href: '/about/contact' },
{ title: 'Permissions & Licensing', href: '/about/permissions' },
{ title: 'FAQ', href: '/about/faq/general_questions' }
]
}
];
| Correct FAQ link on footer | Correct FAQ link on footer
| JavaScript | mit | Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch,Vizzuality/climate-watch | ---
+++
@@ -31,7 +31,7 @@
{ title: 'Climate Watch Partners', href: '/about/partners' },
{ title: 'Contact Us & Feedback', href: '/about/contact' },
{ title: 'Permissions & Licensing', href: '/about/permissions' },
- { title: 'FAQ', href: '/about/faq' }
+ { title: 'FAQ', href: '/about/faq/general_questions' }
]
}
]; |
2ffb9af2862202068c7dc4c7144a3340bc1dd3df | spec/www/background.js | spec/www/background.js | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chromespec.registerJasmineTest('chrome.app.runtime');
chromespec.registerJasmineTest('chrome.app.window');
chromespec.registerJasmineTest('chrome.fileSystem');
chromespec.registerJasmineTest('chrome.i18n');
chromespec.registerJasmineTest('chrome.runtime');
chromespec.registerJasmineTest('chrome.storage');
chromespec.registerJasmineTest('chrome.socket');
chromespec.registerJasmineTest('chrome.syncFileSystem');
chromespec.registerJasmineTest('pageload');
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
chromespec.registerJasmineTest('chrome.app.runtime');
chromespec.registerJasmineTest('chrome.app.window');
chromespec.registerJasmineTest('chrome.fileSystem');
chromespec.registerJasmineTest('chrome.i18n');
chromespec.registerJasmineTest('chrome.runtime');
chromespec.registerJasmineTest('chrome.storage');
chromespec.registerJasmineTest('chrome.socket');
chromespec.registerJasmineTest('pageload');
| Remove test.syncFileSystem.js from the load list as it doesn't exist. | Remove test.syncFileSystem.js from the load list as it doesn't exist.
| JavaScript | bsd-3-clause | xiaoyanit/mobile-chrome-apps,wudkj/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,guozanhua/mobile-chrome-apps,guozanhua/mobile-chrome-apps,chirilo/mobile-chrome-apps,hgl888/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,hgl888/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,chirilo/mobile-chrome-apps,hgl888/mobile-chrome-apps,guozanhua/mobile-chrome-apps,hgl888/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,wudkj/mobile-chrome-apps,chirilo/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,MobileChromeApps/mobile-chrome-apps,hgl888/mobile-chrome-apps,xiaoyanit/mobile-chrome-apps,hgl888/mobile-chrome-apps,liqingzhu/mobile-chrome-apps,hgl888/mobile-chrome-apps,wudkj/mobile-chrome-apps,wudkj/mobile-chrome-apps,guozanhua/mobile-chrome-apps,chirilo/mobile-chrome-apps | ---
+++
@@ -9,5 +9,4 @@
chromespec.registerJasmineTest('chrome.runtime');
chromespec.registerJasmineTest('chrome.storage');
chromespec.registerJasmineTest('chrome.socket');
-chromespec.registerJasmineTest('chrome.syncFileSystem');
chromespec.registerJasmineTest('pageload'); |
e0a85c0e739f1d4b0b82380ec4092893f8fb996c | src/Core/Characters.js | src/Core/Characters.js | // @flow
export opaque type WideBar = "W"
export const WIDE_BAR: WideBar = "W"
export opaque type NarrowBar = "N"
export const NARROW_BAR: NarrowBar = "N"
export opaque type WideSpace = "w"
export const WIDE_SPACE: WideSpace = "w"
export opaque type NarrowSpace = "n"
export const NARROW_SPACE: NarrowSpace = "n"
export opaque type DiscreteSymbologySymbol = WideBar | NarrowBar | WideSpace | WideBar
export opaque type SymbologySymbol = DiscreteSymbologySymbol
| // @flow
export opaque type WideBar = "W"
export const WIDE_BAR: WideBar = "W"
export opaque type NarrowBar = "N"
export const NARROW_BAR: NarrowBar = "N"
export opaque type WideSpace = "w"
export const WIDE_SPACE: WideSpace = "w"
export opaque type NarrowSpace = "n"
export const NARROW_SPACE: NarrowSpace = "n"
export type DiscreteSymbologySymbol = WideBar | NarrowBar | WideSpace | WideBar
export type SymbologySymbol = DiscreteSymbologySymbol
| Make symbol unions non opaque types | Make symbol unions non opaque types
| JavaScript | mit | mormahr/barcode.js,mormahr/barcode.js | ---
+++
@@ -11,5 +11,5 @@
export opaque type NarrowSpace = "n"
export const NARROW_SPACE: NarrowSpace = "n"
-export opaque type DiscreteSymbologySymbol = WideBar | NarrowBar | WideSpace | WideBar
-export opaque type SymbologySymbol = DiscreteSymbologySymbol
+export type DiscreteSymbologySymbol = WideBar | NarrowBar | WideSpace | WideBar
+export type SymbologySymbol = DiscreteSymbologySymbol |
49ad1e4378f81738f8ed59ab94dc603c4d5c1938 | webpack.config.js | webpack.config.js | const path = require("path");
module.exports = {
entry: path.resolve(__dirname, "./source/index.js"),
externals: {
buttercup: "buttercup"
},
module: {
rules : [
{
test: /\.(js|esm)$/,
use: {
loader: "babel-loader",
options: {
"presets": [
["@babel/preset-env", {
"corejs": 3,
"useBuiltIns": "entry",
"targets": {
"node": "6"
}
}]
],
"plugins": [
["@babel/plugin-proposal-object-rest-spread", {
"useBuiltIns": true
}]
]
}
}
}
]
},
output: {
filename: "buttercup-importer.js",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "./dist")
},
target: "node"
};
| const path = require("path");
module.exports = {
entry: path.resolve(__dirname, "./source/index.js"),
externals: {
argon2: "argon2",
buttercup: "buttercup",
kdbxweb: "kdbxweb"
},
module: {
rules : [
{
test: /\.(js|esm)$/,
use: {
loader: "babel-loader",
options: {
"presets": [
["@babel/preset-env", {
"corejs": 3,
"useBuiltIns": "entry",
"targets": {
"node": "6"
}
}]
],
"plugins": [
["@babel/plugin-proposal-object-rest-spread", {
"useBuiltIns": true
}]
]
}
}
}
]
},
output: {
filename: "buttercup-importer.js",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "./dist")
},
target: "node"
};
| Split dependencies out in webpack to reduce bundle size | Split dependencies out in webpack to reduce bundle size
| JavaScript | mit | perry-mitchell/buttercup-importer | ---
+++
@@ -4,7 +4,9 @@
entry: path.resolve(__dirname, "./source/index.js"),
externals: {
- buttercup: "buttercup"
+ argon2: "argon2",
+ buttercup: "buttercup",
+ kdbxweb: "kdbxweb"
},
module: { |
6851efdd1fd5d214c70eb8db093e6d158870eece | webpack.config.js | webpack.config.js | var webpack = require('webpack');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
'./scripts/index'
],
output: {
path: __dirname,
filename: 'bundle.js',
publicPath: '/scripts/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [
{ test: /\.js$/, loaders: ['react-hot', 'jsx?harmony'] },
]
}
};
| var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server',
'./scripts/index'
],
output: {
path: __dirname,
filename: 'bundle.js',
publicPath: '/scripts/'
},
plugins: [
new webpack.HotModuleReplacementPlugin()
],
resolve: {
extensions: ['', '.js']
},
module: {
loaders: [
{ test: /\.js$/, loaders: ['react-hot', 'jsx?harmony'] },
]
}
};
| Add devtool: 'eval' for Chrome DevTools | Add devtool: 'eval' for Chrome DevTools
| JavaScript | mit | getguesstimate/guesstimate-app | ---
+++
@@ -1,6 +1,7 @@
var webpack = require('webpack');
module.exports = {
+ devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/dev-server', |
485af180a0407d2961e53609ab379bdd3bdb1c67 | webpack.config.js | webpack.config.js | const TerserJsPlugin = require('terser-webpack-plugin');
const serverBuild = {
mode: 'production',
entry: './src/twig.js',
target: 'node',
node: false,
output: {
path: __dirname,
filename: 'twig.js',
library: 'Twig',
libraryTarget: 'umd'
},
optimization: {
minimize: false
}
};
const clientBuild = {
mode: 'production',
entry: './src/twig.js',
target: 'web',
node: {
__dirname: false,
__filename: false
},
module: {
rules: [
{
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [
'@babel/plugin-transform-modules-commonjs',
'@babel/plugin-transform-runtime'
]
}
}
}
]
},
output: {
path: __dirname,
filename: 'twig.min.js',
library: 'Twig',
libraryTarget: 'umd'
},
optimization: {
minimize: true,
minimizer: [new TerserJsPlugin({
include: /\.min\.js$/
})]
}
};
module.exports = [serverBuild, clientBuild];
| const TerserJsPlugin = require('terser-webpack-plugin');
const commonModule = {
exclude: /(node_modules)/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
plugins: [
"@babel/plugin-transform-modules-commonjs",
"@babel/plugin-transform-runtime"
]
}
}
};
const serverBuild = {
mode: 'production',
entry: './src/twig.js',
target: 'node',
node: false,
output: {
path: __dirname,
filename: 'twig.js',
library: 'Twig',
libraryTarget: 'umd'
},
module: {
rules: [commonModule],
},
optimization: {
minimize: false
}
};
const clientBuild = {
mode: 'production',
entry: './src/twig.js',
target: 'web',
node: {
__dirname: false,
__filename: false
},
module: {
rules: [commonModule]
},
output: {
path: __dirname,
filename: 'twig.min.js',
library: 'Twig',
libraryTarget: 'umd'
},
optimization: {
minimize: true,
minimizer: [new TerserJsPlugin({
include: /\.min\.js$/
})]
}
};
module.exports = [serverBuild, clientBuild];
| Add babel preset on serverBuild | Add babel preset on serverBuild
| JavaScript | bsd-2-clause | twigjs/twig.js,justjohn/twig.js,twigjs/twig.js,twigjs/twig.js,justjohn/twig.js,justjohn/twig.js | ---
+++
@@ -1,4 +1,18 @@
const TerserJsPlugin = require('terser-webpack-plugin');
+
+const commonModule = {
+ exclude: /(node_modules)/,
+ use: {
+ loader: "babel-loader",
+ options: {
+ presets: ["@babel/preset-env"],
+ plugins: [
+ "@babel/plugin-transform-modules-commonjs",
+ "@babel/plugin-transform-runtime"
+ ]
+ }
+ }
+};
const serverBuild = {
mode: 'production',
@@ -10,6 +24,9 @@
filename: 'twig.js',
library: 'Twig',
libraryTarget: 'umd'
+ },
+ module: {
+ rules: [commonModule],
},
optimization: {
minimize: false
@@ -25,21 +42,7 @@
__filename: false
},
module: {
- rules: [
- {
- exclude: /(node_modules)/,
- use: {
- loader: 'babel-loader',
- options: {
- presets: ['@babel/preset-env'],
- plugins: [
- '@babel/plugin-transform-modules-commonjs',
- '@babel/plugin-transform-runtime'
- ]
- }
- }
- }
- ]
+ rules: [commonModule]
},
output: {
path: __dirname, |
32acbf191be290f0eccf756f5f6dc28067e3c565 | client/sw-precache-config.js | client/sw-precache-config.js | module.exports = {
navigateFallback: '/index.html',
runtimeCaching: [{
urlPattern: /\/api\/search\/.*/,
handler: 'networkFirst',
options: {
cache: {
maxEntries: 100,
name: 'search-cache',
},
},
urlPattern: /\/api\/.*/,
handler: 'networkFirst',
options: {
cache: {
maxEntries: 1000,
name: 'api-cache',
},
},
}],
}
| module.exports = {
navigateFallback: '/index.html',
runtimeCaching: [{
urlPattern: /\/api\/search\/.*/,
handler: 'networkFirst',
options: {
cache: {
maxEntries: 100,
name: 'search-cache',
},
},
urlPattern: /\/api\/.*/,
handler: 'fastest',
options: {
cache: {
maxEntries: 1000,
name: 'api-cache',
},
},
}],
}
| Use fastest method for api calls other than search | Use fastest method for api calls other than search
| JavaScript | apache-2.0 | customelements/v2,webcomponents/webcomponents.org,andymutton/beta,customelements/v2,andymutton/beta,andymutton/v2,andymutton/beta,andymutton/v2,andymutton/beta,webcomponents/webcomponents.org,andymutton/v2,webcomponents/webcomponents.org,andymutton/v2,customelements/v2,customelements/v2 | ---
+++
@@ -10,7 +10,7 @@
},
},
urlPattern: /\/api\/.*/,
- handler: 'networkFirst',
+ handler: 'fastest',
options: {
cache: {
maxEntries: 1000, |
6a15410123e9650f003c7a97ef091e08145dc4eb | src/actions/budgets.js | src/actions/budgets.js | import { ActionTypes } from '../config/constants';
import { ref } from '../config/constants';
export const addItem = payload => {
return {
type: ActionTypes.BUDGETS_ADD_ITEM,
payload,
}
}
export const removeItem = payload => {
return {
type: ActionTypes.BUDGETS_REMOVE_ITEM,
payload,
}
}
export const subscribe = payload => {
return dispatch => {
dispatch({
type: ActionTypes.BUDGETS_SUBSCRIBE,
})
const itemsRef = ref.child(`items`);
itemsRef.on('value', snapshot => {
const itemList = snapshot.val();
dispatch({
type: ActionTypes.BUDGETS_UPDATE,
payload: {
itemList: itemList,
}
});
});
}
}
export const search = payload => {
return {
type: ActionTypes.BUDGETS_SEARCH,
payload,
}
}
export const toggleColumn = payload => {
return {
type: ActionTypes.BUDGETS_TOGGLE_COL,
payload,
}
}
export const updateItem = payload => {
return {
type: ActionTypes.BUDGETS_UPDATE_ITEM,
payload,
}
} | import { ActionTypes } from '../config/constants';
import { ref } from '../config/constants';
export const addItem = payload => {
return dispatch => {
const itemRef = ref.child(`items/${payload.item.id}`);
itemRef.set( payload.item );
dispatch({
type: ActionTypes.BUDGETS_ADD_ITEM,
payload,
});
}
}
export const removeItem = payload => {
return dispatch => {
const itemRef = ref.child(`items/${payload.itemId}`);
itemRef.remove();
dispatch({
type: ActionTypes.BUDGETS_REMOVE_ITEM,
payload,
});
}
}
export const subscribe = payload => {
return dispatch => {
dispatch({
type: ActionTypes.BUDGETS_SUBSCRIBE,
})
const itemsRef = ref.child(`items`);
itemsRef.on('value', snapshot => {
const itemList = snapshot.val();
dispatch({
type: ActionTypes.BUDGETS_UPDATE,
payload: {
itemList: itemList,
}
});
});
}
}
export const search = payload => {
return {
type: ActionTypes.BUDGETS_SEARCH,
payload,
}
}
export const toggleColumn = payload => {
return {
type: ActionTypes.BUDGETS_TOGGLE_COL,
payload,
}
}
export const updateItem = payload => {
return dispatch => {
const itemRef = ref.child(`items/${payload.updatedItem.id}`);
itemRef.update(payload.updatedItem);
dispatch({
type: ActionTypes.BUDGETS_UPDATE_ITEM,
payload,
})
}
} | Update items in Firebase on change | Update items in Firebase on change
Initially only read operators were implemented.
The following write operators are now supported:
- Edit item
- Delete item
- Add item
| JavaScript | mit | nadavspi/UnwiseConnect,nadavspi/UnwiseConnect,nadavspi/UnwiseConnect | ---
+++
@@ -2,16 +2,28 @@
import { ref } from '../config/constants';
export const addItem = payload => {
- return {
- type: ActionTypes.BUDGETS_ADD_ITEM,
- payload,
+ return dispatch => {
+ const itemRef = ref.child(`items/${payload.item.id}`);
+
+ itemRef.set( payload.item );
+
+ dispatch({
+ type: ActionTypes.BUDGETS_ADD_ITEM,
+ payload,
+ });
}
}
export const removeItem = payload => {
- return {
- type: ActionTypes.BUDGETS_REMOVE_ITEM,
- payload,
+ return dispatch => {
+ const itemRef = ref.child(`items/${payload.itemId}`);
+
+ itemRef.remove();
+
+ dispatch({
+ type: ActionTypes.BUDGETS_REMOVE_ITEM,
+ payload,
+ });
}
}
@@ -51,8 +63,14 @@
}
export const updateItem = payload => {
- return {
- type: ActionTypes.BUDGETS_UPDATE_ITEM,
- payload,
+ return dispatch => {
+ const itemRef = ref.child(`items/${payload.updatedItem.id}`);
+
+ itemRef.update(payload.updatedItem);
+
+ dispatch({
+ type: ActionTypes.BUDGETS_UPDATE_ITEM,
+ payload,
+ })
}
} |
818ff925d39f419a290ec46c28c5cea39de23906 | config/ember-try.js | config/ember-try.js | module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-1.13.8',
dependencies: {
'ember': '1.13.8',
'ember-data': '1.13.9'
}
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release',
'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'release'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta'
},
resolutions: {
'ember': 'beta'
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary'
},
resolutions: {
'ember': 'canary'
}
}
]
};
| module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-1.13.8',
dependencies: {
'ember': '1.13.8',
'ember-data': '1.13.9'
}
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release',
'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'release'
}
},
{
name: 'ember-beta',
dependencies: {
'ember': 'components/ember#beta',
'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'beta'
}
},
{
name: 'ember-canary',
dependencies: {
'ember': 'components/ember#canary',
'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'canary'
}
}
]
};
| Use 2.x flavor of ember data in canary and beta. | Use 2.x flavor of ember data in canary and beta.
| JavaScript | mit | mixonic/ember-cli-mirage,flexyford/ember-cli-mirage,martinmaillard/ember-cli-mirage,IAmJulianAcosta/ember-cli-mirage,oliverbarnes/ember-cli-mirage,lazybensch/ember-cli-mirage,mydea/ember-cli-mirage,constantm/ember-cli-mirage,oliverbarnes/ember-cli-mirage,IAmJulianAcosta/ember-cli-mirage,HeroicEric/ember-cli-mirage,ronco/ember-cli-mirage,mixonic/ember-cli-mirage,unchartedcode/ember-cli-mirage,ballPointPenguin/ember-cli-mirage,jerel/ember-cli-mirage,unchartedcode/ember-cli-mirage,blimmer/ember-cli-mirage,blimmer/ember-cli-mirage,samselikoff/ember-cli-mirage,samselikoff/ember-cli-mirage,ronco/ember-cli-mirage,samselikoff/ember-cli-mirage,makepanic/ember-cli-mirage,martinmaillard/ember-cli-mirage,flexyford/ember-cli-mirage,escobera/ember-cli-mirage,mydea/ember-cli-mirage,unchartedcode/ember-cli-mirage,HeroicEric/ember-cli-mirage,ibroadfo/ember-cli-mirage,samselikoff/ember-cli-mirage,alecho/ember-cli-mirage,jherdman/ember-cli-mirage,escobera/ember-cli-mirage,ibroadfo/ember-cli-mirage,LevelbossMike/ember-cli-mirage,jherdman/ember-cli-mirage,alvinvogelzang/ember-cli-mirage,alvinvogelzang/ember-cli-mirage,kategengler/ember-cli-mirage,lependu/ember-cli-mirage,cs3b/ember-cli-mirage,jherdman/ember-cli-mirage,constantm/ember-cli-mirage,cibernox/ember-cli-mirage,jherdman/ember-cli-mirage,unchartedcode/ember-cli-mirage,kategengler/ember-cli-mirage,alecho/ember-cli-mirage,cs3b/ember-cli-mirage,ballPointPenguin/ember-cli-mirage,jamesdixon/ember-cli-mirage,LevelbossMike/ember-cli-mirage,lependu/ember-cli-mirage,lazybensch/ember-cli-mirage,makepanic/ember-cli-mirage,cibernox/ember-cli-mirage,jerel/ember-cli-mirage,jamesdixon/ember-cli-mirage | ---
+++
@@ -24,7 +24,8 @@
{
name: 'ember-beta',
dependencies: {
- 'ember': 'components/ember#beta'
+ 'ember': 'components/ember#beta',
+ 'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'beta'
@@ -33,7 +34,8 @@
{
name: 'ember-canary',
dependencies: {
- 'ember': 'components/ember#canary'
+ 'ember': 'components/ember#canary',
+ 'ember-data': 'v2.0.0-beta.2'
},
resolutions: {
'ember': 'canary' |
826009860e444c74fbb20d668327a4f49e8f678d | public/scripts/chat.js | public/scripts/chat.js | new Vue({
el: '#app',
// Using ES6 string litteral delimiters because
// Go uses {{ . }} for its templates
delimiters: ['${', '}'],
data: {
ws: null,
message: '',
chat: [],
},
created: function() {
let protocol = (window.location.protocol === 'https') ? 'wss' : 'ws'
this.ws = new WebSocket(`${protocol}://${window.location.host}/ws`)
this.ws.addEventListener('message', (e) => {
let { user, avatar, content } = JSON.parse(e.data)
this.chat.push({ user, avatar, content })
})
},
methods: {
send: function() {
if (!this.message) {
return
}
this.ws.send(
JSON.stringify({
content: this.message,
})
)
this.message = ''
},
}
})
| new Vue({
el: '#app',
// Using ES6 string litteral delimiters because
// Go uses {{ . }} for its templates
delimiters: ['${', '}'],
data: {
ws: null,
message: '',
chat: [],
},
created: function() {
let protocol = (window.location.protocol === 'https:') ? 'wss:' : 'ws:'
this.ws = new WebSocket(`${protocol}//${window.location.host}/ws`)
this.ws.addEventListener('message', (e) => {
let { user, avatar, content } = JSON.parse(e.data)
this.chat.push({ user, avatar, content })
})
},
methods: {
send: function() {
if (!this.message) {
return
}
this.ws.send(
JSON.stringify({
content: this.message,
})
)
this.message = ''
},
}
})
| Set protocol correctly ... oops | Set protocol correctly ... oops
| JavaScript | mit | AntonioVdlC/chat,AntonioVdlC/chat,AntonioVdlC/chat | ---
+++
@@ -12,8 +12,8 @@
},
created: function() {
- let protocol = (window.location.protocol === 'https') ? 'wss' : 'ws'
- this.ws = new WebSocket(`${protocol}://${window.location.host}/ws`)
+ let protocol = (window.location.protocol === 'https:') ? 'wss:' : 'ws:'
+ this.ws = new WebSocket(`${protocol}//${window.location.host}/ws`)
this.ws.addEventListener('message', (e) => {
let { user, avatar, content } = JSON.parse(e.data)
this.chat.push({ user, avatar, content }) |
c71f6d3aa4807e6d384846519f266a8bdb4c8e72 | create-user.js | create-user.js | 'use strict';
const path = require('path');
const encryptor = require('./src/encryptor');
const argv = process.argv.slice(2);
if(argv.length != 2) {
console.log('Usage: node create-user.js USERNAME PASSWORD');
process.exit(1);
}
encryptor
.encrypt('{}', path.join('./data', `${argv[0]}.dat`), argv[1])
.then(() => {
console.log('User file created!');
process.exit(0);
})
.catch(err => {
console.log('Error: ', e);
process.exit(1);
});
| 'use strict';
const path = require('path');
const encryptor = require('./src/encryptor');
const argv = process.argv.slice(2);
if(argv.length != 2) {
console.log('Usage: node create-user.js USERNAME PASSWORD');
process.exit(1);
}
encryptor
.encrypt(JSON.stringify({
services: []
}), path.join('./data', `${argv[0]}.dat`), argv[1])
.then(() => {
console.log('User file created!');
process.exit(0);
})
.catch(err => {
console.log('Error: ', e);
process.exit(1);
});
| Create user adiciona json básico no arquivo | Create user adiciona json básico no arquivo
| JavaScript | mit | gustavopaes/password-manager,gustavopaes/password-manager,gustavopaes/password-manager | ---
+++
@@ -10,7 +10,9 @@
}
encryptor
- .encrypt('{}', path.join('./data', `${argv[0]}.dat`), argv[1])
+ .encrypt(JSON.stringify({
+ services: []
+ }), path.join('./data', `${argv[0]}.dat`), argv[1])
.then(() => {
console.log('User file created!');
process.exit(0); |
c771edf30259bae85af719dc27fa5d07999160c8 | scripts/dbsetup.js | scripts/dbsetup.js | let db;
try {
db = require("rethinkdbdash")(require("../config").connectionOpts);
} catch (err) {
console.error("You haven't installed rethinkdbdash npm module or you didn't have configured the bot yet! Please do so.");
}
(async function () {
if (!db) return;
const tables = await db.tableList();
if (!tables.includes("blacklist")) await db.tableCreate("blacklist");
if (!tables.includes("session")) await db.tableCreate("session");
if (!tables.includes("configs")) await db.tableCreate("configs");
if (!tables.includes("feedback")) await db.tableCreate("feedback");
if (!tables.includes("tags")) await db.tableCreate("tags");
if (!tables.includes("profile")) await db.tableCreate("profile");
if (!tables.includes("modlog")) await db.tableCreate("modlog");
if (!tables.includes("extensions")) await db.tableCreate("extensions");
if (!tables.includes("extension_store")) await db.tableCreate("extension_store");
console.log("All set up!");
process.exit(0);
})();
| let db;
try {
db = require("rethinkdbdash")(require("../config").connectionOpts);
} catch (err) {
console.error("You haven't installed rethinkdbdash npm module or you didn't have configured the bot yet! Please do so.");
}
(async function () {
if (!db) return;
const tables = await db.tableList();
if (!tables.includes("blacklist")) await db.tableCreate("blacklist");
if (!tables.includes("session")) await db.tableCreate("session");
if (!tables.includes("configs")) await db.tableCreate("configs");
if (!tables.includes("feedback")) await db.tableCreate("feedback");
if (!tables.includes("tags")) await db.tableCreate("tags");
if (!tables.includes("profile")) await db.tableCreate("profile");
if (!tables.includes("modlog")) await db.tableCreate("modlog");
if (!tables.includes("extensions")) await db.tableCreate("extensions");
if (!tables.includes("extension_store")) await db.tableCreate("extension_store");
if (!tables.includes("phone")) await db.tableCreate("phone");
console.log("All set up!");
process.exit(0);
})();
| Create the phone table when it existn't | Create the phone table when it existn't
| JavaScript | mit | TTtie/TTtie-Bot,TTtie/TTtie-Bot,TTtie/TTtie-Bot | ---
+++
@@ -16,6 +16,7 @@
if (!tables.includes("modlog")) await db.tableCreate("modlog");
if (!tables.includes("extensions")) await db.tableCreate("extensions");
if (!tables.includes("extension_store")) await db.tableCreate("extension_store");
+ if (!tables.includes("phone")) await db.tableCreate("phone");
console.log("All set up!");
process.exit(0);
})(); |
5620ebe8a3c22927e2bacba2ef7ea12157469b8d | js/mentions.js | js/mentions.js | jQuery(function( $ ) {
var mOptions = $.extend({}, mOpt);
console.log(mOptions);
$('#cmessage').atwho({
at: "@",
displayTpl: "<li>${username}<small> ${name}</small></li>",
insertTpl: "${atwho-at}${username}",
callbacks: {
remoteFilter: function(query, callback) {
console.log('Query: ' + query);
//
if(query === null || query.length < 1){
return callback(null);
}
$.ajax({
url: mOptions.path + "index.php?mq=" + query,
type: 'GET',
dataType: 'json',
success: function(data) {
callback(data);
console.log('Data: ' + data);
},
error: function() {
console.warn('Didn\'t Work');
},
beforeSend: function(xhr) {
//xhr.setRequestHeader('Authorization', localStorageService.get('authToken'));
}
});
}
},
searchKey: "username",
limit: 5,
maxLen: 15,
displayTimeout: 300,
highlightFirst: true,
delay: 50,
});
});
| jQuery(function( $ ) {
var mOptions = $.extend({}, mOpt);
console.log(mOptions);
$('#cmessage').atwho({
at: "@",
displayTpl: "<li>${username}<small> ${name}</small></li>",
insertTpl: "${atwho-at}${username}",
callbacks: {
remoteFilter: function(query, callback) {
console.log('Query: ' + query);
//
/*
if(query === null || query.length < 1){
return callback(null);
}*/
$.ajax({
url: mOptions.path + "index.php?mq=" + query,
type: 'GET',
dataType: 'json',
success: function(data) {
callback(data);
console.log('Data: ' + data);
},
error: function() {
console.warn('Didn\'t Work');
},
beforeSend: function(xhr) {
//xhr.setRequestHeader('Authorization', localStorageService.get('authToken'));
}
});
}
},
searchKey: "username",
limit: 5,
maxLen: 15,
minLen: 1,
displayTimeout: 300,
highlightFirst: true,
});
});
| Set atwho.js minLen param to 1 default was 0. | Set atwho.js minLen param to 1 default was 0.
| JavaScript | agpl-3.0 | arunshekher/mentions,arunshekher/mentions | ---
+++
@@ -12,9 +12,10 @@
console.log('Query: ' + query);
//
+ /*
if(query === null || query.length < 1){
return callback(null);
- }
+ }*/
$.ajax({
url: mOptions.path + "index.php?mq=" + query,
@@ -39,9 +40,9 @@
searchKey: "username",
limit: 5,
maxLen: 15,
+ minLen: 1,
displayTimeout: 300,
highlightFirst: true,
- delay: 50,
});
|
6053767e229e18cb4f416a44ede954c2a90ba5ee | src/can-be-asserted.js | src/can-be-asserted.js | import _ from 'lodash';
export default function canBeAsserted(vdom) {
return _.all([].concat(vdom), node =>
node
&& typeof node === 'object'
&& typeof node.type === 'string'
&& (!node.props || typeof node.props === 'object')
);
} | import _ from 'lodash';
import React from 'react';
export default function canBeAsserted(vdom) {
return _.all([].concat(vdom), node =>
React.isValidElement(node) ||
(node
&& typeof node === 'object'
&& typeof node.type === 'string'
&& (!node.props || typeof node.props === 'object'))
);
} | Add validation for local component classes as well First try the official method, then fall-back to duck typing. | Add validation for local component classes as well
First try the official method, then fall-back to duck typing.
| JavaScript | mit | electricmonk/chai-react-element | ---
+++
@@ -1,10 +1,12 @@
import _ from 'lodash';
+import React from 'react';
export default function canBeAsserted(vdom) {
return _.all([].concat(vdom), node =>
- node
+ React.isValidElement(node) ||
+ (node
&& typeof node === 'object'
&& typeof node.type === 'string'
- && (!node.props || typeof node.props === 'object')
+ && (!node.props || typeof node.props === 'object'))
);
} |
1d92c984fc1d0876b26378015a33ba1795733404 | lib/EditorInserter.js | lib/EditorInserter.js | 'use babel';
import { TextEditor } from 'atom';
export default class EditorInserter {
setText(text) {
this.insertionText = text;
}
performInsertion() {
if (!this.insertionText) {
console.error("No text to insert.");
return;
}
this.textEditor = atom.workspace.getActiveTextEditor();
//Break up lines
var lines = this.insertionText.split("\n");
//Start by inserting the first line
this.textEditor.insertText(lines[0]);
//Go back to the very beginning of the line and save the tab spacing
var tabSpacing = " ";
//Now prepend this tab spacing to all other lines and concatenate them
var concatenation = "";
for (let i = 1; i < lines.length; i++) {
concatenation += tabSpacing + lines[i];
}
//Finally, insert this concatenation to complete the insertion
this.textEditor.insertText(concatenation);
}
}
| 'use babel';
import { TextEditor } from 'atom';
export default class EditorInserter {
setText(text) {
this.insertionText = text;
}
performInsertion() {
//Make sure there's actually text to insert before continuing
if (!this.insertionText) {
console.error("No text to insert.");
return;
}
//Get the active text editor
var textEditor = atom.workspace.getActiveTextEditor();
//Get all current selections
var selections = textEditor.getSelections();
//Perform an insertion for each selection taking into account its own tabbing
for (let i = 0; i < selections.length; i++) {
//Break up lines
var lines = this.insertionText.split("\n");
//Go back to the very beginning of the line and save the tab spacing
selections[i].selectToBeginningOfLine();
var selectedText = selections[i].getText();
var tabSpacing = "";
for (let j = 0; j < selectedText.length; j++) {
//Stop collecting tab characters when the first non-(hard/soft)tab character is reached
if (selectedText[j] != "\t" && selectedText[j] != " ") {
break;
}
tabSpacing += selectedText[j];
}
//Place selection back to where it was initially
selections[i].selectRight(selectedText.length);
//Start by inserting the first line
selections[i].insertText(lines[0]);
//Now prepend this tab spacing to all other lines and concatenate them
var concatenation = "";
for (let j = 1; j < lines.length; j++) {
concatenation += tabSpacing + lines[j];
}
//Finally, insert this concatenation to complete the insertion
selections[i].insertText(concatenation);
}
}
}
| Add tabbing to example insertion. | Add tabbing to example insertion.
| JavaScript | mit | Coteh/syntaxdb-atom-plugin | ---
+++
@@ -8,23 +8,41 @@
}
performInsertion() {
+ //Make sure there's actually text to insert before continuing
if (!this.insertionText) {
console.error("No text to insert.");
return;
}
- this.textEditor = atom.workspace.getActiveTextEditor();
- //Break up lines
- var lines = this.insertionText.split("\n");
- //Start by inserting the first line
- this.textEditor.insertText(lines[0]);
- //Go back to the very beginning of the line and save the tab spacing
- var tabSpacing = " ";
- //Now prepend this tab spacing to all other lines and concatenate them
- var concatenation = "";
- for (let i = 1; i < lines.length; i++) {
- concatenation += tabSpacing + lines[i];
+ //Get the active text editor
+ var textEditor = atom.workspace.getActiveTextEditor();
+ //Get all current selections
+ var selections = textEditor.getSelections();
+ //Perform an insertion for each selection taking into account its own tabbing
+ for (let i = 0; i < selections.length; i++) {
+ //Break up lines
+ var lines = this.insertionText.split("\n");
+ //Go back to the very beginning of the line and save the tab spacing
+ selections[i].selectToBeginningOfLine();
+ var selectedText = selections[i].getText();
+ var tabSpacing = "";
+ for (let j = 0; j < selectedText.length; j++) {
+ //Stop collecting tab characters when the first non-(hard/soft)tab character is reached
+ if (selectedText[j] != "\t" && selectedText[j] != " ") {
+ break;
+ }
+ tabSpacing += selectedText[j];
+ }
+ //Place selection back to where it was initially
+ selections[i].selectRight(selectedText.length);
+ //Start by inserting the first line
+ selections[i].insertText(lines[0]);
+ //Now prepend this tab spacing to all other lines and concatenate them
+ var concatenation = "";
+ for (let j = 1; j < lines.length; j++) {
+ concatenation += tabSpacing + lines[j];
+ }
+ //Finally, insert this concatenation to complete the insertion
+ selections[i].insertText(concatenation);
}
- //Finally, insert this concatenation to complete the insertion
- this.textEditor.insertText(concatenation);
}
} |
a1daba2ef60ffb34c73932f68fefb727d45d4568 | src/locale/en/build_distance_in_words_localize_fn/index.js | src/locale/en/build_distance_in_words_localize_fn/index.js | module.exports = function buildDistanceInWordsLocalizeFn () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'less than a second',
other: 'less than ${count} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
other: 'less than ${count} minutes'
},
xMinutes: {
one: '1 minute',
other: '${count} minutes'
},
aboutXHours: {
one: 'about 1 hour',
other: 'about ${count} hours'
},
xDays: {
one: '1 day',
other: '${count} days'
},
aboutXMonths: {
one: 'about 1 month',
other: 'about ${count} months'
},
xMonths: {
one: '1 month',
other: '${count} months'
},
aboutXYears: {
one: 'about 1 year',
other: 'about ${count} years'
},
overXYears: {
one: 'over 1 year',
other: 'over ${count} years'
},
almostXYears: {
one: 'almost 1 year',
other: 'almost ${count} years'
}
}
return function (token, count) {
if (count === undefined) {
return distanceInWordsLocale[token]
} else if (count === 1) {
return distanceInWordsLocale[token].one
} else {
return distanceInWordsLocale[token].other.replace('${count}', count)
}
}
}
| module.exports = function buildDistanceInWordsLocalizeFn () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'less than a second',
other: 'less than {{count}} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
other: 'less than {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'about 1 hour',
other: 'about {{count}} hours'
},
xDays: {
one: '1 day',
other: '{{count}} days'
},
aboutXMonths: {
one: 'about 1 month',
other: 'about {{count}} months'
},
xMonths: {
one: '1 month',
other: '{{count}} months'
},
aboutXYears: {
one: 'about 1 year',
other: 'about {{count}} years'
},
overXYears: {
one: 'over 1 year',
other: 'over {{count}} years'
},
almostXYears: {
one: 'almost 1 year',
other: 'almost {{count}} years'
}
}
return function (token, count) {
if (count === undefined) {
return distanceInWordsLocale[token]
} else if (count === 1) {
return distanceInWordsLocale[token].one
} else {
return distanceInWordsLocale[token].other.replace('{{count}}', count)
}
}
}
| Use handlebars string format in distanceInWords localize function | Use handlebars string format in distanceInWords localize function
| JavaScript | mit | date-fns/date-fns,js-fns/date-fns,date-fns/date-fns,date-fns/date-fns,js-fns/date-fns | ---
+++
@@ -2,54 +2,54 @@
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'less than a second',
- other: 'less than ${count} seconds'
+ other: 'less than {{count}} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
- other: 'less than ${count} minutes'
+ other: 'less than {{count}} minutes'
},
xMinutes: {
one: '1 minute',
- other: '${count} minutes'
+ other: '{{count}} minutes'
},
aboutXHours: {
one: 'about 1 hour',
- other: 'about ${count} hours'
+ other: 'about {{count}} hours'
},
xDays: {
one: '1 day',
- other: '${count} days'
+ other: '{{count}} days'
},
aboutXMonths: {
one: 'about 1 month',
- other: 'about ${count} months'
+ other: 'about {{count}} months'
},
xMonths: {
one: '1 month',
- other: '${count} months'
+ other: '{{count}} months'
},
aboutXYears: {
one: 'about 1 year',
- other: 'about ${count} years'
+ other: 'about {{count}} years'
},
overXYears: {
one: 'over 1 year',
- other: 'over ${count} years'
+ other: 'over {{count}} years'
},
almostXYears: {
one: 'almost 1 year',
- other: 'almost ${count} years'
+ other: 'almost {{count}} years'
}
}
@@ -59,7 +59,7 @@
} else if (count === 1) {
return distanceInWordsLocale[token].one
} else {
- return distanceInWordsLocale[token].other.replace('${count}', count)
+ return distanceInWordsLocale[token].other.replace('{{count}}', count)
}
}
} |
e8b3cb735567ebc27a842c275eab9aac306c8ea2 | assets/www/map/js/views/point-view.js | assets/www/map/js/views/point-view.js | var PointView = Backbone.View.extend({
initialize:function (options) {
this.model = options.model;
this.gmap = options.gmap;
this.marker = new google.maps.Marker({
position:this.model.getGLocation(),
poiType:this.model.getPoiType(),
visible:true,
icon:this.model.get('pin'),
map:null
});
// render the initial point state
this.render();
},
render:function () {
this.marker.setMap(this.gmap);
},
remove:function () {
this.marker.setMap(null);
this.marker = null;
}
});
| var PointView = Backbone.View.extend({
initialize:function (options) {
this.model = options.model;
this.gmap = options.gmap;
this.marker = new google.maps.Marker({
position:this.model.getGLocation(),
poiType:this.model.getPoiType(),
visible:true,
icon:this.model.get('pin'),
map:null
});
var self = this;
this.model.on('change:locations', function () {
self.marker.setPosition(self.model.getGLocation());
});
// render the initial point state
this.render();
},
render:function () {
this.marker.setMap(this.gmap);
},
remove:function () {
this.marker.setMap(null);
this.marker = null;
}
});
| Change position on model location change. | Change position on model location change.
| JavaScript | bsd-3-clause | bwestlin/hermes,bwestlin/hermes,carllarsson/hermes,carllarsson/hermes,bwestlin/hermes,carllarsson/hermes | ---
+++
@@ -10,6 +10,12 @@
visible:true,
icon:this.model.get('pin'),
map:null
+ });
+
+ var self = this;
+
+ this.model.on('change:locations', function () {
+ self.marker.setPosition(self.model.getGLocation());
});
// render the initial point state |
afe38c01e268a04153e8a644b5e64c2fd4897d0e | lib/poolify.js | lib/poolify.js | 'use strict';
const poolified = Symbol('poolified');
const mixFlag = { [poolified]: true };
const duplicate = (factory, n) => (
new Array(n).fill().map(() => {
const instance = factory();
return Object.assign(instance, mixFlag);
})
);
const provide = callback => item => {
setImmediate(() => {
callback(item);
});
};
const poolify = (factory, min, norm, max) => {
let allocated = norm;
const pool = (par) => {
if (par && par[poolified]) {
const delayed = pool.delayed.shift();
if (delayed) delayed(par);
else pool.items.push(par);
return;
}
if (pool.items.length < min && allocated < max) {
const grow = Math.min(max - allocated, norm - pool.items.length);
allocated += grow;
const items = duplicate(factory, grow);
pool.items.push(...items);
}
const res = pool.items.pop();
if (!par) return res;
const callback = provide(par);
if (res) callback(res);
else pool.delayed.push(callback);
};
return Object.assign(pool, {
items: duplicate(factory, norm),
delayed: []
});
};
module.exports = {
poolify,
};
| 'use strict';
const poolified = Symbol('poolified');
const mixFlag = { [poolified]: true };
const duplicate = (factory, n) => Array
.from({ length: n }, factory)
.map(instance => Object.assign(instance, mixFlag));
const provide = callback => item => {
setImmediate(() => {
callback(item);
});
};
const poolify = (factory, min, norm, max) => {
let allocated = norm;
const pool = (par) => {
if (par && par[poolified]) {
const delayed = pool.delayed.shift();
if (delayed) delayed(par);
else pool.items.push(par);
return;
}
if (pool.items.length < min && allocated < max) {
const grow = Math.min(max - allocated, norm - pool.items.length);
allocated += grow;
const items = duplicate(factory, grow);
pool.items.push(...items);
}
const res = pool.items.pop();
if (!par) return res;
const callback = provide(par);
if (res) callback(res);
else pool.delayed.push(callback);
};
return Object.assign(pool, {
items: duplicate(factory, norm),
delayed: []
});
};
module.exports = {
poolify,
};
| Use Array.from({ length: n }, factory) | Use Array.from({ length: n }, factory)
PR-URL: https://github.com/metarhia/metasync/pull/306
| JavaScript | mit | metarhia/MetaSync,DzyubSpirit/MetaSync,DzyubSpirit/MetaSync | ---
+++
@@ -4,12 +4,9 @@
const mixFlag = { [poolified]: true };
-const duplicate = (factory, n) => (
- new Array(n).fill().map(() => {
- const instance = factory();
- return Object.assign(instance, mixFlag);
- })
-);
+const duplicate = (factory, n) => Array
+ .from({ length: n }, factory)
+ .map(instance => Object.assign(instance, mixFlag));
const provide = callback => item => {
setImmediate(() => { |
d9fb86986d77688bfe606dad153b4e0c26125c83 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
qunit: {
files: ['jstests/index.html']
},
jshint: {
all: [
'Gruntfile.js',
'nbdiff/server/static/*.js'
],
options: {
jshintrc: '.jshintrc'
}
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('test', ['qunit']);
// Travis CI task.
grunt.registerTask('travis', ['jshint', 'qunit']);
grunt.registerTask('default', ['qunit', 'jshint']);
};
| module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
qunit: {
files: ['jstests/index.html']
},
jshint: {
all: [
'Gruntfile.js',
'jstests/*.js',
'nbdiff/server/static/*.js'
],
options: {
jshintrc: '.jshintrc'
}
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('test', ['qunit']);
// Travis CI task.
grunt.registerTask('travis', ['jshint', 'qunit']);
grunt.registerTask('default', ['qunit', 'jshint']);
};
| Add jstests to jshint checks | Add jstests to jshint checks
| JavaScript | mit | tarmstrong/nbdiff,tarmstrong/nbdiff,tarmstrong/nbdiff,tarmstrong/nbdiff | ---
+++
@@ -8,6 +8,7 @@
jshint: {
all: [
'Gruntfile.js',
+ 'jstests/*.js',
'nbdiff/server/static/*.js'
],
options: { |
248053f65310ee9e2702a16678f05b2076ca88f1 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json')
});
grunt.loadNpmTasks('grunt-release');
grunt.registerTask('message', function() {
grunt.log.writeln("use grunt release:{patch|minor|major}");
});
grunt.registerTask('default', ['message']);
};
| module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
release: {
options: {
tagName: 'v<%= version %>'
}
}
});
grunt.loadNpmTasks('grunt-release');
grunt.registerTask('message', function() {
grunt.log.writeln("use grunt release:{patch|minor|major}");
});
grunt.registerTask('default', ['message']);
};
| Use correct tag with grunt-release | Use correct tag with grunt-release
| JavaScript | mit | leszekhanusz/generator-knockout-bootstrap | ---
+++
@@ -2,7 +2,12 @@
// Project configuration.
grunt.initConfig({
- pkg: grunt.file.readJSON('package.json')
+ pkg: grunt.file.readJSON('package.json'),
+ release: {
+ options: {
+ tagName: 'v<%= version %>'
+ }
+ }
});
grunt.loadNpmTasks('grunt-release'); |
2fc93c70a7a674bed8a9d677d5ac5b4afd36e179 | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
rebuild: {
command: 'npm install --build-from-source'
}
},
jasmine_node: {
all: ['spec/']
}
});
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('default', ['shell:rebuild', 'jasmine_node:all']);
};
| module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
rebuild: {
command: 'npm install --build-from-source'
}
},
jasmine_node: {
all: ['spec/']
}
});
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('build', ['shell:rebuild']);
grunt.registerTask('test', ['jasmine_node:all']);
grunt.registerTask('default', ['build', 'test']);
};
| Split Grunt tasks into “build” and “test” | Split Grunt tasks into “build” and “test”
| JavaScript | bsd-2-clause | mross-pivotal/node-gemfire,gemfire/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,gemfire/node-gemfire,gemfire/node-gemfire,mross-pivotal/node-gemfire,mross-pivotal/node-gemfire | ---
+++
@@ -12,6 +12,10 @@
});
grunt.loadNpmTasks('grunt-jasmine-node');
grunt.loadNpmTasks('grunt-shell');
- grunt.registerTask('default', ['shell:rebuild', 'jasmine_node:all']);
+
+ grunt.registerTask('build', ['shell:rebuild']);
+ grunt.registerTask('test', ['jasmine_node:all']);
+
+ grunt.registerTask('default', ['build', 'test']);
};
|
cab2faf71d7b8d0e0c8950b2315879b7f39e835f | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
qunit: {
files: ['test/index.html']
}
});
grunt.loadNpmTasks('grunt-contrib-qunit');
// Default task.
grunt.registerTask('test', 'qunit');
// Travis CI task.
grunt.registerTask('travis', 'test');
};
// vim:ts=2:sw=2:et:
| module.exports = function(grunt) {
grunt.initConfig({
qunit: {
files: ['test/index.html']
},
jshint: {
all: ['Gruntfile.js', 'yt-looper.js', 'test/**/*.js'],
options: {
'-W014': true, // ignore [W014] Bad line breaking
},
},
});
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task.
grunt.registerTask('test', 'qunit');
// Travis CI task.
grunt.registerTask('travis', ['test','jshint']);
};
// vim:ts=2:sw=2:et:
| Add jshint to a test suite | Add jshint to a test suite
| JavaScript | cc0-1.0 | sk4zuzu/yt-looper,sk4zuzu/yt-looper,sk4zuzu/yt-looper,lidel/yt-looper,lidel/yt-looper,lidel/yt-looper | ---
+++
@@ -2,14 +2,21 @@
grunt.initConfig({
qunit: {
files: ['test/index.html']
- }
+ },
+ jshint: {
+ all: ['Gruntfile.js', 'yt-looper.js', 'test/**/*.js'],
+ options: {
+ '-W014': true, // ignore [W014] Bad line breaking
+ },
+ },
});
grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task.
grunt.registerTask('test', 'qunit');
// Travis CI task.
- grunt.registerTask('travis', 'test');
+ grunt.registerTask('travis', ['test','jshint']);
};
// vim:ts=2:sw=2:et: |
b32664408a5c57f30a734da5c925ca9453696d1c | js/findermodel.js | js/findermodel.js | 'use strict';
/**
* Finder Model - Main model that uses FinderJS
*
* @constructor
*/
var FinderModel = function (arg) {
// Assign `this` through `riot.observable()`
var self = riot.observable(this);
// Store args
self.args = arg;
// Create an instance of `Applait.Finder`
self.finder = new Applait.Finder({
type: "sdcard",
minSearchLength: 2,
debugMode: arg.debug
});
// Current search results
self.searchResults = [];
/**
* Reset all internals
*/
self.reset = function () {
self.searchResults = [];
self.finder.reset();
};
/**
* Initiate search
*
* @param {string} key - The search string
*/
self.search = function (key) {
self.reset();
self.finder.search(key);
};
/**
* Subscribe to Finder's fileFound event
*/
self.finder.on("fileFound", function (file) {
self.searchResults.push(file);
});
/**
* Subscribe to Finder's searchComplete event
*
* The `resultsFound` is triggered if any file is matched.
* Else, `noResults` is triggered
*/
self.finder.on("searchComplete", function () {
if (self.searchResults.length && self.finder.filematchcount) {
self.trigger("resultsFound");
} else {
self.trigger("noResults");
}
});
};
| 'use strict';
/**
* Finder Model - Main model that uses FinderJS
*
* @constructor
*/
var FinderModel = function (arg) {
// Assign `this` through `riot.observable()`
var self = riot.observable(this);
// Store args
self.args = arg;
// Create an instance of `Applait.Finder`
self.finder = new Applait.Finder({
type: "sdcard",
minSearchLength: 2,
debugMode: arg.debug
});
// Current search results
self.searchResults = [];
/**
* Reset all internals
*/
self.reset = function () {
self.searchResults = [];
self.finder.reset();
};
/**
* Initiate search
*
* @param {string} key - The search string
*/
self.search = function (key) {
self.reset();
self.finder.search(key);
};
/**
* Subscribe to Finder's fileFound event
*/
self.finder.on("fileFound", function (file) {
self.searchResults.push(file);
});
/**
* Subscribe to Finder's searchComplete event
*
* The `resultsFound` is triggered if any file is matched.
* Else, `noResults` is triggered
*/
self.finder.on("searchComplete", function () {
if (self.searchResults.length && self.finder.filematchcount) {
self.trigger("resultsFound");
} else {
self.trigger("noResults");
}
});
/**
* Provide a generic "load" method for routing
*/
self.load = function (path) {
self.trigger("load:" + path);
};
};
| Add a generic load method for routes | Add a generic load method for routes
Signed-off-by: Kaustav Das Modak <ba1ce5b1e09413a89404909d8d270942c5dadd14@yahoo.co.in>
| JavaScript | apache-2.0 | applait/finder,vasuki1996/finder,applait/finder,vasuki1996/finder | ---
+++
@@ -62,4 +62,10 @@
}
});
+ /**
+ * Provide a generic "load" method for routing
+ */
+ self.load = function (path) {
+ self.trigger("load:" + path);
+ };
}; |
b78927680317b26f44008debb33c2abc3db5712b | postcss.config.js | postcss.config.js | 'use strict';
module.exports = {
input: 'src/*.css',
dir: 'dist',
use: [
'postcss-import',
'postcss-import-url',
'postcss-custom-properties',
'postcss-normalize-charset',
'autoprefixer',
'postcss-reporter'
],
'postcss-import': {
plugins: [
require('postcss-copy')({
src: './src',
dest: './dist',
template: (file) => {
return `assets/${file.name}.${file.ext}`;
},
relativePath: (dir, file, result, opts) => {
return opts.dest;
}
})
]
},
'postcss-custom-properties': {
preserve: true
},
autoprefixer: {
browsers: [
'> 1% in JP'
]
},
'postcss-reporter': {
clearMessages: true
}
}
| 'use strict';
module.exports = {
input: 'src/*.css',
dir: 'dist',
use: [
'postcss-import',
'postcss-custom-properties',
'postcss-normalize-charset',
'autoprefixer',
'postcss-reporter'
],
'postcss-import': {
plugins: [
require('postcss-import-url'),
require('postcss-copy')({
src: './src',
dest: './dist',
template: file => {
return `assets/${file.name}.${file.ext}`;
},
relativePath: (dir, file, result, opts) => {
return opts.dest;
}
})
]
},
'postcss-custom-properties': {
preserve: true
},
autoprefixer: {
browsers: [
'> 1% in JP'
]
},
'postcss-reporter': {
clearMessages: true
}
}
| Change the time of loading external CSS | [change] Change the time of loading external CSS
| JavaScript | mit | seamile4kairi/japanese-fonts-css | ---
+++
@@ -5,7 +5,6 @@
dir: 'dist',
use: [
'postcss-import',
- 'postcss-import-url',
'postcss-custom-properties',
'postcss-normalize-charset',
'autoprefixer',
@@ -13,10 +12,11 @@
],
'postcss-import': {
plugins: [
+ require('postcss-import-url'),
require('postcss-copy')({
src: './src',
dest: './dist',
- template: (file) => {
+ template: file => {
return `assets/${file.name}.${file.ext}`;
},
relativePath: (dir, file, result, opts) => { |
bb76add5adfe95e4b95b004bf64c871cde3aaca5 | reviewboard/static/rb/js/models/diffModel.js | reviewboard/static/rb/js/models/diffModel.js | /*
* A diff to be uploaded to a server.
*
* For now, this is used only for uploading new diffs.
*
* It is expected that parentObject will be set to a ReviewRequest instance.
*/
RB.Diff = RB.BaseResource.extend({
rspNamespace: 'diff',
getErrorString: function(rsp) {
if (rsp.err.code == 207) {
return 'The file "' + rsp.file + '" (revision ' + rsp.revision +
') was not found in the repository';
}
return rsp.err.msg;
}
});
| /*
* A diff to be uploaded to a server.
*
* For now, this is used only for uploading new diffs.
*
* It is expected that parentObject will be set to a ReviewRequest instance.
*/
RB.Diff = RB.BaseResource.extend({
defaults: {
diff: null,
parentDiff: null,
basedir: ''
},
payloadFileKeys: ['path', 'parent_diff_path'],
rspNamespace: 'diff',
getErrorString: function(rsp) {
if (rsp.err.code == 207) {
return 'The file "' + rsp.file + '" (revision ' + rsp.revision +
') was not found in the repository';
}
return rsp.err.msg;
},
toJSON: function() {
var payload;
if (this.isNew()) {
payload = {
basedir: this.get('basedir'),
path: this.get('diff'),
parent_diff_path: this.get('parentDiff')
};
} else {
payload = RB.BaseResource.prototype.toJSON.apply(this, arguments);
}
return payload;
}
});
| Enhance RB.Diff to be able to create new diffs. | Enhance RB.Diff to be able to create new diffs.
The existing diff model didn't do very much, and was really meant for dealing
with existing diffs. This change adds some attributes and methods that allow it
to be used to create new diffs.
Testing done:
Used this in another change to create a diff from javascript.
Reviewed at http://reviews.reviewboard.org/r/4303/
| JavaScript | mit | reviewboard/reviewboard,davidt/reviewboard,1tush/reviewboard,1tush/reviewboard,custode/reviewboard,1tush/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,KnowNo/reviewboard,reviewboard/reviewboard,sgallagher/reviewboard,KnowNo/reviewboard,1tush/reviewboard,chipx86/reviewboard,reviewboard/reviewboard,bkochendorfer/reviewboard,sgallagher/reviewboard,bkochendorfer/reviewboard,custode/reviewboard,chipx86/reviewboard,1tush/reviewboard,davidt/reviewboard,chipx86/reviewboard,beol/reviewboard,sgallagher/reviewboard,brennie/reviewboard,1tush/reviewboard,custode/reviewboard,brennie/reviewboard,beol/reviewboard,beol/reviewboard,bkochendorfer/reviewboard,1tush/reviewboard,beol/reviewboard,KnowNo/reviewboard,custode/reviewboard,1tush/reviewboard,KnowNo/reviewboard,1tush/reviewboard,brennie/reviewboard,sgallagher/reviewboard,davidt/reviewboard,brennie/reviewboard,reviewboard/reviewboard,chipx86/reviewboard | ---
+++
@@ -6,6 +6,14 @@
* It is expected that parentObject will be set to a ReviewRequest instance.
*/
RB.Diff = RB.BaseResource.extend({
+ defaults: {
+ diff: null,
+ parentDiff: null,
+ basedir: ''
+ },
+
+ payloadFileKeys: ['path', 'parent_diff_path'],
+
rspNamespace: 'diff',
getErrorString: function(rsp) {
@@ -15,5 +23,21 @@
}
return rsp.err.msg;
+ },
+
+ toJSON: function() {
+ var payload;
+
+ if (this.isNew()) {
+ payload = {
+ basedir: this.get('basedir'),
+ path: this.get('diff'),
+ parent_diff_path: this.get('parentDiff')
+ };
+ } else {
+ payload = RB.BaseResource.prototype.toJSON.apply(this, arguments);
+ }
+
+ return payload;
}
}); |
f6d6955c6d459717a357872ae68a0b0eabc779bf | app/assets/javascripts/pageflow/media_player/volume_fading.js | app/assets/javascripts/pageflow/media_player/volume_fading.js | //= require_self
//= require_tree ./volume_fading
pageflow.mediaPlayer.volumeFading = function(player) {
if (!pageflow.browser.has('volume control support')) {
return pageflow.mediaPlayer.volumeFading.noop(player);
}
else if (pageflow.audioContext.get()) {
return pageflow.mediaPlayer.volumeFading.webAudio(
player,
pageflow.audioContext.get()
);
}
else {
return pageflow.mediaPlayer.volumeFading.interval(player);
}
};
| //= require_self
//= require_tree ./volume_fading
pageflow.mediaPlayer.volumeFading = function(player) {
if (!pageflow.browser.has('volume control support')) {
return pageflow.mediaPlayer.volumeFading.noop(player);
}
else if (pageflow.audioContext.get() && player.getMediaElement) {
return pageflow.mediaPlayer.volumeFading.webAudio(
player,
pageflow.audioContext.get()
);
}
else {
return pageflow.mediaPlayer.volumeFading.interval(player);
}
};
| Use Web Audio volume fading only if player has getMediaElement | Use Web Audio volume fading only if player has getMediaElement
`pagefow-vr` player does not support accessing the media element
directly.
| JavaScript | mit | Modularfield/pageflow,Modularfield/pageflow,Modularfield/pageflow,tf/pageflow,codevise/pageflow,codevise/pageflow,codevise/pageflow,tf/pageflow,tf/pageflow,tf/pageflow,codevise/pageflow,Modularfield/pageflow | ---
+++
@@ -5,7 +5,7 @@
if (!pageflow.browser.has('volume control support')) {
return pageflow.mediaPlayer.volumeFading.noop(player);
}
- else if (pageflow.audioContext.get()) {
+ else if (pageflow.audioContext.get() && player.getMediaElement) {
return pageflow.mediaPlayer.volumeFading.webAudio(
player,
pageflow.audioContext.get() |
1b20df7e99f846efc6f64c1fae20df5e6fdcd6e5 | backend/app/assets/javascripts/spree/backend/store_credits.js | backend/app/assets/javascripts/spree/backend/store_credits.js | Spree.ready(function() {
$('.store-credit-memo-row').each(function() {
var row = this;
var field = row.querySelector('[name="store_credit[memo]"]')
var textDisplay = row.querySelector('.store-credit-memo-text')
$(row).on('ajax:success', function(event, data) {
row.classList.remove('editing');
field.defaultValue = field.value;
textDisplay.textContent = field.value;
show_flash('success', data.message);
}).on('ajax:error', function(event, xhr, status, error) {
show_flash('error', xhr.responseJSON.message);
});
row.querySelector('.edit-memo').addEventListener('click', function() {
row.classList.add('editing');
});
row.querySelector('.cancel-memo').addEventListener('click', function() {
row.classList.remove('editing');
});
});
});
| Spree.ready(function() {
$('.store-credit-memo-row').each(function() {
var row = this;
var field = row.querySelector('[name="store_credit[memo]"]')
var textDisplay = row.querySelector('.store-credit-memo-text')
$(row).on('ajax:success', function(event, data) {
row.classList.remove('editing');
field.defaultValue = field.value;
textDisplay.textContent = field.value;
if (typeof data !== "undefined") {
// we are using jquery_ujs
message = data.message
} else {
// we are using rails-ujs
message = event.detail[0].message
}
show_flash('success', message);
}).on('ajax:error', function(event, xhr, status, error) {
if (typeof xhr !== "undefined") {
// we are using jquery_ujs
message = xhr.responseJSON.message
} else {
// we are using rails-ujs
message = event.detail[0].message
}
show_flash('error', message);
});
row.querySelector('.edit-memo').addEventListener('click', function() {
row.classList.add('editing');
});
row.querySelector('.cancel-memo').addEventListener('click', function() {
row.classList.remove('editing');
});
});
});
| Allow admin store credit memo to be changed using rails-ujs | Allow admin store credit memo to be changed using rails-ujs
rails-ujs has a different api handling ajax events than jquery_ujs.
The former passes all the event information into the event.detail object
while the latter accept different parameters. For more details see:
- https://edgeguides.rubyonrails.org/working_with_javascript_in_rails.html#rails-ujs-event-handlers
- https://github.com/rails/jquery-ujs/wiki/ajax
| JavaScript | bsd-3-clause | pervino/solidus,pervino/solidus,pervino/solidus,pervino/solidus | ---
+++
@@ -9,9 +9,25 @@
field.defaultValue = field.value;
textDisplay.textContent = field.value;
- show_flash('success', data.message);
+ if (typeof data !== "undefined") {
+ // we are using jquery_ujs
+ message = data.message
+ } else {
+ // we are using rails-ujs
+ message = event.detail[0].message
+ }
+
+ show_flash('success', message);
}).on('ajax:error', function(event, xhr, status, error) {
- show_flash('error', xhr.responseJSON.message);
+ if (typeof xhr !== "undefined") {
+ // we are using jquery_ujs
+ message = xhr.responseJSON.message
+ } else {
+ // we are using rails-ujs
+ message = event.detail[0].message
+ }
+
+ show_flash('error', message);
});
row.querySelector('.edit-memo').addEventListener('click', function() { |
2be6aed059542216005f1fbd1b8f0b0ba53af1f4 | examples/scribuntoConsole.js | examples/scribuntoConsole.js | var Bot = require( 'nodemw' ),
readline = require( 'readline' ),
c = require( 'ansi-colors' ),
rl = readline.createInterface( {
input: process.stdin,
output: process.stdout
} ),
client = new Bot( {
protocol: 'https',
server: 'dev.fandom.com',
path: ''
} ),
params = {
action: 'scribunto-console',
title: 'Module:CLI/testcases/title',
clear: true
};
function call( err, info, next, data ) {
if ( err ) {
console.error( err );
} else if ( data.type === 'error' ) {
console.error( data.message );
} else {
console.log( data.print );
}
}
function cli( input ) {
params.question = input;
client.api.call( params, call );
}
function session( err, content ) {
params.content = content;
console.log( c.gray('* The module exports are available as the variable "p", including unsaved modifications.' ) );
console.log( c.gray('* Precede a line with "=" to evaluate it as an expression, or use print().' ) );
console.log( c.gray('* Use mw.log() in module code to send messages to this console.' ) );
rl.on( 'line', cli );
}
client.getArticle( params.title, session );
| var Bot = require( 'nodemw' ),
readline = require( 'readline' ),
c = require( 'ansicolors' ),
rl = readline.createInterface( {
input: process.stdin,
output: process.stdout
} ),
client = new Bot( {
protocol: 'https',
server: 'dev.fandom.com',
path: ''
} ),
params = {
action: 'scribunto-console',
title: 'Module:CLI/testcases/title',
clear: true
};
function call( err, info, next, data ) {
if ( err ) {
console.error( err );
} else if ( data.type === 'error' ) {
console.error( data.message );
} else {
console.log( data.print );
}
}
function cli( input ) {
params.question = input;
client.api.call( params, call );
}
function session( err, content ) {
params.content = content;
console.log( c.green('* The module exports are available as the variable "p", including unsaved modifications.' ) );
console.log( c.green('* Precede a line with "=" to evaluate it as an expression, or use print().' ) );
console.log( c.green('* Use mw.log() in module code to send messages to this console.' ) );
rl.on( 'line', cli );
}
client.getArticle( params.title, session );
| Use green for console intro instead | Use green for console intro instead | JavaScript | bsd-2-clause | macbre/nodemw | ---
+++
@@ -1,6 +1,6 @@
var Bot = require( 'nodemw' ),
readline = require( 'readline' ),
- c = require( 'ansi-colors' ),
+ c = require( 'ansicolors' ),
rl = readline.createInterface( {
input: process.stdin,
output: process.stdout
@@ -33,9 +33,9 @@
function session( err, content ) {
params.content = content;
- console.log( c.gray('* The module exports are available as the variable "p", including unsaved modifications.' ) );
- console.log( c.gray('* Precede a line with "=" to evaluate it as an expression, or use print().' ) );
- console.log( c.gray('* Use mw.log() in module code to send messages to this console.' ) );
+ console.log( c.green('* The module exports are available as the variable "p", including unsaved modifications.' ) );
+ console.log( c.green('* Precede a line with "=" to evaluate it as an expression, or use print().' ) );
+ console.log( c.green('* Use mw.log() in module code to send messages to this console.' ) );
rl.on( 'line', cli );
}
|
c01248767fc5f6b2ffb755f02bd32287c21ae8e4 | google-services-list.user.js | google-services-list.user.js | // ==UserScript==
// @name Google Service List
// @namespace wsmwason.google.service.list
// @description List all Google services on support page, and auto redirect to product url.
// @include https://support.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @auther wsmwason
// @version 1.0
// @license MIT
// @grant none
// ==/UserScript==
// hide show all icon
$('.show-all').hide();
// display hide container
$('.all-hc-container').addClass('all-hc-container-shown');
// add link redirect param for next page
$('a').each(function(){
var stid = $(this).attr('st-id');
if (typeof stid !== typeof undefined && stid !== false) {
$(this).attr('href', $(this).attr('href')+'&redirect=1').attr('target', '_blank');
}
});
// auto redirect to product url
if (location.search.indexOf('redirect=1') > 0) {
// find product-icon link
var productIcon = $('a.product-icon');
if (productIcon.length == 1) {
var productUrl = productIcon.attr('href');
location.href = productUrl;
}
} | // ==UserScript==
// @name Google Services List
// @namespace wsmwason.google.services.list
// @description List all Google services on support page, and auto redirect to product url.
// @include https://support.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @auther wsmwason
// @version 1.1
// @license MIT
// @grant none
// ==/UserScript==
// hide show all icon
$('.show-all').hide();
// display hide container
$('.all-hc-container').addClass('all-hc-container-shown');
// add link redirect param for next page
$('a').each(function(){
var stid = $(this).attr('st-id');
if (typeof stid !== typeof undefined && stid !== false) {
$(this).attr('href', $(this).attr('href')+'&redirect=1').attr('target', '_blank');
}
});
// auto redirect to product url
if (location.search.indexOf('redirect=1') > 0) {
// find product-icon link
var productIcon = $('a.product-icon');
if (productIcon.length == 1) {
var productUrl = productIcon.attr('href');
location.href = productUrl;
}
}
| Update script name and namespace | Update script name and namespace
| JavaScript | mit | wsmwason/google-services-list | ---
+++
@@ -1,11 +1,11 @@
// ==UserScript==
-// @name Google Service List
-// @namespace wsmwason.google.service.list
+// @name Google Services List
+// @namespace wsmwason.google.services.list
// @description List all Google services on support page, and auto redirect to product url.
// @include https://support.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @auther wsmwason
-// @version 1.0
+// @version 1.1
// @license MIT
// @grant none
// ==/UserScript== |
58a5b2b5c69343b684ecb6db9cd9e43bb8f37747 | app/plugins/wildflower/jlm/controllers/components/write_new.js | app/plugins/wildflower/jlm/controllers/components/write_new.js | $.jlm.component('WriteNew', 'wild_posts.wf_index, wild_posts.wf_edit, wild_pages.wf_index, wild_pages.wf_edit', function() {
$('#sidebar .add').click(function() {
var buttonEl = $(this);
var formAction = buttonEl.attr('href');
var templatePath = 'posts/new_post';
var parentPageOptions = null;
if ($.jlm.params.controller == 'wild_pages') {
templatePath = 'pages/new_page';
parentPageOptions = $('.all-page-parents').html();
parentPageOptions = parentPageOptions.replace('[parent_id_options]', '[parent_id]');
}
var dialogEl = $($.jlm.template(templatePath, { action: formAction, parentPageOptions: parentPageOptions }));
var contentEl = $('#content-pad');
contentEl.append(dialogEl);
var toHeight = 230;
var hiddenContentEls = contentEl.animate({
height: toHeight
}, 600).children().not(dialogEl).hide();
$('.input input', dialogEl).focus();
// Bind cancel link
$('.cancel-edit a', dialogEl).click(function() {
dialogEl.remove();
hiddenContentEls.show();
contentEl.height('auto');
return false;
});
// Create link
$('.submit input', dialogEl).click(function() {
$(this).attr('disabled', 'disabled').attr('value', '<l18n>Saving...</l18n>');
return true;
});
return false;
});
}); | $.jlm.component('WriteNew', 'wild_posts.wf_index, wild_posts.wf_edit, wild_pages.wf_index, wild_pages.wf_edit', function() {
$('#sidebar .add').click(function() {
var buttonEl = $(this);
var formAction = buttonEl.attr('href');
var templatePath = 'posts/new_post';
var parentPageOptions = null;
if ($.jlm.params.controller == 'wild_pages') {
templatePath = 'pages/new_page';
parentPageOptions = $('.all-page-parents').html();
parentPageOptions = parentPageOptions.replace('[Page]', '[WildPage]');
parentPageOptions = parentPageOptions.replace('[parent_id_options]', '[parent_id]');
}
var dialogEl = $($.jlm.template(templatePath, { action: formAction, parentPageOptions: parentPageOptions }));
var contentEl = $('#content-pad');
contentEl.append(dialogEl);
var toHeight = 230;
var hiddenContentEls = contentEl.animate({
height: toHeight
}, 600).children().not(dialogEl).hide();
$('.input input', dialogEl).focus();
// Bind cancel link
$('.cancel-edit a', dialogEl).click(function() {
dialogEl.remove();
hiddenContentEls.show();
contentEl.height('auto');
return false;
});
// Create link
$('.submit input', dialogEl).click(function() {
$(this).attr('disabled', 'disabled').attr('value', '<l18n>Saving...</l18n>');
return true;
});
return false;
});
}); | Write new page parent select box bug fixed | Write new page parent select box bug fixed
| JavaScript | mit | klevo/wildflower,klevo/wildflower,klevo/wildflower | ---
+++
@@ -9,6 +9,7 @@
if ($.jlm.params.controller == 'wild_pages') {
templatePath = 'pages/new_page';
parentPageOptions = $('.all-page-parents').html();
+ parentPageOptions = parentPageOptions.replace('[Page]', '[WildPage]');
parentPageOptions = parentPageOptions.replace('[parent_id_options]', '[parent_id]');
}
|
86e08d1d638656ff5c655bb9af4d658330907edf | test/idle-timer_test.js | test/idle-timer_test.js | (function($) {
/*
======== A Handy Little QUnit Reference ========
http://docs.jquery.com/QUnit
Test methods:
expect(numAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
raises(block, [expected], [message])
*/
module("jQuery#idle-timer");
asyncTest( "default behavior", function() {
expect( 1 );
$( document ).on( "idle.idleTimer", function(){
ok( true, "idleTime fires at document by default" );
start();
});
$.idleTimer( 100 );
});
}(jQuery));
| (function($) {
/*
======== A Handy Little QUnit Reference ========
http://docs.jquery.com/QUnit
Test methods:
expect(numAssertions)
stop(increment)
start(decrement)
Test assertions:
ok(value, [message])
equal(actual, expected, [message])
notEqual(actual, expected, [message])
deepEqual(actual, expected, [message])
notDeepEqual(actual, expected, [message])
strictEqual(actual, expected, [message])
notStrictEqual(actual, expected, [message])
raises(block, [expected], [message])
*/
module("jQuery#idle-timer");
asyncTest( "default behavior", function() {
expect( 1 );
$( document ).on( "idle.idleTimer", function(){
ok( true, "idleTime fires at document by default" );
start();
$.idleTimer( "destroy" );
});
$.idleTimer( 100 );
});
}(jQuery));
| Destroy idle timer instance after test has finished | Destroy idle timer instance after test has finished
| JavaScript | mit | thorst/jquery-idletimer,amitabhaghosh197/jquery-idletimer,dpease/jquery-idletimer,amitabhaghosh197/jquery-idletimer,dpease/jquery-idletimer,thorst/jquery-idletimer | ---
+++
@@ -26,6 +26,7 @@
$( document ).on( "idle.idleTimer", function(){
ok( true, "idleTime fires at document by default" );
start();
+ $.idleTimer( "destroy" );
});
$.idleTimer( 100 );
}); |
43906d08af184b3c20bb201dedf1d79de7dd8549 | node-tests/unit/linting-compiler-test.js | node-tests/unit/linting-compiler-test.js | 'use strict';
var assert = require('assert');
var buildTemplateCompiler = require('../helpers/template-compiler');
describe('Ember template compiler', function() {
var templateCompiler;
beforeEach(function() {
templateCompiler = buildTemplateCompiler();
});
it('sanity: compiles templates', function() {
var template = templateCompiler.precompile('<div></div>');
assert.ok(template, 'template is created from precompile');
});
it('sanity: loads plugins on the template compiler', function() {
var instanceCount = 0;
var NoopPlugin = function(){
instanceCount++;
};
NoopPlugin.prototype.transform = function(ast) {
return ast;
};
templateCompiler.registerPlugin('ast', NoopPlugin);
templateCompiler.precompile('<div></div>');
assert.equal(instanceCount, 1, 'registered plugins are instantiated');
});
});
| 'use strict';
var assert = require('assert');
var _compile = require('htmlbars').compile;
describe('Ember template compiler', function() {
var astPlugins;
function compile(template) {
return _compile(template, {
plugins: {
ast: astPlugins
}
});
}
beforeEach(function() {
astPlugins = [];
});
it('sanity: compiles templates', function() {
var template = compile('<div></div>');
assert.ok(template, 'template is created');
});
it('sanity: loads plugins on the template compiler', function() {
var instanceCount = 0;
var NoopPlugin = function(){
instanceCount++;
};
NoopPlugin.prototype.transform = function(ast) {
return ast;
};
astPlugins.push(NoopPlugin);
compile('<div></div>');
assert.equal(instanceCount, 1, 'registered plugins are instantiated');
});
});
| Fix issues with HTMLBars parser transition. | Fix issues with HTMLBars parser transition.
| JavaScript | mit | rwjblue/ember-cli-template-lint,oriSomething/ember-cli-template-lint,oriSomething/ember-template-lint,rwjblue/ember-cli-template-lint,rwjblue/ember-template-lint,oriSomething/ember-cli-template-lint | ---
+++
@@ -1,18 +1,26 @@
'use strict';
var assert = require('assert');
-var buildTemplateCompiler = require('../helpers/template-compiler');
+var _compile = require('htmlbars').compile;
describe('Ember template compiler', function() {
- var templateCompiler;
+ var astPlugins;
+
+ function compile(template) {
+ return _compile(template, {
+ plugins: {
+ ast: astPlugins
+ }
+ });
+ }
beforeEach(function() {
- templateCompiler = buildTemplateCompiler();
+ astPlugins = [];
});
it('sanity: compiles templates', function() {
- var template = templateCompiler.precompile('<div></div>');
- assert.ok(template, 'template is created from precompile');
+ var template = compile('<div></div>');
+ assert.ok(template, 'template is created');
});
it('sanity: loads plugins on the template compiler', function() {
@@ -23,8 +31,9 @@
NoopPlugin.prototype.transform = function(ast) {
return ast;
};
- templateCompiler.registerPlugin('ast', NoopPlugin);
- templateCompiler.precompile('<div></div>');
+ astPlugins.push(NoopPlugin);
+ compile('<div></div>');
+
assert.equal(instanceCount, 1, 'registered plugins are instantiated');
});
}); |
4cc6f5ff25db2cc61cb153a6d60e6a5d5d4a6588 | lib/install/action/update-linked.js | lib/install/action/update-linked.js | 'use strict'
var path = require('path')
module.exports = function (top, buildpath, pkg, log, next) {
if (pkg.package.version !== pkg.oldPkg.package.version)
log.warn('update-linked', path.relative(top, pkg.path), 'needs updating to', pkg.package.version,
'from', pkg.oldPkg.package.version, "but we can't, as it's a symlink")
next()
}
| 'use strict'
var path = require('path')
module.exports = function (top, buildpath, pkg, log, next) {
if (pkg.package.version !== pkg.oldPkg.package.version) {
log.warn('update-linked', path.relative(top, pkg.path), 'needs updating to', pkg.package.version,
'from', pkg.oldPkg.package.version, "but we can't, as it's a symlink")
}
next()
}
| Fix up style to meet requirements for build | Fix up style to meet requirements for build
| JavaScript | artistic-2.0 | DaveEmmerson/npm,DaveEmmerson/npm,DaveEmmerson/npm | ---
+++
@@ -2,8 +2,9 @@
var path = require('path')
module.exports = function (top, buildpath, pkg, log, next) {
- if (pkg.package.version !== pkg.oldPkg.package.version)
+ if (pkg.package.version !== pkg.oldPkg.package.version) {
log.warn('update-linked', path.relative(top, pkg.path), 'needs updating to', pkg.package.version,
'from', pkg.oldPkg.package.version, "but we can't, as it's a symlink")
+ }
next()
} |
26e229add96b3fbf67a15bb3465832881ced5023 | infrastructure/table-creation-wait.js | infrastructure/table-creation-wait.js | exports.runWhenTableIs = function (tableName, desiredStatus, db, callback) {
var describeParams = {};
describeParams.TableName = tableName;
db.describeTable(describeParams, function (err, data) {
if (data.Table.TableStatus === desiredStatus) {
callback();
} else{
var waitTimeMs = 1000;
setTimeout(function () {
console.log('table status is ' + data.Table.TableStatus);
console.log('waiting ' + waitTimeMs + 'ms for table status to be ' + desiredStatus);
exports.runWhenTableIs(tableName, desiredStatus, db, callback);
}, waitTimeMs);
}
});
} | exports.runWhenTableIs = function (tableName, desiredStatus, db, callback) {
var describeParams = {};
describeParams.TableName = tableName;
db.describeTable(describeParams, function (err, data) {
if (err) {
console.log(err);
} else if (data.Table.TableStatus === desiredStatus) {
callback();
} else{
var waitTimeMs = 1000;
setTimeout(function () {
console.log('table status is ' + data.Table.TableStatus);
console.log('waiting ' + waitTimeMs + 'ms for table status to be ' + desiredStatus);
exports.runWhenTableIs(tableName, desiredStatus, db, callback);
}, waitTimeMs);
}
});
} | Check for error and print when waiting for a particular table status. | Check for error and print when waiting for a particular table status.
| JavaScript | apache-2.0 | timg456789/musical-octo-train,timg456789/musical-octo-train,timg456789/musical-octo-train | ---
+++
@@ -4,7 +4,9 @@
describeParams.TableName = tableName;
db.describeTable(describeParams, function (err, data) {
- if (data.Table.TableStatus === desiredStatus) {
+ if (err) {
+ console.log(err);
+ } else if (data.Table.TableStatus === desiredStatus) {
callback();
} else{
var waitTimeMs = 1000; |
470b44113fc07de8ada5b10a64a938177961347b | js/locales/bootstrap-datepicker.fi.js | js/locales/bootstrap-datepicker.fi.js | /**
* Finnish translation for bootstrap-datepicker
* Jaakko Salonen <https://github.com/jsalonen>
*/
;(function($){
$.fn.datepicker.dates['fi'] = {
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
today: "tänään"
};
}(jQuery));
| /**
* Finnish translation for bootstrap-datepicker
* Jaakko Salonen <https://github.com/jsalonen>
*/
;(function($){
$.fn.datepicker.dates['fi'] = {
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "lau", "sun"],
daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
today: "tänään",
weekStart: 1,
format: "d.m.yyyy"
};
}(jQuery));
| Fix Finnish week start to Monday, add format | Fix Finnish week start to Monday, add format
Finns *always* start their week on Mondays.
The d.m.yyyy date format is the most common one. | JavaScript | apache-2.0 | oller/foundation-datepicker-sass,abnovak/bootstrap-sass-datepicker,rocLv/bootstrap-datepicker,rstone770/bootstrap-datepicker,wetet2/bootstrap-datepicker,Azaret/bootstrap-datepicker,osama9/bootstrap-datepicker,zhaoyan158567/bootstrap-datepicker,bitzesty/bootstrap-datepicker,HNygard/bootstrap-datepicker,wetet2/bootstrap-datepicker,NFC-DITO/bootstrap-datepicker,Doublemedia/bootstrap-datepicker,champierre/bootstrap-datepicker,aldano/bootstrap-datepicker,ashleymcdonald/bootstrap-datepicker,SimpleUpdates/bootstrap-datepicker,dswitzer/bootstrap-datepicker,fabdouglas/bootstrap-datepicker,aldano/bootstrap-datepicker,rstone770/bootstrap-datepicker,mfunkie/bootstrap-datepicker,huang-x-h/bootstrap-datepicker,thetimbanks/bootstrap-datepicker,TheJumpCloud/bootstrap-datepicker,xutongtong/bootstrap-datepicker,keiwerkgvr/bootstrap-datepicker,acrobat/bootstrap-datepicker,joubertredrat/bootstrap-datepicker,inway/bootstrap-datepicker,champierre/bootstrap-datepicker,Habitissimo/bootstrap-datepicker,Youraiseme/bootstrap-datepicker,mfunkie/bootstrap-datepicker,NFC-DITO/bootstrap-datepicker,jesperronn/bootstrap-datepicker,saurabh27125/bootstrap-datepicker,Zweer/bootstrap-datepicker,defrian8/bootstrap-datepicker,pacozaa/bootstrap-datepicker,mreiden/bootstrap-datepicker,cbryer/bootstrap-datepicker,darluc/bootstrap-datepicker,Sprinkle7/bootstrap-datepicker,keiwerkgvr/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,janusnic/bootstrap-datepicker,ashleymcdonald/bootstrap-datepicker,vsn4ik/bootstrap-datepicker,ibcooley/bootstrap-datepicker,MartijnDwars/bootstrap-datepicker,dckesler/bootstrap-datepicker,CherryDT/bootstrap-datepicker,riyan8250/bootstrap-datepicker,kiwiupover/bootstrap-datepicker,yangyichen/bootstrap-datepicker,cbryer/bootstrap-datepicker,HuBandiT/bootstrap-datepicker,hebbet/bootstrap-datepicker,gn0st1k4m/bootstrap-datepicker,janusnic/bootstrap-datepicker,uxsolutions/bootstrap-datepicker,kevintvh/bootstrap-datepicker,mfunkie/bootstrap-datepicker,MartijnDwars/bootstrap-datepicker,Invulner/bootstrap-datepicker,1000hz/bootstrap-datepicker,defrian8/bootstrap-datepicker,vsn4ik/bootstrap-datepicker,Mteuahasan/bootstrap-datepicker,stenmuchow/bootstrap-datepicker,cherylyan/bootstrap-datepicker,saurabh27125/bootstrap-datepicker,chengky/bootstrap-datepicker,Azaret/bootstrap-datepicker,Habitissimo/bootstrap-datepicker,Invulner/bootstrap-datepicker,otnavle/bootstrap-datepicker,uxsolutions/bootstrap-datepicker,Tekzenit/bootstrap-datepicker,christophercaburog/bootstrap-datepicker,eternicode/bootstrap-datepicker,steffendietz/bootstrap-datepicker,dckesler/bootstrap-datepicker,Habitissimo/bootstrap-datepicker,steffendietz/bootstrap-datepicker,eternicode/bootstrap-datepicker,tcrossland/bootstrap-datepicker,osama9/bootstrap-datepicker,fabdouglas/bootstrap-datepicker,gn0st1k4m/bootstrap-datepicker,martinRjs/bootstrap-datepicker,menatoric59/bootstrap-datepicker,hemp/bootstrap-datepicker,tcrossland/bootstrap-datepicker,kevintvh/bootstrap-datepicker,chengky/bootstrap-datepicker,abnovak/bootstrap-sass-datepicker,vgrish/bootstrap-datepicker,zhaoyan158567/bootstrap-datepicker,SimpleUpdates/bootstrap-datepicker,nerionavea/bootstrap-datepicker,rocLv/bootstrap-datepicker,WeiLend/bootstrap-datepicker,wulinmengzhu/bootstrap-datepicker,1000hz/bootstrap-datepicker,jhalak/bootstrap-datepicker,menatoric59/bootstrap-datepicker,dswitzer/bootstrap-datepicker,Tekzenit/bootstrap-datepicker,wulinmengzhu/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,i-am-kenny/bootstrap-datepicker,Doublemedia/bootstrap-datepicker,daniyel/bootstrap-datepicker,nilbus/bootstrap-datepicker,nilbus/bootstrap-datepicker,hebbet/bootstrap-datepicker,vgrish/bootstrap-datepicker,josegomezr/bootstrap-datepicker,stenmuchow/bootstrap-datepicker,oller/foundation-datepicker-sass,WeiLend/bootstrap-datepicker,1000hz/bootstrap-datepicker,acrobat/bootstrap-datepicker,parkeugene/bootstrap-datepicker,TheJumpCloud/bootstrap-datepicker,CherryDT/bootstrap-datepicker,huang-x-h/bootstrap-datepicker,christophercaburog/bootstrap-datepicker,nerionavea/bootstrap-datepicker,bitzesty/bootstrap-datepicker,inway/bootstrap-datepicker,daniyel/bootstrap-datepicker,riyan8250/bootstrap-datepicker,inspur-tobacco/bootstrap-datepicker,darluc/bootstrap-datepicker,Sprinkle7/bootstrap-datepicker,jesperronn/bootstrap-datepicker,yangyichen/bootstrap-datepicker,martinRjs/bootstrap-datepicker,wearespindle/datepicker-js,otnavle/bootstrap-datepicker,Mteuahasan/bootstrap-datepicker,josegomezr/bootstrap-datepicker,hemp/bootstrap-datepicker,inukshuk/bootstrap-datepicker,CheapSk8/bootstrap-datepicker,oller/foundation-datepicker-sass,parkeugene/bootstrap-datepicker,joubertredrat/bootstrap-datepicker,Zweer/bootstrap-datepicker,vegardok/bootstrap-datepicker,thetimbanks/bootstrap-datepicker,vegardok/bootstrap-datepicker,xutongtong/bootstrap-datepicker,mreiden/bootstrap-datepicker,i-am-kenny/bootstrap-datepicker,HNygard/bootstrap-datepicker,CheapSk8/bootstrap-datepicker,kiwiupover/bootstrap-datepicker,Youraiseme/bootstrap-datepicker,josegomezr/bootstrap-datepicker,ibcooley/bootstrap-datepicker,inukshuk/bootstrap-datepicker,HuBandiT/bootstrap-datepicker,inspur-tobacco/bootstrap-datepicker,fabdouglas/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,pacozaa/bootstrap-datepicker,jhalak/bootstrap-datepicker,Zweer/bootstrap-datepicker,cherylyan/bootstrap-datepicker | ---
+++
@@ -9,6 +9,8 @@
daysMin: ["su", "ma", "ti", "ke", "to", "pe", "la", "su"],
months: ["tammikuu", "helmikuu", "maaliskuu", "huhtikuu", "toukokuu", "kesäkuu", "heinäkuu", "elokuu", "syyskuu", "lokakuu", "marraskuu", "joulukuu"],
monthsShort: ["tam", "hel", "maa", "huh", "tou", "kes", "hei", "elo", "syy", "lok", "mar", "jou"],
- today: "tänään"
+ today: "tänään",
+ weekStart: 1,
+ format: "d.m.yyyy"
};
}(jQuery)); |
caa5746cb434bfa17731d00e25f2272aed89ccd0 | js/locales/bootstrap-datepicker.mk.js | js/locales/bootstrap-datepicker.mk.js | /**
* Macedonian translation for bootstrap-datepicker
* Marko Aleksic <psybaron@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['mk'] = {
days: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота", "Недела"],
daysShort: ["Нед", "Пон", "Вто", "Сре", "Чет", "Пет", "Саб", "Нед"],
daysMin: ["Не", "По", "Вт", "Ср", "Че", "Пе", "Са", "Не"],
months: ["Јануари", "Февруари", "Март", "Април", "Мај", "Јуни", "Јули", "Август", "Септември", "Октомври", "Ноември", "Декември"],
monthsShort: ["Јан", "Фев", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Ное", "Дек"],
today: "Денес",
format: "dd.MM.yyyy"
};
}(jQuery));
| /**
* Macedonian translation for bootstrap-datepicker
* Marko Aleksic <psybaron@gmail.com>
*/
;(function($){
$.fn.datepicker.dates['mk'] = {
days: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота", "Недела"],
daysShort: ["Нед", "Пон", "Вто", "Сре", "Чет", "Пет", "Саб", "Нед"],
daysMin: ["Не", "По", "Вт", "Ср", "Че", "Пе", "Са", "Не"],
months: ["Јануари", "Февруари", "Март", "Април", "Мај", "Јуни", "Јули", "Август", "Септември", "Октомври", "Ноември", "Декември"],
monthsShort: ["Јан", "Фев", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Ное", "Дек"],
today: "Денес",
format: "dd.mm.yyyy"
};
}(jQuery));
| Change month format from 'MM' to 'mm'. | Change month format from 'MM' to 'mm'. | JavaScript | apache-2.0 | christophercaburog/bootstrap-datepicker,huang-x-h/bootstrap-datepicker,wearespindle/datepicker-js,joubertredrat/bootstrap-datepicker,riyan8250/bootstrap-datepicker,otnavle/bootstrap-datepicker,NFC-DITO/bootstrap-datepicker,osama9/bootstrap-datepicker,SimpleUpdates/bootstrap-datepicker,mfunkie/bootstrap-datepicker,defrian8/bootstrap-datepicker,MartijnDwars/bootstrap-datepicker,janusnic/bootstrap-datepicker,rocLv/bootstrap-datepicker,riyan8250/bootstrap-datepicker,HuBandiT/bootstrap-datepicker,Invulner/bootstrap-datepicker,TheJumpCloud/bootstrap-datepicker,bitzesty/bootstrap-datepicker,tcrossland/bootstrap-datepicker,dswitzer/bootstrap-datepicker,inway/bootstrap-datepicker,mfunkie/bootstrap-datepicker,steffendietz/bootstrap-datepicker,hebbet/bootstrap-datepicker,WeiLend/bootstrap-datepicker,Invulner/bootstrap-datepicker,hebbet/bootstrap-datepicker,MartijnDwars/bootstrap-datepicker,TheJumpCloud/bootstrap-datepicker,darluc/bootstrap-datepicker,otnavle/bootstrap-datepicker,abnovak/bootstrap-sass-datepicker,wulinmengzhu/bootstrap-datepicker,WeiLend/bootstrap-datepicker,Azaret/bootstrap-datepicker,saurabh27125/bootstrap-datepicker,saurabh27125/bootstrap-datepicker,kiwiupover/bootstrap-datepicker,abnovak/bootstrap-sass-datepicker,hemp/bootstrap-datepicker,inspur-tobacco/bootstrap-datepicker,ashleymcdonald/bootstrap-datepicker,kiwiupover/bootstrap-datepicker,NFC-DITO/bootstrap-datepicker,hemp/bootstrap-datepicker,defrian8/bootstrap-datepicker,steffendietz/bootstrap-datepicker,christophercaburog/bootstrap-datepicker,menatoric59/bootstrap-datepicker,yangyichen/bootstrap-datepicker,joubertredrat/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,cbryer/bootstrap-datepicker,1000hz/bootstrap-datepicker,martinRjs/bootstrap-datepicker,kevintvh/bootstrap-datepicker,cherylyan/bootstrap-datepicker,chengky/bootstrap-datepicker,eternicode/bootstrap-datepicker,wulinmengzhu/bootstrap-datepicker,zhaoyan158567/bootstrap-datepicker,menatoric59/bootstrap-datepicker,rstone770/bootstrap-datepicker,HNygard/bootstrap-datepicker,dswitzer/bootstrap-datepicker,pacozaa/bootstrap-datepicker,nilbus/bootstrap-datepicker,Doublemedia/bootstrap-datepicker,janusnic/bootstrap-datepicker,acrobat/bootstrap-datepicker,jesperronn/bootstrap-datepicker,CherryDT/bootstrap-datepicker,rocLv/bootstrap-datepicker,tcrossland/bootstrap-datepicker,keiwerkgvr/bootstrap-datepicker,jesperronn/bootstrap-datepicker,ibcooley/bootstrap-datepicker,vgrish/bootstrap-datepicker,osama9/bootstrap-datepicker,vegardok/bootstrap-datepicker,josegomezr/bootstrap-datepicker,mfunkie/bootstrap-datepicker,Youraiseme/bootstrap-datepicker,vegardok/bootstrap-datepicker,xutongtong/bootstrap-datepicker,ibcooley/bootstrap-datepicker,gn0st1k4m/bootstrap-datepicker,uxsolutions/bootstrap-datepicker,jhalak/bootstrap-datepicker,vsn4ik/bootstrap-datepicker,yangyichen/bootstrap-datepicker,SimpleUpdates/bootstrap-datepicker,inspur-tobacco/bootstrap-datepicker,martinRjs/bootstrap-datepicker,Doublemedia/bootstrap-datepicker,parkeugene/bootstrap-datepicker,acrobat/bootstrap-datepicker,1000hz/bootstrap-datepicker,Azaret/bootstrap-datepicker,inukshuk/bootstrap-datepicker,cherylyan/bootstrap-datepicker,oller/foundation-datepicker-sass,Sprinkle7/bootstrap-datepicker,daniyel/bootstrap-datepicker,aldano/bootstrap-datepicker,nilbus/bootstrap-datepicker,HuBandiT/bootstrap-datepicker,champierre/bootstrap-datepicker,xutongtong/bootstrap-datepicker,thetimbanks/bootstrap-datepicker,stenmuchow/bootstrap-datepicker,kevintvh/bootstrap-datepicker,keiwerkgvr/bootstrap-datepicker,dckesler/bootstrap-datepicker,HNygard/bootstrap-datepicker,huang-x-h/bootstrap-datepicker,wetet2/bootstrap-datepicker,daniyel/bootstrap-datepicker,aldano/bootstrap-datepicker,CheapSk8/bootstrap-datepicker,parkeugene/bootstrap-datepicker,Youraiseme/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,ashleymcdonald/bootstrap-datepicker,gn0st1k4m/bootstrap-datepicker,bitzesty/bootstrap-datepicker,jhalak/bootstrap-datepicker,Tekzenit/bootstrap-datepicker,inukshuk/bootstrap-datepicker,Tekzenit/bootstrap-datepicker,oller/foundation-datepicker-sass,eternicode/bootstrap-datepicker,Sprinkle7/bootstrap-datepicker,rstone770/bootstrap-datepicker,nerionavea/bootstrap-datepicker,josegomezr/bootstrap-datepicker,josegomezr/bootstrap-datepicker,mreiden/bootstrap-datepicker,Mteuahasan/bootstrap-datepicker,vgrish/bootstrap-datepicker,stenmuchow/bootstrap-datepicker,vsn4ik/bootstrap-datepicker,darluc/bootstrap-datepicker,CherryDT/bootstrap-datepicker,zhaoyan158567/bootstrap-datepicker,dckesler/bootstrap-datepicker,i-am-kenny/bootstrap-datepicker,champierre/bootstrap-datepicker,uxsolutions/bootstrap-datepicker,inway/bootstrap-datepicker,CheapSk8/bootstrap-datepicker,1000hz/bootstrap-datepicker,nerionavea/bootstrap-datepicker,oller/foundation-datepicker-sass,Mteuahasan/bootstrap-datepicker,chengky/bootstrap-datepicker,cbryer/bootstrap-datepicker,thetimbanks/bootstrap-datepicker,mreiden/bootstrap-datepicker,WebbyLab/bootstrap-datepicker,pacozaa/bootstrap-datepicker,i-am-kenny/bootstrap-datepicker,wetet2/bootstrap-datepicker | ---
+++
@@ -10,6 +10,6 @@
months: ["Јануари", "Февруари", "Март", "Април", "Мај", "Јуни", "Јули", "Август", "Септември", "Октомври", "Ноември", "Декември"],
monthsShort: ["Јан", "Фев", "Мар", "Апр", "Мај", "Јун", "Јул", "Авг", "Сеп", "Окт", "Ное", "Дек"],
today: "Денес",
- format: "dd.MM.yyyy"
+ format: "dd.mm.yyyy"
};
}(jQuery)); |
e087fe25c546b1a142727b56da4751f18c46f2cb | katas/libraries/hamjest/assertThat.js | katas/libraries/hamjest/assertThat.js | import { assertThat, equalTo, containsString } from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(typeOfAssertThat, equalTo('function'));
});
describe('requires at least two params', () => {
it('1st: the actual value', () => {
assertThat('actual', equalTo('actual'));
});
it('2nd: a matcher for the expected value', () => {
const matcher = equalTo('expected');
assertThat('expected', matcher);
});
describe('the optional 3rd param', () => {
it('goes first(!), and is the assertion reason', () => {
const reason = 'This is the reason, the first `assertThat()` throws as part of its message.';
try {
assertThat(reason, true, equalTo(false));
} catch (e) {
assertThat(e.message, containsString(reason));
}
});
});
});
});
| import {
assertThat, equalTo,
containsString, throws, returns,
} from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(typeOfAssertThat, equalTo('function'));
});
describe('requires at least two params', () => {
it('1st: the actual value', () => {
assertThat('actual', equalTo('actual'));
});
it('2nd: a matcher for the expected value', () => {
const matcher = equalTo('expected');
assertThat('expected', matcher);
});
describe('the optional 3rd param', () => {
it('goes first(!), and is the assertion reason', () => {
const reason = 'This is the reason, the first `assertThat()` throws as part of its message.';
try {
assertThat(reason, true, equalTo(false));
} catch (e) {
assertThat(e.message, containsString(reason));
}
});
});
});
describe('does under the hood', () => {
it('nothing when actual and expected match (using the given matcher)', () => {
const passingTest = () => assertThat(true, equalTo(true));
assertThat(passingTest, returns());
});
it('throws an assertion, when actual and expected don`t match', () => {
const failingTest = () => assertThat(false, equalTo(true));
assertThat(failingTest, throws());
});
});
});
| Add a little under-the-hood tests. | Add a little under-the-hood tests.
| JavaScript | mit | tddbin/katas,tddbin/katas,tddbin/katas | ---
+++
@@ -1,4 +1,7 @@
-import { assertThat, equalTo, containsString } from 'hamjest';
+import {
+ assertThat, equalTo,
+ containsString, throws, returns,
+} from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
@@ -24,4 +27,15 @@
});
});
});
+
+ describe('does under the hood', () => {
+ it('nothing when actual and expected match (using the given matcher)', () => {
+ const passingTest = () => assertThat(true, equalTo(true));
+ assertThat(passingTest, returns());
+ });
+ it('throws an assertion, when actual and expected don`t match', () => {
+ const failingTest = () => assertThat(false, equalTo(true));
+ assertThat(failingTest, throws());
+ });
+ });
}); |
b7d600cdf1d870e2ffba4fd7c64a94156fadb5b9 | src/delir-core/tests/project/project-spec.js | src/delir-core/tests/project/project-spec.js | import Project from '../../src/project/project'
import Asset from '../../src/project/asset'
import Composition from '../../src/project/composition'
import TimeLane from '../../src/project/timelane'
import Layer from '../../src/project/layer'
describe('project structure specs', () => {
describe('Project', () => {
let project
beforeEach(() => {
project = new Project()
})
afterEach(() => {
project = null
})
it('project construction flow', () => {
project.assets.add(new Asset)
project.assets.add(new Asset)
const comp1 = new Composition
project.compositions.add(comp1)
const lane1 = new TimeLane
comp1.timelanes.add(lane1)
lane1.layers.add(new Layer)
})
it('correctry serialize/deserialize the project', () => {
const comp1 = new Composition
project.compositions.add(comp1)
const lane1 = new TimeLane
comp1.timelanes.add(lane1)
const pbson = project.serialize()
expect(Project.deserialize(pbson).toJSON()).to.eql(project.toJSON())
})
})
})
| import Project from '../../src/project/project'
import Asset from '../../src/project/asset'
import Composition from '../../src/project/composition'
import TimeLane from '../../src/project/timelane'
import Clip from '../../src/project/clip'
describe('project structure specs', () => {
describe('Project', () => {
let project
beforeEach(() => {
project = new Project()
})
afterEach(() => {
project = null
})
it('project construction flow', () => {
project.assets.add(new Asset)
project.assets.add(new Asset)
const comp1 = new Composition
project.compositions.add(comp1)
const lane1 = new TimeLane
comp1.timelanes.add(lane1)
lane1.layers.add(new Clip)
})
it('correctry serialize/deserialize the project', () => {
const comp1 = new Composition
project.compositions.add(comp1)
const lane1 = new TimeLane
comp1.timelanes.add(lane1)
const pbson = project.serialize()
expect(Project.deserialize(pbson).toJSON()).to.eql(project.toJSON())
})
})
})
| Replace `Layer` to `Clip` on Project structure spec` | Replace `Layer` to `Clip` on Project structure spec`
| JavaScript | mit | Ragg-/Delir,Ragg-/Delir,Ragg-/Delir,Ragg-/Delir | ---
+++
@@ -2,7 +2,7 @@
import Asset from '../../src/project/asset'
import Composition from '../../src/project/composition'
import TimeLane from '../../src/project/timelane'
-import Layer from '../../src/project/layer'
+import Clip from '../../src/project/clip'
describe('project structure specs', () => {
describe('Project', () => {
@@ -26,7 +26,7 @@
const lane1 = new TimeLane
comp1.timelanes.add(lane1)
- lane1.layers.add(new Layer)
+ lane1.layers.add(new Clip)
})
it('correctry serialize/deserialize the project', () => { |
499b227e4ec6bd00899363366c2520c9c2be151c | tests/frontend/index.js | tests/frontend/index.js | module.exports = {
"open index page": function(browser) {
browser
.url(browser.globals.url)
.waitForElementVisible("#index-view", 3000)
.assert.containsText("#header .logo:nth-child(2)", "Color Themes")
.waitForElementVisible(".pending-icon", 100)
.waitForElementVisible(".preview-list", 5000)
.assert.containsText(".pager .current", "1")
.end();
}
};
| module.exports = {
"open index page": function(browser) {
browser
.url(browser.globals.url)
.waitForElementVisible("#index-view", 3000)
.assert.containsText("#header .logo:nth-child(2)", "Color Themes")
.waitForElementVisible(".pending-icon", 100)
.waitForElementVisible(".preview-list", 5000)
.assert.containsText(".pager .current", "1")
.end();
},
"open next page": function(browser) {
browser
.url(browser.globals.url)
.waitForElementVisible(".pager a:nth-child(2)",5000)
.click(".pager a:nth-child(2)")
.waitForElementVisible(".preview-list", 5000)
.assert.containsText(".pager .current", "2")
.end();
}
}; | Add new test for opening pages | Add new test for opening pages
| JavaScript | mit | y-a-r-g/color-themes,y-a-r-g/color-themes | ---
+++
@@ -8,5 +8,15 @@
.waitForElementVisible(".preview-list", 5000)
.assert.containsText(".pager .current", "1")
.end();
+ },
+
+ "open next page": function(browser) {
+ browser
+ .url(browser.globals.url)
+ .waitForElementVisible(".pager a:nth-child(2)",5000)
+ .click(".pager a:nth-child(2)")
+ .waitForElementVisible(".preview-list", 5000)
+ .assert.containsText(".pager .current", "2")
+ .end();
}
}; |
fba049eecf0689317634e892fd2f3c59f221d0f9 | tests/e2e/utils/activate-amp-and-set-mode.js | tests/e2e/utils/activate-amp-and-set-mode.js |
/**
* WordPress dependencies
*/
import { activatePlugin, visitAdminPage } from '@wordpress/e2e-test-utils';
/**
* The allow list of AMP modes.
*/
export const allowedAMPModes = {
standard: 'standard',
transitional: 'transitional',
reader: 'disabled',
};
/**
* Activate AMP and set it to the correct mode.
*
* @param {string} mode The mode to set AMP to. Possible value of standard, transitional or reader.
*/
export const activateAMPWithMode = async ( mode ) => {
await activatePlugin( 'amp' );
await setAMPMode( mode );
};
/**
* Set AMP Mode
*
* @param {string} mode The mode to set AMP to. Possible value of standard, transitional or reader.
*/
export const setAMPMode = async ( mode ) => {
// Test to be sure that the passed mode is known.
expect( allowedAMPModes ).toHaveProperty( mode );
// Set the AMP mode
await visitAdminPage( 'admin.php', 'page=amp-options' );
await expect( page ).toClick( `#theme_support_${ allowedAMPModes[ mode ] }` );
await expect( page ).toClick( '#submit' );
await page.waitForNavigation();
};
|
/**
* WordPress dependencies
*/
import { activatePlugin, visitAdminPage } from '@wordpress/e2e-test-utils';
/**
* The allow list of AMP modes.
*/
export const allowedAMPModes = {
primary: 'standard',
secondary: 'transitional',
standard: 'standard',
transitional: 'transitional',
reader: 'disabled',
};
/**
* Activate AMP and set it to the correct mode.
*
* @param {string} mode The mode to set AMP to. Possible value of standard, transitional or reader.
*/
export const activateAMPWithMode = async ( mode ) => {
await activatePlugin( 'amp' );
await setAMPMode( mode );
};
/**
* Set AMP Mode
*
* @param {string} mode The mode to set AMP to. Possible value of standard, transitional or reader.
*/
export const setAMPMode = async ( mode ) => {
// Test to be sure that the passed mode is known.
expect( allowedAMPModes ).toHaveProperty( mode );
// Set the AMP mode
await visitAdminPage( 'admin.php', 'page=amp-options' );
await expect( page ).toClick( `#theme_support_${ allowedAMPModes[ mode ] }` );
await expect( page ).toClick( '#submit' );
await page.waitForNavigation();
};
| Add aliase for primary and secondary AMP modes. | Add aliase for primary and secondary AMP modes.
| JavaScript | apache-2.0 | google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp | ---
+++
@@ -8,6 +8,8 @@
* The allow list of AMP modes.
*/
export const allowedAMPModes = {
+ primary: 'standard',
+ secondary: 'transitional',
standard: 'standard',
transitional: 'transitional',
reader: 'disabled', |
d2f7499fc65d63769027f2498dccb5d9b4924fd6 | pages/index.js | pages/index.js | import React from 'react'
import Head from 'next/head'
import {MDXProvider} from '@mdx-js/react'
import IndexMDX from './index.mdx'
import CodeBlock from '../doc-components/CodeBlock'
const components = {
pre: props => <div {...props} />,
code: CodeBlock
}
export default () => (
<MDXProvider components={components}>
<Head>
<title>
React Slidy 🍃 - a simple and minimal slider component for React
</title>
<meta
name="description"
content="A carousel component for React with the basics. It just works. For minimal setup and needs. Focused on performance ⚡"
/>
</Head>
<IndexMDX />
<style jsx global>
{`
body {
background-color: #fff;
color: #000;
font-family: system-ui, sans-serif;
line-height: 1.5;
margin: 0 auto;
max-width: 1000px;
padding: 16px;
}
pre {
overflow: auto;
max-width: 100%;
}
`}
</style>
</MDXProvider>
)
| import React from 'react'
import Head from 'next/head'
import {MDXProvider} from '@mdx-js/react'
import IndexMDX from './index.mdx'
import CodeBlock from '../doc-components/CodeBlock'
const components = {
pre: props => <div {...props} />,
code: CodeBlock
}
export default () => (
<MDXProvider components={components}>
<Head>
<title>
React Slidy 🍃 - a simple and minimal slider component for React
</title>
<meta
name="description"
content="A carousel component for React with the basics. It just works. For minimal setup and needs. Focused on performance ⚡"
/>
<link rel="canonical" href="https://react-slidy.midu.dev/" />
</Head>
<IndexMDX />
<style jsx global>
{`
body {
background-color: #fff;
color: #000;
font-family: system-ui, sans-serif;
line-height: 1.5;
margin: 0 auto;
max-width: 1000px;
padding: 16px;
}
pre {
overflow: auto;
max-width: 100%;
}
`}
</style>
</MDXProvider>
)
| Add canonical url for docs | Add canonical url for docs
| JavaScript | mit | miduga/react-slidy | ---
+++
@@ -20,6 +20,7 @@
name="description"
content="A carousel component for React with the basics. It just works. For minimal setup and needs. Focused on performance ⚡"
/>
+ <link rel="canonical" href="https://react-slidy.midu.dev/" />
</Head>
<IndexMDX />
<style jsx global> |
d85d4bc34ad869b20b4027d5f32c5ca64e4e4c3e | public/utility.js | public/utility.js | module.exports = {
generateQueryString: function (data) {
var ret = []
for (var d in data)
if (data[d])
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d]))
return ret.join("&")
},
base64Encoding: function (data) {
return new Buffer(data).toString('base64')
},
base64Decoding: function (data) {
return new Buffer(data, 'base64')
},
getUnixTimeStamp: function () {
return Math.floor((new Date).getTime() / 1000)
},
stringReplace: function (source, find, replace) {
return source.replace(find, replace)
}
}
| module.exports = {
generateQueryString: function (data) {
var ret = []
for (var d in data)
if (data[d])
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(data[d]))
return ret.join("&")
},
base64Encoding: function (data) {
return new Buffer(data).toString('base64')
},
base64Decoding: function (data) {
return new Buffer(data, 'base64')
},
getUnixTimeStamp: function () {
return Math.floor((new Date).getTime() / 1000)
},
stringReplace: function (source, find, replace) {
return source.replace(find, replace)
},
inputChecker: function (reqInput, whiteList) {
var input = Object.keys(reqInput)
if (input.length != whiteList.length)
return false
for (var i = 0; i < whiteList.length; i++)
if (input.indexOf(whiteList[i]) <= -1)
return false
return true
}
}
| Add Input White List Checker to Utility | Add Input White List Checker to Utility
| JavaScript | mit | Flieral/Publisher-Service,Flieral/Publisher-Service | ---
+++
@@ -21,5 +21,17 @@
stringReplace: function (source, find, replace) {
return source.replace(find, replace)
+ },
+
+ inputChecker: function (reqInput, whiteList) {
+ var input = Object.keys(reqInput)
+ if (input.length != whiteList.length)
+ return false
+
+ for (var i = 0; i < whiteList.length; i++)
+ if (input.indexOf(whiteList[i]) <= -1)
+ return false
+
+ return true
}
} |
be3aab27fb4ec87679a0734335fb5f67b1c691fe | lib/themes/dosomething/paraneue_dosomething/js/url/helpers.js | lib/themes/dosomething/paraneue_dosomething/js/url/helpers.js | /**
* Get a specified segment from the pathname.
*
* @param {String} pathname
* @param {Number} segment
* @return {Boolean}
*/
export function getPathnameSegment(pathname = window.location.pathname, segmentIndex = 0) {
let segments = pathname.split('/');
segments.splice(0,1);
return segments[segmentIndex];
}
| /**
* Get a specified segment from the pathname.
*
* @param {String} pathname
* @param {Number} segment
* @return {Boolean}
*/
export function getPathnameSegment(pathname = window.location.pathname, segmentIndex = 0) {
let segments = pathname.split('/');
segmentIndex++;
return segments[segmentIndex];
}
| Update to increase index insted of splicing first item off array. | Update to increase index insted of splicing first item off array.
| JavaScript | mit | DoSomething/dosomething,sergii-tkachenko/phoenix,mshmsh5000/dosomething-1,mshmsh5000/dosomething-1,DoSomething/dosomething,DoSomething/phoenix,sergii-tkachenko/phoenix,DoSomething/dosomething,deadlybutter/phoenix,deadlybutter/phoenix,sergii-tkachenko/phoenix,mshmsh5000/dosomething-1,DoSomething/dosomething,DoSomething/dosomething,mshmsh5000/dosomething-1,DoSomething/phoenix,DoSomething/phoenix,deadlybutter/phoenix,DoSomething/dosomething,sergii-tkachenko/phoenix,DoSomething/phoenix,sergii-tkachenko/phoenix,mshmsh5000/dosomething-1,deadlybutter/phoenix,deadlybutter/phoenix,DoSomething/phoenix | ---
+++
@@ -7,8 +7,7 @@
*/
export function getPathnameSegment(pathname = window.location.pathname, segmentIndex = 0) {
let segments = pathname.split('/');
-
- segments.splice(0,1);
+ segmentIndex++;
return segments[segmentIndex];
} |
3c95819895253b77edcfcdd6760a846f590c9210 | src/InputHeader.js | src/InputHeader.js | import React from 'react'
import { Component } from 'react'
class InputHeader extends Component {
focus = () => {
this.refs.inputHeader.focus()
}
blur = () => {
this.refs.inputHeader.blur()
}
render() {
return (
<div className="selectize-input items not-full has-options">
<input type="text" className="search-field" placeholder="Enter a location..."
ref="inputHeader"
value={this.props.search}
onChange={this.props.searchChange}
onKeyDown={this.props.handleKeyPress}
onFocus={this.props.handleFocus}
onBlur={this.props.handleBlur}
/>
</div>
)
}
}
export default InputHeader
| import React from 'react'
import { Component } from 'react'
class InputHeader extends Component {
focus = () => {
this._input.focus()
}
blur = () => {
this._input.blur()
}
render() {
return (
<div className="selectize-input items not-full has-options">
<input type="text" className="search-field" placeholder="Enter a location..."
ref={(c) => this._input = c}
value={this.props.search}
onChange={this.props.searchChange}
onKeyDown={this.props.handleKeyPress}
onFocus={this.props.handleFocus}
onBlur={this.props.handleBlur}
/>
</div>
)
}
}
export default InputHeader
| Change ref from string to callback | Change ref from string to callback
| JavaScript | mit | andynoelker/react-data-select | ---
+++
@@ -3,18 +3,18 @@
class InputHeader extends Component {
focus = () => {
- this.refs.inputHeader.focus()
+ this._input.focus()
}
blur = () => {
- this.refs.inputHeader.blur()
+ this._input.blur()
}
render() {
return (
<div className="selectize-input items not-full has-options">
<input type="text" className="search-field" placeholder="Enter a location..."
- ref="inputHeader"
+ ref={(c) => this._input = c}
value={this.props.search}
onChange={this.props.searchChange}
onKeyDown={this.props.handleKeyPress} |
83bea17aff9f4c3d6adcdf88b3f1661be9b92c15 | middleware/protect.js | middleware/protect.js | var UUID = require('./../uuid' );
function forceLogin(keycloak, request, response) {
var host = request.hostname;
var headerHost = request.headers.host.split(':');
var port = headerHost[1] || '';
var protocol = request.protocol;
var redirectUrl = protocol + '://' + host + ( port === '' ? '' : ':' + port ) + request.url + '?auth_callback=1';
request.session.auth_redirect_uri = redirectUrl;
var uuid = UUID();
var loginURL = keycloak.loginUrl( uuid, redirectUrl );
response.redirect( loginURL );
}
function simpleGuard(role,token) {
if ( role.indexOf( "app:" ) === 0 ) {
return token.hasApplicationRole( role.substring( 4 ) );
}
if ( role.indexOf( "realm:" ) === 0 ) {
return token.hasRealmRole( role.substring( 6 ) );
}
return false;
}
module.exports = function(keycloak, spec) {
var guard;
if ( typeof spec == 'function' ) {
guard = spec;
} else if ( typeof spec == 'string' ) {
guard = simpleGuard.bind(undefined, spec);
}
return function protect(request, response, next) {
if ( request.kauth && request.kauth.grant ) {
if ( ! guard || guard( request.kauth.grant.access_token, request, response ) ) {
return next();
}
return keycloak.accessDenied(request,response,next);
}
if (keycloak.config.bearerOnly){
return keycloak.accessDenied(request,response,next);
}else{
forceLogin(keycloak, request, response);
}
};
};
| var UUID = require('./../uuid' );
function forceLogin(keycloak, request, response) {
var host = request.hostname;
var headerHost = request.headers.host.split(':');
var port = headerHost[1] || '';
var protocol = request.protocol;
var redirectUrl = protocol + '://' + host + ( port === '' ? '' : ':' + port ) + request.url + '?auth_callback=1';
request.session.auth_redirect_uri = redirectUrl;
var uuid = UUID();
var loginURL = keycloak.loginUrl( uuid, redirectUrl );
response.redirect( loginURL );
}
function simpleGuard(role,token) {
return token.hasRole(role);
}
module.exports = function(keycloak, spec) {
var guard;
if ( typeof spec == 'function' ) {
guard = spec;
} else if ( typeof spec == 'string' ) {
guard = simpleGuard.bind(undefined, spec);
}
return function protect(request, response, next) {
if ( request.kauth && request.kauth.grant ) {
if ( ! guard || guard( request.kauth.grant.access_token, request, response ) ) {
return next();
}
return keycloak.accessDenied(request,response,next);
}
if (keycloak.config.bearerOnly){
return keycloak.accessDenied(request,response,next);
}else{
forceLogin(keycloak, request, response);
}
};
};
| Use token.hasRole to check for roles of other apps | Use token.hasRole to check for roles of other apps
| JavaScript | apache-2.0 | keycloak/keycloak-nodejs-connect,keycloak/keycloak-nodejs-connect,abstractj/keycloak-nodejs-connect,abstractj/keycloak-nodejs-connect,abstractj/keycloak-nodejs-connect,keycloak/keycloak-nodejs-connect | ---
+++
@@ -16,14 +16,7 @@
}
function simpleGuard(role,token) {
- if ( role.indexOf( "app:" ) === 0 ) {
- return token.hasApplicationRole( role.substring( 4 ) );
- }
- if ( role.indexOf( "realm:" ) === 0 ) {
- return token.hasRealmRole( role.substring( 6 ) );
- }
-
- return false;
+ return token.hasRole(role);
}
module.exports = function(keycloak, spec) { |
1352d718c2229c64dd6e981937efebfe6c3ddf60 | dxr/static/js/panel.js | dxr/static/js/panel.js | $(function() {
var panelContent = $('#panel-content');
/**
* Toggles the ARIA expanded and hidden attributes' state.
*
* @param Object elem The element on which to toggle the attribute.
*/
function toggleAria(elem) {
var expandedState = elem.attr('aria-expanded') === 'true' ? 'false' : 'true';
var hiddenState = elem.attr('aria-hidden') === 'true' ? 'false' : 'true';
elem.attr('aria-hidden', state);
elem.attr('aria-expanded', state);
}
$('#panel-toggle').click(function(event) {
var panelContent = $(this).next();
var icon = $('.navpanel-icon', this);
icon.toggleClass('expanded');
panelContent.toggle();
toggleAria(panelContent);
});
});
| $(function() {
var panelContent = $('#panel-content');
/**
* Toggles the ARIA expanded and hidden attributes' state.
*
* @param Object elem The element on which to toggle the attribute.
*/
function toggleAria(elem) {
var expandedState = elem.attr('aria-expanded') === 'true' ? 'false' : 'true';
var hiddenState = elem.attr('aria-hidden') === 'true' ? 'false' : 'true';
elem.attr('aria-hidden', hiddenState);
elem.attr('aria-expanded', expandedState);
}
$('#panel-toggle').click(function(event) {
var panelContent = $(this).next();
var icon = $('.navpanel-icon', this);
icon.toggleClass('expanded');
panelContent.toggle();
toggleAria(panelContent);
});
});
| Make ARIA attrs actually update. | Make ARIA attrs actually update.
| JavaScript | mit | pombredanne/dxr,pelmers/dxr,gartung/dxr,erikrose/dxr,jbradberry/dxr,jbradberry/dxr,kleintom/dxr,srenatus/dxr,srenatus/dxr,pombredanne/dxr,gartung/dxr,bozzmob/dxr,KiemVM/Mozilla--dxr,jay-z007/dxr,jbradberry/dxr,pombredanne/dxr,bozzmob/dxr,pombredanne/dxr,pelmers/dxr,jay-z007/dxr,nrc/dxr,jay-z007/dxr,kleintom/dxr,nrc/dxr,erikrose/dxr,kleintom/dxr,nrc/dxr,kleintom/dxr,pelmers/dxr,nrc/dxr,pelmers/dxr,gartung/dxr,jay-z007/dxr,kleintom/dxr,erikrose/dxr,srenatus/dxr,bozzmob/dxr,gartung/dxr,erikrose/dxr,nrc/dxr,KiemVM/Mozilla--dxr,jay-z007/dxr,KiemVM/Mozilla--dxr,bozzmob/dxr,nrc/dxr,KiemVM/Mozilla--dxr,jay-z007/dxr,bozzmob/dxr,jbradberry/dxr,srenatus/dxr,KiemVM/Mozilla--dxr,KiemVM/Mozilla--dxr,gartung/dxr,bozzmob/dxr,jbradberry/dxr,pelmers/dxr,gartung/dxr,pombredanne/dxr,kleintom/dxr,srenatus/dxr,erikrose/dxr,jbradberry/dxr,pelmers/dxr,srenatus/dxr,gartung/dxr,bozzmob/dxr,kleintom/dxr,pombredanne/dxr,pombredanne/dxr,jbradberry/dxr,pelmers/dxr,jay-z007/dxr | ---
+++
@@ -9,8 +9,8 @@
function toggleAria(elem) {
var expandedState = elem.attr('aria-expanded') === 'true' ? 'false' : 'true';
var hiddenState = elem.attr('aria-hidden') === 'true' ? 'false' : 'true';
- elem.attr('aria-hidden', state);
- elem.attr('aria-expanded', state);
+ elem.attr('aria-hidden', hiddenState);
+ elem.attr('aria-expanded', expandedState);
}
$('#panel-toggle').click(function(event) { |
cf3d28d03ef9761001799e4224ce38f65c869de4 | src/networking/auth.js | src/networking/auth.js | import * as ACTION_TYPES from '../constants/action_types'
function extractToken(hash, oldToken) {
const match = hash.match(/access_token=([^&]+)/)
let token = !!match && match[1]
if (!token) {
token = oldToken
}
return token
}
export function checkAuth(dispatch, oldToken, location) {
const token = extractToken(location.hash, oldToken)
if (window.history && window.history.replaceState) {
window.history.replaceState(window.history.state, document.title, window.location.pathname)
} else {
document.location.hash = '' // this is a fallback for IE < 10
}
if (token) {
dispatch({
type: ACTION_TYPES.AUTHENTICATION.USER_SUCCESS,
payload: {
response: {
accessToken: token,
tokenType: 'onboarding_auth',
expiresIn: 7200,
createdAt: new Date(),
},
},
})
} else {
const url = `${ENV.AUTH_DOMAIN}/api/oauth/authorize.html
?response_type=token
&scope=web_app+public
&client_id=${ENV.AUTH_CLIENT_ID}
&redirect_uri=${ENV.AUTH_REDIRECT_URI}`
window.location.href = url
}
}
export function resetAuth(dispatch, location) {
checkAuth(dispatch, null, location)
}
| import * as ACTION_TYPES from '../constants/action_types'
function extractToken(hash, oldToken) {
const match = hash.match(/access_token=([^&]+)/)
let token = !!match && match[1]
if (!token) {
token = oldToken
}
return token
}
export function checkAuth(dispatch, oldToken, location) {
const token = extractToken(location.hash, oldToken)
if (window.history && window.history.replaceState) {
window.history.replaceState(window.history.state, document.title, window.location.pathname)
} else {
document.location.hash = '' // this is a fallback for IE < 10
}
if (token) {
dispatch({
type: ACTION_TYPES.AUTHENTICATION.USER_SUCCESS,
payload: {
response: {
accessToken: token,
tokenType: 'onboarding_auth',
expiresIn: 7200,
createdAt: new Date(),
},
},
})
} else {
const urlArr = [`${ENV.AUTH_DOMAIN}/api/oauth/authorize.html`]
urlArr.push('?response_type=token&scope=web_app+public')
urlArr.push(`&client_id=${ENV.AUTH_CLIENT_ID}`)
urlArr.push(`&redirect_uri=${ENV.AUTH_REDIRECT_URI}`)
window.location.href = urlArr.join('')
}
}
export function resetAuth(dispatch, location) {
checkAuth(dispatch, null, location)
}
| Remove unnecessary whitespace from url string. | Remove unnecessary whitespace from url string. | JavaScript | mit | ello/webapp,ello/webapp,ello/webapp | ---
+++
@@ -29,13 +29,11 @@
},
})
} else {
- const url = `${ENV.AUTH_DOMAIN}/api/oauth/authorize.html
- ?response_type=token
- &scope=web_app+public
- &client_id=${ENV.AUTH_CLIENT_ID}
- &redirect_uri=${ENV.AUTH_REDIRECT_URI}`
-
- window.location.href = url
+ const urlArr = [`${ENV.AUTH_DOMAIN}/api/oauth/authorize.html`]
+ urlArr.push('?response_type=token&scope=web_app+public')
+ urlArr.push(`&client_id=${ENV.AUTH_CLIENT_ID}`)
+ urlArr.push(`&redirect_uri=${ENV.AUTH_REDIRECT_URI}`)
+ window.location.href = urlArr.join('')
}
}
|
41ffe8f6551fcf98eaba292a82e94a6bfa382486 | chrome/background.js | chrome/background.js | /*global chrome, console*/
console.log("background.js");
chrome.runtime.getBackgroundPage(function() {
console.log("getBackgroundPage", arguments);
});
chrome.runtime.onMessageExternal.addListener(function(message, sender, sendResponse) {
console.log("onMessageExternal", arguments);
});
| /*global chrome, console*/
// NOT USED
console.log("background.js");
chrome.runtime.getBackgroundPage(function() {
console.log("getBackgroundPage", arguments);
});
chrome.runtime.onMessageExternal.addListener(function(message, sender, sendResponse) {
console.log("onMessageExternal", arguments);
});
| Add comment to say this file isn't used. | Add comment to say this file isn't used.
| JavaScript | mit | gitgrimbo/settlersonlinesimulator,gitgrimbo/settlersonlinesimulator | ---
+++
@@ -1,4 +1,6 @@
/*global chrome, console*/
+
+// NOT USED
console.log("background.js");
|
975685740c083d4e3d73a238e8220ce7255777f1 | bookmarklet.js | bookmarklet.js | /**
* Download FuckMyDom and call slowly()
**/
(function( window, document, undefined ) {
var stag;
if( !window.FuckMyDom ) {
stag = document.createElement( 'script' );
stag.setAttribute( 'src', 'http://mhgbrown.github.io/fuck-my-dom/fuck-my-dom.js' );
stag.onload = function(){ FuckMyDom.slowly(); };
document.body.appendChild( stag );
} else {
FuckMyDom.slowly();
}
}( window, document )); | /**
* Download FuckMyDom and call slowly()
**/
(function( window, document, undefined ) {
var stag;
if( !window.FuckMyDom ) {
stag = document.createElement( 'script' );
stag.setAttribute( 'src', 'https://mhgbrown.github.io/fuck-my-dom/fuck-my-dom.js' );
stag.onload = function(){ FuckMyDom.slowly(); };
document.body.appendChild( stag );
} else {
FuckMyDom.slowly();
}
}( window, document ));
| Load fuck my dom over https | Load fuck my dom over https | JavaScript | mit | mhgbrown/fuck-my-dom | ---
+++
@@ -7,7 +7,7 @@
if( !window.FuckMyDom ) {
stag = document.createElement( 'script' );
- stag.setAttribute( 'src', 'http://mhgbrown.github.io/fuck-my-dom/fuck-my-dom.js' );
+ stag.setAttribute( 'src', 'https://mhgbrown.github.io/fuck-my-dom/fuck-my-dom.js' );
stag.onload = function(){ FuckMyDom.slowly(); };
document.body.appendChild( stag );
} else { |
cd5790825ab7b3f3b57b1735f699c21c4a82fc35 | bookmarklet.js | bookmarklet.js | javascript:(function(){$("tr.file-diff-line > td.diff-line-num-addition.empty-cell").each(function(index,cell){var line=$(cell).parent().attr('data-line');var path=$(cell).parent().attr('data-path');var repoRoot='/Users/nick/reporoot/';var openInTextmateUrl='txmt://open?url=file://'+repoRoot+path+'&line='+line;$(cell).html('<a href="'+openInTextmateUrl+'">Txmt</a>');})})();
| javascript:!function(){$("tr.file-diff-line > td.diff-line-num-addition.empty-cell").each(function(a,b){var c=$(b).parent().attr("data-line"),d=$(b).parent().attr("data-path"),e="/Users/nick/reporoot/",f="txmt://open?url=file://"+e+d+"&line="+c;$(b).html('<a href="'+f+'">Txmt</a>')})}(window,jQuery);
| Use uglifyjs to minify instead | Use uglifyjs to minify instead | JavaScript | mit | nicolasartman/pullmate | ---
+++
@@ -1 +1 @@
-javascript:(function(){$("tr.file-diff-line > td.diff-line-num-addition.empty-cell").each(function(index,cell){var line=$(cell).parent().attr('data-line');var path=$(cell).parent().attr('data-path');var repoRoot='/Users/nick/reporoot/';var openInTextmateUrl='txmt://open?url=file://'+repoRoot+path+'&line='+line;$(cell).html('<a href="'+openInTextmateUrl+'">Txmt</a>');})})();
+javascript:!function(){$("tr.file-diff-line > td.diff-line-num-addition.empty-cell").each(function(a,b){var c=$(b).parent().attr("data-line"),d=$(b).parent().attr("data-path"),e="/Users/nick/reporoot/",f="txmt://open?url=file://"+e+d+"&line="+c;$(b).html('<a href="'+f+'">Txmt</a>')})}(window,jQuery); |
04ff19fca9ffa556bed81950430b9f2257b13841 | front-end/src/components/shared/Footer.js | front-end/src/components/shared/Footer.js | import React, { Component } from 'react'
import '../../css/style.css'
import FA from 'react-fontawesome'
class Footer extends Component {
render(){
return(
<div className="Footer" >
<br />
<FA
name="linkedin"
border={true}
size="2x"
/>
<FA
name="facebook"
border={true}
size="2x"
/>
<br />
<p>Designed with ❤️ by .this</p>
</div>
)
}
}
export default Footer
| import React, { Component } from 'react'
import '../../css/style.css'
import FA from 'react-fontawesome'
class Footer extends Component {
render(){
return(
<div className="Footer" >
<br />
<FA
name="linkedin"
border={true}
size="2x"
/>
<FA
name="facebook"
border={true}
size="2x"
/>
<br />
<p>Beautifully designed with ❤️ by .this</p>
</div>
)
}
}
export default Footer
| Update for github commit settings | Update for github commit settings
| JavaScript | mit | iankhor/medrefr,iankhor/medrefr | ---
+++
@@ -21,7 +21,7 @@
size="2x"
/>
<br />
- <p>Designed with ❤️ by .this</p>
+ <p>Beautifully designed with ❤️ by .this</p>
</div>
)
} |
ac4c46cf46c6f27bdc26cbbd4a2d37989cc2d0ed | src/ActiveRules.js | src/ActiveRules.js | 'use strict'
const { Fact, Rule, Operator, Engine } = require('json-rules-engine')
class ActiveRules {
constructor () {
this.Fact = Fact
this.Rule = Rule
this.Operator = Operator
this.Engine = Engine
}
}
module.exports = ActiveRules
| 'use strict'
const { Fact, Rule, Operator, Engine } = require('json-rules-engine')
const djv = require('djv');
class ActiveRules {
constructor () {
this.Fact = Fact
this.Rule = Rule
this.Operator = Operator
this.Engine = Engine
this.Validator = djv;
}
}
module.exports = ActiveRules
| Add JSON Validator based on djv | Add JSON Validator based on djv | JavaScript | mit | bwinkers/ActiveRules-Server | ---
+++
@@ -1,6 +1,8 @@
'use strict'
const { Fact, Rule, Operator, Engine } = require('json-rules-engine')
+
+const djv = require('djv');
class ActiveRules {
constructor () {
@@ -8,6 +10,7 @@
this.Rule = Rule
this.Operator = Operator
this.Engine = Engine
+ this.Validator = djv;
}
}
|
a53181a444acf6b91db6ccbc41f5c4dc55c4b2a4 | e2e/e2e.conf.js | e2e/e2e.conf.js | var HtmlReporter = require('protractor-html-screenshot-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'*.js'
],
multiCapabilities: [{
'browserName': 'chrome'
// }, {
// 'browserName': 'firefox'
}],
baseUrl: 'http://localhost:9001/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/tmp/screnshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: 'e2e/reports'
}));
}
};
| var HtmlReporter = require('protractor-html-screenshot-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'*.js'
],
sauceUser: 'mkuzak',
sauceKey: '2e7a055d-0a1d-40ce-81dd-f6bff479c555',
multiCapabilities: [{
'browserName': 'chrome',
'version': '39.0',
'platform': 'WIN8_1'
}, {
'browserName': 'chrome',
'version': '39.0',
'platform': 'Linux'
}, {
'browserName': 'chrome',
'version': '39.0',
'platform': 'OS X 10.10'
}, {
'browserName': 'Firefox',
'version': '34.0',
'platform': 'Linux'
}],
baseUrl: 'http://localhost:9001/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
},
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/tmp/screnshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: 'e2e/reports'
}));
}
};
| Use sauce labs for e2e tests | Use sauce labs for e2e tests
| JavaScript | apache-2.0 | NLeSC/PattyVis,NLeSC/PattyVis | ---
+++
@@ -7,10 +7,25 @@
'*.js'
],
+ sauceUser: 'mkuzak',
+ sauceKey: '2e7a055d-0a1d-40ce-81dd-f6bff479c555',
+
multiCapabilities: [{
- 'browserName': 'chrome'
- // }, {
- // 'browserName': 'firefox'
+ 'browserName': 'chrome',
+ 'version': '39.0',
+ 'platform': 'WIN8_1'
+ }, {
+ 'browserName': 'chrome',
+ 'version': '39.0',
+ 'platform': 'Linux'
+ }, {
+ 'browserName': 'chrome',
+ 'version': '39.0',
+ 'platform': 'OS X 10.10'
+ }, {
+ 'browserName': 'Firefox',
+ 'version': '34.0',
+ 'platform': 'Linux'
}],
baseUrl: 'http://localhost:9001/', |
da8de07075912bdfa163efdfeac6b5b4237f8928 | src/ProjectInfo.js | src/ProjectInfo.js | import React, { PropTypes } from 'react';
export default function ProjectInfo({ projectData }) {
// console.log('projectData: ', projectData);
const {
urls,
photo,
name
} = projectData;
const url = urls.web.project;
const photoSrc = photo.med;
return (
<div className="project-info">
<a href={url} target="_blank">
<div className="image-wrapper">
<img src={photoSrc} alt="project" />
</div>
<h1>{name}</h1>
</a>
</div>
);
}
ProjectInfo.propTypes = {
projectData: PropTypes.object.isRequired
};
| import React, { PropTypes } from 'react';
export default function ProjectInfo({ projectData }) {
// console.log('projectData: ', projectData);
const {
urls,
photo,
name
} = projectData;
if (!urls || !photo) return null;
return (
<div className="project-info">
<a href={urls.web.project} target="_blank">
<div className="image-wrapper">
<img src={photo.med} alt="project" />
</div>
<h1>{name}</h1>
</a>
</div>
);
}
ProjectInfo.propTypes = {
projectData: PropTypes.object.isRequired
};
| Handle not having loaded all projectdata yet | Handle not having loaded all projectdata yet
| JavaScript | mit | peteruithoven/KickstarterStatus,peteruithoven/KickstarterStatus,peteruithoven/KickstarterStatus | ---
+++
@@ -7,13 +7,12 @@
photo,
name
} = projectData;
- const url = urls.web.project;
- const photoSrc = photo.med;
+ if (!urls || !photo) return null;
return (
<div className="project-info">
- <a href={url} target="_blank">
+ <a href={urls.web.project} target="_blank">
<div className="image-wrapper">
- <img src={photoSrc} alt="project" />
+ <img src={photo.med} alt="project" />
</div>
<h1>{name}</h1>
</a> |
f9025b6288b23cad196aec602d97b8536ccb45ee | ZombieRun4HTML5/js/zombie.js | ZombieRun4HTML5/js/zombie.js | function Zombie(map, location) {
this._map = map;
this._location = location;
var markerimage = new google.maps.MarkerImage(
"res/zombie_meandering.png",
new google.maps.Size(14, 30));
this._marker = new google.maps.Marker({
position:location,
map:map,
title:"Zombie",
icon:markerimage,
// TODO: shadow image.
});
}
Zombie.prototype.locationChanged = function(position) {
this._location = latLngFromPosition(position);
this._marker.set_position(this._location);
} | var Zombie = Class.create({
initialize: function(map, location) {
this.map = map;
this.location = location;
var markerimage = new google.maps.MarkerImage(
"res/zombie_meandering.png",
new google.maps.Size(14, 30));
this.marker = new google.maps.Marker({
position:this.location,
map:this.map,
title:"Zombie",
icon:markerimage,
// TODO: shadow image.
});
},
locationChanged: function(latLng) {
this.location = latLng;
this.marger.set_position(this.location);
}
}); | Convert the Zombie to a Prototype class. | Convert the Zombie to a Prototype class. | JavaScript | mit | waynecorbett/z,Arifsetiadi/zombie-run,yucemahmut/zombie-run,waynecorbett/z,malizadehq/zombie-run,malizadehq/zombie-run,mroshow/zombie-run,yucemahmut/zombie-run,tropikhajma/zombie-run,tropikhajma/zombie-run,Arifsetiadi/zombie-run,yucemahmut/zombie-run,mroshow/zombie-run,malizadehq/zombie-run,yucemahmut/zombie-run,Arifsetiadi/zombie-run,waynecorbett/z,waynecorbett/z,mroshow/zombie-run,tropikhajma/zombie-run,mroshow/zombie-run,malizadehq/zombie-run,Arifsetiadi/zombie-run,tropikhajma/zombie-run | ---
+++
@@ -1,20 +1,22 @@
-function Zombie(map, location) {
- this._map = map;
- this._location = location;
+var Zombie = Class.create({
+ initialize: function(map, location) {
+ this.map = map;
+ this.location = location;
- var markerimage = new google.maps.MarkerImage(
- "res/zombie_meandering.png",
- new google.maps.Size(14, 30));
- this._marker = new google.maps.Marker({
- position:location,
- map:map,
- title:"Zombie",
- icon:markerimage,
- // TODO: shadow image.
- });
-}
-
-Zombie.prototype.locationChanged = function(position) {
- this._location = latLngFromPosition(position);
- this._marker.set_position(this._location);
-}
+ var markerimage = new google.maps.MarkerImage(
+ "res/zombie_meandering.png",
+ new google.maps.Size(14, 30));
+ this.marker = new google.maps.Marker({
+ position:this.location,
+ map:this.map,
+ title:"Zombie",
+ icon:markerimage,
+ // TODO: shadow image.
+ });
+ },
+
+ locationChanged: function(latLng) {
+ this.location = latLng;
+ this.marger.set_position(this.location);
+ }
+}); |
3095917c0871ce437b74329f314ba5d65e8ff489 | examples/clear/index.js | examples/clear/index.js | #!/usr/bin/env node
/**
* Like GNU ncurses "clear" command.
* https://github.com/mscdex/node-ncurses/blob/master/deps/ncurses/progs/clear.c
*/
require('../../')(process.stdout)
.eraseData(2)
.goto(1, 1)
| #!/usr/bin/env node
/**
* Like GNU ncurses "clear" command.
* https://github.com/mscdex/node-ncurses/blob/master/deps/ncurses/progs/clear.c
*/
function lf () { return '\n' }
require('../../')(process.stdout)
.write(Array.apply(null, Array(process.stdout.getWindowSize()[1])).map(lf).join(''))
.eraseData(2)
.goto(1, 1)
| Make 'clear' command work on Windows. | Make 'clear' command work on Windows.
| JavaScript | mit | TooTallNate/ansi.js,kasicka/ansi.js | ---
+++
@@ -5,6 +5,9 @@
* https://github.com/mscdex/node-ncurses/blob/master/deps/ncurses/progs/clear.c
*/
+function lf () { return '\n' }
+
require('../../')(process.stdout)
+ .write(Array.apply(null, Array(process.stdout.getWindowSize()[1])).map(lf).join(''))
.eraseData(2)
.goto(1, 1) |
d2d174a6953c247abad372f804cb5db356244779 | packages/imon-scatter/imon_scatter.js | packages/imon-scatter/imon_scatter.js | Settings = {
chart: {
padding: { right: 40, bottom: 80 },
margins: { top: 30, bottom: 0, right: 35 },
dots: {
size: 5,
color: '#378E00',
opacity: 0.7
}
},
defaultData: {
title: 'Scatter Plot',
x: {
indicator: 'ipr', // Percentage of individuals using the Internet
log: false,
jitter: 0.0
},
y: {
indicator: 'downloadkbps', // Average download speed (kbps)
log: false,
jitter: 0.0
}
}
};
IMonScatterWidget = function(doc) {
Widget.call(this, doc);
_.defaults(this.data, Settings.defaultData);
};
IMonScatterWidget.prototype = Object.create(Widget.prototype);
IMonScatterWidget.prototype.constructor = IMonScatterWidget;
IMonScatter = {
widget: {
name: 'Scatter Plot',
description: 'Shows a scatterplot of two chosen metrics from the Internet Monitor dataset across all countries',
url: 'https://thenetmonitor.org/sources',
dimensions: { width: 3, height: 2 },
resize: { mode: 'cover' },
constructor: IMonScatterWidget,
typeIcon: 'line-chart'
},
org: {
name: 'Internet Monitor',
shortName: 'IM',
url: 'http://thenetmonitor.org'
}
};
| Settings = {
chart: {
padding: { right: 40, bottom: 80 },
margins: { top: 30, bottom: 0, right: 35 },
dots: {
size: 5,
color: '#378E00',
opacity: 0.7
}
},
defaultData: {
title: 'Scatter Plot',
x: {
indicator: 'ipr', // Percentage of individuals using the Internet
log: false,
jitter: 0.0
},
y: {
indicator: 'downloadkbps', // Average download speed (kbps)
log: false,
jitter: 0.0
}
}
};
IMonScatterWidget = function(doc) {
Widget.call(this, doc);
_.defaults(this.data, Settings.defaultData);
};
IMonScatterWidget.prototype = Object.create(Widget.prototype);
IMonScatterWidget.prototype.constructor = IMonScatterWidget;
IMonScatter = {
widget: {
name: 'Scatterplot',
description: 'Shows a scatterplot of two chosen metrics from the Internet Monitor dataset across all countries',
url: 'https://thenetmonitor.org/sources',
dimensions: { width: 3, height: 2 },
resize: { mode: 'cover' },
constructor: IMonScatterWidget,
typeIcon: 'line-chart'
},
org: {
name: 'Internet Monitor',
shortName: 'IM',
url: 'http://thenetmonitor.org'
}
};
| Change 'Scatter Plot' to 'Scatterplot' | Change 'Scatter Plot' to 'Scatterplot'
| JavaScript | mit | berkmancenter/internet_dashboard,berkmancenter/internet_dashboard,blaringsilence/internet_dashboard,blaringsilence/internet_dashboard,berkmancenter/internet_dashboard | ---
+++
@@ -33,7 +33,7 @@
IMonScatter = {
widget: {
- name: 'Scatter Plot',
+ name: 'Scatterplot',
description: 'Shows a scatterplot of two chosen metrics from the Internet Monitor dataset across all countries',
url: 'https://thenetmonitor.org/sources',
dimensions: { width: 3, height: 2 }, |
3a20e160d532d82895251ca568378bf903ba67c1 | app/users/user-links.directive.js | app/users/user-links.directive.js | {
angular
.module('meganote.users')
.directive('userLinks', [
'CurrentUser',
(CurrentUser) => {
class UserLinksController {
user() {
return CurrentUser.get();
}
signedIn() {
return CurrentUser.signedIn();
}
}
return {
scope: {},
controller: UserLinksController,
controllerAs: 'vm',
bindToController: true,
template: `
<div class="user-links">
<span ng-show="vm.signedIn()">
Signed in as {{ vm.user().name }}
</span>
<span ng-hide="vm.signedIn()">
<a ui-sref="sign-up">Sign up for Meganote today!</a>
</span>
</div>`,
};
}]);
}
| {
angular
.module('meganote.users')
.directive('userLinks', [
'AuthToken',
'CurrentUser',
(AuthToken, CurrentUser) => {
class UserLinksController {
user() {
return CurrentUser.get();
}
signedIn() {
return CurrentUser.signedIn();
}
logout() {
AuthToken.clear();
CurrentUser.clear();
}
}
return {
scope: {},
controller: UserLinksController,
controllerAs: 'vm',
bindToController: true,
template: `
<div class="user-links">
<span ng-show="vm.signedIn()">
Signed in as {{ vm.user().name }}
|
<a ui-sref="sign-up" ng-click="vm.logout()">Log out</a>
</span>
<span ng-hide="vm.signedIn()">
<a ui-sref="sign-up">Sign up for Meganote today!</a>
</span>
</div>`,
};
}]);
}
| Add logout link and method | Add logout link and method
| JavaScript | mit | sbaughman/meganote,sbaughman/meganote | ---
+++
@@ -3,9 +3,10 @@
.module('meganote.users')
.directive('userLinks', [
+ 'AuthToken',
'CurrentUser',
- (CurrentUser) => {
+ (AuthToken, CurrentUser) => {
class UserLinksController {
user() {
@@ -13,6 +14,10 @@
}
signedIn() {
return CurrentUser.signedIn();
+ }
+ logout() {
+ AuthToken.clear();
+ CurrentUser.clear();
}
}
@@ -25,6 +30,8 @@
<div class="user-links">
<span ng-show="vm.signedIn()">
Signed in as {{ vm.user().name }}
+ |
+ <a ui-sref="sign-up" ng-click="vm.logout()">Log out</a>
</span>
<span ng-hide="vm.signedIn()">
<a ui-sref="sign-up">Sign up for Meganote today!</a> |
4fa12570580a6c81a1cf3eb64e68aef0966b7b67 | ObjectPoolMaker.js | ObjectPoolMaker.js | (function () {
'use strict';
function ObjectPoolMaker(Constructor, size) {
var objectPool = [],
marker = 0,
poolSize = size || 0;
if (poolSize) {
expandPool(poolSize);
}
function expandPool(newSize) {
var i;
for (i = 0; i < newSize - poolSize; i++) {
objectPool.push(new Constructor());
}
poolSize = newSize;
}
return {
create: function () {
if (marker >= poolSize) {
expandPool(poolSize * 2);
}
var obj = objectPool[marker];
obj.index = marker;
marker += 1;
obj.constructor.apply(obj, arguments);
return obj;
},
destroy: function (obj) {
marker -= 1;
var lastObj = objectPool[marker],
lastObjIndex = lastObj.index;
objectPool[marker] = obj;
objectPool[obj.index] = lastObj;
lastObj.index = obj.index;
obj.index = lastObjIndex;
}
};
}
// make ObjectPoolMaker available globally
window.ObjectPoolMaker = ObjectPoolMaker;
}());
| (function () {
'use strict';
function ObjectPoolMaker(Constructor, size) {
var objectPool = [],
nextAvailableIndex = 0,
poolSize = size || 1;
if (poolSize) {
expandPool(poolSize);
}
function expandPool(newSize) {
var i;
for (i = 0; i < newSize - poolSize; i++) {
objectPool.push(new Constructor());
}
poolSize = newSize;
}
return {
create: function () {
if (nextAvailableIndex >= poolSize) {
expandPool(poolSize * 2);
}
var obj = objectPool[nextAvailableIndex];
obj.index = nextAvailableIndex;
nextAvailableIndex += 1;
obj.constructor.apply(obj, arguments);
return obj;
},
destroy: function (obj) {
nextAvailableIndex -= 1;
var lastObj = objectPool[nextAvailableIndex],
lastObjIndex = lastObj.index;
objectPool[nextAvailableIndex] = obj;
objectPool[obj.index] = lastObj;
lastObj.index = obj.index;
obj.index = lastObjIndex;
}
};
}
// make ObjectPoolMaker available globally
window.ObjectPoolMaker = ObjectPoolMaker;
}());
| Rename "marker" to "nextAvailableIndex" for better readability | Rename "marker" to "nextAvailableIndex" for better readability
* Initialize poolSize with 1 (doubling 0 is not smart :)
| JavaScript | mit | handrus/zombies-game,brunops/zombies-game,brunops/zombies-game | ---
+++
@@ -3,8 +3,8 @@
function ObjectPoolMaker(Constructor, size) {
var objectPool = [],
- marker = 0,
- poolSize = size || 0;
+ nextAvailableIndex = 0,
+ poolSize = size || 1;
if (poolSize) {
expandPool(poolSize);
@@ -22,25 +22,25 @@
return {
create: function () {
- if (marker >= poolSize) {
+ if (nextAvailableIndex >= poolSize) {
expandPool(poolSize * 2);
}
- var obj = objectPool[marker];
- obj.index = marker;
- marker += 1;
+ var obj = objectPool[nextAvailableIndex];
+ obj.index = nextAvailableIndex;
+ nextAvailableIndex += 1;
obj.constructor.apply(obj, arguments);
return obj;
},
destroy: function (obj) {
- marker -= 1;
+ nextAvailableIndex -= 1;
- var lastObj = objectPool[marker],
+ var lastObj = objectPool[nextAvailableIndex],
lastObjIndex = lastObj.index;
- objectPool[marker] = obj;
+ objectPool[nextAvailableIndex] = obj;
objectPool[obj.index] = lastObj;
lastObj.index = obj.index; |
55d2ef6add68fde5914af4a43117000fc31f65a3 | app/models/coordinator.js | app/models/coordinator.js | import EmberObject from '@ember/object';
import Evented from '@ember/object/evented';
import { computed } from '@ember/object';
import ObjHash from './obj-hash';
import { unwrapper } from 'ember-drag-drop/utils/proxy-unproxy-objects';
export default EmberObject.extend(Evented, {
objectMap: computed(function() {
return ObjHash.create();
}),
getObject: function(id,ops) {
ops = ops || {};
var payload = this.get('objectMap').getObj(id);
if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) {
payload.ops.source.send('action', payload.obj);
}
if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) {
payload.ops.target.send('action', payload.obj);
}
this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target});
return unwrapper(payload.obj);
},
setObject: function(obj,ops) {
ops = ops || {};
return this.get('objectMap').add({obj: obj, ops: ops});
}
});
| import EmberObject from '@ember/object';
import Evented from '@ember/object/evented';
import { computed } from '@ember/object';
import ObjHash from './obj-hash';
import { unwrapper } from 'ember-drag-drop/utils/proxy-unproxy-objects';
export default EmberObject.extend(Evented, {
objectMap: computed(function() {
return ObjHash.create();
}),
getObject: function(id,ops) {
ops = ops || {};
var payload = this.get('objectMap').getObj(id);
if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) {
if (typeof payload.ops.source['action'] === 'function') {
payload.ops.source['action'](payload.obj)
}
}
if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) {
if (typeof payload.ops.target['action'] === 'function') {
payload.ops.target['action'](payload.obj)
}
}
this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target});
return unwrapper(payload.obj);
},
setObject: function(obj,ops) {
ops = ops || {};
return this.get('objectMap').add({obj: obj, ops: ops});
}
});
| Call directly instead of sending | Call directly instead of sending
| JavaScript | mit | mharris717/ember-drag-drop,mharris717/ember-drag-drop | ---
+++
@@ -14,11 +14,15 @@
var payload = this.get('objectMap').getObj(id);
if (payload.ops.source && !payload.ops.source.isDestroying && !payload.ops.source.isDestroyed) {
- payload.ops.source.send('action', payload.obj);
+ if (typeof payload.ops.source['action'] === 'function') {
+ payload.ops.source['action'](payload.obj)
+ }
}
if (payload.ops.target && !payload.ops.target.isDestroying && !payload.ops.target.isDestroyed) {
- payload.ops.target.send('action', payload.obj);
+ if (typeof payload.ops.target['action'] === 'function') {
+ payload.ops.target['action'](payload.obj)
+ }
}
this.trigger("objectMoved", {obj: unwrapper(payload.obj), source: payload.ops.source, target: ops.target}); |
799893651200debc93951818b09526217e4472b8 | lib/ssq.js | lib/ssq.js | var dgram = require('dgram');
module.exports = {}; | /* Source Server Query (SSQ) library
* Author : George Pittarelli
*
* SSQ protocol is specified here:
* https://developer.valvesoftware.com/wiki/Server_queries
*/
// Module imports
var dgram = require('dgram');
// Message request formats, straight from the spec
var A2A_PING = "i"
, A2S_SERVERQUERY_GETCHALLENGE = "\xFF\xFF\xFF\xFF\x57"
, A2S_INFO = "\xFF\xFF\xFF\xFFTSource Engine Query\x00"
// The following messages require challenge values to be appended to them
, A2S_PLAYER = "\xFF\xFF\xFF\xFF\x55"
, A2S_RULES = "\xFF\xFF\xFF\xFF\x56";
module.exports = {
}; | Add request constants from spec | Add request constants from spec
| JavaScript | bsd-3-clause | gpittarelli/node-ssq | ---
+++
@@ -1,3 +1,24 @@
+/* Source Server Query (SSQ) library
+ * Author : George Pittarelli
+ *
+ * SSQ protocol is specified here:
+ * https://developer.valvesoftware.com/wiki/Server_queries
+ */
+
+// Module imports
var dgram = require('dgram');
-module.exports = {};
+// Message request formats, straight from the spec
+var A2A_PING = "i"
+ , A2S_SERVERQUERY_GETCHALLENGE = "\xFF\xFF\xFF\xFF\x57"
+ , A2S_INFO = "\xFF\xFF\xFF\xFFTSource Engine Query\x00"
+ // The following messages require challenge values to be appended to them
+ , A2S_PLAYER = "\xFF\xFF\xFF\xFF\x55"
+ , A2S_RULES = "\xFF\xFF\xFF\xFF\x56";
+
+module.exports = {
+
+
+
+
+}; |
3cdee6c75924c3cd2c0a0a503d2f927ee6e348a0 | https.js | https.js | //@ts-check
const fs = require("fs");
const https = require('https');
const tls = require("tls");
module.exports = function (iface) {
/** @type { import("tls").TlsOptions } Server options object */
const serveroptions = {
key: [fs.readFileSync("tiddlyserver.key")], // server key file
cert: [fs.readFileSync("tiddlyserver.cer")], //server certificate
// pfx: [fs.readFileSync("server.pfx")], //server pfx (key and cert)
//passphrase for password protected server key and pfx files
// passphrase: "",
//list of certificate authorities for client certificates
// ca: [fs.readFileSync("clients-laptop.cer")],
//request client certificate
// requestCert: true,
//reject connections from clients that cannot present a certificate signed by one of the ca certificates
// rejectUnauthorized: false,
};
return serveroptions;
} | //@ts-check
const fs = require("fs");
const https = require('https');
const tls = require("tls");
// use this command to create a new self-signed certificate
// openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt
module.exports = function (iface) {
/** @type { import("tls").TlsOptions } Server options object */
const serveroptions = {
key: [fs.readFileSync("tiddlyserver.key")], // server key file
cert: [fs.readFileSync("tiddlyserver.cer")], //server certificate
// pfx: [fs.readFileSync("server.pfx")], //server pfx (key and cert)
//passphrase for password protected server key and pfx files
// passphrase: "",
//list of certificate authorities for client certificates
// ca: [fs.readFileSync("clients-laptop.cer")],
//request client certificate
// requestCert: true,
//reject connections from clients that cannot present a certificate signed by one of the ca certificates
// rejectUnauthorized: false,
};
return serveroptions;
} | Add openssl command to generate certificate | Add openssl command to generate certificate
| JavaScript | mit | Arlen22/TiddlyServer,Arlen22/TiddlyServer,Arlen22/TiddlyServer,Arlen22/TiddlyServer | ---
+++
@@ -3,6 +3,8 @@
const https = require('https');
const tls = require("tls");
+// use this command to create a new self-signed certificate
+// openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt
module.exports = function (iface) {
/** @type { import("tls").TlsOptions } Server options object */ |
ce3f97ffbb05d83401356bd64b4870559adaaf18 | index.js | index.js | 'use strict';
var normalizeOptions = require('es5-ext/object/normalize-options')
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
, ensureObject = require('es5-ext/object/valid-object')
, ensureStringifiable = require('es5-ext/object/validate-stringifiable-value')
, d = require('d')
, htmlToDom = require('html-template-to-dom')
, SiteTree = require('site-tree')
, defineProperty = Object.defineProperty, defineProperties = Object.defineProperties;
var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts) {
if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts);
SiteTree.call(this, document);
defineProperty(this, 'inserts', d(ensureObject(inserts)));
}, SiteTree), {
ensureTemplate: d(ensureStringifiable)
});
HtmlSiteTree.prototype = Object.create(SiteTree.prototype, {
constructor: d(HtmlSiteTree),
_resolveTemplate: d(function (tpl, context) {
return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context));
})
});
module.exports = HtmlSiteTree;
| 'use strict';
var normalizeOptions = require('es5-ext/object/normalize-options')
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
, ensureObject = require('es5-ext/object/valid-object')
, ensureStringifiable = require('es5-ext/object/validate-stringifiable-value')
, d = require('d')
, htmlToDom = require('html-template-to-dom')
, SiteTree = require('site-tree')
, defineProperties = Object.defineProperties;
var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts/*, options*/) {
var options;
if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts, arguments[3]);
options = Object(arguments[3]);
SiteTree.call(this, document);
defineProperties(this, {
inserts: d(ensureObject(inserts)),
reEvaluateScriptsOptions: d(options.reEvaluateScripts)
});
}, SiteTree), {
ensureTemplate: d(ensureStringifiable)
});
HtmlSiteTree.prototype = Object.create(SiteTree.prototype, {
constructor: d(HtmlSiteTree),
_resolveTemplate: d(function (tpl, context) {
return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context),
{ reEvaluateScripts: this.reEvaluateScriptsOptions });
})
});
module.exports = HtmlSiteTree;
| Support pass of reEvaluateScript options | Support pass of reEvaluateScript options
| JavaScript | mit | medikoo/html-site-tree | ---
+++
@@ -8,12 +8,17 @@
, htmlToDom = require('html-template-to-dom')
, SiteTree = require('site-tree')
- , defineProperty = Object.defineProperty, defineProperties = Object.defineProperties;
+ , defineProperties = Object.defineProperties;
-var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts) {
- if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts);
+var HtmlSiteTree = defineProperties(setPrototypeOf(function (document, inserts/*, options*/) {
+ var options;
+ if (!(this instanceof HtmlSiteTree)) return new HtmlSiteTree(document, inserts, arguments[3]);
+ options = Object(arguments[3]);
SiteTree.call(this, document);
- defineProperty(this, 'inserts', d(ensureObject(inserts)));
+ defineProperties(this, {
+ inserts: d(ensureObject(inserts)),
+ reEvaluateScriptsOptions: d(options.reEvaluateScripts)
+ });
}, SiteTree), {
ensureTemplate: d(ensureStringifiable)
});
@@ -21,7 +26,8 @@
HtmlSiteTree.prototype = Object.create(SiteTree.prototype, {
constructor: d(HtmlSiteTree),
_resolveTemplate: d(function (tpl, context) {
- return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context));
+ return htmlToDom(this.document, tpl, normalizeOptions(this.inserts, context),
+ { reEvaluateScripts: this.reEvaluateScriptsOptions });
})
});
|
5617c3fd5e2d98b68408ffc5332c6e657613e2cc | index.js | index.js | 'use strict'
var zip = require('zippo')
var State = require('dover')
var Observ = require('observ')
var pipe = require('value-pipe')
var changeEvent = require('value-event/change')
var h = require('virtual-dom/h')
module.exports = ZipInput
function ZipInput (data) {
data = data || {}
var state = State({
value: Observ(data.value || ''),
valid: Observ(zip.validate(data.value || '')),
placeholder: Observ(data.placeholder || ''),
channels: {
change: change
}
})
state.value(pipe(zip.validate, state.valid.set))
return state
}
function change (state, data) {
state.value.set(zip.parse(data.zip))
}
ZipInput.render = function render (state) {
return h('input', {
type: 'text',
name: 'zip',
value: state.value,
placeholder: state.placeholder,
// trigger the big number keyboard on mobile
pattern: '[0-9]*',
'ev-event': changeEvent(state.channels.change)
})
}
| 'use strict'
var zip = require('zippo')
var State = require('dover')
var Observ = require('observ')
var pipe = require('value-pipe')
var changeEvent = require('value-event/change')
var h = require('virtual-dom/h')
module.exports = ZipInput
function ZipInput (data) {
data = data || {}
var state = State({
value: Observ(data.value || ''),
valid: Observ(zip.validate(data.value || '')),
channels: {
change: change
}
})
state.value(pipe(zip.validate, state.valid.set))
return state
}
function change (state, data) {
state.value.set(zip.parse(data.zip))
}
ZipInput.render = function render (state) {
return h('input', {
type: 'text',
name: 'zip',
value: state.value,
// trigger the big number keyboard on mobile
pattern: '[0-9]*',
'ev-event': changeEvent(state.channels.change)
})
}
| Remove placeholder from state atom | Remove placeholder from state atom
| JavaScript | mit | bendrucker/zip-input | ---
+++
@@ -14,7 +14,6 @@
var state = State({
value: Observ(data.value || ''),
valid: Observ(zip.validate(data.value || '')),
- placeholder: Observ(data.placeholder || ''),
channels: {
change: change
}
@@ -34,7 +33,6 @@
type: 'text',
name: 'zip',
value: state.value,
- placeholder: state.placeholder,
// trigger the big number keyboard on mobile
pattern: '[0-9]*',
'ev-event': changeEvent(state.channels.change) |
5d59dffde1a6d3d5d86dfcbbcdb1f798613870bf | website/src/app/project/experiments/services/experiments-service.service.js | website/src/app/project/experiments/services/experiments-service.service.js | class ExperimentsService {
/*@ngInject*/
constructor(projectsAPI) {
this.projectsAPI = projectsAPI;
}
getAllForProject(projectID) {
return this.projectsAPI(projectID).one('experiments').getList();
}
createForProject(projectID, experiment) {
return this.projectsAPI(projectID).one('experiments').customPOST(experiment);
}
updateForProject(projectID, experimentID, what) {
return this.projectsAPI(projectID).one('experiments', experimentID).customPUT(what);
}
getForProject(projectID, experimentID) {
return this.projectsAPI(projectID).one('experiments', experimentID).customGET();
}
createTask(projectID, experimentID, experimentTask) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks').customPOST(experimentTask);
}
updateTask(projectID, experimentID, taskID, task) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks', taskID).customPUT(task);
}
deleteTask(projectID, experimentID, taskID) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('task', taskID).customDELETE();
}
}
angular.module('materialscommons').service('experimentsService', ExperimentsService);
| class ExperimentsService {
/*@ngInject*/
constructor(projectsAPI) {
this.projectsAPI = projectsAPI;
}
getAllForProject(projectID) {
return this.projectsAPI(projectID).one('experiments').getList();
}
createForProject(projectID, experiment) {
return this.projectsAPI(projectID).one('experiments').customPOST(experiment);
}
updateForProject(projectID, experimentID, what) {
return this.projectsAPI(projectID).one('experiments', experimentID).customPUT(what);
}
getForProject(projectID, experimentID) {
return this.projectsAPI(projectID).one('experiments', experimentID).customGET();
}
createTask(projectID, experimentID, experimentTask) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks').customPOST(experimentTask);
}
updateTask(projectID, experimentID, taskID, task) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks', taskID).customPUT(task);
}
addTemplateToTask(projectID, experimentID, taskID, templateID) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks', taskID)
.one('template', templateID).customPOST({});
}
deleteTask(projectID, experimentID, taskID) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('task', taskID).customDELETE();
}
}
angular.module('materialscommons').service('experimentsService', ExperimentsService);
| Add call to associate a template with a task. | Add call to associate a template with a task.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | ---
+++
@@ -28,6 +28,11 @@
return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks', taskID).customPUT(task);
}
+ addTemplateToTask(projectID, experimentID, taskID, templateID) {
+ return this.projectsAPI(projectID).one('experiments', experimentID).one('tasks', taskID)
+ .one('template', templateID).customPOST({});
+ }
+
deleteTask(projectID, experimentID, taskID) {
return this.projectsAPI(projectID).one('experiments', experimentID).one('task', taskID).customDELETE();
} |
4e1a2db67b76238ca22fd5d398f4751b10a25bed | index.js | index.js | module.exports = {
parser: 'babel-eslint',
extends: 'airbnb',
globals: {
before: true,
beforeEach: true,
after: true,
afterEach: true,
describe: true,
it: true,
},
rules: {
'arrow-body-style': ['off'],
'react/jsx-no-bind': ['off'],
'object-shorthand': ['off'],
},
};
| module.exports = {
parser: 'babel-eslint',
extends: 'airbnb',
globals: {
before: true,
beforeEach: true,
after: true,
afterEach: true,
describe: true,
it: true,
xit: true,
xdescribe: true,
},
rules: {
'arrow-body-style': ['off'],
'react/jsx-no-bind': ['off'],
'object-shorthand': ['off'],
},
};
| Make `xit` and `xdescribe` not complain, they are shown after the test run anyways. | Make `xit` and `xdescribe` not complain, they are shown after the test run anyways.
| JavaScript | mit | crewmeister/eslint-config-crewmeister | ---
+++
@@ -8,6 +8,8 @@
afterEach: true,
describe: true,
it: true,
+ xit: true,
+ xdescribe: true,
},
rules: {
'arrow-body-style': ['off'], |
abf1a63a609375f02957ded2d2d6e2014f44fc7e | index.js | index.js | import { Tracker } from 'meteor/tracker';
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
checkNpmVersions({
'mobx': '2.3.x'
}, 'space:tracker-mobx-autorun');
const { autorun } = require('mobx');
export default (trackerMobxAutorun) => {
let mobxDisposer = null;
let computation = null;
let hasBeenStarted;
return {
start() {
let isFirstRun = true;
computation = Tracker.autorun(() => {
if (mobxDisposer) {
mobxDisposer();
isFirstRun = true;
}
mobxDisposer = autorun(() => {
if (isFirstRun) {
trackerMobxAutorun();
} else {
computation.invalidate();
}
isFirstRun = false;
});
});
hasBeenStarted = true;
},
stop() {
if (hasBeenStarted) {
computation.stop();
mobxDisposer();
}
}
};
};
| import { Tracker } from 'meteor/tracker';
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
checkNpmVersions({
'mobx': '2.x'
}, 'space:tracker-mobx-autorun');
const { autorun } = require('mobx');
export default (trackerMobxAutorun) => {
let mobxDisposer = null;
let computation = null;
let hasBeenStarted;
return {
start() {
let isFirstRun = true;
computation = Tracker.autorun(() => {
if (mobxDisposer) {
mobxDisposer();
isFirstRun = true;
}
mobxDisposer = autorun(() => {
if (isFirstRun) {
trackerMobxAutorun();
} else {
computation.invalidate();
}
isFirstRun = false;
});
});
hasBeenStarted = true;
},
stop() {
if (hasBeenStarted) {
computation.stop();
mobxDisposer();
}
}
};
};
| Change mobx dependency version requirement from 2.3.x to 2.x | Change mobx dependency version requirement from 2.3.x to 2.x
| JavaScript | mit | meteor-space/tracker-mobx-autorun | ---
+++
@@ -2,7 +2,7 @@
import { checkNpmVersions } from 'meteor/tmeasday:check-npm-versions';
checkNpmVersions({
- 'mobx': '2.3.x'
+ 'mobx': '2.x'
}, 'space:tracker-mobx-autorun');
const { autorun } = require('mobx'); |
6285af0cc0cac013c5f3501f4251ee091f2e4ef9 | index.js | index.js | (function(){
"use strict";
var gutil = require('gulp-util'),
through = require('through2'),
multimarkdown = require('multimarkdown');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError('gulp-markdown', 'Streaming not supported'));
return cb();
}
file.contents = new Buffer(multimarkdown.convert(file.contents.toString()));
file.path = gutil.replaceExtension(file.path, '.html');
this.push(file);
cb();
});
};
})(); | (function(){
"use strict";
var gutil = require('gulp-util'),
through = require('through2'),
multimarkdown = require('multimarkdown');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) {
this.emit('error', new gutil.PluginError('gulp-multimarkdown', 'Streaming not supported'));
return cb();
}
file.contents = new Buffer(multimarkdown.convert(file.contents.toString()));
file.path = gutil.replaceExtension(file.path, '.html');
this.push(file);
cb();
});
};
})();
| Correct plugin name passed to constructor of PluginError. | Correct plugin name passed to constructor of PluginError.
| JavaScript | mit | jjlharrison/gulp-multimarkdown | ---
+++
@@ -12,7 +12,7 @@
}
if (file.isStream()) {
- this.emit('error', new gutil.PluginError('gulp-markdown', 'Streaming not supported'));
+ this.emit('error', new gutil.PluginError('gulp-multimarkdown', 'Streaming not supported'));
return cb();
}
|
cd972400073e154c2e7b6aa483447763ad87947f | schema/me/suggested_artists_args.js | schema/me/suggested_artists_args.js | import { GraphQLBoolean, GraphQLString, GraphQLInt } from "graphql"
export const SuggestedArtistsArgs = {
artist_id: {
type: GraphQLString,
description: "The slug or ID of an artist",
},
exclude_artists_without_forsale_artworks: {
type: GraphQLBoolean,
description: "Exclude artists without for sale works",
},
exclude_artists_without_artworks: {
type: GraphQLBoolean,
description: "Exclude artists without any artworks",
},
exclude_followed_artists: {
type: GraphQLBoolean,
description: "Exclude artists the user already follows",
},
page: {
type: GraphQLInt,
description: "Pagination, need I say more?",
},
size: {
type: GraphQLInt,
description: "Amount of artists to return",
},
}
| import { GraphQLBoolean, GraphQLString, GraphQLInt, GraphQLList } from "graphql"
export const SuggestedArtistsArgs = {
artist_id: {
type: GraphQLString,
description: "The slug or ID of an artist",
},
exclude_artists_without_forsale_artworks: {
type: GraphQLBoolean,
description: "Exclude artists without for sale works",
},
exclude_artists_without_artworks: {
type: GraphQLBoolean,
description: "Exclude artists without any artworks",
},
exclude_followed_artists: {
type: GraphQLBoolean,
description: "Exclude artists the user already follows",
},
exclude_artist_ids: {
type: new GraphQLList(GraphQLString),
description: "Exclude these ids from results, may result in all artists being excluded.",
},
page: {
type: GraphQLInt,
description: "Pagination, need I say more?",
},
size: {
type: GraphQLInt,
description: "Amount of artists to return",
},
}
| Add excluded artist ids to suggested artist arguments | Add excluded artist ids to suggested artist arguments
| JavaScript | mit | artsy/metaphysics,artsy/metaphysics,artsy/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,mzikherman/metaphysics-1,mzikherman/metaphysics-1 | ---
+++
@@ -1,4 +1,4 @@
-import { GraphQLBoolean, GraphQLString, GraphQLInt } from "graphql"
+import { GraphQLBoolean, GraphQLString, GraphQLInt, GraphQLList } from "graphql"
export const SuggestedArtistsArgs = {
artist_id: {
@@ -17,6 +17,10 @@
type: GraphQLBoolean,
description: "Exclude artists the user already follows",
},
+ exclude_artist_ids: {
+ type: new GraphQLList(GraphQLString),
+ description: "Exclude these ids from results, may result in all artists being excluded.",
+ },
page: {
type: GraphQLInt,
description: "Pagination, need I say more?", |
abaa6231fbb1d0e25eb188acd186a8236e901372 | app/lib/Actions.js | app/lib/Actions.js | 'use strict';
var Reflux = require('reflux');
module.exports = function(api, resource) {
var asyncChildren = {
children: ['completed', 'failed'],
};
var Actions = Reflux.createActions({
load: asyncChildren,
create: asyncChildren,
update: asyncChildren,
sort: asyncChildren,
});
Actions.load.listen(function(o) {
api[resource].get(o).then((res) => {
this.completed({
count: res.headers['total-count'],
data: res.data
});
}).catch(this.failed);
});
Actions.create.listen(function(data) {
api[resource].post(data).then((res) => {
data.id = res.data.id;
this.completed(data);
}).catch(this.failed);
});
Actions.update.listen(function(data) {
api[resource].put(data).then(() => this.completed(data)).catch(this.failed);
});
Actions.sort.listen(function(o) {
api[resource].get(o).then((res) => {
this.completed({
count: res.headers['total-count'],
data: res.data
});
}).catch(this.failed);
});
return Actions;
};
| 'use strict';
var Reflux = require('reflux');
module.exports = function(api, resource) {
var asyncChildren = {
children: ['completed', 'failed'],
};
var Actions = Reflux.createActions({
load: asyncChildren,
create: asyncChildren,
update: asyncChildren,
sort: asyncChildren,
});
Actions.load.listen(function(o) {
api[resource].get(o).then((res) => {
this.completed({
count: res.headers['total-count'],
data: res.data
});
}).catch(this.failed);
});
Actions.create.listen(function(data) {
api[resource].post(data).then((res) => {
this.completed(res.data);
}).catch(this.failed);
});
Actions.update.listen(function(data) {
api[resource].put(data).then((res) => {
this.completed(res.data);
}).catch(this.failed);
});
Actions.sort.listen(function(o) {
api[resource].get(o).then((res) => {
this.completed({
count: res.headers['total-count'],
data: res.data
});
}).catch(this.failed);
});
return Actions;
};
| Use data returned from PUT/POST after actions | Use data returned from PUT/POST after actions
Now dates and other derived values should show up ok.
| JavaScript | mit | koodilehto/koodilehto-crm-frontend,bebraw/react-crm-frontend,bebraw/react-crm-frontend,koodilehto/koodilehto-crm-frontend | ---
+++
@@ -24,14 +24,14 @@
Actions.create.listen(function(data) {
api[resource].post(data).then((res) => {
- data.id = res.data.id;
-
- this.completed(data);
+ this.completed(res.data);
}).catch(this.failed);
});
Actions.update.listen(function(data) {
- api[resource].put(data).then(() => this.completed(data)).catch(this.failed);
+ api[resource].put(data).then((res) => {
+ this.completed(res.data);
+ }).catch(this.failed);
});
Actions.sort.listen(function(o) { |
49fec8ec59fa692f7cb9b04670f6e5a221dc8087 | src/js/store/reducers/settings.js | src/js/store/reducers/settings.js | import { SET_SETTINGS, EDITOR_DECREASE_FONT_SIZE, EDITOR_INCREASE_FONT_SIZE } from '../actions';
const initialState = {};
const MINIMUM_FONT_SIZE = 8;
const settings = (state = initialState, action) => {
// The settings is an object with an arbitrary set of properties.
// The only property we don't want to copy is `type`, which is
// only used in the reducer, here. Make sure we combine incoming
// properties with existing properties.
const settingsObj = Object.assign({}, state, action);
delete settingsObj.type;
switch (action.type) {
case SET_SETTINGS:
return {
...settingsObj,
};
case EDITOR_DECREASE_FONT_SIZE:
return {
...settingsObj,
editorFontSize: Math.max(state.editorFontSize - 1, MINIMUM_FONT_SIZE),
};
case EDITOR_INCREASE_FONT_SIZE:
return {
...settingsObj,
editorFontSize: state.editorFontSize + 1,
};
default:
return state;
}
};
export default settings;
| import { SET_SETTINGS, EDITOR_DECREASE_FONT_SIZE, EDITOR_INCREASE_FONT_SIZE } from '../actions';
const MINIMUM_FONT_SIZE = 8;
const initialState = {
editorFontSize: 14,
};
const settings = (state = initialState, action) => {
// The settings is an object with an arbitrary set of properties.
// The only property we don't want to copy is `type`, which is
// only used in the reducer, here. Make sure we combine incoming
// properties with existing properties.
const settingsObj = Object.assign({}, state, action);
delete settingsObj.type;
switch (action.type) {
case SET_SETTINGS:
return {
...settingsObj,
};
case EDITOR_DECREASE_FONT_SIZE:
return {
...settingsObj,
editorFontSize: Math.max(state.editorFontSize - 1, MINIMUM_FONT_SIZE),
};
case EDITOR_INCREASE_FONT_SIZE:
return {
...settingsObj,
editorFontSize: state.editorFontSize + 1,
};
default:
return state;
}
};
export default settings;
| Fix editor font size brokenness | Fix editor font size brokenness
| JavaScript | mit | tangrams/tangram-play,tangrams/tangram-play | ---
+++
@@ -1,7 +1,10 @@
import { SET_SETTINGS, EDITOR_DECREASE_FONT_SIZE, EDITOR_INCREASE_FONT_SIZE } from '../actions';
-const initialState = {};
const MINIMUM_FONT_SIZE = 8;
+
+const initialState = {
+ editorFontSize: 14,
+};
const settings = (state = initialState, action) => {
// The settings is an object with an arbitrary set of properties. |
e6a41ab15506da80c954185de2a4cea3e18393fa | index.js | index.js | const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
app.set('view engine', 'ejs');
app.set('views', './')
app.get('/serve-seed.html', (req, res) => {
res.render('./serve-seed.ejs', {
url: process.env.APIARY_SEED_URL || 'http://localhost:3000'
});
});
app.use(bodyParser.json());
app.use(cors());
app.post('/api/users/:user', (req, res) => {
return res.json(Object.assign({
id: req.params.id,
name: 'Vincenzo',
surname: 'Chianese',
age: 27 // Ahi Ahi, getting older
}, req.body));
});
app.listen(process.env.PORT || 3001);
| const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const app = express();
app.set('view engine', 'ejs');
app.set('views', './')
app.use(cors());
app.get('/serve-seed.html', (req, res) => {
res.render('./serve-seed.ejs', {
url: process.env.APIARY_SEED_URL || 'http://localhost:3000'
});
});
app.use(bodyParser.json());
app.post('/api/users/:user', (req, res) => {
return res.json(Object.assign({
id: req.params.id,
name: 'Vincenzo',
surname: 'Chianese',
age: 27 // Ahi Ahi, getting older
}, req.body));
});
app.listen(process.env.PORT || 3001);
| Enable cors for every route | Enable cors for every route
| JavaScript | mit | apiaryio/apiary-console-seed,apiaryio/console-proxy,apiaryio/apiary-console-seed,apiaryio/console-proxy | ---
+++
@@ -7,6 +7,8 @@
app.set('view engine', 'ejs');
app.set('views', './')
+app.use(cors());
+
app.get('/serve-seed.html', (req, res) => {
res.render('./serve-seed.ejs', {
url: process.env.APIARY_SEED_URL || 'http://localhost:3000'
@@ -14,7 +16,6 @@
});
app.use(bodyParser.json());
-app.use(cors());
app.post('/api/users/:user', (req, res) => {
return res.json(Object.assign({ |
5ecd628fb0f597811a69a7c8e4cdf02f46497f50 | components/Deck/ContentModulesPanel/ContentHistoryPanel/SlideHistoryPanel.js | components/Deck/ContentModulesPanel/ContentHistoryPanel/SlideHistoryPanel.js | import React from 'react';
import {connectToStores} from 'fluxible-addons-react';
import SlideHistoryStore from '../../../../stores/SlideHistoryStore';
import UserProfileStore from '../../../../stores/UserProfileStore';
import PermissionsStore from '../../../../stores/PermissionsStore';
import {Feed} from 'semantic-ui-react';
import ContentChangeItem from './ContentChangeItem';
class SlideHistoryPanel extends React.Component {
render() {
const changes = this.props.SlideHistoryStore.changes ? this.props.SlideHistoryStore.changes.map((change, index) => {
return (
<ContentChangeItem selector={this.props.selector} permissions={this.props.PermissionsStore.permissions} change={change} key={index}/>
);
}) : '';
return (
<div ref="slideHistoryPanel" className="ui">
<Feed>
{changes}
</Feed>
</div>
);
}
}
SlideHistoryPanel.contextTypes = {
executeAction: React.PropTypes.func.isRequired
};
SlideHistoryPanel = connectToStores(SlideHistoryPanel, [SlideHistoryStore, UserProfileStore, PermissionsStore], (context, props) => {
return {
SlideHistoryStore: context.getStore(SlideHistoryStore).getState(),
UserProfileStore: context.getStore(UserProfileStore).getState(),
PermissionsStore: context.getStore(PermissionsStore).getState()
};
});
export default SlideHistoryPanel;
| import React from 'react';
import {connectToStores} from 'fluxible-addons-react';
import SlideHistoryStore from '../../../../stores/SlideHistoryStore';
import UserProfileStore from '../../../../stores/UserProfileStore';
import PermissionsStore from '../../../../stores/PermissionsStore';
import {Feed} from 'semantic-ui-react';
import ContentChangeItem from './ContentChangeItem';
class SlideHistoryPanel extends React.Component {
render() {
const changes = this.props.SlideHistoryStore.changes && this.props.SlideHistoryStore.changes.length ? this.props.SlideHistoryStore.changes.map((change, index) => {
return (
<ContentChangeItem selector={this.props.selector} permissions={this.props.PermissionsStore.permissions} change={change} key={index}/>
);
}) : 'There are no changes for this slide.';
return (
<div ref="slideHistoryPanel" className="ui">
<Feed>
{changes}
</Feed>
</div>
);
}
}
SlideHistoryPanel.contextTypes = {
executeAction: React.PropTypes.func.isRequired
};
SlideHistoryPanel = connectToStores(SlideHistoryPanel, [SlideHistoryStore, UserProfileStore, PermissionsStore], (context, props) => {
return {
SlideHistoryStore: context.getStore(SlideHistoryStore).getState(),
UserProfileStore: context.getStore(UserProfileStore).getState(),
PermissionsStore: context.getStore(PermissionsStore).getState()
};
});
export default SlideHistoryPanel;
| Add message for empty slide history | Add message for empty slide history
| JavaScript | mpl-2.0 | slidewiki/slidewiki-platform,slidewiki/slidewiki-platform,slidewiki/slidewiki-platform | ---
+++
@@ -9,11 +9,11 @@
class SlideHistoryPanel extends React.Component {
render() {
- const changes = this.props.SlideHistoryStore.changes ? this.props.SlideHistoryStore.changes.map((change, index) => {
+ const changes = this.props.SlideHistoryStore.changes && this.props.SlideHistoryStore.changes.length ? this.props.SlideHistoryStore.changes.map((change, index) => {
return (
<ContentChangeItem selector={this.props.selector} permissions={this.props.PermissionsStore.permissions} change={change} key={index}/>
);
- }) : '';
+ }) : 'There are no changes for this slide.';
return (
<div ref="slideHistoryPanel" className="ui"> |
3985a313a544580a829e3ae708b13d578510c2cf | index.js | index.js | "use strict";
const express = require('express');
const twilio = require('twilio');
const bodyParser = require('body-parser');
const app = express();
// Run server to listen on port 5000.
const server = app.listen(5000, () => {
console.log('listening on *:5000');
});
const io = require('socket.io')(server);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static('static'));
app.get('/', (req, res) => {
res.sendFile(__dirname + '/views/index.html');
});
app.post('/sms', (req, res) => {
let twiml = twilio.TwimlResponse();
let sentiment = 'positive'; // For now
io.emit('sms', sentiment);
twiml.message('Thanks for joining my demo :)');
res.send(twiml.toString());
});
| "use strict";
const express = require('express');
const twilio = require('twilio');
const bodyParser = require('body-parser');
const app = express();
// Run server to listen on port 8000.
const server = app.listen(8000, () => {
console.log('listening on *:8000');
});
const io = require('socket.io')(server);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(express.static('static'));
app.get('/', (req, res) => {
res.sendFile(__dirname + '/views/index.html');
});
app.post('/sms', (req, res) => {
let twiml = twilio.TwimlResponse();
let addOns = JSON.parse(req.body.AddOns);
let sentimentStatus = addOns.results.ibm_watson_sentiment.status;
if (sentimentStatus === 'successful') {
let sentiment = addOns.results.ibm_watson_sentiment.result.docSentiment.type;
io.emit('sms', sentiment);
console.log(sentiment);
} else {
console.log('Sentiment failed');
}
twiml.message('Thanks for joining my demo :)');
res.send(twiml.toString());
});
| Fix error checking for sentiment analysis | Fix error checking for sentiment analysis
| JavaScript | mit | sagnew/SentimentRocket,sagnew/SentimentRocket | ---
+++
@@ -5,9 +5,9 @@
const app = express();
-// Run server to listen on port 5000.
-const server = app.listen(5000, () => {
- console.log('listening on *:5000');
+// Run server to listen on port 8000.
+const server = app.listen(8000, () => {
+ console.log('listening on *:8000');
});
const io = require('socket.io')(server);
@@ -22,9 +22,18 @@
app.post('/sms', (req, res) => {
let twiml = twilio.TwimlResponse();
- let sentiment = 'positive'; // For now
+ let addOns = JSON.parse(req.body.AddOns);
+ let sentimentStatus = addOns.results.ibm_watson_sentiment.status;
- io.emit('sms', sentiment);
+ if (sentimentStatus === 'successful') {
+ let sentiment = addOns.results.ibm_watson_sentiment.result.docSentiment.type;
+ io.emit('sms', sentiment);
+ console.log(sentiment);
+ } else {
+ console.log('Sentiment failed');
+ }
+
twiml.message('Thanks for joining my demo :)');
+
res.send(twiml.toString());
}); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.