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 |
|---|---|---|---|---|---|---|---|---|---|---|
5e7ee92ba760f0a014852b44ca603de0cf33103b | lib/router.js | lib/router.js |
;(function(riot, evt) {
// browsers only
if (!this.top) return
var loc = location,
fns = riot.observable(),
win = window,
current
function hash() {
return loc.hash.slice(1)
}
function parser(path) {
return path.split('/')
}
function emit(path) {
if (path.type) path = ... |
;(function(riot, evt) {
// browsers only
if (!this.top) return
var loc = location,
fns = riot.observable(),
win = window,
current
function hash() {
return loc.href.split('#')[1] || ''
}
function parser(path) {
return path.split('/')
}
function emit(path) {
if (path.ty... | Use location.href to extract hash | Use location.href to extract hash
There is a bug in firefox which means that location.hash contains the decoded URL. e.g
if the url is
xxx.com/#link/http%3A%2Fwhy.com
Then:
location.hash will be: #link/http://why.com
and
location.href will be: xxx.com/#link/http%3A%2Fwhy.com
So location.href contains... | JavaScript | mit | laomu1988/riot,davidmarkclements/riot,davidmarkclements/riot,dschnare/riot,marcioj/riot,xieyu33333/riot,xieyu33333/riot,GerHobbelt/riotjs,marciojcoelho/riotjs,ListnPlay/riotjs,scalabl3/riot,ListnPlay/riotjs,dp-lewis/riot,xtity/riot,tao-zeng/riot,scalabl3/riot,duongphuhiep/riot,rsbondi/riotjs,muut/riotjs,ttamminen/riotj... | ---
+++
@@ -10,7 +10,7 @@
current
function hash() {
- return loc.hash.slice(1)
+ return loc.href.split('#')[1] || ''
}
function parser(path) { |
9120504c07a69506831f3264dd3b244411fd2ebd | Queue/index.js | Queue/index.js | function Queue() {
this._oldestIndex = 1;
this._newestIndex = 1;
this._storage = {};
}
Queue.prototype.size = function() {
return this._newestIndex - this._oldestIndex;
};
Queue.prototype.enqueue = function(data) {
this._storage[this._newestIndex] = data;
this._newestIndex++;
};
Queue.prototype.dequeue =... | Add Queue, and rename files | Add Queue, and rename files
| JavaScript | mit | jazlalli/data-structure-playground | ---
+++
@@ -0,0 +1,30 @@
+function Queue() {
+ this._oldestIndex = 1;
+ this._newestIndex = 1;
+ this._storage = {};
+}
+
+Queue.prototype.size = function() {
+ return this._newestIndex - this._oldestIndex;
+};
+
+Queue.prototype.enqueue = function(data) {
+ this._storage[this._newestIndex] = data;
+ this._newe... | |
cfb735bf738443de1d868435e55758e6a1cf3c62 | udata/migrations/2019-07-23-reversed-date-range.js | udata/migrations/2019-07-23-reversed-date-range.js | /**
* Swap reversed DateRange values
*/
var updated = 0;
// Match all Dataset having temporal_coverage.start > temporal_coverage.end
const pipeline = [
{$project: {
cmp: {$cmp: ['$temporal_coverage.start', '$temporal_coverage.end']},
obj: '$$ROOT'
}},
{$match: {cmp: {$gt: 0}}},
{$rep... | Fix existing dataset with reversed temporal coverage (migration) | Fix existing dataset with reversed temporal coverage (migration)
| JavaScript | agpl-3.0 | opendatateam/udata,etalab/udata,etalab/udata,etalab/udata,opendatateam/udata,opendatateam/udata | ---
+++
@@ -0,0 +1,29 @@
+/**
+ * Swap reversed DateRange values
+ */
+
+var updated = 0;
+
+// Match all Dataset having temporal_coverage.start > temporal_coverage.end
+const pipeline = [
+ {$project: {
+ cmp: {$cmp: ['$temporal_coverage.start', '$temporal_coverage.end']},
+ obj: '$$ROOT'
+ }},
+... | |
7613c87332c207db7cfd0809c1695ed991a89fc5 | file-system/watcher-spawn.js | file-system/watcher-spawn.js | 'use strict';
// In the curernt version of JavaScript, one **cannot** 'use strict' with const
// declarations
// Import the fs (file system) module.
// "Require" returns an object: the module being required.
// By declaring it
const fs = require('fs');
// Import the child_process module; however, only get a single f... | Add file watcher that spawns a new process. | Add file watcher that spawns a new process.
Add a file watcher process that spawns an operating system process,
captures its output and pipes that output to the standard output of the
node process running the file watcher script.
| JavaScript | mit | mrwizard82d1/node-js-the-right-way | ---
+++
@@ -0,0 +1,30 @@
+'use strict';
+
+// In the curernt version of JavaScript, one **cannot** 'use strict' with const
+// declarations
+
+// Import the fs (file system) module.
+// "Require" returns an object: the module being required.
+// By declaring it
+const fs = require('fs');
+
+// Import the child_proces... | |
5826f84bf22d136fa4eede515b7511f4e566fd4a | child_process/handle_error.js | child_process/handle_error.js | /*
If the child process fails, print the error.
*/
const {exec} = require('child_process')
proc = exec('python count.py abc', (error, stdout, stderr) => {
if (error) {
console.log('Error:', error)
}
console.log(stdout)
})
| Add example that prints the error from a child process | Add example that prints the error from a child process
| JavaScript | apache-2.0 | feihong/node-examples,feihong/node-examples | ---
+++
@@ -0,0 +1,14 @@
+/*
+
+If the child process fails, print the error.
+
+*/
+
+const {exec} = require('child_process')
+
+proc = exec('python count.py abc', (error, stdout, stderr) => {
+ if (error) {
+ console.log('Error:', error)
+ }
+ console.log(stdout)
+}) | |
3245e5defcce51139b0d30cc4956b5520708d068 | 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", "Kate", "Joe", "Mary"];
// ________________________________... | Add variables objects solution to match test code | Add variables objects solution to match test code
| JavaScript | mit | michaelzwang/phase-0,michaelzwang/phase-0,michaelzwang/phase-0 | ---
+++
@@ -0,0 +1,79 @@
+// 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", "Kate", "Joe", "Mary"];... | |
7041c7958b3b8a8354300b76ef1e5716d67de2d4 | src/lib/SpreadSheet.spec.js | src/lib/SpreadSheet.spec.js | import { SpreadSheet } from './SpreadSheet';
import { Row, Cell } from './models';
import { parseCommand } from './models';
describe('SpreadSheet', () => {
const cells = [
new Cell(0, 'A', 0),
new Cell(1, 'A', 5),
new Cell(2, 'A', 10)
];
const rows = [
new Row('A', cells)
];
const spreadShee... | Add tests for SpreadSheet eval | Add tests for SpreadSheet eval
| JavaScript | mit | schultyy/spreadsheet,schultyy/spreadsheet | ---
+++
@@ -0,0 +1,34 @@
+import { SpreadSheet } from './SpreadSheet';
+import { Row, Cell } from './models';
+import { parseCommand } from './models';
+
+describe('SpreadSheet', () => {
+ const cells = [
+ new Cell(0, 'A', 0),
+ new Cell(1, 'A', 5),
+ new Cell(2, 'A', 10)
+ ];
+ const rows = [
+ new R... | |
a66bd438086607e141616769368eae3c799d70a5 | lib/utilities.js | lib/utilities.js | 'use strict';
/**
* Convert a string to camel case.
*
* @param {String} string - The string.
* @return {String}
*/
function camelCase(string) {
if (typeof string !== 'string') {
throw new Error('`camelCase`: first argument must be a string.');
}
// hyphen found after first character
if (... | Create utility helper for camel casing text with hyphens | Create utility helper for camel casing text with hyphens
This helper will be used when converting CSS styles to JS objects.
Then the `style` object will be consistent in the React props.
| JavaScript | mit | remarkablemark/html-react-parser,remarkablemark/html-react-parser,remarkablemark/html-react-parser | ---
+++
@@ -0,0 +1,34 @@
+'use strict';
+
+/**
+ * Convert a string to camel case.
+ *
+ * @param {String} string - The string.
+ * @return {String}
+ */
+function camelCase(string) {
+ if (typeof string !== 'string') {
+ throw new Error('`camelCase`: first argument must be a string.');
+ }
+
+ // hy... | |
70fc48b39ea70654f230899629da2339c63606d4 | src/concat/index.js | src/concat/index.js | var FileType = require('../file').type;
/**
* @param {Array<Object>} files
* @param {string} fileType
*/
function concat(files, fileType) {
var code = [];
files.forEach(function(file) {
switch (fileType) {
case FileType.CSS:
code.push(file.code);
... | Add simple module for concatting code. | Add simple module for concatting code.
| JavaScript | bsd-3-clause | ZocDoc/Bundler,ZocDoc/Bundler | ---
+++
@@ -0,0 +1,34 @@
+var FileType = require('../file').type;
+
+/**
+ * @param {Array<Object>} files
+ * @param {string} fileType
+ */
+function concat(files, fileType) {
+
+ var code = [];
+
+ files.forEach(function(file) {
+
+ switch (fileType) {
+
+ case FileType.CSS:
+ ... | |
5ae4b4f4b0fbef750a0f897c05c3dca5c1d8454f | src/tasks/load-model-files.js | src/tasks/load-model-files.js | var path = require('path'),
vow = require('vow'),
inherit = require('inherit'),
fsExtra = require('fs-extra'),
Base = require('./base');
module.exports = inherit(Base, {
logger: undefined,
__constructor: function (baseConfig, taskConfig) {
this.__base(baseConfig, taskConfig);
... | Implement task for loading model files | Implement task for loading model files
| JavaScript | mpl-2.0 | bem-site/builder-core,bem-site/gorshochek | ---
+++
@@ -0,0 +1,51 @@
+var path = require('path'),
+ vow = require('vow'),
+ inherit = require('inherit'),
+ fsExtra = require('fs-extra'),
+ Base = require('./base');
+
+module.exports = inherit(Base, {
+
+ logger: undefined,
+
+ __constructor: function (baseConfig, taskConfig) {
+ this._... | |
630e5319af9242035b66df3dba9714604f7a058f | scripts/process-all-records.js | scripts/process-all-records.js | var jobs = require('../server/kue').jobs;
var mongoose = require('../server/mongoose');
var Record = mongoose.model('Record');
var count = 0;
Record
.find()
.select({ identifier: 1, parentCatalog: 1 })
.lean()
.stream()
.on('data', function (record) {
count++;
jobs
.cr... | Add script to process all records again | Add script to process all records again
| JavaScript | agpl-3.0 | jdesboeufs/geogw,inspireteam/geogw | ---
+++
@@ -0,0 +1,30 @@
+var jobs = require('../server/kue').jobs;
+var mongoose = require('../server/mongoose');
+
+var Record = mongoose.model('Record');
+
+var count = 0;
+
+Record
+ .find()
+ .select({ identifier: 1, parentCatalog: 1 })
+ .lean()
+ .stream()
+ .on('data', function (record) {
+ ... | |
5ce37602b361f4ed79d4354b998f0ae1d99a18bf | test/functional/ios/testapp/keyboard-specs.js | test/functional/ios/testapp/keyboard-specs.js | "use strict";
var setup = require("../../common/setup-base")
, desired = require('./desired')
, _ = require('underscore');
describe("testapp - keyboard stability @skip-ci", function () {
var runs = 10
, text = 'Delhi is New @@@ QA-BREAKFAST-FOOD-0001';
var driver;
setup(this, _.defaults({
deviceNa... | Add stability test for iOS keyboard | Add stability test for iOS keyboard
| JavaScript | apache-2.0 | appium/appium,appium/appium,appium/appium,appium/appium,appium/appium,Sw0rdstream/appium,appium/appium | ---
+++
@@ -0,0 +1,30 @@
+"use strict";
+
+var setup = require("../../common/setup-base")
+ , desired = require('./desired')
+ , _ = require('underscore');
+
+
+describe("testapp - keyboard stability @skip-ci", function () {
+ var runs = 10
+ , text = 'Delhi is New @@@ QA-BREAKFAST-FOOD-0001';
+
+ var driver;
... | |
71b4aecaabd67943c58a2fa62f03f10b21bc9b63 | index.js | index.js | const http = require('http')
const parseString = require('xml2js').parseString
const nfl = {
hostname: 'www.nfl.com',
path: '/liveupdate/scorestrip/ss.xml',
method: 'GET'
}
const getGames = function getGames(xml) {
let games
parseString(xml.join(''), (err, data) => {
if (err) return console.error(err)
... | Add random team select script | Add random team select script
This script will randomly select a team from the current season's,
week's set of matches.
Not sure if the XML will get updated as the
season goes along. Will update if changes are needed.
| JavaScript | mit | yuleugim/nfld16 | ---
+++
@@ -0,0 +1,50 @@
+const http = require('http')
+const parseString = require('xml2js').parseString
+
+const nfl = {
+ hostname: 'www.nfl.com',
+ path: '/liveupdate/scorestrip/ss.xml',
+ method: 'GET'
+}
+
+const getGames = function getGames(xml) {
+ let games
+
+ parseString(xml.join(''), (err, data) => {... | |
3c6bec39f84dd8aa6424483a2d819420d0e2e785 | bundle.js | bundle.js | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.ex... | Create a dist file with browserify | Create a dist file with browserify
| JavaScript | mit | jollyra/tiles,jollyra/tiles | ---
+++
@@ -0,0 +1,20 @@
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1... | |
429fa904d86ee4c6963a331b6a73ca70d15c4605 | bin/tap-reader.js | bin/tap-reader.js | #!/usr/bin/env node
// read a tap stream from stdin.
var TapConsumer = require("../lib/tap-consumer")
, TapStream = require("../lib/tap-stream")
var tc = new TapConsumer
, ts = new TapStream(!process.env.nodiag)
//process.stdin.pipe(tc)
process.stdin.on("data", function (c) {
c = c + ""
// console.error(JSO... | Read tap output from stdin, to test parsing | Read tap output from stdin, to test parsing
| JavaScript | isc | iarna/node-tap,tapjs/node-tap,isaacs/node-tap,myndzi/node-tap,evanlucas/node-tap,myndzi/node-tap,jkrems/node-tap,Raynos/node-tap,Dignifiedquire/node-tap-core,evanlucas/node-tap,strongloop-forks/node-tap,iarna/node-tap,jondlm/node-tap,isaacs/node-tap,tapjs/node-tap,strongloop-forks/node-tap,jinivo/marhert,jondlm/node-ta... | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env node
+
+// read a tap stream from stdin.
+
+var TapConsumer = require("../lib/tap-consumer")
+ , TapStream = require("../lib/tap-stream")
+
+var tc = new TapConsumer
+ , ts = new TapStream(!process.env.nodiag)
+
+//process.stdin.pipe(tc)
+process.stdin.on("data", function (c... | |
25c32481177b8055a7c746b38d094efd5ab8e3a7 | test/test-util.js | test/test-util.js | /*globals suite, test, setup, teardown */
var sutil = require('sake/util');
suite('sake.util', function () {
test('fileFromStackTrace', function () {
sutil.fileFromStackTrace().should.equal(__filename);
});
test('directoryFromStackTrace', function () {
sutil.directoryFromStackTrace()... | Add test file for stack trace functions. | Add test file for stack trace functions.
| JavaScript | mit | jhamlet/node-sake | ---
+++
@@ -0,0 +1,15 @@
+/*globals suite, test, setup, teardown */
+
+var sutil = require('sake/util');
+
+suite('sake.util', function () {
+
+ test('fileFromStackTrace', function () {
+ sutil.fileFromStackTrace().should.equal(__filename);
+ });
+
+ test('directoryFromStackTrace', function () {
+... | |
b31d1b6e1e0eb033d9b7165e2c476fdfdadf7591 | scripts/managedb/swap_coords.js | scripts/managedb/swap_coords.js | /*
# Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U
#
# This file is part of Orion Context Broker.
#
# Orion Context Broker 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 ver... | ADD script for swapping coordinates in entities collection | ADD script for swapping coordinates in entities collection
| JavaScript | agpl-3.0 | McMutton/fiware-orion,gavioto/fiware-orion,fortizc/fiware-orion,gavioto/fiware-orion,telefonicaid/fiware-orion,j1fig/fiware-orion,Fiware/data.Orion,j1fig/fiware-orion,jmcanterafonseca/fiware-orion,pacificIT/fiware-orion,jmcanterafonseca/fiware-orion,fiwareulpgcmirror/fiware-orion,Fiware/data.Orion,telefonicaid/fiware-o... | ---
+++
@@ -0,0 +1,56 @@
+/*
+ # Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U
+ #
+ # This file is part of Orion Context Broker.
+ #
+ # Orion Context Broker 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 F... | |
a1f23b243a855a9cae37edaaa5ed2a2c62c50072 | webpack.config.js | webpack.config.js | const path = require('path');
module.exports = {
resolve: {
modules: [
__dirname + '/scripts',
path.resolve(__dirname, "./node_modules")
]
}
}; | Resolve import for modules in ‘scripts’ directory | Resolve import for modules in ‘scripts’ directory
| JavaScript | apache-2.0 | weepower/wee-core | ---
+++
@@ -0,0 +1,10 @@
+const path = require('path');
+
+module.exports = {
+ resolve: {
+ modules: [
+ __dirname + '/scripts',
+ path.resolve(__dirname, "./node_modules")
+ ]
+ }
+}; | |
8adde8004e6986a919fc26e1df2c72bddc55077b | test/actions/editor_test.js | test/actions/editor_test.js | import { expect, isFSA, isFSAName } from '../spec_helper'
import * as subject from '../../src/actions/editor'
describe('editor actions', () => {
context('#setIsCompleterActive', () => {
const action = subject.setIsCompleterActive({ isActive: true })
it('is an FSA compliant action', () => {
expect(isFS... | Add tests around the new updated editor actions | Add tests around the new updated editor actions | JavaScript | mit | ello/webapp,ello/webapp,ello/webapp | ---
+++
@@ -0,0 +1,73 @@
+import { expect, isFSA, isFSAName } from '../spec_helper'
+import * as subject from '../../src/actions/editor'
+
+describe('editor actions', () => {
+ context('#setIsCompleterActive', () => {
+ const action = subject.setIsCompleterActive({ isActive: true })
+
+ it('is an FSA compliant... | |
a19c5e3daf7cc6b81f410c5780b9eff24df70b00 | test/unit/ngGravatarTest.js | test/unit/ngGravatarTest.js | var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require("sinon-chai");
var ngGravatar = require('../../src/ngGravatar');
chai.should();
chai.use(sinonChai);
describe('ngGravatar', function() {
var gravatarDirective;
beforeEach(function() {
gravatarDirective = ngGravatar();
... | Add simple test for gravatar directive | Add simple test for gravatar directive
| JavaScript | mit | Spidy88/ngGravatar | ---
+++
@@ -0,0 +1,20 @@
+var chai = require('chai');
+var sinon = require('sinon');
+var sinonChai = require("sinon-chai");
+
+var ngGravatar = require('../../src/ngGravatar');
+
+chai.should();
+chai.use(sinonChai);
+
+describe('ngGravatar', function() {
+ var gravatarDirective;
+
+ beforeEach(function() {
+ ... | |
eb2454acd11b656a16813a1bdbc7e6257d5d486f | core/model/formats/bibtexmisc.js | core/model/formats/bibtexmisc.js | 'use strict';
require('../../../utils/array');
/**
* @module bibTex Misc Entry Formatter
* Module for formatting source data into a bibTeX misc type entry
*/
module.exports = {
/**
* Formats a source data object to a citation
* @param {SourceData} sourceData - The SourceData object to generate the citation... | Set up initial bibtex misc style formatter | Set up initial bibtex misc style formatter
| JavaScript | mit | nokeeo/software-citation-tools,faokryn/software-citation-tools | ---
+++
@@ -0,0 +1,19 @@
+'use strict';
+require('../../../utils/array');
+
+/**
+ * @module bibTex Misc Entry Formatter
+ * Module for formatting source data into a bibTeX misc type entry
+ */
+
+module.exports = {
+ /**
+ * Formats a source data object to a citation
+ * @param {SourceData} sourceData - The Sou... | |
fb969ac6c3ebd2dd62897c3cbb34222a08e09655 | src/io.js | src/io.js | /* IO monad taken from monet.js */
/*
The MIT License (MIT)
Copyright (c) 2016 Chris Myers
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 ri... | Add IO monad from monet.js | Add IO monad from monet.js
but make it more es6-like
| JavaScript | mit | memee/reactive-charts | ---
+++
@@ -0,0 +1,62 @@
+/* IO monad taken from monet.js */
+/*
+The MIT License (MIT)
+
+Copyright (c) 2016 Chris Myers
+
+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,... | |
5dbd7c1c09c05fa122d53ca3060b565af75b54d7 | lib/properties.es6.js | lib/properties.es6.js | /**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* 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.0
*
* Unless requir... | Add missing properties module (required by Hook and PubHook) | Add missing properties module (required by Hook and PubHook)
| JavaScript | apache-2.0 | mdittmer/smw,mdittmer/smw,mdittmer/smw | ---
+++
@@ -0,0 +1,97 @@
+/**
+ * @license
+ * Copyright 2016 Google Inc. All Rights Reserved.
+ *
+ * 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/lice... | |
d0d1827193fbcb37d9315adddf3000f4d0037a75 | controllers/helpers/docHelper.js | controllers/helpers/docHelper.js | const docHelper = {
checkDocDetails: (req, res) => {
let document = req.body;
if (!(document.title && document.content && document.access)) {
res.status(400)
.json({
success: false,
message: 'All fields must be filled'
});
res.end();
return true;
}
}... | Add document helper file for document controller | Add document helper file for document controller
| JavaScript | mit | andela-oolutola/document-management-system-api | ---
+++
@@ -0,0 +1,16 @@
+const docHelper = {
+ checkDocDetails: (req, res) => {
+ let document = req.body;
+ if (!(document.title && document.content && document.access)) {
+ res.status(400)
+ .json({
+ success: false,
+ message: 'All fields must be filled'
+ });
+ re... | |
25955ef55a3086c37c8e6fa6590abb4b3bd80da6 | Workspace/Project/utility.js | Workspace/Project/utility.js | module.exports = {
move: function(arr, old_index, new_index)
{
while (old_index < 0)
old_index += arr.length;
while (new_index < 0)
new_index += arr.length
if (new_index >= arr.length)
{
var k = new_index - arr.length
while ((k--) + 1)
arr.push(undefined)
}
arr.spli... | Add Object Compare Check and Element Change Position in Array | Add Object Compare Check and Element Change Position in Array
| JavaScript | mit | MrWooJ/WJChipDesign,MrWooJ/WJChipDesign | ---
+++
@@ -0,0 +1,46 @@
+module.exports = {
+ move: function(arr, old_index, new_index)
+ {
+ while (old_index < 0)
+ old_index += arr.length;
+ while (new_index < 0)
+ new_index += arr.length
+ if (new_index >= arr.length)
+ {
+ var k = new_index - arr.length
+ while ((k--) + 1)
+ ... | |
c99512ea8181d4020de2d1adc45612a70ddce91d | files/bootstrap.hover-dropdown/2.1.3/bootstrap-hover-dropdown.min.js | files/bootstrap.hover-dropdown/2.1.3/bootstrap-hover-dropdown.min.js | /**
* @preserve
* Project: Bootstrap Hover Dropdown
* Author: Cameron Spear
* Version: v2.1.3
* Contributors: Mattia Larentis
* Dependencies: Bootstrap's Dropdown plugin, jQuery
* Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice user experience.
* License: MIT
* ... | Update project bootstrap-hover-dropdown to v2.1.3 | Update project bootstrap-hover-dropdown to v2.1.3
| JavaScript | mit | anilanar/jsdelivr,MenZil/jsdelivr,dnbard/jsdelivr,siscia/jsdelivr,tunnckoCore/jsdelivr,Swatinem/jsdelivr,photonstorm/jsdelivr,cognitom/jsdelivr,anilanar/jsdelivr,yyx990803/jsdelivr,vousk/jsdelivr,garrypolley/jsdelivr,labsvisual/jsdelivr,dpellier/jsdelivr,siscia/jsdelivr,anilanar/jsdelivr,Sneezry/jsdelivr,ajibolam/jsdel... | ---
+++
@@ -0,0 +1,12 @@
+/**
+ * @preserve
+ * Project: Bootstrap Hover Dropdown
+ * Author: Cameron Spear
+ * Version: v2.1.3
+ * Contributors: Mattia Larentis
+ * Dependencies: Bootstrap's Dropdown plugin, jQuery
+ * Description: A simple plugin to enable Bootstrap dropdowns to active on hover and provide a nice u... | |
185f131d51470073e4656122276c7d8a561ef3a5 | src/utils/get-scripts.js | src/utils/get-scripts.js | import fs from 'fs';
import path from 'path';
import yaml from 'js-yaml';
const scriptCache = {};
function getCacheOrFile(key, fn) {
if (scriptCache[key]) {
return scriptCache[key];
}
const value = fn();
scriptCache[key] = value;
return value;
}
const travisCommands = [
// Reference: http://docs.tr... | import fs from 'fs';
import path from 'path';
import yaml from 'js-yaml';
const scriptCache = {};
function getCacheOrFile(key, fn) {
if (scriptCache[key]) {
return scriptCache[key];
}
const value = fn();
scriptCache[key] = value;
return value;
}
const travisCommands = [
// Reference: http://docs.tr... | Fix a bug in getScript utility. | Fix a bug in getScript utility.
- Should not extract script from deploy section.
| JavaScript | mit | depcheck/depcheck,depcheck/depcheck | ---
+++
@@ -23,7 +23,6 @@
'script',
'after_success or after_failure',
'before_deploy',
- 'deploy',
'after_deploy',
'after_script',
]; |
7d5d37e7477c4a41e264d583158d759ad851b201 | patchDedupe.js | patchDedupe.js | var through = require("through2");
exports.patch = function (Browserify) {
Browserify.prototype._dedupe = function () {
return through.obj(function (row, enc, next) {
if (!row.dedupeIndex && row.dedupe) {
// PATCH IS AS SIMPLE AS NOT DOING THE FOLLOWING:
/*
... | Add monkey patch for _dedupe. | Add monkey patch for _dedupe.
| JavaScript | mit | YuzuJS/browserify-dedupe-patch | ---
+++
@@ -0,0 +1,42 @@
+var through = require("through2");
+
+exports.patch = function (Browserify) {
+ Browserify.prototype._dedupe = function () {
+ return through.obj(function (row, enc, next) {
+ if (!row.dedupeIndex && row.dedupe) {
+ // PATCH IS AS SIMPLE AS NOT DOING THE F... | |
6793f01abdbd91e6b8918504145e616ffa05f727 | week-7/group_project_solution.js | week-7/group_project_solution.js | // PERSON 5
// Refactored code:
// Simplified variable names and sum.
function sum(array){
// This works thanks to ECMAScript 6!
var total = array.reduce((a, b) => a + b, 0);
return total;
}
// Got rid of total_sum variable.
function mean(array){
var average = sum(array) / array.length;
return average;
}... | Add 7.8 JS Telephone file | Add 7.8 JS Telephone file
| JavaScript | mit | Rinthm/phase-0,Rinthm/phase-0,Rinthm/phase-0 | ---
+++
@@ -0,0 +1,54 @@
+// PERSON 5
+
+// Refactored code:
+
+// Simplified variable names and sum.
+function sum(array){
+ // This works thanks to ECMAScript 6!
+ var total = array.reduce((a, b) => a + b, 0);
+ return total;
+}
+
+// Got rid of total_sum variable.
+function mean(array){
+ var average = sum(a... | |
fb9ac1e15ab745af5cc79ad5c06a91be49760ed7 | src/components/events/DetailSpec.js | src/components/events/DetailSpec.js | import { shallow, createLocalVue } from '@vue/test-utils';
import Vuex from 'vuex';
import Detail from './Detail.vue';
const localVue = createLocalVue();
localVue.use(Vuex);
describe('Event Detail.vue', () => {
let wrapper, getters, store;
beforeEach(() => {
getters = {
isAdmin: () => true
}
... | Test to catch compile issues | Test to catch compile issues
| JavaScript | mit | dmurtari/mbu-frontend,dmurtari/mbu-frontend | ---
+++
@@ -0,0 +1,34 @@
+import { shallow, createLocalVue } from '@vue/test-utils';
+import Vuex from 'vuex';
+
+import Detail from './Detail.vue';
+
+const localVue = createLocalVue();
+localVue.use(Vuex);
+
+describe('Event Detail.vue', () => {
+ let wrapper, getters, store;
+
+ beforeEach(() => {
+ getters =... | |
9ef27994b8fab189390e473ccd8ed59ca15281c1 | server/startup/migrations/v060.js | server/startup/migrations/v060.js | RocketChat.Migrations.add({
version: 60,
up: function() {
let subscriptions = RocketChat.models.Subscriptions.find({ $or: [ { name: { $exists: 0 } }, { name: { $not: { $type: 2 } } } ] }).fetch();
if (subscriptions && subscriptions.length > 0) {
RocketChat.models.Subscriptions.remove({ _id: { $in: _.pluck(subs... | Add migration to remove invalid subscriptions | Add migration to remove invalid subscriptions
| JavaScript | mit | Achaikos/Rocket.Chat,ahmadassaf/Rocket.Chat,Gyubin/Rocket.Chat,4thParty/Rocket.Chat,BorntraegerMarc/Rocket.Chat,alexbrazier/Rocket.Chat,abduljanjua/TheHub,snaiperskaya96/Rocket.Chat,mwharrison/Rocket.Chat,ealbers/Rocket.Chat,NMandapaty/Rocket.Chat,ealbers/Rocket.Chat,Movile/Rocket.Chat,matthewshirley/Rocket.Chat,AlecTr... | ---
+++
@@ -0,0 +1,16 @@
+RocketChat.Migrations.add({
+ version: 60,
+ up: function() {
+ let subscriptions = RocketChat.models.Subscriptions.find({ $or: [ { name: { $exists: 0 } }, { name: { $not: { $type: 2 } } } ] }).fetch();
+ if (subscriptions && subscriptions.length > 0) {
+ RocketChat.models.Subscriptions.... | |
ea67a765efd1145cc6f9df34ce7d7b6a0c0f12a5 | models/county.js | models/county.js | 'use strict';
module.exports = (sequelize, DataTypes) => {
const county = sequelize.define('county', {
name: DataTypes.STRING(64) // eslint-disable-line no-magic-numbers
}, {
timestamps: false,
classMethods: {
associate: (models) => {
county.hasMany(models.temp);
}
}
});
ret... | Rename of the area model | Rename of the area model
| JavaScript | mit | NewEvolution/thermostats,NewEvolution/thermostats | ---
+++
@@ -0,0 +1,15 @@
+'use strict';
+
+module.exports = (sequelize, DataTypes) => {
+ const county = sequelize.define('county', {
+ name: DataTypes.STRING(64) // eslint-disable-line no-magic-numbers
+ }, {
+ timestamps: false,
+ classMethods: {
+ associate: (models) => {
+ county.hasMany(mo... | |
2472cec57936a2d8820f5e047b7f9520a7cf5d3c | components/ClickablePath.js | components/ClickablePath.js | import React, { Component } from 'react';
import { TouchableOpacity, Image, View } from 'react-native';
import styles from './styles/ClickablePathStyle';
import PropTypes from 'prop-types';
import { StackNagivator } from 'react-navigation';
export default class ClickablePath extends Component {
static propTypes = {
... | Add separate clickable image for paths | Add separate clickable image for paths
| JavaScript | mit | fridl8/cold-bacon-client,fridl8/cold-bacon-client,fridl8/cold-bacon-client | ---
+++
@@ -0,0 +1,24 @@
+import React, { Component } from 'react';
+import { TouchableOpacity, Image, View } from 'react-native';
+import styles from './styles/ClickablePathStyle';
+import PropTypes from 'prop-types';
+import { StackNagivator } from 'react-navigation';
+
+export default class ClickablePath extends C... | |
52a9aa355a2c931d96f3f3d9a5ad483e94a95cf4 | geoportailv3/static/js/statemanagerservice.js | geoportailv3/static/js/statemanagerservice.js | /**
* @fileoverview This files provides a service for managing application
* states. States are written to both the URL (through the ngeoLocation
* service) and the local storage.
*/
goog.provide('app.StateManager');
goog.require('app');
goog.require('goog.asserts');
goog.require('goog.math');
goog.require('goog.s... | Add a state manager service | Add a state manager service
| JavaScript | mit | Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,geoportallux/geoportailv3-gisgr,Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,Geoportail-Luxembourg/geoportailv3,geoportallux/geoportailv3-gisgr,geoportallux/geoportailv3-gisgr,geoportallux/geoportailv3-gisgr | ---
+++
@@ -0,0 +1,87 @@
+/**
+ * @fileoverview This files provides a service for managing application
+ * states. States are written to both the URL (through the ngeoLocation
+ * service) and the local storage.
+ */
+goog.provide('app.StateManager');
+
+goog.require('app');
+goog.require('goog.asserts');
+goog.requi... | |
40ae6817fa0314ebd3f249965876c9a7b18056a9 | static/js/loadall.js | static/js/loadall.js | // ready() functions executed after everything else.
// Mainly for widget layout
$(function() {
$(window).resize(function(event) {
layoutWidgets();
});
layoutWidgets();
$(window).trigger("resize");
$("#workspace").invalidateLayout = function(event) {
layoutWidgets();
... | Add specific JS to run after everything else has loaded, mainly for widget layout. | Add specific JS to run after everything else has loaded, mainly for widget layout.
| JavaScript | apache-2.0 | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ---
+++
@@ -0,0 +1,15 @@
+// ready() functions executed after everything else.
+// Mainly for widget layout
+
+$(function() {
+ $(window).resize(function(event) {
+ layoutWidgets();
+ });
+ layoutWidgets();
+ $(window).trigger("resize");
+
+ $("#workspace").invalidateLayout = function(event) {
+... | |
c5a39025eb85c99f3a14e522b7e3411e3336ce7d | lib/rules/split-platform-components.js | lib/rules/split-platform-components.js | /**
* @fileoverview Android and IOS components should be
* used in platform specific React Native components.
* @author Tom Hastjarjanto
*/
'use strict';
module.exports = function(context) {
var reactComponents = [];
var androidMessage = 'Android components should be placed in android files';
var iosMessage... | Add initial implementation to force seperation of platform specific components | Add initial implementation to force seperation of platform specific components
| JavaScript | mit | Intellicode/eslint-plugin-react-native | ---
+++
@@ -0,0 +1,61 @@
+/**
+ * @fileoverview Android and IOS components should be
+ * used in platform specific React Native components.
+ * @author Tom Hastjarjanto
+ */
+'use strict';
+
+module.exports = function(context) {
+ var reactComponents = [];
+ var androidMessage = 'Android components should be place... | |
c51db7e3983d631228cd39f2ee6ac1d840104e28 | doubly-linked-list.js | doubly-linked-list.js | "use strict";
// DOUBLY-LINKED LIST
// define constructor
function Node(val) {
this.data = val;
this.previous = null;
this.next = null;
}
| Define constructor for doubly linked list | Define constructor for doubly linked list
| JavaScript | mit | derekmpham/interview-prep,derekmpham/interview-prep | ---
+++
@@ -0,0 +1,10 @@
+"use strict";
+
+// DOUBLY-LINKED LIST
+
+// define constructor
+function Node(val) {
+ this.data = val;
+ this.previous = null;
+ this.next = null;
+} | |
988347f27393de2cd643c29aad772d13df170189 | shared/util/typed-connect.js | shared/util/typed-connect.js | // @flow
import {Component} from 'react'
import {connect} from 'react-redux'
type TypedMergeProps<State, Dispatch, OwnProps, Props> = (state: State, dispatch: Dispatch, ownProps: OwnProps) => Props
export class ConnectedComponent<OwnProps> extends Component<void, OwnProps, void> {}
export default function typedConn... | Add typedConnect to let smart components in on the action | Add typedConnect to let smart components in on the action
| JavaScript | bsd-3-clause | keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client | ---
+++
@@ -0,0 +1,18 @@
+// @flow
+
+import {Component} from 'react'
+import {connect} from 'react-redux'
+
+type TypedMergeProps<State, Dispatch, OwnProps, Props> = (state: State, dispatch: Dispatch, ownProps: OwnProps) => Props
+
+export class ConnectedComponent<OwnProps> extends Component<void, OwnProps, void> {}... | |
ec3dc4a2824e31bcb526d7873045efaa638b7f5f | migrations/20141007112548-uniqueromvariants.js | migrations/20141007112548-uniqueromvariants.js | module.exports = {
up: function(migration, DataTypes, done) {
migration.removeIndex('Incrementals', 'Incrementals_UniqueFilePerDirectory');
migration.addIndex(
'Incrementals',
[ 'RomVariantId', 'filename' ],
{
indexName: 'Incrementals_UniqueFilePerRomVariant',
indicesType: 'UNIQUE',
}
);
... | Add a unique index for the rom variant. | Add a unique index for the rom variant.
| JavaScript | mit | xdarklight/cm-update-server,xdarklight/cm-update-server,TheNameIsNigel/cm-update-server,TheNameIsNigel/cm-update-server | ---
+++
@@ -0,0 +1,31 @@
+module.exports = {
+ up: function(migration, DataTypes, done) {
+ migration.removeIndex('Incrementals', 'Incrementals_UniqueFilePerDirectory');
+
+ migration.addIndex(
+ 'Incrementals',
+ [ 'RomVariantId', 'filename' ],
+ {
+ indexName: 'Incrementals_UniqueFilePerRomVariant',
+ ... | |
68d195f515efc4aab1fa9bcc69f4df151c886d17 | generators/REACT_SCRIPTS/template/.storybook/config.js | generators/REACT_SCRIPTS/template/.storybook/config.js | import { configure } from '@kadira/storybook';
import '../src/index.css';
function loadStories() {
require('../src/stories');
}
configure(loadStories, module);
| import { configure } from '@kadira/storybook';
function loadStories() {
require('../src/stories');
}
configure(loadStories, module);
| Remove index.css import for CRA based apps. | Remove index.css import for CRA based apps.
| JavaScript | mit | enjoylife/storybook,rhalff/storybook,enjoylife/storybook,storybooks/react-storybook,nfl/react-storybook,shilman/storybook,storybooks/storybook,nfl/react-storybook,jribeiro/storybook,kadirahq/react-storybook,bigassdragon/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,jribeiro/storybook,bi... | ---
+++
@@ -1,5 +1,4 @@
import { configure } from '@kadira/storybook';
-import '../src/index.css';
function loadStories() {
require('../src/stories'); |
945a11ece943e8d4bde889b297905a88150eef78 | utils/seed_test_cases.js | utils/seed_test_cases.js | var str = "[";
for (var seedVal = 0; seedVal < 256; seedVal++) {
var a = -3969392806;
var b = -1780940711;
var c = -1021952437;
var d = 255990488;
var e = -651539848;
var f = -1525007287;
var g = -990909925;
var h = 811634969;
var results = [];
for (var i = 0; i < 256; i++) {
results[i] = see... | Create script for getting seed test cases | Create script for getting seed test cases
| JavaScript | mit | Jameskmonger/isaac-crypto | ---
+++
@@ -0,0 +1,72 @@
+var str = "[";
+
+for (var seedVal = 0; seedVal < 256; seedVal++) {
+ var a = -3969392806;
+ var b = -1780940711;
+ var c = -1021952437;
+ var d = 255990488;
+ var e = -651539848;
+ var f = -1525007287;
+ var g = -990909925;
+ var h = 811634969;
+
+ var results = [];
+
+ for (var i... | |
e99435374eb3b53bf5e1e88226976a0aacefc7f8 | remove-the-minimum.js | remove-the-minimum.js | // https://www.codewars.com/kata/remove-the-minimum
const removeSmallest = numbers => {
const smallest = Math.min(...numbers);
const smallestIndex = numbers.findIndex(number => number === smallest);
const result = [...numbers];
result.splice(smallestIndex, 1);
return result;
};
| Add solution for "remove the minimum" | Add solution for "remove the minimum"
| JavaScript | mit | jonathanweiss/codewars | ---
+++
@@ -0,0 +1,11 @@
+// https://www.codewars.com/kata/remove-the-minimum
+
+const removeSmallest = numbers => {
+ const smallest = Math.min(...numbers);
+ const smallestIndex = numbers.findIndex(number => number === smallest);
+ const result = [...numbers];
+
+ result.splice(smallestIndex, 1);
+
+ return re... | |
cb0bea819f71afa4f01e8856e252c17aa177c1d9 | 17/amqp-broadcast-bind.js | 17/amqp-broadcast-bind.js | var amqp = require('amqp');
var connection = amqp.createConnection({
host: 'localhost'
});
connection.on('ready', function () {
connection.exchange('broadcast', { type: 'fanout', autoDelete: false },
function(exchange) {
connection.queue('tmp-' + Math.random, { exclusive: true }, function(q) ... | Add the example to subscribe the broadcast via amqp. | Add the example to subscribe the broadcast via amqp.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | ---
+++
@@ -0,0 +1,18 @@
+var amqp = require('amqp');
+
+var connection = amqp.createConnection({
+ host: 'localhost'
+});
+
+connection.on('ready', function () {
+ connection.exchange('broadcast', { type: 'fanout', autoDelete: false },
+ function(exchange) {
+ connection.queue('tmp-' + Math.rand... | |
0ee01508243586e88b56b32f7089a00ce8eca4cc | app/assets/javascripts/factoid.js | app/assets/javascripts/factoid.js | $(document).ready(function(){
$("body").on("click", "#new-facts button", function(event){
event.preventDefault();
$.ajax({
url: "/factoids",
type: "get"
}).done(function(resp){
$("#factoid-display").empty().append(resp);
}).fail(function(respo){
console.log(Error("Couldn't re... | Write ajax call for new facts. | Write ajax call for new facts.
| JavaScript | mit | lukert33/about_luke_thomas,lukert33/about_luke_thomas,lukert33/about_luke_thomas | ---
+++
@@ -0,0 +1,16 @@
+$(document).ready(function(){
+
+ $("body").on("click", "#new-facts button", function(event){
+ event.preventDefault();
+
+ $.ajax({
+ url: "/factoids",
+ type: "get"
+ }).done(function(resp){
+ $("#factoid-display").empty().append(resp);
+ }).fail(function(respo)... | |
92fafb2e0ee21222aba97084998ac1ca8ef38c6f | server/node-server.js | server/node-server.js | var express = require('express');
var app = express();
var path = __dirname + '';
var port = 8080;
app.use(express.static(path));
app.get('*', function(req, res) {
res.sendFile(path + '/index.html');
});
app.listen(port);
| Add custom Node.js server written with Express. | Add custom Node.js server written with Express.
| JavaScript | mit | emc-mongoose/console,emc-mongoose/console,emc-mongoose/console | ---
+++
@@ -0,0 +1,11 @@
+var express = require('express');
+var app = express();
+
+var path = __dirname + '';
+var port = 8080;
+
+app.use(express.static(path));
+app.get('*', function(req, res) {
+ res.sendFile(path + '/index.html');
+});
+app.listen(port); | |
60b69b21c56edffe45e60e9cb8ab4d1bff7f1726 | 7/archiver-zip-bulk.js | 7/archiver-zip-bulk.js | var fs = require('fs');
var archiver = require('archiver');
var output = fs.createWriteStream('output.zip');
output.on('close', function() {
console.log('Done');
});
var archive = archiver('zip');
archive.on('error', function(err) {
throw err;
});
archive.pipe(output);
archive.bulk([
{ expand: true, cwd... | Add the example to create a zip file with multiple files by archiver. | Add the example to create a zip file with multiple files by archiver.
| JavaScript | mit | nicebook/Node.js-Reference,nicebook/Node.js-Reference,nicebook/Node.js-Reference | ---
+++
@@ -0,0 +1,20 @@
+var fs = require('fs');
+var archiver = require('archiver');
+
+var output = fs.createWriteStream('output.zip');
+output.on('close', function() {
+ console.log('Done');
+});
+
+var archive = archiver('zip');
+archive.on('error', function(err) {
+ throw err;
+});
+
+archive.pipe(output)... | |
39d080cfca62991c5f57de38a77bd30c61bbabb0 | corehq/couchapps/exports_forms/views/attachments/map.js | corehq/couchapps/exports_forms/views/attachments/map.js | function (doc) {
var media = 0, attachments = {}, value;
if (doc.doc_type === "XFormInstance") {
if (doc.xmlns) {
for (var key in doc._attachments) {
if (doc._attachments.hasOwnProperty(key) &&
doc._attachments[key].content_type !== "text/xml") {
... | Add couch view for attachments | Add couch view for attachments
| JavaScript | bsd-3-clause | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,23 @@
+function (doc) {
+ var media = 0, attachments = {}, value;
+
+ if (doc.doc_type === "XFormInstance") {
+ if (doc.xmlns) {
+ for (var key in doc._attachments) {
+ if (doc._attachments.hasOwnProperty(key) &&
+ doc._attachments[key].cont... | |
70b7c22e48a21079a379ced7d895d489fc96e65d | Greasemonkey/apple-documentation.user.js | Greasemonkey/apple-documentation.user.js | // ==UserScript==
// @name Apple documentation class link
// @namespace https://franklinyu.github.io/
// @version 0.1
// @description create link for classes in code segments
// @author Franklin Yu
// @include https://developer.apple.com/reference/*
// @grant none
// ==/UserScript==
... | Add script to help finding Apple documentation | Add script to help finding Apple documentation
| JavaScript | mit | franklinyu/snippets,franklinyu/snippets,franklinyu/snippets | ---
+++
@@ -0,0 +1,39 @@
+// ==UserScript==
+// @name Apple documentation class link
+// @namespace https://franklinyu.github.io/
+// @version 0.1
+// @description create link for classes in code segments
+// @author Franklin Yu
+// @include https://developer.apple.com/reference/*
+// @gra... | |
60995e57bc9e1b417693231f1818faf80feff641 | src/es5.js | src/es5.js | var isES5 = (function(){
"use strict";
return this === void 0;
})();
if (isES5) {
module.exports = {
freeze: Object.freeze,
defineProperty: Object.defineProperty,
keys: Object.keys,
getPrototypeOf: Object.getPrototypeOf,
isArray: Array.isArray,
isES5: isES5
... | var isES5 = (function(){
"use strict";
return this === void 0;
})();
if (isES5) {
module.exports = {
freeze: Object.freeze,
defineProperty: Object.defineProperty,
keys: Object.keys,
getPrototypeOf: Object.getPrototypeOf,
isArray: Array.isArray,
isES5: isES5
... | Change function defs to variable defs in block scope. | Change function defs to variable defs in block scope.
Function definitions in blocks cause chrome to throw syntax error in
strict mode.
| JavaScript | mit | alubbe/bluebird,xbenjii/bluebird,bjonica/bluebird,peterKaleta/bluebird,vladikoff/bluebird,code-monkeys/bluebird,sequelize/bluebird,davyengone/bluebird,kidaa/bluebird,janmeier/bluebird,timnew/bluebird,mdarveau/bluebird,bsiddiqui/bluebird,STRML/bluebird,code-monkeys/bluebird,wainage/bluebird,xdevelsistemas/bluebird,Wande... | ---
+++
@@ -19,7 +19,7 @@
var str = {}.toString;
var proto = {}.constructor.prototype;
- function ObjectKeys(o) {
+ var ObjectKeys = function ObjectKeys(o) {
var ret = [];
for (var key in o) {
if (has.call(o, key)) {
@@ -29,16 +29,16 @@
return ret;
}
- ... |
86f58920fea9f9773c64fb598139a795ba4bc2cc | client/src/reducers/reducer_broadcast.js | client/src/reducers/reducer_broadcast.js | import {SAVE_BROADCAST} from '../actions/index';
export default function (state=[], action) {
switch (action.type){
case SAVE_BROADCAST:
return state.concat([action.payload.data]);
}
return state;
} | Create reducer that listens to SAVE_BROADCAST actions. | Create reducer that listens to SAVE_BROADCAST actions.
| JavaScript | mit | TeamDreamStream/GigRTC,AuggieH/GigRTC,kat09kat09/GigRTC,AuggieH/GigRTC,TeamDreamStream/GigRTC,kat09kat09/GigRTC | ---
+++
@@ -0,0 +1,9 @@
+import {SAVE_BROADCAST} from '../actions/index';
+
+export default function (state=[], action) {
+ switch (action.type){
+ case SAVE_BROADCAST:
+ return state.concat([action.payload.data]);
+ }
+ return state;
+} | |
11a8b02e97884f77c8c1f9720acc64dd9026e503 | test/util/content-disposition.js | test/util/content-disposition.js | var assert = require('assert');
var contentDisposition = require('../../lib/util/content-disposition');
describe('contentDisposition', function() {
it('returns attachment for no file name', function() {
assert.equal(contentDisposition(), 'attachment');
});
it('returns file name', function() {
... | Add full coverage for contentDisposition utility | Add full coverage for contentDisposition utility
| JavaScript | mit | itsananderson/molded | ---
+++
@@ -0,0 +1,18 @@
+var assert = require('assert');
+var contentDisposition = require('../../lib/util/content-disposition');
+
+describe('contentDisposition', function() {
+ it('returns attachment for no file name', function() {
+ assert.equal(contentDisposition(), 'attachment');
+ });
+ it('ret... | |
bbe6a5c7fd28324bf5ce8df345ac97e2182db570 | packages/gatsby/src/cache-dir/register-service-worker.js | packages/gatsby/src/cache-dir/register-service-worker.js | import emitter from "./emitter"
if (`serviceWorker` in navigator) {
navigator.serviceWorker
.register(`sw.js`)
.then(function(reg) {
reg.addEventListener(`updatefound`, () => {
// The updatefound event implies that reg.installing is set; see
// https://w3c.github.io/ServiceWorker/#servi... | import emitter from "./emitter"
let pathPrefix = `/`
if (__PREFIX_PATHS__) {
pathPrefix = __PATH_PREFIX__
}
if (`serviceWorker` in navigator) {
navigator.serviceWorker
.register(`${pathPrefix}sw.js`)
.then(function(reg) {
reg.addEventListener(`updatefound`, () => {
// The updatefound event i... | Support path prefixes for service workers | Support path prefixes for service workers
| JavaScript | mit | 0x80/gatsby,gatsbyjs/gatsby,chiedo/gatsby,okcoker/gatsby,danielfarrell/gatsby,mingaldrichgan/gatsby,ChristopherBiscardi/gatsby,danielfarrell/gatsby,0x80/gatsby,gatsbyjs/gatsby,mingaldrichgan/gatsby,chiedo/gatsby,gatsbyjs/gatsby,ChristopherBiscardi/gatsby,mingaldrichgan/gatsby,ChristopherBiscardi/gatsby,fk/gatsby,daniel... | ---
+++
@@ -1,8 +1,13 @@
import emitter from "./emitter"
+
+let pathPrefix = `/`
+if (__PREFIX_PATHS__) {
+ pathPrefix = __PATH_PREFIX__
+}
if (`serviceWorker` in navigator) {
navigator.serviceWorker
- .register(`sw.js`)
+ .register(`${pathPrefix}sw.js`)
.then(function(reg) {
reg.addEventLis... |
956a4c76ff90d4169d21f90b4ef6f1a33ed787bf | test/renderer/components/cell/cell_spec.js | test/renderer/components/cell/cell_spec.js | import React from 'react';
import {renderIntoDocument} from 'react-addons-test-utils';
import {expect} from 'chai';
import Cell from '../../../../src/notebook/components/cell/cell';
import * as commutable from 'commutable';
describe('Cell', () => {
it('should be able to render a markdown cell', () => {
const c... | Add tests for cell component | Add tests for cell component
| JavaScript | bsd-3-clause | jdetle/nteract,nteract/nteract,jdfreder/nteract,temogen/nteract,jdetle/nteract,jdfreder/nteract,nteract/composition,rgbkrk/nteract,jdfreder/nteract,temogen/nteract,0u812/nteract,temogen/nteract,captainsafia/nteract,rgbkrk/nteract,nteract/nteract,nteract/nteract,nteract/composition,nteract/nteract,jdfreder/nteract,0u812... | ---
+++
@@ -0,0 +1,16 @@
+import React from 'react';
+
+import {renderIntoDocument} from 'react-addons-test-utils';
+import {expect} from 'chai';
+
+import Cell from '../../../../src/notebook/components/cell/cell';
+import * as commutable from 'commutable';
+
+describe('Cell', () => {
+ it('should be able to render ... | |
21efb579e9ed5d925296dfa030afa487d4ce6fd2 | spec/helpers/consolereporter.js | spec/helpers/consolereporter.js | var util = require('util');
var options = {
showColors: true,
print: function () {
process.stdout.write(util.format.apply(this, arguments));
}
};
jasmine.getEnv().addReporter(new jasmine.ConsoleReporter(options)); | Fix jasmine has no output | Fix jasmine has no output
| JavaScript | mit | jean343/Node-OpenMAX,jean343/Node-OMX,jean343/Node-OpenMAX,jean343/Node-OpenMAX,jean343/Node-OMX,jean343/Node-OpenMAX,jean343/Node-OMX,jean343/Node-OMX,jean343/Node-OMX,jean343/Node-OpenMAX,jean343/Node-OMX,jean343/Node-OpenMAX | ---
+++
@@ -0,0 +1,9 @@
+var util = require('util');
+var options = {
+ showColors: true,
+ print: function () {
+ process.stdout.write(util.format.apply(this, arguments));
+ }
+};
+
+jasmine.getEnv().addReporter(new jasmine.ConsoleReporter(options)); | |
a3b1e4c08b61db7cfb09ee82a085621ec19da8d1 | modules/errors/errors.js | modules/errors/errors.js | /**
* Meters the number of page errors, and provides traces after notices.
*/
exports.version = '0.1';
exports.module = function(phantomas) {
var errors = [];
phantomas.on('pageerror', function(msg, trace) {
errors.push({"msg":msg, "trace":trace});
});
phantomas.on('report', function() {
var len = errors.... | Add a basic error reporting module. | Add a basic error reporting module.
| JavaScript | bsd-2-clause | gmetais/phantomas,ingoclaro/phantomas,macbre/phantomas,william-p/phantomas,macbre/phantomas,ingoclaro/phantomas,gmetais/phantomas,ingoclaro/phantomas,william-p/phantomas,gmetais/phantomas,macbre/phantomas,william-p/phantomas | ---
+++
@@ -0,0 +1,29 @@
+/**
+ * Meters the number of page errors, and provides traces after notices.
+ */
+
+exports.version = '0.1';
+
+exports.module = function(phantomas) {
+ var errors = [];
+
+ phantomas.on('pageerror', function(msg, trace) {
+ errors.push({"msg":msg, "trace":trace});
+ });
+
+ phantomas.on('... | |
6ba99cb38f453499eb2cf84d0300f96f13584fd0 | code/js/controllers/HoferLifeMusicController.js | code/js/controllers/HoferLifeMusicController.js | ;(function() {
"use strict";
var BaseController = require("BaseController");
new BaseController({
siteName: "LifeStoreFlat",
play: ".player-play-button .icon-play-button",
pause: ".player-play-button .icon-pause2",
playNext: ".player-advance-button",
playPrev: ".player-rewind-button",
li... | ;(function() {
"use strict";
var BaseController = require("BaseController");
new BaseController({
siteName: "Hofer life music",
play: ".player-play-button .icon-play-button",
pause: ".player-play-button .icon-pause2",
playNext: ".player-advance-button",
playPrev: ".player-rewind-button",
... | Fix hofer life music Controller name | Fix hofer life music Controller name
| JavaScript | mit | nemchik/streamkeys,nemchik/streamkeys,alexesprit/streamkeys,berrberr/streamkeys,ovcharik/streamkeys,berrberr/streamkeys,alexesprit/streamkeys,nemchik/streamkeys,ovcharik/streamkeys,berrberr/streamkeys | ---
+++
@@ -4,7 +4,7 @@
var BaseController = require("BaseController");
new BaseController({
- siteName: "LifeStoreFlat",
+ siteName: "Hofer life music",
play: ".player-play-button .icon-play-button",
pause: ".player-play-button .icon-pause2",
playNext: ".player-advance-button", |
9de6aaaf8f14e1e91497a34012e8e46de519d7f4 | Sources/Proxy/Core/LookupTableProxy/index.js | Sources/Proxy/Core/LookupTableProxy/index.js | import macro from 'vtk.js/Sources/macro';
import vtkColorMaps from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction/ColorMaps';
import vtkColorTransferFunction from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction';
const DEFAULT_PRESET_NAME = 'Cool to Warm';
// ----------------------------------------------... | Add proxy to manage LoookupTable with preset | fix(LookupTableProxy): Add proxy to manage LoookupTable with preset
| JavaScript | bsd-3-clause | Kitware/vtk-js,Kitware/vtk-js,Kitware/vtk-js,Kitware/vtk-js | ---
+++
@@ -0,0 +1,83 @@
+import macro from 'vtk.js/Sources/macro';
+
+import vtkColorMaps from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction/ColorMaps';
+import vtkColorTransferFunction from 'vtk.js/Sources/Rendering/Core/ColorTransferFunction';
+
+const DEFAULT_PRESET_NAME = 'Cool to Warm';
+
+// -----------... | |
ccfc1237400f0f719e6e17f4372cce18cc0d7692 | utils/streamHandler.js | utils/streamHandler.js | var Tweet = require('../models/Tweet');
var StreamHandler = function(stream, io) {
// Whenever the stream handler passes new tweets...
stream.on('data', function(data) {
var tweet = {
twid: data['id'],
active: false,
author: data['user']['name'],
avatar: data['user']['profile_image_url'... | Add stream handler for saving new tweets and emitting data to the client | Add stream handler for saving new tweets and emitting data to the client
| JavaScript | mit | thinkswan/react-twitter-stream,thinkswan/react-twitter-stream | ---
+++
@@ -0,0 +1,28 @@
+var Tweet = require('../models/Tweet');
+
+var StreamHandler = function(stream, io) {
+ // Whenever the stream handler passes new tweets...
+ stream.on('data', function(data) {
+ var tweet = {
+ twid: data['id'],
+ active: false,
+ author: data['user']['name'],
+ ava... | |
b4aeabeeb81f14505416e0b0c4a5001f422044d2 | test/tap/00-check-mock-dep.js | test/tap/00-check-mock-dep.js | console.log("TAP Version 13")
process.on("uncaughtException", function(er) {
console.log("not ok - Failed checking mock registry dep. Expect much fail!")
console.log("1..1")
process.exit(1)
})
var assert = require("assert")
var semver = require("semver")
var mock = require("npm-registry-mock/package.json").vers... | Add test to verify npm-registry-mock version | test: Add test to verify npm-registry-mock version
I keep getting myself into weird cases where I have an outdated copy of
npm-registry-mock, and so tests fail, and I spend several minutes digging
only to find that it's because I didn't update after the package.json dep
changed.
Add a test to alert to this situation,... | JavaScript | artistic-2.0 | cchamberlain/npm,yibn2008/npm,lxe/npm,thomblake/npm,rsp/npm,thomblake/npm,Volune/npm,kimshinelove/naver-npm,TimeToogo/npm,DaveEmmerson/npm,segrey/npm,yodeyer/npm,Volune/npm,DIREKTSPEED-LTD/npm,misterbyrne/npm,cchamberlain/npm-msys2,haggholm/npm,ekmartin/npm,yibn2008/npm,yibn2008/npm,lxe/npm,cchamberlain/npm,kimshinelov... | ---
+++
@@ -0,0 +1,15 @@
+console.log("TAP Version 13")
+
+process.on("uncaughtException", function(er) {
+ console.log("not ok - Failed checking mock registry dep. Expect much fail!")
+ console.log("1..1")
+ process.exit(1)
+})
+
+var assert = require("assert")
+var semver = require("semver")
+var mock = require(... | |
edd9a17fd5d08514b54ce0450d82dbe055ba762b | mp3-stream.js | mp3-stream.js | var express = require('express');
var app = express();
var fs = require('fs');
app.listen(3000, function() {
console.log("[NodeJS] Application Listening on Port 3000");
});
app.get('/api/play/:key', function(req, res) {
var key = req.params.key;
var music = 'music/' + key + '.mp3';
... | Add mp3 file streaming example | Add mp3 file streaming example | JavaScript | mit | voidabhi/node-scripts,voidabhi/node-scripts,voidabhi/node-scripts | ---
+++
@@ -0,0 +1,47 @@
+var express = require('express');
+var app = express();
+var fs = require('fs');
+
+app.listen(3000, function() {
+ console.log("[NodeJS] Application Listening on Port 3000");
+});
+
+app.get('/api/play/:key', function(req, res) {
+ var key = req.params.key;
+
+ ... | |
fd644a2e6881833fdbbc56c0451235f22b5f8aeb | test/karma.conf.js | test/karma.conf.js | module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath : '',
// frameworks to use
frameworks : [ 'mocha', 'sinon', 'chai-jquery', 'jquery-2.1.0', 'chai' ],
// list of files / patterns to load in the browser... | Add karma file for browser tests | Add karma file for browser tests
| JavaScript | mit | uplift/ExoSuit,uplift/ExoSuit | ---
+++
@@ -0,0 +1,90 @@
+module.exports = function(config) {
+ config.set({
+ // base path, that will be used to resolve files and exclude
+ basePath : '',
+
+ // frameworks to use
+ frameworks : [ 'mocha', 'sinon', 'chai-jquery', 'jquery-2.1.0', 'chai' ],
+
+ // list of fil... | |
9dd1afd6966c5b53dcc7f98ab7caf92d328fdd29 | test/index.js | test/index.js | const expect = require('expect');
const createProbot = require('..');
describe('Probot', () => {
let probot;
let event;
beforeEach(() => {
probot = createProbot();
probot.robot.auth = () => Promise.resolve({});
event = {
event: 'push',
payload: require('./fixtures/webhook/push')
};
... | Test for manually delivering events | Test for manually delivering events
| JavaScript | isc | pholleran-org/probot,pholleran-org/probot,bkeepers/PRobot,probot/probot,pholleran-org/probot,probot/probot,probot/probot,bkeepers/PRobot | ---
+++
@@ -0,0 +1,40 @@
+const expect = require('expect');
+const createProbot = require('..');
+
+describe('Probot', () => {
+ let probot;
+ let event;
+
+ beforeEach(() => {
+ probot = createProbot();
+ probot.robot.auth = () => Promise.resolve({});
+
+ event = {
+ event: 'push',
+ payload: r... | |
71156875e3af065137a620c918f042b9719a5aa9 | mods/inverse/abilities.js | mods/inverse/abilities.js | exports.BattleAbilities = {
arenatrap: {
inherit: true,
onFoeModifyPokemon: function(pokemon) {
if (!pokemon.hasType('Flying') && pokemon.runImmunity('Ground', false)) {
pokemon.tryTrap();
}
},
onFoeMaybeTrapPokemon: function(pokemon) {
if (!pokemon.hasType('Flying') && pokemon.runImmunity('Ground... | Fix Arena Trap on Inverse Battle Arena Trap still does not trap Flying-types on Inverse Battle. | Fix Arena Trap on Inverse Battle
Arena Trap still does not trap Flying-types on Inverse Battle.
| JavaScript | mit | yashagl/pokemon,Irraquated/Pokemon-Showdown,lFernanl/Pokemon-Showdown,gustavo515/batata,JennyPRO/Jenny,BlazingAura/Showdown-Boilerplate,SSJGVegito007/Vegito-s-Server,lAlejandro22/lolipoop,hayleysworld/serenityc9,DalleTest/Pokemon-Showdown,Elveman/RPCShowdownServer,Syurra/Pokemon-Showdown,comedianchameleon/servertest1,l... | ---
+++
@@ -0,0 +1,15 @@
+exports.BattleAbilities = {
+ arenatrap: {
+ inherit: true,
+ onFoeModifyPokemon: function(pokemon) {
+ if (!pokemon.hasType('Flying') && pokemon.runImmunity('Ground', false)) {
+ pokemon.tryTrap();
+ }
+ },
+ onFoeMaybeTrapPokemon: function(pokemon) {
+ if (!pokemon.hasType('Fl... | |
1e84ec991a9d161f1e5d4fa4351d8a0d2562ec42 | test/api-compiler-tests.js | test/api-compiler-tests.js | 'use strict';
require('./patch-module');
require('marko/node-require').install();
var chai = require('chai');
chai.config.includeStack = true;
var expect = require('chai').expect;
var nodePath = require('path');
require('../compiler');
var autotest = require('./autotest');
var marko = require('../');
var markoCompile... | Test runner for `api-compiler` tests | Test runner for `api-compiler` tests
| JavaScript | mit | marko-js/marko,marko-js/marko | ---
+++
@@ -0,0 +1,22 @@
+'use strict';
+require('./patch-module');
+require('marko/node-require').install();
+
+var chai = require('chai');
+chai.config.includeStack = true;
+
+var expect = require('chai').expect;
+var nodePath = require('path');
+require('../compiler');
+var autotest = require('./autotest');
+var m... | |
a0811c7c3b685dbd94b8ad2cb463fdad97b67620 | 06/jjhampton-ch6-sequence-interface.js | 06/jjhampton-ch6-sequence-interface.js | // Design an interface that abstracts iteration over a collection of values. An object that provides this interface represents a sequence, and the interface must somehow make it possible for code that uses such an object to iterate over the sequence, looking at the element values it is made up of and having some way to... | Add partial solution to sequence-interface exercise | Add partial solution to sequence-interface exercise
Specify Sequence interface - define constructor, instance properties, and prototype
methods. Also implement ArraySeq constructor that uses the Sequence
interface.
| JavaScript | mit | OperationCode/eloquent-js | ---
+++
@@ -0,0 +1,56 @@
+// Design an interface that abstracts iteration over a collection of values. An object that provides this interface represents a sequence, and the interface must somehow make it possible for code that uses such an object to iterate over the sequence, looking at the element values it is made ... | |
8bb4599170ecfb99af9a3e1029d30093bb83e7ef | popup-view.js | popup-view.js | PinPoint.View = function(){
//Steven's storeListDOMRoot is equivalent to our noteList
this.noteListDOMRoot = document.getElementsByTagName('table');
}
//the 'notes' argument will be an array of parsed JSON note objects
PinPoint.View.prototype = {
loadNotesFromDatabase: function(notes) {
// this.noteList.app... | Create view file for popup. | Create view file for popup.
| JavaScript | mit | ospreys-2014/PinPoint,jbouzi12/PinPoint,jbouzi12/PinPoint | ---
+++
@@ -0,0 +1,35 @@
+PinPoint.View = function(){
+ //Steven's storeListDOMRoot is equivalent to our noteList
+ this.noteListDOMRoot = document.getElementsByTagName('table');
+
+}
+
+//the 'notes' argument will be an array of parsed JSON note objects
+PinPoint.View.prototype = {
+ loadNotesFromDatabase: functi... | |
8fd28d35f51c40088a834eaa4bbfb01dc86385f9 | web/js/swToolboxAdmin.js | web/js/swToolboxAdmin.js | /*
* $Id$
*
* (c) 2008 Thomas Rabaix <thomas.rabaix@soleoweb.com>
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCL... | Add admin backend js helper | Add admin backend js helper
git-svn-id: c69874b65fc60996824a336b7ccbc1d3cf663ce3@12655 ee427ae8-e902-0410-961c-c3ed070cd9f9
| JavaScript | mit | rande/swToolboxPlugin | ---
+++
@@ -0,0 +1,25 @@
+/*
+ * $Id$
+ *
+ * (c) 2008 Thomas Rabaix <thomas.rabaix@soleoweb.com>
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FO... | |
8cbf3e2469e4e6a157d7916817bfaf939e89007d | app/helpers/functions.js | app/helpers/functions.js | module.exports = {
capitalizeFirstLetter: function (str) {
if (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}
return '';
}
}; | Create a place for function helpers | Create a place for function helpers
Add first function, capitalizeFirstLetter
| JavaScript | mit | hacksu/kenthackenough,hacksu/kenthackenough | ---
+++
@@ -0,0 +1,10 @@
+module.exports = {
+
+ capitalizeFirstLetter: function (str) {
+ if (str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+ }
+ return '';
+ }
+
+}; | |
edef73dce067d18c3dab643e2c454f992a06e13f | test/api/lambdas/:organizationName/:lambdaName/get.js | test/api/lambdas/:organizationName/:lambdaName/get.js | import express from "express";
import request from "supertest-as-promised";
import {sign} from "jsonwebtoken";
import api from "api";
import * as config from "config";
import dynamodb from "services/dynamodb";
describe("GET /lambdas/:organizationName/:lambdaName", () => {
const server = express().use(api);
c... | Add tests for GET /lambdas/:organizationName/:lambdaName | Add tests for GET /lambdas/:organizationName/:lambdaName
| JavaScript | mit | lk-architecture/lh-api | ---
+++
@@ -0,0 +1,76 @@
+import express from "express";
+import request from "supertest-as-promised";
+import {sign} from "jsonwebtoken";
+
+import api from "api";
+import * as config from "config";
+import dynamodb from "services/dynamodb";
+
+describe("GET /lambdas/:organizationName/:lambdaName", () => {
+
+ co... | |
b1f87ed9f07f24154e86be7d3a1df8ed54f1883a | updates/0.0.1-locales.js | updates/0.0.1-locales.js | var fs = require('fs');
var namespaces = [
'app','home','form','services',
'footer','portfolio','terms',
'contact'
],
lngs = ['fr', 'en'],
resources = [];
function loadResource($ns,$lng) {
var data = fs.readFileSync('./locales/' + $lng +'/' + $ns + '.json', 'utf8');
return {
_id: $ns + '_' + $lng,
ns:... | Add localeResource model and update | Add localeResource model and update
| JavaScript | mit | infocinc/homepage,infocinc/homepage,infocinc/homepage | ---
+++
@@ -0,0 +1,38 @@
+var fs = require('fs');
+
+var namespaces = [
+ 'app','home','form','services',
+ 'footer','portfolio','terms',
+ 'contact'
+ ],
+ lngs = ['fr', 'en'],
+ resources = [];
+
+
+function loadResource($ns,$lng) {
+ var data = fs.readFileSync('./locales/' + $lng +'/' + $ns + '.json', 'utf8');
... | |
c099debbc24fb8576cdddfe31b9391996a6aad21 | server/models/listsubscriber.js | server/models/listsubscriber.js | 'use strict';
module.exports = function(sequelize, DataTypes) {
var listsubscriber = sequelize.define('listsubscriber', {
email: DataTypes.STRING,
subscribed: { type: DataTypes.BOOLEAN, defaultValue: true },
unsubscribeKey: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4 },
mostRecentStatus: { ... | 'use strict';
module.exports = function(sequelize, DataTypes) {
var listsubscriber = sequelize.define('listsubscriber', {
email: DataTypes.STRING,
subscribed: { type: DataTypes.BOOLEAN, defaultValue: true },
unsubscribeKey: { type: DataTypes.UUID, defaultValue: DataTypes.UUIDV4 },
mostRecentStatus: { ... | Remove unique constraint for ListSubscribers table | Remove unique constraint for ListSubscribers table
| JavaScript | bsd-3-clause | karuppiah7890/Mail-for-Good,zhakkarn/Mail-for-Good,karuppiah7890/Mail-for-Good,karuppiah7890/Mail-for-Good,zhakkarn/Mail-for-Good,zhakkarn/Mail-for-Good | ---
+++
@@ -18,7 +18,6 @@
},
indexes: [
{
- unique: true,
fields:['email']
}
] |
9858889189d3516b62bd0b78ae76cb9dbb9b837c | lib/core-components/famous-demos/config-panel/config-panel.js | lib/core-components/famous-demos/config-panel/config-panel.js | FamousFramework.component('famous-demos:config-panel', {
tree: `
<famous:ui:config-panel:controller id="controller">
<famous-demos:clickable-square id="square" class="configurable"></famous-demos:clickable-square>
</famous:ui:config-panel:controller>
`
});
| Add config panel demo with everyone's favorite, clickable-square | feat: Add config panel demo with everyone's favorite, clickable-square
| JavaScript | mit | jeremykenedy/framework,Famous/framework,SvitlanaShepitsena/framework,infamous/framework,KraigWalker/framework,ildarsamit/framework,SvitlanaShepitsena/framework,tbossert/framework,infamous/famous-framework,woltemade/framework,colllin/famous-framework,KraigWalker/framework,woltemade/framework,SvitlanaShepitsena/remax-ban... | ---
+++
@@ -0,0 +1,8 @@
+FamousFramework.component('famous-demos:config-panel', {
+
+ tree: `
+ <famous:ui:config-panel:controller id="controller">
+ <famous-demos:clickable-square id="square" class="configurable"></famous-demos:clickable-square>
+ </famous:ui:config-panel:controller>
+ ... | |
6df052468b535b54f208207a44f42ef4791c89c4 | settings/OwnerSettings.js | settings/OwnerSettings.js | import React from 'react';
import PropTypes from 'prop-types';
import ControlledVocab from '@folio/stripes-smart-components/lib/ControlledVocab';
class OwnerSettings extends React.Component {
static propTypes = {
stripes: PropTypes.shape({
connect: PropTypes.func.isRequired,
intl: PropTypes.object.is... | Add settings for UIU-193 CRUD Fee/Fine Owners | Add settings for UIU-193 CRUD Fee/Fine Owners
| JavaScript | apache-2.0 | folio-org/ui-users,folio-org/ui-users | ---
+++
@@ -0,0 +1,40 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import ControlledVocab from '@folio/stripes-smart-components/lib/ControlledVocab';
+
+class OwnerSettings extends React.Component {
+ static propTypes = {
+ stripes: PropTypes.shape({
+ connect: PropTypes.func.isRequir... | |
bc239931777d170dc8ab1737746fcaeb6465e1b1 | src/data/migrations/20170728095755-removeLevelsFieldsFromPools.js | src/data/migrations/20170728095755-removeLevelsFieldsFromPools.js | export async function up(r) {
return r.table('pools').replace(r.row.without('levels'))
}
export async function down() {
// irreversible; cannot recover data
}
| Remove "level" fields from pools table in database. | Remove "level" fields from pools table in database.
| JavaScript | mit | sdweber422/echo,LearnersGuild/echo | ---
+++
@@ -0,0 +1,7 @@
+export async function up(r) {
+ return r.table('pools').replace(r.row.without('levels'))
+}
+
+export async function down() {
+ // irreversible; cannot recover data
+} | |
23f2f179f298e435b49375edb7516e9b67dc0622 | database_connection.js | database_connection.js | var mysqlConnection = function(credentials) {
var mysql = require('mysql');
this.connection = mysql.createConnection(credentials);
return this;
}
mysqlConnection.prototype.getUsers = function(callback, errCallback) {
this.connection.query('SELECT username, password_hash, token FROM users', function(err, rows, ... | Add database connection script with mysql option | Add database connection script with mysql option
| JavaScript | mit | peternatewood/socket-battle,peternatewood/socket-battle | ---
+++
@@ -0,0 +1,75 @@
+var mysqlConnection = function(credentials) {
+ var mysql = require('mysql');
+
+ this.connection = mysql.createConnection(credentials);
+ return this;
+}
+mysqlConnection.prototype.getUsers = function(callback, errCallback) {
+ this.connection.query('SELECT username, password_hash, toke... | |
b7ef5c2df3c76bd20691036ee20d00350538d403 | test/frontend/editController.spec.js | test/frontend/editController.spec.js | describe('editController', function(){
var scope; // use this scope in our tests
// mock Application to allow us to inject our own dependencies
beforeEach(angular.mock.module('zoomableApp'));
// mock the controller for the same reason and include $rootScope and $controller
beforeEach(angular.mock.inject(fun... | Add unit test for editController.js | Add unit test for editController.js
| JavaScript | mit | nus-mtp/zoomable.js,nus-mtp/zoomable.js,nus-mtp/zoomable.js | ---
+++
@@ -0,0 +1,38 @@
+describe('editController', function(){
+ var scope; // use this scope in our tests
+
+ // mock Application to allow us to inject our own dependencies
+ beforeEach(angular.mock.module('zoomableApp'));
+
+ // mock the controller for the same reason and include $rootScope and $controller
+ ... | |
ee6cd9202c7a55798085d07a4c0682eade4dd1ce | app/filters/commonFilters.js | app/filters/commonFilters.js | define(['app','lodash', ], function (app,_) { 'use strict';
//##################################################################
app.filter('filterByLetter', function () {
return function (arr, letter) {
if (!arr)
return null;
if(!letter || letter==='A... | Add common filters file. filter created to filter by first char | Add common filters file. filter created to filter by first char
| JavaScript | mit | scbd/chm.cbd.int,scbd/chm.cbd.int,scbd/chm.cbd.int | ---
+++
@@ -0,0 +1,21 @@
+define(['app','lodash', ], function (app,_) { 'use strict';
+
+ //##################################################################
+ app.filter('filterByLetter', function () {
+ return function (arr, letter) {
+ if (!arr)
+ return null;
+
+
+ ... | |
b51858e4e24ed5f919532724b44ea96fddf8ea61 | lib/sentient.js | lib/sentient.js | "use strict";
var Level2Compiler = require("./sentient/compiler/level2Compiler");
var Level2Runtime = require("./sentient/runtime/level2Runtime");
var Level1Compiler = require("./sentient/compiler/level1Compiler");
var Level1Runtime = require("./sentient/runtime/level1Runtime");
var Machine = require("./sentient/mac... | Add a top-level Sentient module… | Add a top-level Sentient module…
This will probably be re-written to use dedicated
compiler / runtime so that they can be packaged
separately, but this will do for now. | JavaScript | bsd-3-clause | sentient-lang/sentient-lang,sentient-lang/sentient-lang | ---
+++
@@ -0,0 +1,48 @@
+"use strict";
+
+var Level2Compiler = require("./sentient/compiler/level2Compiler");
+var Level2Runtime = require("./sentient/runtime/level2Runtime");
+
+var Level1Compiler = require("./sentient/compiler/level1Compiler");
+var Level1Runtime = require("./sentient/runtime/level1Runtime");
+
+v... | |
46c63ae49ee4f2b9e66dd440f2a4acc3e245f8de | src/shared/components/boardCard/boardCard.js | src/shared/components/boardCard/boardCard.js | import React from 'react';
import PropTypes from 'prop-types';
import styles from './boardCard.css';
const BoardCard = ({
alt,
name,
role,
src,
description
}) => (
<div className={styles.boardCard}>
<img className={styles.img} src={src} alt={alt} />
<span className={styles.name}>
{name}
<... | import React from 'react';
import PropTypes from 'prop-types';
import styles from './boardCard.css';
const BoardCard = ({
alt,
name,
role,
src,
description
}) => (
<div className={styles.boardCard}>
<img className={styles.img} src={src} alt={alt} />
<span className={styles.name}>
{name}
<... | Make conditional rendering even shorter syntax | Make conditional rendering even shorter syntax | JavaScript | mit | hollomancer/operationcode_frontend,tskuse/operationcode_frontend,NestorSegura/operationcode_frontend,tal87/operationcode_frontend,tskuse/operationcode_frontend,tskuse/operationcode_frontend,sethbergman/operationcode_frontend,tal87/operationcode_frontend,tal87/operationcode_frontend,hollomancer/operationcode_frontend,ho... | ---
+++
@@ -17,7 +17,7 @@
<hr className={styles.hr} />
<span className={styles.item}>
<span className={styles.upper}>Role: </span> {role}
- {description !== null && <p>{description}</p>}
+ {description && <p>{description}</p>}
</span>
</div>
); |
92abd614459c4e702a7b786ccd285c240a758243 | app/lib/collections/flows.js | app/lib/collections/flows.js | import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
import { FlowSchema } from './projects';
Flows = new Mongo.Collection('flows');
if (Meteor.isServer) {
Flows.allow({
insert: function(userId, doc) {
return false;
},
update: function(userId, doc, f... | Create a separate Flows collection | Create a separate Flows collection
| JavaScript | agpl-3.0 | openp2pdesign/OpenMetaDesign,openp2pdesign/OpenMetaDesign,openp2pdesign/OpenMetaDesign | ---
+++
@@ -0,0 +1,54 @@
+import { Mongo } from 'meteor/mongo';
+import SimpleSchema from 'simpl-schema';
+import { FlowSchema } from './projects';
+
+Flows = new Mongo.Collection('flows');
+
+
+if (Meteor.isServer) {
+ Flows.allow({
+ insert: function(userId, doc) {
+ return false;
+ },
+... | |
273c67b0d7cfee84adb181ca10e80f69e8b69d27 | test/unit/server/util/adjust-resource-quantity.js | test/unit/server/util/adjust-resource-quantity.js | const adjustResourceQuantity = require('../../../../server/util/adjust-resource-quantity');
adjustResourceQuantity.setResources([
{name: 'cat', plural_form: 'cats'},
{name: 'person', plural_form: 'people'},
]);
describe('adjustResourceQuantity', function() {
describe('when requesting singular', () => {
it('... | Add unit tests for adjustResourceQuantity | Add unit tests for adjustResourceQuantity
| JavaScript | mit | jmeas/api-pls | ---
+++
@@ -0,0 +1,20 @@
+const adjustResourceQuantity = require('../../../../server/util/adjust-resource-quantity');
+
+adjustResourceQuantity.setResources([
+ {name: 'cat', plural_form: 'cats'},
+ {name: 'person', plural_form: 'people'},
+]);
+
+describe('adjustResourceQuantity', function() {
+ describe('when re... | |
f82f69de8cc08ac27b9948264582bffda635027c | Gruntfile.js | Gruntfile.js | module.exports = function(grunt) {
grunt.initConfig({
less: {
production: {
options: {
paths: [ "bower_components/bootstrap/less" ],
cleancss: true
},
files: {
"css/application.min.css": "_less/application.less"
}
}
},
uglify: {
... | Build and serve via Grunt. | Build and serve via Grunt.
| JavaScript | bsd-3-clause | nfloersch/codeforbtv.github.com,nfloersch/codeforbtv.github.com,nfloersch/codeforbtv.github.com | ---
+++
@@ -0,0 +1,69 @@
+module.exports = function(grunt) {
+
+ grunt.initConfig({
+ less: {
+ production: {
+ options: {
+ paths: [ "bower_components/bootstrap/less" ],
+ cleancss: true
+ },
+ files: {
+ "css/application.min.css": "_less/application.less"
+ ... | |
6e48690e84b3b9411b8fe5872941dd0ed1e40da0 | app/js/arethusa.relation/directives/nested_menu.js | app/js/arethusa.relation/directives/nested_menu.js | "use strict";
angular.module('arethusa.relation').directive('nestedMenu', [
'$compile',
function($compile) {
return {
restrict: 'A',
scope: {
relation: '=',
values: '=',
label: '='
},
link: function(scope, element, attrs) {
//var nestedHtml = '<ul nested-... | Add nesteMenu directive in relation | Add nesteMenu directive in relation
| JavaScript | mit | alpheios-project/arethusa,fbaumgardt/arethusa,fbaumgardt/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,PonteIneptique/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa,PonteIneptique/arethusa,Masoumeh/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa | ---
+++
@@ -0,0 +1,35 @@
+"use strict";
+
+angular.module('arethusa.relation').directive('nestedMenu', [
+ '$compile',
+ function($compile) {
+ return {
+ restrict: 'A',
+ scope: {
+ relation: '=',
+ values: '=',
+ label: '='
+ },
+ link: function(scope, element, attrs) {... | |
243f86b8177d59647b60db50f2961cec431badf7 | chapter_06/load_crawl_urls.js | chapter_06/load_crawl_urls.js | const AWS = require('aws-sdk');
const async = require('async');
const argv = require('minimist')(process.argv.slice(2));
const config = require('./config');
const helpers = require('./helpers');
AWS.config.update({ region: 'us-east-1' });
const urls = argv._;
if (urls.length === 0) {
console.error('Usage: node loa... | Add script to add URL to queue | Add script to add URL to queue
| JavaScript | mit | colinking/host_your_website_jeff_barr,colinking/host_your_website_jeff_barr | ---
+++
@@ -0,0 +1,36 @@
+const AWS = require('aws-sdk');
+const async = require('async');
+const argv = require('minimist')(process.argv.slice(2));
+const config = require('./config');
+const helpers = require('./helpers');
+
+AWS.config.update({ region: 'us-east-1' });
+
+const urls = argv._;
+
+if (urls.length ===... | |
20fa1dc0a4a870e54b361af453e6a112130e1a99 | app/index.js | app/index.js | "use strict";
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var favicon = require('serve-favicon');
var routes = require('./routes');
var cachebuster = ... | "use strict";
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var favicon = require('serve-favicon');
var routes = require('./routes');
var cachebuster = ... | Print combined logs in production | Print combined logs in production
| JavaScript | mit | pheadra/isomorphic500,devypt/isomorphic500,jonathanconway/MovieBrowser,gpbl/isomorphic500,veeracs/isomorphic500,jeffhandley/oredev-sessions,beeva-davidgarcia/isomorphic500,geekyme/isomorphic-react-template,fustic/isomorphic500,jmfurlott/isomorphic500,ryankanno/isomorphic500,davedx/isomorphic-react-template,dmitrif/isom... | ---
+++
@@ -14,7 +14,7 @@
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
-app.use(logger('dev'));
+app.use(logger(app.get('env') === 'production' ? 'combined' : 'dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser()); |
a88b98ac08d8918dbb8ae2c274ff6d88fa983694 | tests/unit/controllers/tasks.js | tests/unit/controllers/tasks.js | const TaskController = require('../../../controllers/tasks');
describe('Controllers: Tasks', () => {
describe('Get all tasks from a tasklist: getAll()', () => {
it('should return all tasks', () => {
const Task = {
getAll: td.function(),
}
const owner = {
id: 1,
name: '... | Create unit test to task controller (getAll) | Create unit test to task controller (getAll)
| JavaScript | mit | jonatasleon/neo4j-tutorial,jonatasleon/neo4j-tutorial | ---
+++
@@ -0,0 +1,33 @@
+const TaskController = require('../../../controllers/tasks');
+
+describe('Controllers: Tasks', () => {
+
+ describe('Get all tasks from a tasklist: getAll()', () => {
+ it('should return all tasks', () => {
+ const Task = {
+ getAll: td.function(),
+ }
+
+ const ow... | |
6fccdf744ff88a14ee0cd3a7334bd215ff59d791 | test/jsxtest.js | test/jsxtest.js | import { Component, Render, RasterManager, View, Text } from '../index';
const assert = require('assert');
describe('JSX', function() {
describe('Comments', function() {
it('should not include comments in children', function() {
class MyComponent extends Component {
render() {
return <Vie... | Test to check JSX does not pass comments as children. | Test to check JSX does not pass comments as children.
| JavaScript | mit | dmikey/syr,dmikey/syr,dmikey/syr,dmikey/syr | ---
+++
@@ -0,0 +1,29 @@
+import { Component, Render, RasterManager, View, Text } from '../index';
+const assert = require('assert');
+
+describe('JSX', function() {
+ describe('Comments', function() {
+ it('should not include comments in children', function() {
+ class MyComponent extends Component {
+ ... | |
cb5f8e7d25388849d4caed72d839253f7d94a56c | test/queries.js | test/queries.js | import test from 'ava'
import nock from 'nock'
import data from './fixtures/data'
import Onionoo from '../'
test('Query string is built correctly', async t => {
const onionoo = new Onionoo()
const defaultEndpoint = data.defaultEndpoints[0]
const scope = nock(data.defaultBaseUrl)
.get(`/${defaultEndpoint}?fo... | Test query string is built correctly | Test query string is built correctly
| JavaScript | mit | lukechilds/onionoo-node-client | ---
+++
@@ -0,0 +1,18 @@
+import test from 'ava'
+import nock from 'nock'
+import data from './fixtures/data'
+import Onionoo from '../'
+
+test('Query string is built correctly', async t => {
+ const onionoo = new Onionoo()
+
+ const defaultEndpoint = data.defaultEndpoints[0]
+ const scope = nock(data.defaultBase... | |
7944212d6c2ad4b7d4bd8141f2918d4f08b1b90e | tests/server.js | tests/server.js | "use strict";
var Server = require("../server");
exports.testMissingBasicHeader = function (test) {
var parser = Server.prototype._basicAuthentication({
"headers": {}
});
parser().fail(function (err) {
test.equal(401, err.statusCode);
test.done();
});
};
exports.testValidBasicHeader = function (test) {
va... | Add tests for basic auth header parser | Add tests for basic auth header parser
| JavaScript | isc | whymarrh/mattress | ---
+++
@@ -0,0 +1,33 @@
+"use strict";
+
+var Server = require("../server");
+
+exports.testMissingBasicHeader = function (test) {
+ var parser = Server.prototype._basicAuthentication({
+ "headers": {}
+ });
+ parser().fail(function (err) {
+ test.equal(401, err.statusCode);
+ test.done();
+ });
+};
+
+exports.te... | |
6c40337f6b32f1ace131ab2e2238cceebefa9cfe | test/index.js | test/index.js | const koa = require('koa'),
expect = require('expect'),
uncapitalize = require('../'),
app = koa();
app.use(uncapitalize);
app.use(function *(next) {
if (this.path.toLowerCase() != '/test') {
return yield next;
}
this.body = "OK";
});
const request = require('supertest').agent(app.listen(... | Add simple tests to detect redirect behavior | Add simple tests to detect redirect behavior
| JavaScript | mit | mfinelli/koa-uncapitalize | ---
+++
@@ -0,0 +1,29 @@
+const koa = require('koa'),
+ expect = require('expect'),
+ uncapitalize = require('../'),
+ app = koa();
+
+app.use(uncapitalize);
+app.use(function *(next) {
+ if (this.path.toLowerCase() != '/test') {
+ return yield next;
+ }
+
+ this.body = "OK";
+});
+
+const reques... | |
49a9a81570b45f3d024035fb1e31fc1d775edeb0 | src/test/js/scryptSpeed.js | src/test/js/scryptSpeed.js | /**
* Example command for running this testing utility:
*
* <pre>
* jjs -cp ~/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:target/scrypt-1.4.0.jar scryptTimer.js
* </pre>
*
* If you don't have commons-codec, use the following command to download with Maven:
*
* <pre>
* mvn dep... | Add a jjs runnable JavaScript test script to ease testing whether native library is loaded on a specific platform. | Add a jjs runnable JavaScript test script to ease testing whether native
library is loaded on a specific platform.
Signed-off-by: Haochen Xie <6cdef7921402f78bb75e2821c6818c66fb01ab31@xie.name>
| JavaScript | apache-2.0 | haochenx/scrypt,haochenx/scrypt,haochenx/scrypt | ---
+++
@@ -0,0 +1,45 @@
+/**
+ * Example command for running this testing utility:
+ *
+ * <pre>
+ * jjs -cp ~/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:target/scrypt-1.4.0.jar scryptTimer.js
+ * </pre>
+ *
+ * If you don't have commons-codec, use the following command to download wi... | |
7be879358cc4b91d4fafb504641d652133d48c86 | lib/remixes/floodgap.js | lib/remixes/floodgap.js | 'use strict';
// Generate image link
var SERVICE_FLOODGAP = /(((www.floodgap\.com))\/\w\/\w+)/i;
exports.process = function(media, remix) {
if (!remix.isMatched && media.link.match(SERVICE_FLOODGAP)) {
var parts = media.link.split('/');
var shortcode = parts[parts.length - 2];
remix.isMatched = true;
... | Add an image remix for Cameron Kaiser’s (@doctorlinguist) image posts. | Add an image remix for Cameron Kaiser’s (@doctorlinguist) image posts.
| JavaScript | bsd-3-clause | 33mhz/noodleapp | ---
+++
@@ -0,0 +1,20 @@
+'use strict';
+
+// Generate image link
+var SERVICE_FLOODGAP = /(((www.floodgap\.com))\/\w\/\w+)/i;
+
+exports.process = function(media, remix) {
+ if (!remix.isMatched && media.link.match(SERVICE_FLOODGAP)) {
+ var parts = media.link.split('/');
+ var shortcode = parts[parts.length ... | |
b9415f91b0b25ae6b0ea21e2cccd6bf5f6ad4f60 | Easy/155_Min_Stack.js | Easy/155_Min_Stack.js | /**
* @constructor
*/
var MinStack = function() {
this.stack = [];
this.minStack = [];
};
/**
* @param {number} x
* @returns {void}
*/
MinStack.prototype.push = function(x) {
this.stack.push(x);
if (this.minStack.length === 0 || x <= this.minStack[this.minStack.length - 1]) {
this.minStack... | Add solution to question 155 | Add solution to question 155
| JavaScript | mit | Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode,Rhadow/leetcode | ---
+++
@@ -0,0 +1,42 @@
+/**
+ * @constructor
+ */
+var MinStack = function() {
+ this.stack = [];
+ this.minStack = [];
+};
+
+/**
+ * @param {number} x
+ * @returns {void}
+ */
+MinStack.prototype.push = function(x) {
+ this.stack.push(x);
+ if (this.minStack.length === 0 || x <= this.minStack[this.min... | |
dd36e9af22d3a522e449e47abc0143475fd24b82 | tests/node/sourcemap-test.js | tests/node/sourcemap-test.js | var fs = require('fs');
QUnit.module('sourcemap validation', function() {
var assets = ['ember.debug', 'ember.prod', 'ember.min'];
assets.forEach(asset => {
QUnit.test(`${asset} has only a single sourcemaps comment`, function(assert) {
var jsPath = `dist/${asset}.js`;
assert.ok(fs.existsSync(jsPat... | Add Node.js test asserting on the number of sourcemap comments in final assets | Add Node.js test asserting on the number of sourcemap comments in final assets
| JavaScript | mit | asakusuma/ember.js,givanse/ember.js,kellyselden/ember.js,Turbo87/ember.js,GavinJoyce/ember.js,qaiken/ember.js,qaiken/ember.js,intercom/ember.js,givanse/ember.js,jaswilli/ember.js,qaiken/ember.js,jaswilli/ember.js,mixonic/ember.js,bekzod/ember.js,kellyselden/ember.js,bekzod/ember.js,sly7-7/ember.js,miguelcobain/ember.js... | ---
+++
@@ -0,0 +1,27 @@
+var fs = require('fs');
+
+QUnit.module('sourcemap validation', function() {
+ var assets = ['ember.debug', 'ember.prod', 'ember.min'];
+
+ assets.forEach(asset => {
+ QUnit.test(`${asset} has only a single sourcemaps comment`, function(assert) {
+ var jsPath = `dist/${asset}.js`;
... | |
234e5503df070b34f220a2cc483921aa754d2ac3 | lib/resources/hook/attemptToRequireUntrustedHook.js | lib/resources/hook/attemptToRequireUntrustedHook.js | var config = require('../../../config');
var fs = require("fs");
module['exports'] = function attemptToRequireUntrustedHook (opts, callback) {
var username = opts.username,
script = opts.script;
var untrustedHook;
var isStreamingHook;
var untrustedTemplate;
var err = null;
// At this stage, the ho... | var config = require('../../../config');
var fs = require("fs");
module['exports'] = function attemptToRequireUntrustedHook (opts, callback) {
var username = opts.username,
script = opts.script;
var untrustedHook;
var isStreamingHook;
var untrustedTemplate;
var err = null;
// At this stage, the ho... | Set param theme precedence over hook theme module scope ( for now ) | [api] Set param theme precedence over hook theme module scope ( for now ) | JavaScript | agpl-3.0 | ljharb/hook.io,ljharb/hook.io,ajnsit/hook.io,joshgillies/hook.io,joshgillies/hook.io,ljharb/hook.io,joshgillies/hook.io,joshgillies/hook.io,joshgillies/hook.io,ajnsit/hook.io,joshgillies/hook.io,ajnsit/hook.io,joshgillies/hook.io | ---
+++
@@ -18,8 +18,8 @@
untrustedHook = require(_script);
opts.req.hook = opts.req.hook || {};
untrustedHook.schema = untrustedHook.schema || {};
- untrustedHook.theme = untrustedHook.theme || opts.req.hook.theme || config.defaultTheme;
- untrustedHook.presenter = untrustedHook.presenter || op... |
f7e0be860842febbe2d7b327a34cda2dba72bbde | app/utils/replayEvents.js | app/utils/replayEvents.js | export function replayEvents(events, currentTime) {
const head = events[0];
const tail = events.slice(1);
// Exit condition, no events
if (head === undefined) return;
if (head.timestamp > currentTime) {
const delay = head.timestamp - currentTime;
setTimeout(() => {
head.replay();
replayE... | Add helper method to replay events | Add helper method to replay events
| JavaScript | mit | UniSiegenCSCW/remotino,UniSiegenCSCW/remotino,UniSiegenCSCW/remotino | ---
+++
@@ -0,0 +1,17 @@
+export function replayEvents(events, currentTime) {
+ const head = events[0];
+ const tail = events.slice(1);
+
+ // Exit condition, no events
+ if (head === undefined) return;
+
+ if (head.timestamp > currentTime) {
+ const delay = head.timestamp - currentTime;
+ setTimeout(() =>... | |
77a86d9a5180a1586d9a61eb87b4408d107ab3c3 | nin/dasBoot/Random.js | nin/dasBoot/Random.js | function Random(seed){
var m_w = seed || 123456791;
var m_z = 987654321;
var mask = 0xffffffff;
return function random() {
m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;
m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;
var result = ((m_z << 16) + m_w) & mask;
res... | Add better seeded random function | Add better seeded random function
Instead of using
`Math.seedrandom(seed)` which affects the global Math object, use
`var rand = Random(seed)` which returns a unique random object for you
to use. This does not affect the global random method or other instances
of random.
| JavaScript | apache-2.0 | ninjadev/nin,ninjadev/nin,ninjadev/nin | ---
+++
@@ -0,0 +1,13 @@
+function Random(seed){
+ var m_w = seed || 123456791;
+ var m_z = 987654321;
+ var mask = 0xffffffff;
+
+ return function random() {
+ m_z = (36969 * (m_z & 65535) + (m_z >> 16)) & mask;
+ m_w = (18000 * (m_w & 65535) + (m_w >> 16)) & mask;
+ var result = ((m... | |
c223b150921943c2b5ba178863ed7c22a585be91 | migrations/20160324195635_add_ip_for_actions.js | migrations/20160324195635_add_ip_for_actions.js |
exports.up = function(knex, Promise) {
return knex.schema.table('actions', function(table) {
table.string('ip', 15);
});
};
exports.down = function(knex, Promise) {
return knex.schema.table('actions', function(table) {
table.dropColumn('ip');
});
};
| Add ip column for actions table | Add ip column for actions table
| JavaScript | mit | futurice/wappuapp-backend,kaupunki-apina/prahapp-backend,kaupunki-apina/prahapp-backend,futurice/wappuapp-backend | ---
+++
@@ -0,0 +1,13 @@
+
+exports.up = function(knex, Promise) {
+ return knex.schema.table('actions', function(table) {
+ table.string('ip', 15);
+ });
+};
+
+exports.down = function(knex, Promise) {
+ return knex.schema.table('actions', function(table) {
+ table.dropColumn('ip');
+ });
+};
+ | |
cd267b8d836ac79980106bbbe2f9851f45a938fa | hooks/opencps-hook/docroot/META-INF/custom_jsps/html/extensions/hex2base.js | hooks/opencps-hook/docroot/META-INF/custom_jsps/html/extensions/hex2base.js | // FIXME: origin unknown
if (!window.atob) {
var tableStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var table = tableStr.split("");
window.atob = function (base64) {
if (/(=[^=]+|={3,})$/.test(base64)) throw new Error("String contains an invalid character");
base64 = base64.re... | Add lib js for signature | Add lib js for signature | JavaScript | agpl-3.0 | hltn/opencps,VietOpenCPS/opencps,hltn/opencps,VietOpenCPS/opencps,VietOpenCPS/opencps,hltn/opencps | ---
+++
@@ -0,0 +1,45 @@
+// FIXME: origin unknown
+if (!window.atob) {
+ var tableStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ var table = tableStr.split("");
+
+ window.atob = function (base64) {
+ if (/(=[^=]+|={3,})$/.test(base64)) throw new Error("String contains an invalid c... | |
68868f156ce62400c9148c4cdd80dd0f562f6c37 | problem-009/problem-009.0.js | problem-009/problem-009.0.js | /*
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a^2 + b^2 = c^2
For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
*/
var euler9 = function() {
//Euclid's Formula: https://en.wikipedia.... | Add problem 9 solution :tada: | Add problem 9 solution :tada:
| JavaScript | mit | ItsASine/Project-Euler | ---
+++
@@ -0,0 +1,44 @@
+/*
+ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
+
+ a^2 + b^2 = c^2
+ For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.
+
+ There exists exactly one Pythagorean triplet for which a + b + c = 1000.
+ Find the product abc.
+ */
+
+var euler9 = function() {
+ //... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.