commit stringlengths 40 40 | old_file stringlengths 4 264 | new_file stringlengths 4 264 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 624 | message stringlengths 15 4.7k | lang stringclasses 3
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
a2f4e0a23386678a46fceaa4efd8802d8dd5d6bd | 17/amqp-server-worker.js | 17/amqp-server-worker.js | var amqp = require('amqp');
var connection = amqp.createConnection({
host: 'localhost'
});
connection.on('ready', function () {
connection.queue('task-queue', { autoDelete: false, durable: true }, function(q) {
q.bind('#');
q.subscribe({ ack: true, prefetchCount: 1 }, function(message) {
... | Add the example to the worker for RabbitMG server. | Add the example to the worker for RabbitMG server.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | |
d11e67d241fd12daff2ec7ea2c2ad5ef1d8bb166 | index.js | index.js | "use strict";
// Export the most important modules
global[ "ResourceBundle" ] = require( "./lib/resource-bundle" );
global[ "Locale" ] = require( "./lib/locale" );
global[ "Currency" ] = require( "./lib/currency" );
global[ "Format" ] = require( "./lib/format" );
global[ "FieldPosition" ] = require( "./lib/field-posi... | Add the package main file | Add the package main file
| JavaScript | mit | yannickebongue/text-formatjs,yannickebongue/text-formatjs | |
1ab91d4923ece874474ae08934452b35609c4124 | metashare/media/js/jsi18n.js | metashare/media/js/jsi18n.js | /* gettext library */
// This function is copied from django admin path
var catalog = new Array();
function pluralidx(count) { return (count == 1) ? 0 : 1; }
function gettext(msgid) {
var value = catalog[msgid];
if (typeof(value) == 'undefined') {
return msgid;
} else {
return (typeof(value) == 'string') ? value : ... | Manage default editor group on a single page | Manage default editor group on a single page
| JavaScript | bsd-3-clause | MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,zeehio/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/CEF-ELRC,JuliBakagianni/META-SHARE,MiltosD/CEF-ELRC,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,JuliBakagianni/CEF-ELRC,zeehio/META-SHARE,zeehio/META-SHARE... | |
54a5a217282470916cbc97c08209f39f89296f19 | test/mecab_test.js | test/mecab_test.js | 'use strict';
const assert = require('assert');
const Mecab = require('../lib/mecab');
describe('Mecab', () => {
const tests = [
{argv: '本日は晴天なり', expected: ['本日', 'は', '晴天', 'なり']},
{argv: '\r\n 本日は晴天なり \r\n \r\n', expected: ['本日', 'は', '晴天', 'なり']},
];
tests.forEach(test => {
... | Add test cases of mecab.js | Add test cases of mecab.js
| JavaScript | mit | tanikawa04/kyrica | |
a3b279660d21b9e4453a68f9cbfaae7d0cef1ef0 | public/modules/core/directives/focusOn.js | public/modules/core/directives/focusOn.js | /*global angular*/
(function () {
'use strict';
angular.module('core').directive('focusOn', ["$timeout", "$parse", function ($timeout, $parse) {
return {
link: function (scope, element, attrs) {
var expr = $parse(attrs.focusOn);
scope.$watch(expr, function (... | Add directive to focus an element based on an expression (useful for search inputs). | Add directive to focus an element based on an expression (useful for search inputs).
| JavaScript | mit | tmol/iQSlideShow,tmol/iQSlideShow,tmol/iQSlideShow | |
043fec02cb4d1ad6c90422701079f12d80662811 | app/assets/javascripts/unit_toggler.js | app/assets/javascripts/unit_toggler.js | $(function() {
$('.toggleDeadlineUnitDate').on('click', function(e) {
e.preventDefault();
$(this).replaceWith("<label for='project_goal_deadline_date'>Goal Deadline Date</label><input type='date' name='project[goal_deadline_date]' id='project_goal_deadline_date'></input>");
$('.toggleDeadlineUnitHours').r... | Add JS date toggle file and functionality. | Add JS date toggle file and functionality.
| JavaScript | mit | tiger-swallowtails-2014/write-now,tiger-swallowtails-2014/write-now | |
45e9577cad2e3955edc60e3acb831ef1445c38e6 | lib/middleware/timeout.js | lib/middleware/timeout.js | /*!
* Connect - timeout
* Ported from https://github.com/LearnBoost/connect-timeout
* MIT Licensed
*/
/**
* Module dependencies.
*/
var debug = require('debug')('connect:timeout');
/**
* Timeout:
*
* Times out the request in `ms`, defaulting to `5000`. The
* method `req.clearTimeout()` is added to revert t... | /*!
* Connect - timeout
* Ported from https://github.com/LearnBoost/connect-timeout
* MIT Licensed
*/
/**
* Module dependencies.
*/
var debug = require('debug')('connect:timeout');
/**
* Timeout:
*
* Times out the request in `ms`, defaulting to `5000`. The
* method `req.clearTimeout()` is added to revert t... | Fix status code in documentation | Fix status code in documentation
Fix a mismatch between the documented status code (408) and the one set by the middleware | JavaScript | mit | behind2/connect,chinazhaghai/connect,liuwei9413/connect,khirayama/connect,austincitylimits/connect,RoseTHERESA/connect,lian774739140/connect,davehorton/drachtio,tanveer12332/connect,khalerc/connect,qitianchan/connect,gtomitsuka/connect,RickyDan/connect,dkfiresky/connect,mi2oon/connect,keenwon/connect,llwanghong/connect... |
bd532c391431ab5f097fbf15e36a5db9b4e8415a | src/utils/config.js | src/utils/config.js | // node modules
import fs from 'fs';
// npm modules
import homedir from 'homedir';
const configFilePath = `${homedir()}/.urcli/config.json`;
export class Config {
constructor() {
try {
const config = JSON.parse(fs.readFileSync(configFilePath));
Object.assign(this, config);
} catch (e) {
//... | // node modules
import fs from 'fs';
// npm modules
import homedir from 'homedir';
const configFilePath = `${homedir()}/.urcli/config.json`;
export class Config {
constructor() {
try {
const config = JSON.parse(fs.readFileSync(configFilePath));
Object.assign(this, config);
} catch (e) {
//... | Save the object itself, rather than a list of arguments | Save the object itself, rather than a list of arguments
| JavaScript | mit | trolster/urcli,gabraganca/ur-cli,trolster/ur-cli |
a7c95c5cdccf0ec21ce2da6d71e4fb756059dc5b | tools/distServer.js | tools/distServer.js | // This file configures a web server for testing the production build
// on your local machine.
import browserSync from 'browser-sync';
import historyApiFallback from 'connect-history-api-fallback';
// Run Browsersync
browserSync({
port: 3000,
ui: {
port: 3001
},
server: {
baseDir: 'dist'
},
file... | // This file configures a web server for testing the production build
// on your local machine.
import browserSync from 'browser-sync';
import historyApiFallback from 'connect-history-api-fallback';
import {chalkProcessing} from './chalkConfig';
/* eslint-disable no-console */
console.log(chalkProcessing('Opening pr... | Add message when opening prod build | Add message when opening prod build
| JavaScript | mit | svitekpavel/Conway-s-Game-of-Life,danpersa/remindmetolive-react,svitekpavel/chatbot-website,waneka/codenames,PatrickHai/react-client-changers,danpersa/remindmetolive-react,lisavogtsf/canned-react-slingshot-app,aaronholmes/yelp-clone,oded-soffrin/gkm_viewer,kpuno/survey-app,akataz/theSite,oshalygin/react-slingshot,oshal... |
82d1b94903536e70edf56faa5011246be9c67be3 | scripts/bugs/math_pow.js | scripts/bugs/math_pow.js | 'use strict';
var x = 10;
var y = 308;
var actual = Math.pow( x, y );
var expected = 1e308;
console.log( 'pow(%d,%d) = %d. Expected: %d.', x, y, actual, expected );
actual = pow( x, y );
console.log( 'pow(%d,%d) = %d. Expected: %d.', x, y, actual, expected );
// See https://bugs.chromium.org/p/v8/issues/detail?id=3... | Add script showing Math.pow bug | Add script showing Math.pow bug
| JavaScript | mit | kgryte/talks-nodejs-interactive-2016,kgryte/talks-nodejs-interactive-2016 | |
8f141dc580a0168927441745c824a7e98382e805 | boxcharter/common/status_types.js | boxcharter/common/status_types.js | /*
* Copyright (c) 2017 Bonnie Schulkin. All Rights Reserved.
*
* This file is part of BoxCharter.
*
* BoxCharter is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, ... | Add status type object for consistent use across client / server. | Add status type object for consistent use across client / server.
| JavaScript | agpl-3.0 | flyrightsister/boxcharter,flyrightsister/boxcharter | |
24136b649067029c3d0f8be4254accc50a68c455 | Medium/073_Set_Matrix_Zeroes.js | Medium/073_Set_Matrix_Zeroes.js | /**
* @param {number[][]} matrix
* @return {void} Do not return anything, modify matrix in-place instead.
*/
var setZeroes = function(matrix) {
var zeroes = [];
for (var i = 0; i < matrix.length; i++) {
for (var j = 0; j < matrix[i].length; j++) {
if (matrix[i][j] === 0) {
... | Add solution to question 73 | Add solution to question 73
| JavaScript | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | |
1067669be2af48b5f8f55411c0c7d35438535438 | src/common.js | src/common.js | const symbols = {
'~': 'tilde',
'`': 'backtick',
'!': 'exclamation',
'@': 'at',
'#': 'pound',
$: 'dollar',
'%': 'percent',
'^': 'carat',
'&': 'ampersand',
'*': 'asterisk',
'(': 'paren-open',
')': 'paren-close',
'-': 'hyphen',
_: 'underscore',
'=': 'equals',
'+': 'plus',
'[': 'square-op... | Add a list of useful regex. | Add a list of useful regex.
| JavaScript | mit | kroogs/scanty | |
faa58cbd818d4bfcdc2861301d5cd2415b432ac5 | js/nav_menu.js | js/nav_menu.js | /**
* Handle the custom post type nav menu meta box
*/
jQuery( document ).ready( function($) {
$( '#submit-mlp_language' ).click( function( event ) {
event.preventDefault();
var items = $( '#' + mlp_nav_menu.metabox_list_id + ' li :checked' ),
submit = $( '#submit-mlp_language' ),
languages = []... | Add missing nav menu js | Add missing nav menu js
| JavaScript | mit | inpsyde/multilingual-press,inpsyde/multilingual-press | |
d2b3e46f9f58b3b47dcec1032401885b2ea139cf | JS-Fundamentals-Homeworks/Operators-and-Expressions/02.Divide-by-7-and-5.js | JS-Fundamentals-Homeworks/Operators-and-Expressions/02.Divide-by-7-and-5.js | function solve(argument) {
var n = parseInt(argument[0]);
if (n % 7 === 0 && n % 5 === 0) {
console.log("true " + n);
} else {
console.log("false " + n);
}
} | Solve problem 02. Divide by 7 and 5 | Solve problem 02. Divide by 7 and 5
| JavaScript | mit | Gyokay/Telerik-Academy-Homeworks,Gyokay/Telerik-Homeworks,Gyokay/Telerik-Academy-Homeworks,Gyokay/Telerik-Homeworks,Gyokay/Telerik-Academy-Homeworks | |
f4b135a3897e708a6332aebc307cc0d6602cef3b | app/js/GameOfLife.js | app/js/GameOfLife.js | var GameOfLife = (function () {
var ALIVE = "alive", DEAD = "dead";
function Cell(initialState) {
var state = initialState || DEAD;
function getNumberOfAlive(neighbours) {
var nbAliveCells = 0;
neighbours.forEach(function (neighbor) {
if (neighbor.isAliv... | Move game of life module to its own file | Move game of life module to its own file
| JavaScript | mit | velcrin/GameOfLife | |
102429aa5b8f3c56f2aa64ab5cc09b4c6bb1e7de | src/components/PreviewPane.js | src/components/PreviewPane.js | import React, { PropTypes } from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Widgets from './Widgets';
export default class PreviewPane extends React.Component {
previewFor(field) {
const { entry, getMedia } = this.props;
const widget = Widgets[field.get('widget')] || Widgets.... | import React, { PropTypes } from 'react';
import { render } from 'react-dom';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Widgets from './Widgets';
class Preview extends React.Component {
previewFor(field) {
const { entry, getMedia } = this.props;
const widget = Widgets[field.get('widg... | Make preview pane render to an iframe | Make preview pane render to an iframe
| JavaScript | mit | dopry/netlify-cms,netlify/netlify-cms,Aloomaio/netlify-cms,netlify/netlify-cms,Aloomaio/netlify-cms,netlify/netlify-cms,netlify/netlify-cms,dopry/netlify-cms |
1a2b5a507dbfd75fdaf8630f6b29907d813c3bb9 | scripts/points-url-data-to-new-bucket.js | scripts/points-url-data-to-new-bucket.js | const promise = require("bluebird");
const options = {
// Initialization Options
promiseLib: promise, // use bluebird as promise library
capSQL: true, // when building SQL queries dynamically, capitalize SQL keywords
};
const pgp = require("pg-promise")(options);
const connectionString = process.env.DATABASE_URL;... | Create a script to update old photo URL to new URL | Create a script to update old photo URL to new URL
| JavaScript | mit | participedia/api,participedia/api,participedia/api,participedia/api | |
4ce36f3443a3385468fd6fde0ae9f27d54ea1d37 | spec/frontend/notes/stores/utils_spec.js | spec/frontend/notes/stores/utils_spec.js | import { hasQuickActions } from '~/notes/stores/utils';
describe('hasQuickActions', () => {
it.each`
input | expected
${'some comment'} | ${false}
${'/quickaction'} | ${true}
${'some comment with\n/quickaction'} | ${true}
`('retur... | Add failing test for hasQuickActions | Add failing test for hasQuickActions
| JavaScript | mit | stoplightio/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,mmkassem/gitlabhq,stoplightio/gitlabhq,mmkassem/gitlabhq | |
fecd3b971f6536a7ef289640168d33d981ac5c66 | tests/commands/cenTests.js | tests/commands/cenTests.js | var cen = require("__buttercup/classes/commands/command.cen.js");
module.exports = {
setUp: function(cb) {
this.command = new cen();
(cb)();
},
errors: {
groupNotFoundThrowsError: function (test) {
var fakeSearching = {
findGroupByID: function (a, b) {
return false;
}... | Test error for cen command | Test error for cen command
| JavaScript | mit | buttercup/buttercup-core,buttercup/buttercup-core,buttercup/buttercup-core,perry-mitchell/buttercup-core,buttercup-pw/buttercup-core,perry-mitchell/buttercup-core,buttercup-pw/buttercup-core | |
ad3e5c3f9a4529819b26ebeef3ba2ec94eaecf83 | string-truncate.js | string-truncate.js | const stringTruncate = (str, lgt) => {
if (str.length > lgt) {
return str.substring(0, lgt) + "...";
}
return str;
};
stringTruncate("hello mortal world", 13);
| Truncate a string with a specific length | Truncate a string with a specific length
| JavaScript | mit | divyanshu-rawat/Basic-JS-Algorithms | |
7a45e111d37b899432e191e439f7c843e74b3455 | router.js | router.js | var Router = (function() {
var routes = [],
redirects = [];
/**
* Add a set of routes and their callbacks to the Router
* Params: alternating RegExp objects and functions are expected
*/
function setRoutes() {
if (arguments.length % 2 != 0) {
throw new Error("Even... | Add initial version of routes.js | Add initial version of routes.js
| JavaScript | mit | AndreiDuma/router.js | |
cb14823f8fb538a662e7220740aa46af93b36bc1 | replaceHtml.js | replaceHtml.js | function replaceHtml(htmlString, hashObject) {
const filesArray = Object.keys(hashObject)
let newHtmlString = htmlString
function replaceSrc(file) {
const srcAttributeDblQuote = `src="${file}"`
const srcAttributeSingQuote = `src='${file}'`
const hash = hashObject[file]
const classAttribute = `c... | Replace src in html with class=hash | Replace src in html with class=hash
| JavaScript | mit | CarolAG/WebFlight,coryc5/WebFlight | |
e308516a1407f64f9642fadf0ca51707340a56bc | test/bin.js | test/bin.js | var expect = require('chai').expect;
var fs = require("fs");
var exec = require('child_process').exec;
describe('Smoke test for the executable script', function () {
beforeEach(function () {
fs.writeFileSync(
"test/test-data.js",
'var foo = 10;\n' +
'[1, 2, 3].map(function(x) { return x*x });'
... | Add smoke test for running the executable script | Add smoke test for running the executable script
It's slow, but we only need a few of these just to ensure that
everything has been wired together correctly.
| JavaScript | mit | lebab/lebab,mohebifar/xto6,mohebifar/lebab | |
fa12c52231dd91e2485433cbd9df2161b8839c7a | migrations/3_deploy_crowdsale_contract.js | migrations/3_deploy_crowdsale_contract.js | var NeufundTestToken = artifacts.require("./NeufundTestToken.sol");
var Crowdsale = artifacts.require("./Crowdsale.sol");
module.exports = function (deployer) {
/**
* address ifSuccessfulSendTo,
* uint fundingGoalInEthers,
* uint durationInMinutes,
* uint etherCostOfEachToken,
* Token addr... | Add migration for a crowdsale contract | Add migration for a crowdsale contract
| JavaScript | mit | Neufund/Contracts | |
adf64a16d81e5c2968b4d572d9cb649b48d92910 | scripts/mocha.js | scripts/mocha.js | var system = require('system')
, webpage = require('webpage');
var page = webpage.create()
, passes = 0
, failures = 0
, total;
page.onAlert = function(msg) {
var a = JSON.parse(msg)
switch(a.event) {
case 'start':
total = a.params.total;
break;
case 'pass':
console.log('[ ok ]... | Add PhantomJS script to report test results. | Add PhantomJS script to report test results.
| JavaScript | mit | jaredhanson/phantomjs-mocha | |
4b051356414093bcee39a46d0ab727261e6d4a54 | maintenance/recompute-indexed-geometry.js | maintenance/recompute-indexed-geometry.js | #!/usr/bin/env node
/*jslint node: true */
/*
* Compute a new indexedGeometry field for every Response document.
* We should run this if we significantly change our algorithm for computing
* the indexedGeometry field.
*
* Usage:
* $ envrun -e my-deployment.env --path recompute-indexed-geometry.js
*
* Or run ... | Add maintenance script for recomputing indexed geometries | Add maintenance script for recomputing indexed geometries
| JavaScript | bsd-3-clause | LocalData/localdata-api,LocalData/localdata-api,LocalData/localdata-api | |
b395f02cf30a64bd21af14bfd0883467962b4902 | 16/sharp-toFormat.js | 16/sharp-toFormat.js | var sharp = require('sharp');
var dirpath = 'images/';
var imgname = 'download-logo.png';
var tmppath = 'tmp/'
sharp(dirpath + imgname)
.jpeg()
.toFile(tmppath + 'New_' + 'output.jpeg', function (err, info) {
if (err)
throw err;
console.log('done');
});
sharp(dirpath + imgn... | Add the example to change format of image via sharp. | Add the example to change format of image via sharp.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | |
f9c48d88a67fed97610ba82106df668abca53698 | scripts/opendata_manual_update.js | scripts/opendata_manual_update.js | 'use strict';
const co = require('co');
const logger = require('../modules').logger;
const mongooseHelper = require('../modules').mongooseHelper;
const opendata = require('../worker').opendata;
const rollbarHelper = require('../modules').rollbarHelper;
mongooseHelper.connect()
.then(() => rollbarHelper.init())
.t... | Add script to execute manually to update parkings | Add script to execute manually to update parkings
| JavaScript | mit | carparker/carparker-server | |
2f234f6ce007a625382f597af0cd017d8ca044ac | server/startup/migrations/v095.js | server/startup/migrations/v095.js | RocketChat.Migrations.add({
version: 95,
up() {
if (RocketChat && RocketChat.models && RocketChat.models.Settings) {
const emailHeader = RocketChat.models.Settings.findOne({ _id: 'Email_Header' });
const emailFooter = RocketChat.models.Settings.findOne({ _id: 'Email_Footer' });
const startWithHTML = emailH... | Add <html> tags to email header and footer | Add <html> tags to email header and footer
| JavaScript | mit | mrinaldhar/Rocket.Chat,fatihwk/Rocket.Chat,mrsimpson/Rocket.Chat,galrotem1993/Rocket.Chat,inoio/Rocket.Chat,danielbressan/Rocket.Chat,k0nsl/Rocket.Chat,Sing-Li/Rocket.Chat,4thParty/Rocket.Chat,cnash/Rocket.Chat,4thParty/Rocket.Chat,k0nsl/Rocket.Chat,Sing-Li/Rocket.Chat,4thParty/Rocket.Chat,nishimaki10/Rocket.Chat,VoiSm... | |
73a91ee247e43d67fb586b5b0c7b8e2694c14345 | src/modules/gallery-lazy-load.js | src/modules/gallery-lazy-load.js | import axios from 'axios';
function Loader(options = {}) {
this.page = options.page || 0;
this.limit = options.limit || 1;
this.url = options.url || '';
this.nextPage = () => {
this.page += 1;
return axios.get(this.url, {
params: {
page: this.page,
limit: this.limit,
},
... | Add lazy loader client script | Add lazy loader client script
| JavaScript | mit | tuelsch/bolg,tuelsch/bolg | |
9f495fe9c7edb89cdf9226007715b55a6f5fb15f | tests/record.js | tests/record.js | var expect = require('chai').expect,
models = require('../models'),
Record = require('../models/record'),
connection = require('../lib/datastore').connection;
describe('Record retrieved from database', function () {
var wantid
var rec;
before(function (done) {
connection.query('SELECT i... | Add simple unit test for Record model | Add simple unit test for Record model
| JavaScript | agpl-3.0 | jcamins/biblionarrator,jcamins/biblionarrator | |
05131a5eaf5c4bdab431a8de4d86f3ce726fc7e4 | server/labyrinthdb.js | server/labyrinthdb.js | 'use strict';
var r = require('rethinkdb');
export class LabyrinthDB {
constructor (conn, dbName) {
this.conn = conn;
this.dbName = dbName;
this.tableList = ['chat'];
this.checkDB();
}
checkDB () {
const _this = this;
r.dbList().run(this.conn, function (err, dbList) {
if (err)... | Add first prototype of LabyrinthDB. | Add first prototype of LabyrinthDB.
| JavaScript | mit | nobus/Labyrinth,nobus/Labyrinth | |
e8bebebe19e64d664069f23e534b173ca50e4d2f | ui/src/status/apis/index.js | ui/src/status/apis/index.js | import {get} from 'utils/ajax'
export const getJSONFeed = url => get(url)
| import {get} from 'utils/ajax'
import {fixtureJSONFeed} from 'src/status/fixtures'
// TODO: remove async/await & object return, uncomment get(url) when proxy route implemented
export const getJSONFeed = async url => {
return await {data: fixtureJSONFeed}
// get(url)
}
| Return fixture data until json feed proxy implemented | Return fixture data until json feed proxy implemented
| JavaScript | mit | li-ang/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,nooproblem/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb,li-ang/influxdb,influxdb/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,influxdata/influxdb,mark... |
d2b27174c997b0bda5836ade508511fd3a21c9cf | js/api-server.js | js/api-server.js | var lightResource,
sensor = require( "./mock-sensor" )(),
iotivity = require( "iotivity" ),
device = iotivity.OicDevice(),
settings = {
role: "server",
connectionMode: "acked",
info: {
uuid: "INTEL"
}
};
device.configure( settings );
sensor.on( "change", function( newData ) {
var index,
updates = [... | Add API observable server example | Examples: Add API observable server example
| JavaScript | mit | zqzhang/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node,zolkis/iotivity-node,zolkis/iotivity-node,zqzhang/iotivity-node | |
e019d9c26f2be9d571016a9c606c3635437af323 | scripts/init-db.js | scripts/init-db.js | /**
* Generate the dbtables
* and generate a user with a post
*
* username = batman
* password = robin
*/
const path = require('path')
require('dotenv').load({ path: path.resolve(__dirname, '../../', '.env') });
const bcrypt = require('bcryptjs')
const fs = require('fs-promise')
const mysql = require('mysql')
con... | Write a script to setup db and a test user & post | Write a script to setup db and a test user & post
| JavaScript | mit | chamsocial/Chamsocial,chamsocial/Chamsocial,chamsocial/Chamsocial | |
ea8d07da420713a6adc1c3ac50402e9adbc6a88c | test/fitness-scoring.js | test/fitness-scoring.js | const {scoreScenario, boilDownIndividualScore} = require('../app/fitness-scoring.js');
const assert = require('assert');
describe('scoreScenario', () => {
it('assigns fitness scores for individuals', () => {
const scenario = {
id: 1,
participants: ['Nick'],
initialPositions: {
Nick: {... | Add tests for fitness behaviour and bug | Add tests for fitness behaviour and bug
| JavaScript | mit | helix-pi/helix-pi,Widdershin/helix-pi,helix-pi/helix-pi,Widdershin/helix-pi | |
68f52baec830b28259d5d486b3dcf892e51285d3 | server.js | server.js | var dgram = require("dgram");
var socket = dgram.createSocket("udp4");
socket.on("error", function (err) {
console.log("server error:\n" + err.stack);
socket.close();
});
socket.on("message", function (msg, rinfo) {
var jsonObj = { message: msg.toString('utf8').replace(/\r?\n|\r/g, " "), tags: ['sawyer'], sawy... | Read syslog data and outputs to console as JSON | Read syslog data and outputs to console as JSON
| JavaScript | bsd-3-clause | genebean/sawyer | |
fbe55dba68fb2542fd12e4daf5bd1203d356bb5c | lib/util/hook.js | lib/util/hook.js |
/**
* This is our "Hook" class that allows a script to hook into the lifecyle of the
* "configure", "build" and "clean" commands. It's basically a hack into the
* module.js file to allow custom hooks into the module-space, specifically to
* make the global scope act as an EventEmitter.
*/
var fs = require('fs')
... | Add the 'createHook()' function. Rather hacky but oh well... | Add the 'createHook()' function. Rather hacky but oh well...
| JavaScript | mit | maghoff/node-gyp,spacelis/node-gyp,spacelis/node-gyp,maghoff/node-gyp,tepez/node-gyp,pombredanne/pangyp,saper/node-gyp,yorkie/node-gyp,justinmchase/node-gyp,overra/node-gyp,MiniGod/nw-gyp,implausible/pangyp,CodeJockey/node-ninja,rvagg/pangyp,watonyweng/node-gyp,atiti/pangyp,nodegit/node-gyp,jqk6/node-gyp,fengmk2/node-g... | |
56b7877f251fdd0b9cd53dfa6d0d19f9fd6b7d8f | tests/ids/add_ids.js | tests/ids/add_ids.js | /* bender-tags: editor,unit */
/* bender-ckeditor-plugins: autoid */
'use strict';
bender.editor = {
config: {
enterMode: CKEDITOR.ENTER_P
}
};
bender.test({
setUp: function() {
this.editor = this.editorBot.editor;
},
'test it can add a unique id to a heading': function() {
var bot = this.editorBo... | Add start of tests for checking that plugin adds ids correctly on initial load | Add start of tests for checking that plugin adds ids correctly on initial load
| JavaScript | mit | PolicyStat/ckeditor-plugin-autoid-headings,PolicyStat/ckeditor-plugin-autoid-headings | |
9b7b663c33e9dea0e21ac778712f4dfa8f507883 | sandbox/sangmee.js | sandbox/sangmee.js | function deleteDestination(place) {
function placeToDelete(){
return place;
};
// delete user's destination
// NEED TO REPLACE USERNAME WITH CURRENT USER UID
usersRef.child('sangmee/destinations').orderByKey().on('child_added', function(snapshot){
snapshot.forEach(function(destination){
if(des... | Add method to delete users destination | Add method to delete users destination
| JavaScript | mit | okjill/scout,okjill/scout,okjill/scout,okjill/scout | |
ce34ddf2c1dc99050e669f24f6f35794bbe956a0 | lib/datapacktypes/product2.js | lib/datapacktypes/product2.js | var Product2 = module.exports = function(vlocity) {
this.vlocity = vlocity;
};
Product2.prototype.childrenExport = async function(inputMap) {
try {
var jobInfo = inputMap.jobInfo;
var childrenDataPacks = inputMap.childrenDataPacks;
var dataPackType = childrenDataPacks[0].VlocityDataPackType;
let querySt... | Update to have Children for Product2 run in JavaScript | Update to have Children for Product2 run in JavaScript
| JavaScript | mit | vlocityinc/vlocity_build,vlocityinc/vlocity_build,vlocityinc/vlocity_build | |
987f8fb93621526c42b7866af816f01b6d7fced4 | lib/mongoskin/gridfs.js | lib/mongoskin/gridfs.js | var GridStore = require('mongodb').GridStore;
/**
* @param filename: filename or ObjectId
*/
var SkinGridStore = exports.SkinGridStore = function(skinDb) {
this.skinDb = skinDb;
}
/**
* @param filename: filename or ObjectId
* callback(err, gridStoreObject)
*/
SkinGridStore.prototype.open = function(filename,... | var GridStore = require('mongodb').GridStore;
/**
* @param filename: filename or ObjectId
*/
var SkinGridStore = exports.SkinGridStore = function(skinDb) {
this.skinDb = skinDb;
}
/**
* @param filename: filename or ObjectId
* callback(err, gridStoreObject)
*/
SkinGridStore.prototype.open = function(id, filen... | Allow opening a file by id and name | Allow opening a file by id and name
| JavaScript | mit | kissjs/node-mongoskin,microlv/node-mongoskin,mleanos/node-mongoskin,dropfen/node-mongoskin |
93e2ebe6e77256e9102019350f0969ee3470e813 | src/doc_injector.js | src/doc_injector.js | var DocInjector = {
init: function() {
var that = this;
$.each(this.data, function(i, docReference) {
that.inject(docReference)
});
},
data: [{
"api_url": "http://developer.github.com/v3/meta/#meta",
"method_name":"meta"
}],
inject: function(docReference) {
var anchor = docReference.api_url.split("#... | Add initial API docs js injector | Add initial API docs js injector
| JavaScript | mit | joeyw/octodoctotron,joeyw/octodoctotron,joeyw/octodoctotron | |
84c329ce0406b08649bb2c667e5b0e3f4c3e1132 | lib/util/TradingPair.js | lib/util/TradingPair.js |
/*
*
* poloniex-unofficial
* https://git.io/polonode
*
* Yet another unofficial Node.js wrapper for the Poloniex cryptocurrency
* exchange APIs.
*
* Copyright (c) 2016 Tyler Filla
*
* This software may be modified and distributed under the terms of the MIT
* license. See the LICENSE file for details.
*
*/... | Implement basic representation of a trading pair | Implement basic representation of a trading pair
| JavaScript | mit | tylerfilla/node-poloniex-unofficial | |
84157c3942725eaaf928a08ad5ac3ba389dc141a | server/routes/users/index.js | server/routes/users/index.js | import express from 'express';
import * as userController from '../../controllers/users';
const user = express.Router();
// define route controllers for creating sign up, login and sign out
user.post('/signup', userController.signUp);
user.post('/signin', userController.signIn);
user.get('/signout', userController.... | Set up '/signup' to use User controller | Set up '/signup' to use User controller
| JavaScript | apache-2.0 | larrystone/BC-26-More-Recipes,larrystone/BC-26-More-Recipes | |
fae9ab2828b9e5a4c19a65a7e2918b9e33b60558 | src/shared/keypaths.js | src/shared/keypaths.js | const refPattern = /\[\s*(\*|[0-9]|[1-9][0-9]+)\s*\]/g;
const splitPattern = /([^\\](?:\\\\)*)\./;
const escapeKeyPattern = /\\|\./g;
const unescapeKeyPattern = /((?:\\)+)\1|\\(\.)/g;
export function escapeKey ( key ) {
if ( typeof key === 'string' ) {
return key.replace( escapeKeyPattern, '\\$&' );
}
return key... | const refPattern = /\[\s*(\*|[0-9]|[1-9][0-9]+)\s*\]/g;
const splitPattern = /([^\\](?:\\\\)*)\./;
const escapeKeyPattern = /\\|\./g;
const unescapeKeyPattern = /((?:\\)+)\1|\\(\.)/g;
export function escapeKey ( key ) {
if ( typeof key === 'string' ) {
return key.replace( escapeKeyPattern, '\\$&' );
}
return key... | Make splitKeypath() work in old IE | Make splitKeypath() work in old IE
| JavaScript | mit | marcalexiei/ractive,ISNIT0/ractive,marcalexiei/ractive,marcalexiei/ractive,ISNIT0/ractive,ractivejs/ractive,ractivejs/ractive,ractivejs/ractive,ISNIT0/ractive |
c365f8c33825e67846d40e651f4bb7dd063461c5 | lib/extensions.js | lib/extensions.js | var semver = require('semver'),
runtimeVersion = semver.parse(process.version);
/**
* Get Runtime Name
*
* @api private
*/
function getRuntimeName() {
return process.execPath
.split(/[\\/]+/).pop()
.split('.').shift();
}
/**
* Get unique name of binary for current platform
*
* @api priva... | var semver = require('semver'),
runtimeVersion = semver.parse(process.version);
/**
* Get Runtime Name
*
* @api private
*/
function getRuntimeName() {
var runtime = process.execPath
.split(/[\\/]+/).pop()
.split('.').shift();
return runtime === 'node' || runtime === 'nodejs' ? 'node' : ru... | Normalize runtime name for binary installation | Normalize runtime name for binary installation
| JavaScript | mit | Vitogee/node-sass,littlepoolshark/node-sass,paulcbetts/node-sass,nschonni/node-sass,quentinyang/node-sass,justame/node-sass,Smartbank/node-sass,justame/node-sass,SomeoneWeird/node-sass,pmq20/node-sass,chriseppstein/node-sass,yanickouellet/node-sass,besarthoxhaj/node-sass,am11/node-sass,kylecho/node-sass,nibblebot/node-... |
394cbfd34ee9439048e266fc824432a5a6edec25 | test/player-eats-virus-test.js | test/player-eats-virus-test.js | const chai = require('chai');
const assert = chai.assert;
const Player = require('../public/online-player');
const Virus = require('../lib/virus');
describe('Player eating viruses', function(){
context('Player is large enough to consume virus', function() {
it('deletes the virus from the viruses array', functi... | Add test for player eats virus | Add test for player eats virus
| JavaScript | mit | jecrockett/gametime,jecrockett/gametime | |
66cfb46a9a824b185f7ff3b8c74e666fd80436be | lib/number.with.commas.js | lib/number.with.commas.js | "use static";
function numberWithCommas(number) {
var parts = number.toString().split(".");
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
return parts.join(".");
}
Handlebars.registerHelper('commas', numberWithCommas);
| Format numbers with thousand seperators | Format numbers with thousand seperators
| JavaScript | bsd-2-clause | narthollis/eve-skillplan-webapp,narthollis/eve-skillplan-webapp | |
5dcc55153ee9f81058f01d22a4db8a215b221966 | squanch.js | squanch.js | const squanch = (...patterns) => {
return v => {
const primitives = ['Number', 'String', 'Boolean', 'Symbol'];
const isIdentical = (p, v) => p === v;
const isNull = (p, v) => isIdentical(null, p) && isIdentical(p, v);
const isUndefined = (p, v) => isIdentical(undefined, p) && isIdentical(p, v);
const isPrim... | Add initial pattern matching logic | Add initial pattern matching logic
get schwifty! | JavaScript | mit | magbicaleman/squanch | |
e2558b0870f368dcbf7a3defa63167384f521c66 | html2md.js | html2md.js | #!/usr/bin/env node
var fs = require('fs')
toMarkdown = require('to-markdown');
fn = process.argv[2]
fs.readFile(fn, 'utf8', function (err,data) {
if (err) {
return console.log(err);
}
converter = {
filter: ['span', 'title', 'meta', 'style'],
replacement: function(content) {
if (
content.tagName == '... | Add html->md script (moved from wkoszek/me/scripts) | Add html->md script (moved from wkoszek/me/scripts)
| JavaScript | bsd-2-clause | wkoszek/tools,wkoszek/tools,wkoszek/tools | |
cdd10264a128017b80b501e183c2925e30048a43 | server/index.js | server/index.js | const express = require('express');
const redis = require("redis");
const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const passport = require('passport');
const path = require('path');
const app = express();
const server = require('http').createServer(app);
const io = re... | const express = require('express');
const redis = require("redis");
const session = require('express-session');
const RedisStore = require('connect-redis')(session);
const passport = require('passport');
const path = require('path');
const app = express();
const server = require('http').createServer(app);
const io = re... | Add csurf to protect against CSRF attacks | Add csurf to protect against CSRF attacks
| JavaScript | bsd-3-clause | zhakkarn/Mail-for-Good,karuppiah7890/Mail-for-Good,karuppiah7890/Mail-for-Good,zhakkarn/Mail-for-Good,zhakkarn/Mail-for-Good,karuppiah7890/Mail-for-Good |
7022aa26b0ef3a0610b5f80255bc95d8d29027a7 | tests/hello.js | tests/hello.js | // Copyright 2015 Samsung Electronics Co., Ltd.
// Copyright 2015 University of Szeged.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.... | Add a "Hello JerryScript!" program to the tests | Add a "Hello JerryScript!" program to the tests
The current code base does not contain any "first JavaScript
program" for those who build JerryScript for Linux console. It
does contain a LED-blinking example -- blinky.js -- but that's
only useful on an developer board where LEDs-to-be-blinked are
available. And the re... | JavaScript | apache-2.0 | zherczeg/jerryscript,jack60504/jerryscript,slaff/jerryscript,bzsolt/jerryscript,robertsipka/jerryscript,loki04/jerryscript,LaszloLango/jerryscript,slaff/jerryscript,akosthekiss/jerryscript,bzsolt/jerryscript,jerryscript-project/jerryscript,martijnthe/jerryscript,tilmannOSG/jerryscript,martijnthe/jerryscript,LaszloLango... | |
944f8f79929e732b6554b7648dac0188213ca540 | app/components/api.js | app/components/api.js | export function get(path) {
return request('GET', path, '', {});
}
export function post(path, body, signature) {
return request('POST', path, body, signature);
}
function request(verb, path, body, signature) {
return fetch(path, Object.assign({
method: verb,
headers: {
'Accept': 'application/json'... | Move API functions into separate file | Move API functions into separate file
| JavaScript | apache-2.0 | dillonhafer/garage-ios,dillonhafer/garage-ios | |
98c536016b4c8d2364b854b835ad347038dc49dd | tests/utils/time/TimeParserTests.js | tests/utils/time/TimeParserTests.js | /** @ignore */
const TimeParser = requireApp('utils/time/TimeParser');
/** @ignore */
const assert = require('assert');
describe('app/utils/time/TimeParser', () => {
describe('#parse()', () => {
it('returns format, time array and seconds as an object', () => {
let time = TimeParser.parse('2h2s'... | Add tests for time parser utility | Add tests for time parser utility
| JavaScript | mit | Senither/AvaIre | |
7f61cb688bdd653a05f8d44bb242f63732acdcc2 | node-tests/blueprints/mixin-test.js | node-tests/blueprints/mixin-test.js | 'use strict';
var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers');
var setupTestHooks = blueprintHelpers.setupTestHooks;
var emberNew = blueprintHelpers.emberNew;
var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy;
var expect = require('ember-cli-blueprint-test-helpers/chai').expe... | Add inital test for mixin blueprint | Add inital test for mixin blueprint
| JavaScript | mit | kimroen/ember-cli-coffeescript,kimroen/ember-cli-coffeescript,kimroen/ember-cli-coffeescript | |
68235553f0d6fda45339cbf88b4998942ca5037c | i18n/jquery.spectrum-es.js | i18n/jquery.spectrum-es.js | // Spectrum Colorpicker
// Spanish (es) localization
// https://github.com/bgrins/spectrum
(function ( $ ) {
var localization = $.spectrum.localization["es"] = {
cancelText: "Cancelar",
chooseText: "Elegir",
clearText: "Borrar color seleccionado",
noColorSelectedText: "Ningn color ... | // Spectrum Colorpicker
// Spanish (es) localization
// https://github.com/bgrins/spectrum
(function ( $ ) {
var localization = $.spectrum.localization["es"] = {
cancelText: "Cancelar",
chooseText: "Elegir",
clearText: "Borrar color seleccionado",
noColorSelectedText: "Ningún color... | Fix Spanish language file encoding (UTF-8). | Fix Spanish language file encoding (UTF-8).
| JavaScript | mit | ginlime/spectrum,GerHobbelt/spectrum,liitii/spectrum,GerHobbelt/spectrum,ajssd/spectrum,maurojs25/spectrum,kotmatpockuh/spectrum,liitii/spectrum,safareli/spectrum,ginlime/spectrum,shawinder/spectrum,armanforghani/spectrum,bgrins/spectrum,ajssd/spectrum,kotmatpockuh/spectrum,safareli/spectrum,c9s/spectrum,shawinder/spec... |
3a0dfb0a715d352ff612059a924a8992006fa6c9 | 25/passport-facebook.js | 25/passport-facebook.js | var passport = require('passport');
var FacebookStrategy = require('passport-facebook').Strategy;
var express = require('express');
var cookieSession = require('cookie-session');
var app = express();
app.use(cookieSession({keys: ['asdfghjkl!@#$%ASDFGHJ']}))
app.use(passport.initialize());
app.use(passport.session());
... | Add the example to get the authorization from facebook. | Add the example to get the authorization from facebook.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | |
b85b349730792bfc7721d343467a831a7304e1a8 | client/app/data/validator/Email.js | client/app/data/validator/Email.js | Ext.define('Starter.data.validator.Email', {
override: 'Ext.data.validator.Email',
validate: function(value) {
if (value === undefined || value === null || Ext.String.trim(value).length === 0) {
return true;
}
var matcher = this.getMatcher(), result = matcher && matcher.test(value);
return result ? result... | Change the email validator so it also works for optional fields | Change the email validator so it also works for optional fields | JavaScript | apache-2.0 | ralscha/eds-starter6-mongodb,ralscha/eds-starter6-mongodb,ralscha/eds-starter6-mongodb | |
6a6e35d90b2da1265911c1c4ebdf5082b2d1e777 | test/reducers/gui_test.js | test/reducers/gui_test.js | /* eslint-disable max-len */
import { UPDATE_LOCATION } from 'react-router-redux'
import { expect, // sinon
} from '../spec_helper'
import * as subject from '../../src/reducers/gui'
describe('gui reducer', () => {
describe('initial state', () => {
it('sets up a default initialState', () => {
expect(... | Add basic gui reducer test | Add basic gui reducer test
| JavaScript | mit | ello/webapp,ello/webapp,ello/webapp | |
57e0abe38feb077cfb1e33414813d5bc704d150e | week-7/variables-objects.js | week-7/variables-objects.js | // JavaScript Variables and Objects
// I paired by myself on this challenge.
// __________________________________________
// Write your code below.
var secretNumber = 7;
var password = "just open the door"
var allowedIn = false;
var members = ["John", "Susan", "Tom", "Mary"]
// __________________________________... | Add 7.3 variables and objects | Add 7.3 variables and objects
| JavaScript | mit | marcus-a-davis/phase-0,marcus-a-davis/phase-0,marcus-a-davis/phase-0 | |
558503a4eb6e696294255161d5d83645c89702d5 | migrations/20160728121504-update-chat-channels-to-be-more-flexible.js | migrations/20160728121504-update-chat-channels-to-be-more-flexible.js | exports.up = function(db, cb) {
db.runSql(`
CREATE TABLE channels (
name citext PRIMARY KEY,
private boolean NOT NULL DEFAULT false,
high_traffic boolean NOT NULL DEFAULT false,
topic text,
password text
);`, addChannelNameConstraint)
function addChannelNameConst... | Update the database structure of the chat channels to be more flexible. | Update the database structure of the chat channels to be more flexible.
| JavaScript | mit | ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery,ShieldBattery/ShieldBattery | |
851dc3c21b3b98d60965cda6368623a3750c3c22 | client/webpack.common.config.js | client/webpack.common.config.js | // Common webpack configuration used by webpack.hot.config and webpack.rails.config.
const path = require('path');
module.exports = {
// the project dir
context: __dirname,
entry: ['jquery', 'jquery-ujs', './assets/javascripts/App'],
resolve: {
root: [
path.join(__dirname, 'scripts'),
path.j... | // Common webpack configuration used by webpack.hot.config and webpack.rails.config.
const path = require('path');
module.exports = {
// the project dir
context: __dirname,
entry: ['jquery', 'jquery-ujs', './assets/javascripts/App'],
resolve: {
root: [
path.join(__dirname, 'scripts'),
path.j... | Add additional jquery expose-loader to global $ | Add additional jquery expose-loader to global $
| JavaScript | mit | szyablitsky/react-webpack-rails-tutorial,yakovenkodenis/react-webpack-rails-tutorial,roxolan/react-webpack-rails-tutorial,janklimo/react-webpack-rails-tutorial,shunwen/react-webpack-rails-tutorial,Rvor/react-webpack-rails-tutorial,jeffthemaximum/jeffline,janklimo/react-webpack-rails-tutorial,suzukaze/react-webpack-rail... |
1ea2a51a7d944e5e0abf15ff23c959085178adf5 | week-7/nums_commas.js | week-7/nums_commas.js | // Separate Numbers with Commas in JavaScript **Pairing Challenge**
// I worked on this challenge with: Joseph Scott.
// Pseudocode
// turn number into string, split it into an array, & reverse it
// iterate through array
// push each value to new output array
// if value's index+1 is divisible by 3, then push a com... | Add code and reflection for challenge. | Add code and reflection for challenge.
| JavaScript | mit | svcastaneda/phase-0,svcastaneda/phase-0,svcastaneda/phase-0 | |
ee570a8136252524eadf44a52c2e502c1d5e24f1 | index.js | index.js | const logger = require('./lib/logging')
const make = require('./lib/make')
const random = require('./lib/random')
const utils = require('./lib/utils')
module.exports = {
logger,
random,
make,
utils
}
| Add entry point for node package | Add entry point for node package
| JavaScript | mpl-2.0 | MozillaSecurity/octo | |
d26711169f97188af5600ce48897e6332cb6b024 | index.js | index.js | /**
* Detect Electron renderer process, which is node, but we should
* treat as a browser.
*/
if ((process || {}).type === 'renderer') {
module.exports = require('./browser');
} else {
module.exports = require('./node');
}
| Add a switch to flip between electron and node | Add a switch to flip between electron and node
| JavaScript | mit | visionmedia/debug,jabaz/debug,jabaz/debug | |
28637a6017dd9dd142d795e6600eb31b2f4a48fe | Easy/070_Clibing_Stairs.js | Easy/070_Clibing_Stairs.js | /**
* @param {number} n
* @return {number}
*/
var climbStairs = function(n) {
var ans = [1,1,2];
for (var i = 3; i <= n; i++) {
ans[i] = ans[i - 1] + ans[i - 2];
}
return ans[n];
};
| Add solution to question 70 | Add solution to question 70
| JavaScript | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | |
d14ab90a3d1d459d277beb24d987fc634f7dcaf1 | files/transportapi.js/0.0.1/transportapi.min.js | files/transportapi.js/0.0.1/transportapi.min.js | var TransportAPI=function(){var a="",b="",c="http://transportapi.com/v3",d=function(){return"app_id="+a+"&api_key="+b+"&callback=?"},e=function(a,b){return function(){$.ajax({url:a,dataType:"jsonp",timeout:1e4}).done(b).fail(function(){console.log("transportAPIcall FAIL. URL:"+a)})}};return{init:function(c,d){a=c,b=d},... | Update project transportapi.js to 0.0.1 | Update project transportapi.js to 0.0.1
| JavaScript | mit | Swatinem/jsdelivr,walkermatt/jsdelivr,royswastik/jsdelivr,firulais/jsdelivr,bdukes/jsdelivr,ManrajGrover/jsdelivr,ntd/jsdelivr,labsvisual/jsdelivr,justincy/jsdelivr,alexmojaki/jsdelivr,firulais/jsdelivr,Sneezry/jsdelivr,garrypolley/jsdelivr,tomByrer/jsdelivr,dpellier/jsdelivr,yaplas/jsdelivr,bonbon197/jsdelivr,Metrakit... | |
b6ced965ce852c91998b9b9fd08c8120ad5f973c | index.js | index.js |
var postcss = require('postcss'),
color = require('color');
module.exports = postcss.plugin('postcss-lowvision', function () {
return function (css) {
css.walkDecls('color', function (decl) {
var val = decl.value;
var rgb = color(val);
rgb = rgb.rgbArray();
... |
var postcss = require('postcss'),
color = require('color');
module.exports = postcss.plugin('postcss-lowvision', function () {
return function (css) {
css.walkDecls('color', function (decl) {
var val = decl.value;
var rgb = color(val);
rgb = rgb.rgbArray();
... | Fix error - transparent not defined | Fix error - transparent not defined
| JavaScript | mit | keukenrolletje/postcss-lowvision |
b615be2f238a488b17a394d0b2d0572541164c95 | ui/src/kapacitor/components/LogsTable.js | ui/src/kapacitor/components/LogsTable.js | import React, {PropTypes} from 'react'
import InfiniteScroll from 'shared/components/InfiniteScroll'
import LogsTableRow from 'src/kapacitor/components/LogsTableRow'
const LogsTable = ({logs, onToggleExpandLog}) =>
<div className="logs-table--container">
<div className="logs-table--header">
<h2 className=... | import React, {PropTypes} from 'react'
import LogsTableRow from 'src/kapacitor/components/LogsTableRow'
import FancyScrollbar from 'src/shared/components/FancyScrollbar'
const numLogsToRender = 200
const LogsTable = ({logs, onToggleExpandLog}) =>
<div className="logs-table--container">
<div className="logs-tab... | Remove infinite scroll from logs table and render only 200 most recent logs | Remove infinite scroll from logs table and render only 200 most recent logs
| JavaScript | mit | li-ang/influxdb,influxdb/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,li-ang/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,nooproblem/influxdb,nooproblem/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,influxdb/influxdb,influxdata/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influ... |
37ea3cd02080533bb1fd8f9794f06eef83a6f4eb | example/MultiModule.js | example/MultiModule.js |
/**
* This is a class/module.
* @class class1
* @module module1
*/
/**
* This is another class/module.
* @class class2
* @module module2
*/
/**
* This is a module that's a private class.
* @class class3
* @module module3
*/
/**
* This is another something.
* @class class4
* @module module4
*/
/**
... | Add more simple modules/classes to test example | Add more simple modules/classes to test example
| JavaScript | mit | kevinlacotaco/yuidoc-bootstrap-theme,wyantb/yuidoc-bootstrap-theme,naturalatlas/yuidoc-lucid-theme,kevinlacotaco/yuidoc-bootstrap-theme,wyantb/yuidoc-bootstrap-theme,wyantb/yuidoc-bootstrap-theme,kevinlacotaco/yuidoc-bootstrap-theme,naturalatlas/yuidoc-lucid-theme | |
d3371d4c6eff5c69ff3c904f76541b3c6277355a | src/util/find-element-in-registry.js | src/util/find-element-in-registry.js | import customElements from '../native/custom-elements';
export default function (elem) {
const tagName = elem.tagName;
if (!tagName) {
return;
}
const tagNameLc = tagName.toLowerCase();
const tagNameDefinition = customElements.get(tagNameLc);
if (tagNameDefinition) {
return tagNameDefinition;
... | Add a utility for getting an element definition from the registry base on the element itself. | Add a utility for getting an element definition from the registry base on the element itself.
| JavaScript | mit | chrisdarroch/skatejs,chrisdarroch/skatejs,skatejs/skatejs,skatejs/skatejs,skatejs/skatejs | |
51fab14d010e8187d2691f205439722faac03837 | test/addCreateAndModified-test.js | test/addCreateAndModified-test.js | var vows = require('vows')
, assert = require('assert')
, mongoose = require('mongoose')
, timestamp = require('../lib/addCreatedAndModified')
, util = require('util')
// DB setup
mongoose.connect('mongodb://localhost/mongoose_troop')
// Setting up test schema
var Schema = mongoose.Schema
, ObjectId = Sch... | Test case for addCreateAndModified plugin | Test case for addCreateAndModified plugin
| JavaScript | mit | tblobaum/mongoose-troop,janez89/mongoose-utilities,iliakan/mongoose-troop | |
943e66b8b52cadeb4959378b608cc91ed2d28cb4 | lib/natural/util/stopwords_zh.js | lib/natural/util/stopwords_zh.js | /*
Copyright (c) 2011, David Przybilla, Chris Umbel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, ... | Add stopwords which have little meaning and can be excluded from analysis for Chinese. | Add stopwords which have little meaning and can be excluded from analysis for Chinese.
| JavaScript | mit | ahmedshuhel/natural,kjhenner/natural,PTaylour/natural,NaturalNode/natural,mamaral/natural,Hugo-ter-Doest/natural,itamayo/natural,mcanthony/natural,walkingdoctors/natural,dpraimeyuu/natural,levy5674/natural,moos/natural,PMSI-AlignAlytics/natural,karimsa/natural,Logicify/natural,polymaths/natural | |
846a954d365408a8571c30c22e88beb3c91bd949 | context-test.js | context-test.js | var Buffer = require('buffer').Buffer;
var readline = require('readline');
var gss = require('./index.js');
var creds = gss.acquireCredential(null, 0,
[gss.KRB5_MECHANISM], gss.C_INITIATE);
var zsrName = gss.importName('host@zsr.mit.edu', gss.C_NT_HOSTBASED_SERVICE);
var context = gs... | Add a test program for an initiator context | Add a test program for an initiator context
| JavaScript | mit | roost-im/node-gss,roost-im/node-gss,roost-im/node-gss | |
16e3b3de48b4ee6d391d647ab49dc92e3347204c | eloquent_js/chapter15/ch15_ex03.js | eloquent_js/chapter15/ch15_ex03.js | function asTabs(node) {
for (let child of node.children) {
let label = child.getAttribute("data-tabname");
let button = document.createElement("button");
button.appendChild(document.createTextNode(label));
button.addEventListener(
"click",
event => changeTab(event.target.firstChild.nodeValue)
);
chil... | Add chapter 15, exercise 3 | Add chapter 15, exercise 3
| JavaScript | mit | bewuethr/ctci | |
5b98216ecbcff1bd99ffd8f98630a069d4ad3f2b | test/reporters/console-gjs.js | test/reporters/console-gjs.js | 'use strict';
var deferred = require('deferred');
module.exports = function (t, a) {
var report = [{ message: 'Lorem ipsum', character: 1, line: 1 }], invoked;
report.src = 'Lorem ipsum';
report.options = {};
t(deferred({ 'foo': report }), { log: function (str) {
a(typeof str, 'string', "Log string");
invoked... | Test for gjs style report | Test for gjs style report
| JavaScript | mit | medikoo/xlint,medikoo/xlint | |
54cf7c53c2077520011bbc9f7c6e95e581cea2be | test/components/FactionSwitch.spec.js | test/components/FactionSwitch.spec.js | import { React, sinon, assert, expect, TestUtils } from '../test_exports';
import FactionSwitch from '../../src/js/components/FactionSwitch';
import * as MapActions from '../../src/js/actions/MapActions';
const props = {
ontext: 'radiant',
offtext: 'dire',
isRadiant: true,
switchFaction: MapActions.switchFacti... | Create test with clicking simulation | Create test with clicking simulation
| JavaScript | mit | kusera/sentrii,kusera/sentrii | |
1c37233c9af23749fea11b52423c64f18fd0be1a | migrations/20171228201331_agenda-tags-image.js | migrations/20171228201331_agenda-tags-image.js |
exports.up = function (knex, Promise) {
return Promise.all([
knex.schema.table('agenda', function (table) {
table.string('image');
}),
knex.schema.createTable('tags', function (table) {
table.increments('id').notNullable().primary();
table.string('tag').notNullable();
}),
knex... | Add migration file for agenda tags and image | Add migration file for agenda tags and image
| JavaScript | mit | voxpelli/node-one-page,voxpelli/node-one-page | |
dfa25e23b43c3464b8cd18fc70f5bd69e8e9644d | test-fixtures/migration-data.js | test-fixtures/migration-data.js | export const round1 = {
'Bridge.currentRound': '1',
'Bridge.maker': '0',
'Bridge.players': '[{"bid":null,"win":null,"_buffer":{"lastRound":null,"combo":null,"miss":null,"maxCombo":null,"sum":null},"score":[],"name":"Jonathan"},{"bid":null,"win":null,"_buffer":{"lastRound":null,"combo":null,"miss":null,"maxCombo":... | Add test fixtures for data in v1.0.0 | Add test fixtures for data in v1.0.0
| JavaScript | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc | |
ad31d7b15df5c18f922d026a62ea7cce6056054e | website/app/application/services/prov-template.js | website/app/application/services/prov-template.js | Application.Services.factory("provTemplate", [provTemplate]);
function provTemplate() {
var service = {
_handleProcessStep: function(templates, filesRequired) {
if (templates.length !== 0) {
return templates[0].template_name;
}
// templates.length === 0... | Add service for determining things to do with templates. | Add service for determining things to do with templates.
| JavaScript | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | |
6558cbf9032ad066b42e7e91c33fc4a5a7c63d96 | test/js/spec/vent-constructor.js | test/js/spec/vent-constructor.js | define([
'js-utils/js/vent-constructor',
'underscore'
], function(VentConstructor, _) {
describe('Vent constructor', function() {
beforeEach(function() {
this.clock = sinon.useFakeTimers();
this.router = jasmine.createSpyObj('router', ['navigate']);
this.vent =... | Add tests for vent constructor. [rev: matthew.gordon2] | Add tests for vent constructor. [rev: matthew.gordon2]
| JavaScript | mit | hpautonomy/jsWhatever,hpe-idol/jsWhatever,hpe-idol/jsWhatever,hpautonomy/jsWhatever,hpautonomy/jsWhatever,hpe-idol/jsWhatever | |
0703d3d0d20aa9056448af5afd236d3f8d845721 | test/validators/boolean.spec.js | test/validators/boolean.spec.js | import { expect } from 'chai';
import validator from '../../lib';
describe('Boolean validator', () => {
const rules = {
paid: ['boolean']
};
context('when given false', () => {
it('should success', () => {
const result = validator.validate(rules, {paid: false});
const err = result.messages;
... | Add test cases for boolean validation rule | Add test cases for boolean validation rule
| JavaScript | mit | sendyhalim/satpam,cermati/satpam | |
9906576240c224e31e5813a7243c503f084e293b | src/utils/hilbert-curve.js | src/utils/hilbert-curve.js | /* eslint-disable no-plusplus,no-bitwise */
// Adapted from Jason Davies: https://www.jasondavies.com/hilbert-curve/
const hilbert = (function () {
// From Mike Bostock: http://bl.ocks.org/597287
// Adapted from Nick Johnson: http://bit.ly/biWkkq
const pairs = [
[[0, 3], [1, 0], [3, 1], [2, 0]],
[[2, 1],... | Add code for Hilbert curve | Add code for Hilbert curve
| JavaScript | mit | flekschas/hipiler,flekschas/hipiler,flekschas/hipiler | |
5c3bfa6a83689bafe404041987250c455c82a5f9 | spec/unit/matrix-client.spec.js | spec/unit/matrix-client.spec.js | "use strict";
var sdk = require("../..");
var MatrixClient = sdk.MatrixClient;
var utils = require("../test-utils");
describe("MatrixClient", function() {
var userId = "@alice:bar";
var client;
beforeEach(function() {
utils.beforeEach(this);
});
describe("getSyncState", function() {
... | Add stub unit tests for syncing | Add stub unit tests for syncing
| JavaScript | apache-2.0 | krombel/matrix-js-sdk,matrix-org/matrix-js-sdk,krombel/matrix-js-sdk,matrix-org/matrix-js-sdk,krombel/matrix-js-sdk,matrix-org/matrix-js-sdk,williamboman/matrix-js-sdk,matrix-org/matrix-js-sdk,williamboman/matrix-js-sdk,williamboman/matrix-js-sdk | |
7500fb9b8c55f7468accf6d9a7e0dcb5a5b4d5ef | test/modules.node.test.js | test/modules.node.test.js | var modules = require('../lib/middleware/modules')
, fs = require('fs');
function MockRequest() {
}
function MockResponse(done) {
this.headers = {};
this._done = done;
}
MockResponse.prototype.setHeader = function(name, value) {
this.headers[name] = value;
}
MockResponse.prototype.end = function(data) {
... | Test case for serving Node program. | Test case for serving Node program.
| JavaScript | mit | jaredhanson/jsmt | |
e1f74e4ca49c6d08b9cf18483acf187b14c47242 | test/processtimes.test.js | test/processtimes.test.js | 'use strict';
//Load Config File
var fs = require('fs');
var processTimes = require('../processtimes');
//Require Module
var log4js = require('log4js');
var logger = log4js.getLogger('unit-test');
exports['Test Checking Time Format Function'] ={
'Test checkTimeFormat sucess(12:00)':function(test){
... | Test the function which will process times | Test the function which will process times
| JavaScript | apache-2.0 | dollars0427/SQLwatcher | |
323fd8981dd021516d6e8f00930b586bcb900284 | Medium/096_Unique_Binary_Search_Trees.js | Medium/096_Unique_Binary_Search_Trees.js | /**
* @param {number} n
* @return {number}
*/
var numTrees = function(n) {
var dp = [0, 1];
var less = 0;
var more = 0;
dp[n] = dp[n] || 0;
for (var i = 1; i <= n; i++) {
less = i - 1;
more = n - i;
if (!dp[less]) {
dp[less] = numTrees(less)
}
... | Add solution to question 096 | Add solution to question 096
| JavaScript | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | |
6e8a1628d0468446a4f04306534d9325a93f6f6d | test/composer/lifecycle-os-deps-test.js | test/composer/lifecycle-os-deps-test.js | var assert = require('assert'),
path = require('path'),
nock = require('nock'),
vows = require('vows'),
helpers = require('../helpers'),
macros = require('../helpers/macros'),
mock = require('../helpers/mock'),
quill = require('../../lib/quill'),
wtfos = require('wtfos');
wtfos.result =... | Add missing lifecycle OS deps test | [test] Add missing lifecycle OS deps test
| JavaScript | mit | opsmezzo/quill | |
cd5ceceffef29fcd87b465d9a29ab5975acab6a7 | src/js/helpers/qajaxWrapper.js | src/js/helpers/qajaxWrapper.js | var qajax = require("qajax");
var qajaxWrapper = function (options) {
var response = {
status: null,
body: null
};
var parseResponse = function (xhr) {
response.status = xhr.status;
try {
response.body = JSON.parse(xhr.responseText);
} catch (e) {
response.body = xhr.responseText... | var qajax = require("qajax");
var uniqueCalls = [];
function removeCall(options) {
uniqueCalls.splice(uniqueCalls.indexOf(options.url), 1);
}
var qajaxWrapper = function (options) {
if (!options.concurrent) {
if (uniqueCalls.indexOf(options.url) > -1) {
return {
error: () => { return this; },
... | Return stub request object on concurrent request | Return stub request object on concurrent request | JavaScript | apache-2.0 | watonyweng/marathon-ui,cribalik/marathon-ui,cribalik/marathon-ui,mesosphere/marathon-ui,yp-engineering/marathon-ui,janisz/marathon-ui,mesosphere/marathon-ui,yp-engineering/marathon-ui,Raffo/marathon-ui,watonyweng/marathon-ui,janisz/marathon-ui,Raffo/marathon-ui |
b84879cd0ec21e1f7c0dcf8b503560d56e66a6c4 | tests/unit/components/LCircleMarker.spec.js | tests/unit/components/LCircleMarker.spec.js | import { getWrapperWithMap } from '@/tests/test-helpers';
import { testCircleFunctionality } from '@/tests/mixin-tests/circle-tests';
import LCircleMarker from '@/components/LCircleMarker.vue';
import L from 'leaflet';
describe('component: LCircleMarker.vue', () => {
test('LCircleMarker.vue has a mapObject', () => {... | Add tests for LCircleMarker component | Add tests for LCircleMarker component
| JavaScript | mit | KoRiGaN/Vue2Leaflet | |
ac82e1dfda63c2140559ae1ec2e452f737be9291 | template/js/more-recipe.js | template/js/more-recipe.js |
var counter = 0;
$("#up-vote").click(function() {
counter++;
$("#count").text(counter);
});
$("#down-vote").click(function() {
counter--;
$("#count").text(counter);
}) | Add up-vote & down-vote functionality | Add up-vote & down-vote functionality
| JavaScript | mit | iidrees/More-Recipes,iidrees/More-Recipes | |
b5616985757ade1f8981c1330a605677bf2c3a82 | test/components/Header.spec.js | test/components/Header.spec.js | import { React, sinon, assert, expect, TestUtils } from '../test_exports';
import Header from '../../src/js/components/Header';
describe('Header component', () => {
let sandbox, header, container, titleGroup, title, subtitle, navbar, navItems;
let findDOMWithClass = TestUtils.findRenderedDOMComponentWithClass;
l... | Add basic component testing for Header | Add basic component testing for Header
| JavaScript | mit | kusera/sentrii,kusera/sentrii | |
3d550711e29ab3be257b65350afe583c39b7f1c7 | 9/child_process_ls.js | 9/child_process_ls.js | var child_process = require('child_process');
var ls = child_process.spawn('ls', [ '-lh', '/usr' ]);
ls.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
ls.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
ls.on('close', function (code) {
console.log('child p... | Add the example to list the folder with child process. | Add the example to list the folder with child process.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | |
a2bcc2373e3dbb2313878e303612ed8c13807e59 | app/resources/v1/users_streets_pg.js | app/resources/v1/users_streets_pg.js | const { User, Street } = require('../../db/models')
const { ERRORS } = require('../../../lib/util')
const logger = require('../../../lib/logger.js')()
exports.get = async function (req, res) {
// Flag error if user ID is not provided
if (!req.params.user_id) {
res.status(400).send('Please provide user ID.')
... | Add users_streets api with sequelize | Add users_streets api with sequelize
| JavaScript | bsd-3-clause | codeforamerica/streetmix,codeforamerica/streetmix,codeforamerica/streetmix | |
128ea7db413c3f49832949d8d0f2fff97d2f8701 | lib/handlers/providers/index.js | lib/handlers/providers/index.js | "use strict";
var Anyfetch = require('anyfetch');
module.exports.get = function get(req, res, next) {
var anyfetchClient = new Anyfetch(req.accessToken.token);
anyfetchClient.getDocuments({
fields: 'facets.provider'
}, function updated(err, res) {
if(!err) {
var providers = res.facets.providers;
... | Add new endpoint (to replace start) | Add new endpoint (to replace start)
| JavaScript | mit | AnyFetch/companion-server | |
15825eacb313872cfe6d8afff52a93604127e8dd | src/physics/arcade/inc/tilemap/TileIntersectsBody.js | src/physics/arcade/inc/tilemap/TileIntersectsBody.js | var TileIntersectsBody = function (tileWorldRect, body)
{
if (body.isCircle)
{
return false;
}
else
{
return !(
body.right <= tileWorldRect.left ||
body.bottom <= tileWorldRect.top ||
body.position.x >= tileWorldRect.right ||
body.posit... | var TileIntersectsBody = function (tileWorldRect, body)
{
// Currently, all bodies are treated as rectangles when colliding with a Tile. Eventually, this
// should support circle bodies when those are less buggy in v3.
return !(
body.right <= tileWorldRect.left ||
body.bottom <= tileWorldRe... | Add note about circle bodies not currently being supported in Arcade tile intersection | Add note about circle bodies not currently being supported in Arcade tile intersection
| JavaScript | mit | photonstorm/phaser,TukekeSoft/phaser,TukekeSoft/phaser,BeanSeed/phaser,mahill/phaser,spayton/phaser,photonstorm/phaser,pixelpicosean/phaser,spayton/phaser,TukekeSoft/phaser,rblopes/phaser,BeanSeed/phaser,englercj/phaser,mahill/phaser |
0c5f9eda34a90954a94c2e9aa657d2256fe0208f | flow-typed/npm/react-ui-validations_v0.x.x.js | flow-typed/npm/react-ui-validations_v0.x.x.js | // flow-typed signature: 291855e84801d873d854919a58e86373
// flow-typed version: <<STUB>>/react-ui-validations_v0.0.0/flow_v0.90.0
/**
* This is an autogenerated libdef stub for:
*
* 'react-ui-validations'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share ... | Add types for react-ui-validation package | Add types for react-ui-validation package
| JavaScript | mit | moira-alert/web2.0,moira-alert/web2.0,moira-alert/web2.0,moira-alert/web2.0 | |
72af2a8f45fad46be6f01a52a2ff40507b2a450c | frontend/src/containers/DeleteNotification.js | frontend/src/containers/DeleteNotification.js | import React from 'react';
export default class DeleteNotification extends React.Component {
render() {
return(
<div className='notification'>
<p>The victim has been deleted.</p>
<div className='btn underline' onClick={ this.props.onUndo }>Undo</div>
... | Add notification once victim deleted | Add notification once victim deleted
| JavaScript | mit | dimriou/rupture,dimriou/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,esarafianou/rupture,dionyziz/rupture,dimkarakostas/rupture,dimriou/rupture,dionyziz/rupture,dionyziz/rupture,dimriou/rupture,dimkarakostas/rupture,dimriou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,di... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.