commit
stringlengths 40
40
| old_file
stringlengths 4
236
| new_file
stringlengths 4
236
| old_contents
stringlengths 1
3.26k
| new_contents
stringlengths 16
4.43k
| subject
stringlengths 16
624
| message
stringlengths 17
3.29k
| lang
stringclasses 5
values | license
stringclasses 13
values | repos
stringlengths 5
91.5k
|
|---|---|---|---|---|---|---|---|---|---|
ff95f103ac755324d36b4d3a60a61ad8014e9ce9
|
src/web3.js
|
src/web3.js
|
import Web3 from 'web3';
const web3 = new Web3();
export default web3;
export const initWeb3 = (web3) => {
if (window.web3) {
web3.setProvider(window.web3.currentProvider);
} else {
web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/'));
}
window.web3 = web3;
}
|
import Web3 from 'web3';
const web3 = new Web3();
export default web3;
export const initWeb3 = (web3) => {
if (window.web3) {
web3.setProvider(window.web3.currentProvider);
} else {
web3.setProvider(new Web3.providers.HttpProvider('https://mainnet.infura.io/Tl5m5gSA2IY0XJe9BWrS'));
}
window.web3 = web3;
}
|
Add api key... will have to remove eventually
|
Add api key... will have to remove eventually
|
JavaScript
|
mit
|
nanexcool/feeds,nanexcool/feeds
|
d3296125920a838a56c68ca2da1e9f9b4216bc03
|
preTest.js
|
preTest.js
|
//makes the bdd interface available (describe, it before, after, etc
if(Meteor.settings.public.mocha_setup_args) {
mocha.setup(Meteor.settings.public.mocha_setup_args);
} else {
mocha.setup("bdd");
}
|
//makes the bdd interface available (describe, it before, after, etc
if(Meteor.settings && Meteor.settings.public.mocha_setup_args) {
mocha.setup(Meteor.settings.public.mocha_setup_args);
} else {
mocha.setup("bdd");
}
|
Fix for when Mocha.settings are not available
|
Fix for when Mocha.settings are not available
|
JavaScript
|
mit
|
kelbongoo/meteor-mocha-web,abernix/meteor-mocha-web,mad-eye/meteor-mocha-web,mad-eye/meteor-mocha-web,kelbongoo/meteor-mocha-web,abernix/meteor-mocha-web
|
ba64925e6c6b07b42f8a28b9a141e1ada42c3550
|
src/components/MainNav/Breadcrumbs/Breadcrumbs.js
|
src/components/MainNav/Breadcrumbs/Breadcrumbs.js
|
import React from 'react';
import css from './Breadcrumbs.css';
const propTypes = {
links: React.PropTypes.array,
};
function Breadcrumbs(props) {
const links = props.links.map((link, i) => {
const linkElem = <li key={`breadcrumb_${i}`}><a href={link.path}>{link.label}</a></li>;
const dividerElem = <li key={`divider${i}`}>{'>'}</li>;
if (i !== props.links.length - 1) {
return (linkElem + dividerElem);
}
return linkElem;
});
return (
<ul className={css.navBreadcrumbs}>
{links}
</ul>
);
}
Breadcrumbs.propTypes = propTypes;
export default Breadcrumbs;
|
import React from 'react';
import css from './Breadcrumbs.css';
const propTypes = {
links: React.PropTypes.array,
};
function Breadcrumbs(props) {
const links = props.links.map((link, i) => {
// eslint-disable-next-line react/no-array-index-key
const linkElem = <li key={`breadcrumb_${i}`}><a href={link.path}>{link.label}</a></li>;
// eslint-disable-next-line react/no-array-index-key
const dividerElem = <li key={`divider${i}`}>{'>'}</li>;
if (i !== props.links.length - 1) {
return (linkElem + dividerElem);
}
return linkElem;
});
return (
<ul className={css.navBreadcrumbs}>
{links}
</ul>
);
}
Breadcrumbs.propTypes = propTypes;
export default Breadcrumbs;
|
Add eslint-disable-next-line comments to get rid of excessively pedantic react/no-array-index-key errors.
|
Add eslint-disable-next-line comments to get rid of excessively pedantic react/no-array-index-key errors.
|
JavaScript
|
apache-2.0
|
folio-org/stripes-core,folio-org/stripes-core,folio-org/stripes-core
|
470c616cf598fb14842d8326d6fe416952b79d8a
|
test/common.js
|
test/common.js
|
'use strict';
const hookModule = require("../src/");
class TallyHook extends hookModule.Hook {
preProcess(thing) {
thing.preTally = thing.preTally + 1;
return true;
}
postProcess(thing) {
thing.postTally = thing.postTally + 1;
}
}
module.exports = {
TallyHook
};
|
'use strict';
const hookModule = require("../src/");
class TallyHook extends hookModule.Hook {
preProcess(thing) {
thing.preTally = thing.preTally + 1;
return true;
}
postProcess(thing) {
thing.postTally = thing.postTally + 1;
}
}
class DelayableHook extends hookModule.Hook {
constructor(options) {
super(options)
}
preProcess() {
this.delay( this.settings.preprocess || 500, "preProcess");
return true
}
execute() {
this.delay(this.settings.execute || 200, "execute");
}
postProcess() {
this.delay(this.settings.postprocess || 100, "postProcess");
}
delay(ms, str){
var ctr, rej, p = new Promise((resolve, reject) => {
ctr = setTimeout(() => {
console.log( `delayed ${str} by ${ms}ms`)
resolve();
}, ms);
rej = reject;
});
p.cancel = function(){ clearTimeout(ctr); rej(Error("Cancelled"))};
return p;
}
}
module.exports = {
TallyHook,
DelayableHook
};
|
Add a DelayedHook test class.
|
Add a DelayedHook test class.
|
JavaScript
|
mit
|
StevenBlack/hooks-and-anchors
|
e49fd692e1281f91164d216708befd81a1a3c102
|
test/simple.js
|
test/simple.js
|
var test = require("tape")
var crypto = require('crypto')
var cryptoB = require('../')
var assert = require('assert')
function assertSame (fn) {
test(fn.name, function (t) {
fn(crypto, function (err, expected) {
fn(cryptoB, function (err, actual) {
t.equal(actual, expected)
t.end()
})
})
})
}
assertSame(function sha1 (crypto, cb) {
cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex'))
})
assertSame(function md5(crypto, cb) {
cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex'))
})
assert.equal(cryptoB.randomBytes(10).length, 10)
test('randomBytes', function (t) {
cryptoB.randomBytes(10, function(ex, bytes) {
assert.ifError(ex)
bytes.forEach(function(bite) {
assert.equal(typeof bite, 'number')
})
t.end()
})
})
|
var test = require("tape")
var crypto = require('crypto')
var cryptoB = require('../')
function assertSame (fn) {
test(fn.name, function (t) {
t.plan(1)
fn(crypto, function (err, expected) {
fn(cryptoB, function (err, actual) {
t.equal(actual, expected)
t.end()
})
})
})
}
assertSame(function sha1 (crypto, cb) {
cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex'))
})
assertSame(function md5(crypto, cb) {
cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex'))
})
test('randomBytes', function (t) {
t.plan(3 + 10)
t.equal(cryptoB.randomBytes(10).length, 10)
cryptoB.randomBytes(10, function(ex, bytes) {
t.error(ex)
t.equal(bytes.length, 10)
bytes.forEach(function(bite) {
t.equal(typeof bite, 'number')
})
t.end()
})
})
|
Use tape for asserts to better detect callbacks not being fired
|
Use tape for asserts to better detect callbacks not being fired
|
JavaScript
|
mit
|
crypto-browserify/crypto-browserify,crypto-browserify/crypto-browserify
|
4da17d2e30b07b73de2a5d7b548ca8ed4b9bc4f2
|
src/utils/hex-generator.js
|
src/utils/hex-generator.js
|
const hexWidth = 50;
const hexPadding = 2;
export default ({ width, height, columns, rows, renderSector }) => {
const hexWidthUnit = hexWidth / 4;
const hexHeight = (Math.sqrt(3) / 2) * hexWidth;
const hexHeightUnit = hexHeight / 2;
const hexArray = [];
let isWithinHeight = true;
let isWithinWidth = true;
let i = 0;
let j = 0;
while (isWithinHeight) {
const minRowHeight = hexHeightUnit * 2 * i;
while (isWithinWidth) {
const xOffset = j * 3 * hexWidthUnit;
hexArray.push({
key: `${i}-${j}`,
width: hexWidth - hexPadding,
xOffset,
yOffset: j % 2 ? minRowHeight + hexHeightUnit : minRowHeight,
highlighted: renderSector && i < rows && j < columns,
});
j += 1;
isWithinWidth = xOffset + (2 * hexWidthUnit) < width;
}
j = 0;
i += 1;
isWithinWidth = true;
isWithinHeight = minRowHeight - hexHeightUnit < height;
}
return hexArray;
};
|
const defaultHexWidth = 50;
const hexPadding = 2;
export default ({ width, height, columns, rows, renderSector }) => {
const scaledWidth = Math.min(height / (rows + 4), width / (columns + 4));
const horizHexOffset = Math.ceil((((width / scaledWidth) / (Math.sqrt(3) / 2)) - columns) / 2);
const vertHexOffset = Math.ceil(((height / scaledWidth) - rows) / 2);
const hexWidth = renderSector ? scaledWidth / (Math.sqrt(3) / 2) : defaultHexWidth;
const hexWidthUnit = hexWidth / 4;
const hexHeight = (Math.sqrt(3) / 2) * hexWidth;
const hexHeightUnit = hexHeight / 2;
const hexArray = [];
let isWithinHeight = true;
let isWithinWidth = true;
let i = 0;
let j = 0;
while (isWithinHeight) {
const minRowHeight = hexHeightUnit * 2 * i;
while (isWithinWidth) {
const xOffset = j * 3 * hexWidthUnit;
hexArray.push({
key: `${i}-${j}`,
width: hexWidth - hexPadding,
xOffset,
yOffset: j % 2 ? minRowHeight + hexHeightUnit : minRowHeight,
highlighted: renderSector
&& i > vertHexOffset && i < rows + vertHexOffset
&& j > horizHexOffset && j < columns + horizHexOffset,
});
j += 1;
isWithinWidth = xOffset + (2 * hexWidthUnit) < width;
}
j = 0;
i += 1;
isWithinWidth = true;
isWithinHeight = minRowHeight - hexHeightUnit < height;
}
return hexArray;
};
|
Put the sector in the middle of the hex grid (very crude)
|
Put the sector in the middle of the hex grid (very crude)
|
JavaScript
|
mit
|
mpigsley/sectors-without-number,mpigsley/sectors-without-number
|
31663486624635748d6f2202504b0a187a102fcd
|
RcmBrightCoveLib/public/keep-aspect-ratio.js
|
RcmBrightCoveLib/public/keep-aspect-ratio.js
|
/**
* This script keeps the height set on elements with regard to their
* width for a given aspect ratio. Great for "display:block" elements
*
* Example usage:
*
* <div data-keep-aspect-ratio="16:9">
*
* Author: Rod McNew
* License: BSD
*/
new function () {
var setHeights = function () {
$.each($('[data-keep-aspect-ratio]'), function () {
var ele = $(this);
var ratioParts = ele.attr('data-keep-aspect-ratio').split(':');
var ratioWidth = ratioParts[0];
var ratioHeight = ratioParts[1];
var width = ele.width();
var newHeight = width * ratioHeight / ratioWidth;
ele.css('height', newHeight);
})
};
//Run onReady
$(setHeights);
//Run when window is resized
$(window).resize(setHeights);
//Run when target elements are resized without a window resize
$('body').delegate('[data-keep-aspect-ratio]', 'resize', setHeights);
};
|
/**
* This script keeps the height set on elements with regard to their
* width for a given aspect ratio. Great for "display:block" elements
*
* Example usage:
*
* <div data-keep-aspect-ratio="16:9">
*
* Author: Rod McNew
* License: BSD
*/
new function () {
var setHeights = function () {
$.each($('[data-keep-aspect-ratio]'), function () {
var ele = $(this);
var ratioParts = ele.attr('data-keep-aspect-ratio').split(':');
var ratioWidth = ratioParts[0];
var ratioHeight = ratioParts[1];
var width = ele.width();
var newHeight = width * ratioHeight / ratioWidth;
ele.css('height', newHeight);
})
};
//Run onReady
$(setHeights);
//Run when window is resized
$(window).resize(setHeights);
//Run when target elements are resized without a window resize
$('body').on('resize', '[data-keep-aspect-ratio]', setHeights);
$('body').on('orientationchange', '[data-keep-aspect-ratio]', setHeights);
};
|
Fix for brightcove player when orintation is changed
|
Fix for brightcove player when orintation is changed
|
JavaScript
|
bsd-3-clause
|
jerv13/RcmPlugins,jerv13/RcmPlugins,bjanish/RcmPlugins,jerv13/RcmPlugins,innaDa/RcmPlugins,innaDa/RcmPlugins,innaDa/RcmPlugins,bjanish/RcmPlugins,bjanish/RcmPlugins
|
c57a584a3bc781db629ae15dd2912f62992f98f3
|
Resources/private/js/sylius-auto-complete.js
|
Resources/private/js/sylius-auto-complete.js
|
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
(function ( $ ) {
'use strict';
$.fn.extend({
autoComplete: function () {
var element = $(this);
var criteriaType = $(this).data('criteria-type');
var criteriaName = $(this).data('criteria-name');
element.dropdown({
delay: {
search: 250
},
apiSettings: {
dataType: 'JSON',
cache: false,
data: {
criteria: {}
},
beforeSend: function(settings) {
settings.data.criteria[criteriaName] = {type: criteriaType, value: ''};
settings.data.criteria[criteriaName].value = settings.urlData.query;
return settings;
},
onResponse: function (response) {
var choiceName = element.data('choice-name');
var choiceValue = element.data('choice-value');
var myResults = [];
$.each(response._embedded.items, function (index, item) {
myResults.push({
name: item[choiceName],
value: item[choiceValue]
});
});
return {
success: true,
results: myResults
};
}
}
});
}
});
})( jQuery );
|
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
(function ( $ ) {
'use strict';
$.fn.extend({
autoComplete: function () {
var element = $(this);
var criteriaType = $(this).data('criteria-type');
var criteriaName = $(this).data('criteria-name');
element.dropdown({
delay: {
search: 250
},
forceSelection: false,
apiSettings: {
dataType: 'JSON',
cache: false,
data: {
criteria: {}
},
beforeSend: function(settings) {
settings.data.criteria[criteriaName] = {type: criteriaType, value: ''};
settings.data.criteria[criteriaName].value = settings.urlData.query;
return settings;
},
onResponse: function (response) {
var choiceName = element.data('choice-name');
var choiceValue = element.data('choice-value');
var myResults = [];
$.each(response._embedded.items, function (index, item) {
myResults.push({
name: item[choiceName],
value: item[choiceValue]
});
});
return {
success: true,
results: myResults
};
}
}
});
}
});
})( jQuery );
|
Use collection instead of array in all transformers, also use map method
|
[Resource][Core] Use collection instead of array in all transformers, also use map method
|
JavaScript
|
mit
|
Sylius/SyliusUiBundle,Sylius/SyliusUiBundle
|
62b292ddf6a6fb71097c5cfa527b625366c46a3f
|
src/components/slide/index.js
|
src/components/slide/index.js
|
import React, { Component, PropTypes } from 'react';
require('./slide.scss');
class Slide extends Component {
render() {
return (
<div className="slide">
<header className="slide__header">
<h1 className="slide__title">{this.props.title}</h1>
</header>
<ul>
{this.props.children}
</ul>
<footer className="slide__footer">
{this.props.order} / {this.props.total}
</footer>
</div>
);
}
}
export default Slide;
|
import React, { Component, PropTypes } from 'react';
require('./slide.scss');
class Slide extends Component {
constructor(props) {
super(props);
this.isViewable = this.isViewable.bind(this);
}
isViewable() {
return this.props.current === +this.props.order;
}
render() {
return (
this.isViewable() &&
<div className="slide">
<header className="slide__header">
<h1 className="slide__title">{this.props.title}</h1>
</header>
<ul>
{this.props.children}
</ul>
<footer className="slide__footer">
{this.props.order} / {this.props.total}
</footer>
</div>
);
}
}
export default Slide;
|
Make slide viewable based on current and order
|
feature: Make slide viewable based on current and order
A slide will be viewable only if the current property matches
the order property.
|
JavaScript
|
mit
|
leadiv/react-slides,leadiv/react-slides
|
daed42ff845baa2abf1e0fd180d7fb0eb2a13b3d
|
lib/cli/file-set-pipeline/log.js
|
lib/cli/file-set-pipeline/log.js
|
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module mdast:cli:log
* @fileoverview Log a file context on successful completion.
*/
'use strict';
/*
* Dependencies.
*/
var report = require('vfile-reporter');
/**
* Output diagnostics to stdout(4) or stderr(4).
*
* @param {CLI} context - CLI engine.
*/
function log(context) {
var files = context.files;
var frail = context.frail;
var applicables = files.filter(function (file) {
return file.namespace('mdast:cli').providedByUser;
});
var hasFailed = files.some(function (file) {
return file.hasFailed() || (frail && file.messages.length);
});
var diagnostics = report(applicables, {
'quiet': context.quiet,
'silent': context.silent
});
if (diagnostics) {
context[hasFailed ? 'stderr' : 'stdout'](diagnostics);
}
}
/*
* Expose.
*/
module.exports = log;
|
/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module mdast:cli:log
* @fileoverview Log a file context on successful completion.
*/
'use strict';
/*
* Dependencies.
*/
var report = require('vfile-reporter');
/**
* Output diagnostics to stdout(4) or stderr(4).
*
* @param {CLI} context - CLI engine.
*/
function log(context) {
var files = context.files;
var applicables = files.filter(function (file) {
return file.namespace('mdast:cli').providedByUser;
});
var diagnostics = report(applicables, {
'quiet': context.quiet,
'silent': context.silent
});
if (diagnostics) {
context.stderr(diagnostics);
}
}
/*
* Expose.
*/
module.exports = log;
|
Move all info output of mdast(1) to stderr(4)
|
Move all info output of mdast(1) to stderr(4)
This changes moves all reporting output, even when not including
failure messages, from stout(4) to stderr(4).
Thus, when piping only stdout(4) from mdast(1) into a file, only
the markdown is written.
Closes GH-47.
|
JavaScript
|
mit
|
ulrikaugustsson/mdast,eush77/remark,chcokr/mdast,ulrikaugustsson/mdast,yukkurisinai/mdast,tanzania82/remarks,yukkurisinai/mdast,wooorm/remark,chcokr/mdast,eush77/remark
|
38c8a46baee9cd61571cf26ba9c3942a98f3ce92
|
src/js/stores/ArrangeStore.js
|
src/js/stores/ArrangeStore.js
|
import { action, computed } from 'mobx'
import { moveTabs, tabComparator } from '../libs'
export default class ArrangeStore {
constructor (store) {
this.store = store
}
@computed
get urlTabMap () {
return this.store.windowStore.tabs.reduce((acc, tab) => {
const { url } = tab
acc[url] = acc[url] || []
acc[url].push(tab)
return acc
}, {})
}
@computed
get duplicatedTabs () {
return Object.values(this.urlTabMap).filter(x => x.length > 1)
}
@action
sortTabs = () => {
this.store.windowStore.windows.map((win) => {
const tabs = win.tabs.sort(tabComparator)
moveTabs(tabs, win.id, 0)
})
this.groupDuplicateTabs()
}
groupDuplicateTabs = () => {
this.duplicatedTabs.map((tabs) => {
moveTabs(tabs, tabs[0].windowId, -1)
})
}
}
|
import { action, computed } from 'mobx'
import { moveTabs, tabComparator } from '../libs'
const urlPattern = /.*:\/\/[^/]*/
const getDomain = (url) => {
const matches = url.match(urlPattern)
if (matches) {
return matches[0]
}
return url
}
export default class ArrangeStore {
constructor (store) {
this.store = store
}
@computed
get domainTabsMap () {
return this.store.windowStore.tabs.reduce((acc, tab) => {
const domain = getDomain(tab.url)
acc[domain] = acc[domain] || []
acc[domain].push(tab)
return acc
}, {})
}
@action
sortTabs = async () => {
await this.groupTabs()
await this.sortInWindow()
}
groupTabs = async () => {
await Promise.all(
Object.entries(this.domainTabsMap).map(
async ([ domain, tabs ]) => {
if (tabs.length > 1) {
const sortedTabs = tabs.sort(tabComparator)
const { windowId, pinned } = sortedTabs[0]
await moveTabs(
sortedTabs.map(x => ({ ...x, pinned })),
windowId
)
}
}
)
)
}
sortInWindow = async () => {
const windows = await chrome.windows.getAll({ populate: true })
windows.map((win) => {
const tabs = win.tabs.sort(tabComparator)
moveTabs(tabs, win.id)
})
}
}
|
Update sortTabs to group tabs by domain then sort in window
|
Update sortTabs to group tabs by domain then sort in window
|
JavaScript
|
mit
|
xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2,xcv58/Tab-Manager-v2
|
bdca4d4b6b04ad011a25fd913ec4c7ed2ed04b1d
|
react/components/Onboarding/components/UI/CTAButton/index.js
|
react/components/Onboarding/components/UI/CTAButton/index.js
|
import theme from 'react/styles/theme';
import GenericButton from 'react/components/UI/GenericButton';
import styled from 'styled-components';
const CTAButton = styled(GenericButton).attrs({
f: 6,
})`
margin-top: ${theme.space[6]}
`;
export default CTAButton;
|
import GenericButton from 'react/components/UI/GenericButton';
import styled from 'styled-components';
const CTAButton = styled(GenericButton).attrs({
f: 6
})`
margin-top: ${x => x.theme.space[6]}
`;
export default CTAButton;
|
Use theme propeties in CTAButton styled component
|
Use theme propeties in CTAButton styled component
|
JavaScript
|
mit
|
aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell
|
06b9ff1d0759d289ae70fbd9717cf8129e3485bc
|
pages/home/index.js
|
pages/home/index.js
|
/**
* React Static Boilerplate
* https://github.com/kriasoft/react-static-boilerplate
*
* Copyright © 2015-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React, { PropTypes } from 'react';
import Layout from '../../components/Layout';
import { title, html } from './index.md';
class HomePage extends React.Component {
static propTypes = {
articles: PropTypes.array.isRequired,
};
componentDidMount() {
document.title = title;
}
render() {
return (
<Layout>
<div dangerouslySetInnerHTML={{ __html: html }} />
<h4>Articles</h4>
<ul>
{this.props.articles.map(article =>
<li><a href={article.url}>{article.title}</a> by {article.author}</li>
)}
</ul>
<p>
<br /><br />
</p>
</Layout>
);
}
}
export default HomePage;
|
/**
* React Static Boilerplate
* https://github.com/kriasoft/react-static-boilerplate
*
* Copyright © 2015-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React, { PropTypes } from 'react';
import Layout from '../../components/Layout';
import { title, html } from './index.md';
class HomePage extends React.Component {
static propTypes = {
articles: PropTypes.array.isRequired,
};
componentDidMount() {
document.title = title;
}
render() {
return (
<Layout>
<div dangerouslySetInnerHTML={{ __html: html }} />
<h4>Articles</h4>
<ul>
{this.props.articles.map((article, i) =>
<li key={i}><a href={article.url}>{article.title}</a> by {article.author}</li>
)}
</ul>
<p>
<br /><br />
</p>
</Layout>
);
}
}
export default HomePage;
|
Fix React warning on the home page (add key attribute to list items)
|
Fix React warning on the home page (add key attribute to list items)
|
JavaScript
|
mit
|
raffidil/garnanain,koistya/react-static-boilerplate,jamesrf/weddingwebsite,kyoyadmoon/fuzzy-hw1,gadflying/profileSite,RyanGosden/react-poll,srossross-tableau/hackathon,kyoyadmoon/fuzzy-hw1,leo60228/HouseRuler,jamesrf/weddingwebsite,gadflying/profileSite,leo60228/HouseRuler,RyanGosden/react-poll,kriasoft/react-static-boilerplate,koistya/react-static-boilerplate,lifeiscontent/OpenPoGoUI,willchertoff/planner,kriasoft/react-static-boilerplate,gmorel/me,zedd45/react-static-todos,raffidil/garnanain,zedd45/react-static-todos,gmorel/me,willchertoff/planner,lifeiscontent/OpenPoGoUI,srossross-tableau/hackathon
|
5afa1a697da48fb473d0e19fe6e5dbfc6913ca75
|
src/common/analytics/index.js
|
src/common/analytics/index.js
|
/**
* Dependencies.
*/
let NullAnalytics = require('./NullAnalytics');
let Tracker = require('./Tracker');
/**
* Constants.
*/
const ANALYTICS_KEY = process.env.ANALYTICS_KEY;
/**
* Locals.
*/
let enableAnalytics = window.ProductHuntAnalytics && ANALYTICS_KEY;
let ProductHuntAnalytics = enableAnalytics ? window.ProductHuntAnalytics : NullAnalytics;
let analytics = new ProductHuntAnalytics(process.env.ANALYTICS_KEY);
/**
* Export a new `Tracker`.
*/
module.exports = new Tracker(analytics);
|
/**
* Dependencies.
*/
let NullAnalytics = require('./NullAnalytics');
let Tracker = require('./Tracker');
/**
* Constants.
*/
const ANALYTICS_KEY = process.env.ANALYTICS_KEY;
/**
* Locals.
*
* Note(andreasklinger): window.ProductHuntAnalytics gets set by a custom built of the analytics.js
* To recreate this use their make script - it offers a options to set the variable name.
*/
let enableAnalytics = window.ProductHuntAnalytics && ANALYTICS_KEY;
let ProductHuntAnalytics = enableAnalytics ? window.ProductHuntAnalytics : NullAnalytics;
let analytics = new ProductHuntAnalytics(process.env.ANALYTICS_KEY);
/**
* Export a new `Tracker`.
*/
module.exports = new Tracker(analytics);
|
Add note to explain where the custom name comes from
|
Add note to explain where the custom name comes from
|
JavaScript
|
isc
|
producthunt/producthunt-chrome-extension,producthunt/producthunt-chrome-extension
|
998601c34ba9537fa6230232379c1efad84e17bb
|
routes/new.js
|
routes/new.js
|
// This route will save the given url into the database
// returning its "shorter" version
var router = require('express').Router();
var isValid = require('valid-url').isWebUri;
router.get('/http://:url', function(req, res) {
var json = {};
json.original = 'http://' + req.params.url;
json.shorter = getShortUrl(req, random()); + req.originalUrl
res.send(json);
});
router.get('/https://:url', function(req, res) {
var json = {};
json.original = 'https://' + req.params.url;
json.shorter = getShortUrl(req, random()); + req.originalUrl
res.send(json);
});
var getShortUrl = function (req, id) {
var baseUrl = req.protocol + '://' + req.get('host') + '/';
return baseUrl + id;
}
var random = function() {
// Let the IDs be numbers with up to 5 digits
return Math.ceil(Math.random() * 100000);
}
module.exports = router;
|
// This route will save the given url into the database
// returning its "shorter" version
var router = require('express').Router();
var isValid = require('valid-url').isWebUri;
// Using GET parameters in place of something like "/:url", because
// with this last solution the server is fooled by the "http" in the
// middle of the whole url.
router.get('/', function(req, res) {
var json = {};
json.original = req.param('url');
if (!isValid(json.original)) {
json.err = 'invalid url';
} else {
json.shorter = getShortUrl(req, random()); + req.originalUrl
}
res.send(json);
});
var random = function() {
// Let the IDs be numbers with up to 5 digits
return Math.ceil(Math.random() * 100000);
}
module.exports = router;
|
Reduce code duplication using GET params
|
Reduce code duplication using GET params
Replaced the two routes, one for http and another one for https, using
GET parameter ?url=
|
JavaScript
|
mit
|
clobrano/fcc-url-shortener-microservice,clobrano/fcc-url-shortener-microservice
|
ede5962c9926c8a852ccbc307e3a970ede4d6954
|
build/server.js
|
build/server.js
|
console.time('Starting server');
require('promise-helpers');
var fs = require('fs');
var path = require('path');
var express = require('express');
var app = express();
/**
* Serve static files such as css, js, images
*/
app.use('/images', express.static('dist/assets/images'));
app.use('/javascripts', express.static('dist/assets/javascripts'));
app.use('/css', express.static('dist/assets/css'));
// Individual routes pulled from the routes directory
fs.readdir(path.join(__dirname, '/routes'), function(err, files) {
if(err) {
require('trace');
require('clarify');
console.trace(err);
}
files.forEach(function(file) {
require(path.join(__dirname, '/routes/') + file)(app);
});
});
// Go go go
app.listen(process.env.PORT || 3000);
console.log('listening on localhost:' + (process.env.npm_config_port || 3000));
// Export our server for testing purposes
module.exports = app;
console.timeEnd('Starting server');
|
console.time('Starting server');
require('promise-helpers');
var fs = require('fs');
var path = require('path');
var express = require('express');
var app = express();
/**
* Serve static files such as css, js, images
*/
app.use('/images', express.static('dist/assets/images'));
app.use('/javascripts', express.static('dist/assets/javascripts'));
app.use('/stylesheets', express.static('dist/assets/stylesheets'));
// Individual routes pulled from the routes directory
fs.readdir(path.join(__dirname, '/routes'), function(err, files) {
if(err) {
require('trace');
require('clarify');
console.trace(err);
}
files.forEach(function(file) {
require(path.join(__dirname, '/routes/') + file)(app);
});
});
// Go go go
app.listen(process.env.PORT || 3000);
console.log('listening on localhost:' + (process.env.npm_config_port || 3000));
// Export our server for testing purposes
module.exports = app;
console.timeEnd('Starting server');
|
Fix broken path to css caused by previous commit
|
Fix broken path to css caused by previous commit
|
JavaScript
|
mit
|
LandRegistry/land-registry-elements,LandRegistry/land-registry-elements,LandRegistry/land-registry-elements,LandRegistry/land-registry-elements,LandRegistry/land-registry-elements
|
8712432a2c9d555ecdbae0b9c549f6554dd9be6d
|
assets/materialize/js/init.js
|
assets/materialize/js/init.js
|
(function($){
$(function(){
$('.button-collapse').sideNav();
}); // end of document ready
})(jQuery); // end of jQuery name space
// Keep one tab expanded while editing profile
$('li div.collapsible-header').on('click',function(e){
if($(this).parents('li').hasClass('active')){
e.stopPropagation();
}
});
// Expand "Home" upon loading Edit page
$("document").ready(function() {
setTimeout(function() {
$("ul li:first-child div").trigger('click');
},10);
});
$('#last_name').on('blur',function(e) {
if( document.getElementById('username').value==''
&& document.getElementById('first_name').value!=''
&& document.getElementById('last_name').value!='')
{
// combine firstname and lastname to create username
var username = document.getElementById('first_name').value.substr(0,490)
+ document.getElementById('last_name').value.substr(0,49);
username = username.replace(/\s+/g, '');
username = username.replace(/\'+/g, '');
username = username.replace(/-+/g, '');
username = username.toLowerCase();
document.getElementById('username').value = username;
// username label should translate up
var label = $('label[for="username"]');
label['addClass']('active');
// username underline should turn green
document.getElementById('username').className = "validate valid";
}
});
|
(function($){
$(function(){
$('.button-collapse').sideNav();
}); // end of document ready
})(jQuery); // end of jQuery name space
// Keep one tab expanded while editing profile
/*$('li div.collapsible-header').on('click',function(e){
if($(this).parents('li').hasClass('active')){
e.stopPropagation();
}
});*/
// Expand "Home" upon loading Edit page
$("document").ready(function() {
setTimeout(function() {
$("ul li:first-child div").trigger('click');
},10);
});
// Sign-up form: Auto generate username based on first name and llast name inputs
$('#last_name').on('blur',function(e) {
if( document.getElementById('username').value==''
&& document.getElementById('first_name').value!=''
&& document.getElementById('last_name').value!='')
{
// combine firstname and lastname to create username
var username = document.getElementById('first_name').value.substr(0,490)
+ document.getElementById('last_name').value.substr(0,49);
username = username.replace(/\s+/g, '');
username = username.replace(/\'+/g, '');
username = username.replace(/-+/g, '');
username = username.toLowerCase();
document.getElementById('username').value = username;
// username label should translate up
var label = $('label[for="username"]');
label['addClass']('active');
// username underline should turn green
document.getElementById('username').className = "validate valid";
}
});
|
Allow collapse all accordion tabs in profileeditor
|
Allow collapse all accordion tabs in profileeditor
|
JavaScript
|
mit
|
VoodooWorks/profile-cms,VoodooWorks/profile-cms,VoodooWorks/profile-cms
|
4e7eaa000c897c36ed6cdbea6e5e53d49b2b2a76
|
src/components/pages/PatientsSummary/header/PTCustomCheckbox.js
|
src/components/pages/PatientsSummary/header/PTCustomCheckbox.js
|
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Col } from 'react-bootstrap';
const PTCustomCheckbox = ({ title, name, isChecked, disabled = false, onChange }) => {
const toggleCheckbox = () => !disabled && onChange(name);
return <Col xs={6} sm={4}>
<div className="wrap-fcustominp">
<div className={classNames('fcustominp-state', { disabled })} onClick={toggleCheckbox} >
<div className="fcustominp">
<input type="checkbox" name={name} checked={isChecked} onChange={toggleCheckbox} />
<label htmlFor="patients-table-info-name" />
</div>
<label htmlFor={name} className="fcustominp-label">{title}</label>
</div>
</div>
</Col>
}
PTCustomCheckbox.propTypes = {
title: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
isChecked: PropTypes.bool.isRequired,
onChange: PropTypes.func,
disabled: PropTypes.bool,
};
export default PTCustomCheckbox
|
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Col } from 'react-bootstrap';
const PTCustomCheckbox = ({ title, name, isChecked, disabled = false, onChange }) => {
const toggleCheckbox = () => !disabled && onChange(name);
return <Col xs={6} sm={4}>
<div className="wrap-fcustominp">
<div className={classNames('fcustominp-state', { disabled })} onClick={toggleCheckbox} >
<div className="fcustominp">
<input type="checkbox" id={`dashboard-${name}`} name={`dashboard-${name}`} checked={isChecked} onChange={toggleCheckbox} />
<label htmlFor={`dashboard-${name}`} />
</div>
<label htmlFor={`dashboard-${name}`} className="fcustominp-label">{title}</label>
</div>
</div>
</Col>
}
PTCustomCheckbox.propTypes = {
title: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
isChecked: PropTypes.bool.isRequired,
onChange: PropTypes.func,
disabled: PropTypes.bool,
};
export default PTCustomCheckbox
|
Fix checkboxes for Patient Summary.
|
Fix checkboxes for Patient Summary.
|
JavaScript
|
apache-2.0
|
PulseTile/PulseTile-React,PulseTile/PulseTile-React,PulseTile/PulseTile-React
|
f0e7098f88d7ceeae02ba60bb484f4cfa266bce7
|
src/plugins.js
|
src/plugins.js
|
/* @flow */
export const inMemory = (data : Object, transition : Function) => {
let rootState = data;
const read = () => rootState;
const write = (fn : Function) => {
const oldState = read();
const newState = fn(oldState);
transition(oldState, newState);
rootState = newState;
return read();
};
return { read, write };
};
export const webStorage = (
{ type, key } : Object,
data : Object,
transition : Function
) => {
const store = window[`${type}Storage`];
const read = () => JSON.parse(store.getItem(key));
const write = (fn : Function) => {
const oldState = read();
const newState = fn(oldState);
transition(oldState, newState);
store.setItem(key, JSON.stringify(newState));
return read();
};
return { read, write };
};
|
/* @flow */
export const inMemory = (initial : Object, transition : Function) => {
let rootState = initial;
const read = () => rootState;
const write = (fn : Function) => {
const oldState = read();
const newState = fn(oldState);
transition(oldState, newState);
rootState = newState;
return read();
};
return { read, write };
};
export const webStorage = (
{ type, key } : Object,
initial : Object,
transition : Function
) => {
const store = window[`${type}Storage`];
const read = () => JSON.parse(store.getItem(key));
const write = (fn : Function) => {
const oldState = read();
const newState = fn(oldState);
transition(oldState, newState);
store.setItem(key, JSON.stringify(newState));
return read();
};
return { read, write };
};
|
Rename data prop to initial
|
Rename data prop to initial
|
JavaScript
|
mit
|
jameshopkins/atom-store,jameshopkins/atom-store
|
6505b754bc31ce4062d1a4c2eecc172636dbba64
|
src/components/Node.js
|
src/components/Node.js
|
import React, { PropTypes } from 'react';
import { StyleSheet, css } from 'aphrodite';
const styles = StyleSheet.create({
node: {
cursor: 'move',
},
});
const renderState = (state, index) => (
<text key={state} x="5" y={37 + (18 * index)}>
<tspan>{state}</tspan>
<tspan x="155" textAnchor="end">99.9</tspan>
</text>
);
const Node = props => (
<g
className={css(styles.node)}
onMouseDown={props.onMouseDown}
transform={`translate(${props.x} ${props.y})`}
>
<rect
height={20 + (20 * props.states.length)}
width="160"
fill="#ff8"
stroke="#333"
ref={props.rectRef}
/>
<text x="5" y="15">{props.id}</text>
<path d="M0,20 h160" stroke="#333" />
{props.states.map(renderState)}
</g>
);
Node.propTypes = {
id: PropTypes.string.isRequired,
states: PropTypes.arrayOf(PropTypes.string).isRequired,
rectRef: PropTypes.func,
onMouseDown: PropTypes.func,
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
};
export default Node;
|
import React, { PropTypes } from 'react';
import { StyleSheet, css } from 'aphrodite';
const styles = StyleSheet.create({
node: {
cursor: 'move',
userSelect: 'none',
},
});
const renderState = (state, index) => (
<text key={state} x="5" y={37 + (18 * index)}>
<tspan>{state}</tspan>
<tspan x="155" textAnchor="end">99.9</tspan>
</text>
);
const Node = props => (
<g
className={css(styles.node)}
onMouseDown={props.onMouseDown}
transform={`translate(${props.x} ${props.y})`}
>
<rect
height={20 + (20 * props.states.length)}
width="160"
fill="#ff8"
stroke="#333"
ref={props.rectRef}
/>
<text x="5" y="15">{props.id}</text>
<path d="M0,20 h160" stroke="#333" />
{props.states.map(renderState)}
</g>
);
Node.propTypes = {
id: PropTypes.string.isRequired,
states: PropTypes.arrayOf(PropTypes.string).isRequired,
rectRef: PropTypes.func,
onMouseDown: PropTypes.func,
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
};
export default Node;
|
Fix selecting node text when moving
|
Fix selecting node text when moving
|
JavaScript
|
mit
|
fhelwanger/bayesjs-editor,fhelwanger/bayesjs-editor
|
bbf64c4d45fc83b5143951f79f2a9c25d757cd65
|
addon/components/outside-click/component.js
|
addon/components/outside-click/component.js
|
import Ember from 'ember'
import layout from './template'
import PropTypeMixin, { PropTypes } from 'ember-prop-types'
const { K } = Ember
export default Ember.Component.extend(PropTypeMixin, {
layout,
propTypes: {
onOutsideClick: PropTypes.func
},
getDefaultProps() {
return { onOutsideClick: K }
},
init() {
this._super(...arguments)
this.handleDown = this.handleDown.bind(this)
this.handleUp = this.handleUp.bind(this)
},
didInsertElement() {
this._super(...arguments)
document.addEventListener('mousedown', this.handleDown, true)
document.addEventListener('mouseup', this.handleUp, true)
},
willDestroyElement() {
this._super(...arguments)
document.removeEventListener('mousedown', this.handleDown, true)
document.removeEventListener('mouseup', this.handleUp, true)
},
isOutside: false,
handleDown(e) {
if (this.isDestroyed || this.isDestroying) {
return;
}
const el = this.$()[0];
if (!el.contains(e.target)) this.set('isOutside', true)
},
handleUp(e) {
if (this.isDestroyed || this.isDestroying) {
return;
}
if (this.get('isOutside')) this.get('onOutsideClick')(e)
this.set('isOutside', false)
}
})
|
import Ember from 'ember'
import layout from './template'
import PropTypeMixin, { PropTypes } from 'ember-prop-types'
const { K } = Ember
export default Ember.Component.extend(PropTypeMixin, {
layout,
propTypes: {
onOutsideClick: PropTypes.func
},
getDefaultProps() {
return { onOutsideClick: K }
},
init() {
this._super(...arguments)
this.handleDown = this.handleDown.bind(this)
this.handleUp = this.handleUp.bind(this)
},
didInsertElement() {
this._super(...arguments)
document.addEventListener('mousedown', this.handleDown, true)
document.addEventListener('mouseup', this.handleUp, true)
},
willDestroyElement() {
this._super(...arguments)
document.removeEventListener('mousedown', this.handleDown, true)
document.removeEventListener('mouseup', this.handleUp, true)
},
isOutside: false,
handleDown(e) {
const el = this.$()[0];
if (this.isDestroyed || this.isDestroying) return;
if (!el.contains(e.target)) this.set('isOutside', true)
},
handleUp(e) {
if (this.get('isOutside')) this.get('onOutsideClick')(e)
if (this.isDestroyed || this.isDestroying) return;
this.set('isOutside', false)
}
})
|
Move destroy checks just before set
|
Move destroy checks just before set
|
JavaScript
|
mit
|
nucleartide/ember-outside-click,nucleartide/ember-outside-click
|
ec5e284f43cd890a2d24f775f77f0fc5f3810dfc
|
src/App.js
|
src/App.js
|
import React from 'react';
import './App.css';
import logo from './logo.png';
export default function App() {
return (
<div>
<h1>
Welcome to
<img src={logo} className="App--logo" alt="React logo" />
React
</h1>
<p>
To get started, edit <code>src/App.js</code> and
save the file to update.
</p>
</div>
);
}
|
import React from 'react';
import './App.css';
import logo from './logo.png';
export default function App() {
return (
<div>
<h1>
Welcome to <img src={logo} className="App--logo" alt="logo" /> React
</h1>
<p>
To get started, edit <code>src/App.js</code> and save to reload.
</p>
</div>
);
}
|
Make it fit in one line
|
Make it fit in one line
|
JavaScript
|
bsd-3-clause
|
emvu/create-react-app,HelpfulHuman/helpful-react-scripts,Timer/create-react-app,christiantinauer/create-react-app,yosharepoint/react-scripts-ts-sp,powerreviews/create-react-app,CodingZeal/create-react-app,lolaent/create-react-app,xiaohu-developer/create-react-app,HelpfulHuman/helpful-react-scripts,andyeskridge/create-react-app,Clearcover/web-build,mikechau/create-react-app,brysgo/create-react-app,TondaHack/create-react-app,timlogemann/create-react-app,timlogemann/create-react-app,andyhite/create-react-app,peopleticker/create-react-app,ConnectedHomes/create-react-web-app,jdcrensh/create-react-app,scyankai/create-react-app,matart15/create-react-app,jayphelps/create-react-app,accurat/accurapp,andyhite/create-react-app,cr101/create-react-app,in2core/create-react-app,matart15/create-react-app,DivineGod/create-react-app,mangomint/create-react-app,Psychwire/create-react-app,kst404/e8e-react-scripts,Bogala/create-react-app-awesome-ts,reedsa/create-react-app,dsopel94/create-react-app,andrewmaudsley/create-react-app,lopezator/create-react-app,liamhu/create-react-app,stockspiking/create-react-app,prometheusresearch/create-react-app,Bogala/create-react-app-awesome-ts,ro-savage/create-react-app,xiaohu-developer/create-react-app,Sonu-sj/cardMatcher,ontruck/create-react-app,maletor/create-react-app,igetgames/spectacle-create-react-app,paweljedrzejczyk/create-react-app,digitalorigin/create-react-app,pdillon/create-react-app,g3r4n/create-esri-react-app,gutenye/create-react-app,Clearcover/web-build,Bogala/create-react-app-awesome-ts,andyhite/create-react-app,0xaio/create-react-app,vgmr/create-ts-app,johnslay/create-react-app,iamdoron/create-react-app,appier/create-react-app,gutenye/create-react-app,lolaent/create-react-app,pdillon/create-react-app,amido/create-react-app,johnslay/create-react-app,digitalorigin/create-react-app,tharakawj/create-react-app,svrcekmichal/react-scripts,powerreviews/create-react-app,andyeskridge/create-react-app,ontruck/create-react-app,romaindso/create-react-app,Exocortex/create-react-app,g3r4n/create-esri-react-app,ro-savage/create-react-app,sigmacomputing/create-react-app,Place1/create-react-app-typescript,pdillon/create-react-app,facebookincubator/create-react-app,iamdoron/create-react-app,HelpfulHuman/helpful-react-scripts,devex-web-frontend/create-react-app-dx,lolaent/create-react-app,Sonu-sj/cardMatcher,RobzDoom/frame_trap,infernojs/create-inferno-app,magic-FE/create-magic-component,romaindso/create-react-app,svrcekmichal/react-scripts,facebookincubator/create-react-app,Exocortex/create-react-app,infernojs/create-inferno-app,scyankai/create-react-app,liamhu/create-react-app,accurat/accurapp,maletor/create-react-app,dpoineau/create-react-app,viankakrisna/create-react-app,ConnectedHomes/create-react-web-app,1Body/prayer-app,viankakrisna/create-react-app,dpoineau/create-react-app,prometheusresearch/create-react-app,paweljedrzejczyk/create-react-app,Bogala/create-react-app-awesome-ts,IamJoseph/create-react-app,TryKickoff/create-kickoff-app,lopezator/create-react-app,gutenye/create-react-app,Psychwire/create-react-app,picter/create-react-app,tharakawj/create-react-app,CodingZeal/create-react-app,magic-FE/create-magic-component,igetgames/spectacle-create-react-app,in2core/create-react-app,accurat/accurapp,kst404/e8e-react-scripts,viankakrisna/create-react-app,bttf/create-react-app,tharakawj/create-react-app,RobzDoom/frame_trap,g3r4n/create-esri-react-app,shrynx/react-super-scripts,Place1/create-react-app-typescript,1Body/prayer-app,prontotools/create-react-app,jayphelps/create-react-app,mangomint/create-react-app,cr101/create-react-app,christiantinauer/create-react-app,sigmacomputing/create-react-app,Timer/create-react-app,1Body/prayer-app,bttf/create-react-app,johnslay/create-react-app,just-boris/create-preact-app,dsopel94/create-react-app,maletor/create-react-app,ConnectedHomes/create-react-web-app,ConnectedHomes/create-react-web-app,peopleticker/create-react-app,1Body/prayer-app,amido/create-react-app,yosharepoint/react-scripts-ts-sp,flybayer/create-react-webextension,josephfinlayson/create-react-app,bttf/create-react-app,mikechau/create-react-app,DivineGod/create-react-app,svrcekmichal/react-scripts,sigmacomputing/create-react-app,Exocortex/create-react-app,jdcrensh/create-react-app,dsopel94/create-react-app,GreenGremlin/create-react-app,xiaohu-developer/create-react-app,reedsa/create-react-app,andrewmaudsley/create-react-app,flybayer/create-react-webextension,Place1/create-react-app-typescript,stockspiking/create-react-app,d3ce1t/create-react-app,iamdoron/create-react-app,GreenGremlin/create-react-app,paweljedrzejczyk/create-react-app,Psychwire/create-react-app,vgmr/create-ts-app,andrewmaudsley/create-react-app,facebookincubator/create-react-app,emvu/create-react-app,jayphelps/create-react-app,prometheusresearch/create-react-app,ontruck/create-react-app,brysgo/create-react-app,TondaHack/create-react-app,josephfinlayson/create-react-app,digitalorigin/create-react-app,mangomint/create-react-app,DivineGod/create-react-app,in2core/create-react-app,magic-FE/create-magic-component,christiantinauer/create-react-app,andyeskridge/create-react-app,timlogemann/create-react-app,vgmr/create-ts-app,devex-web-frontend/create-react-app-dx,igetgames/spectacle-create-react-app,flybayer/create-react-webextension,jdcrensh/create-react-app,stockspiking/create-react-app,infernojs/create-inferno-app,shrynx/react-super-scripts,matart15/create-react-app,Timer/create-react-app,devex-web-frontend/create-react-app-dx,d3ce1t/create-react-app,picter/create-react-app,scyankai/create-react-app,romaindso/create-react-app,d3ce1t/create-react-app,mikechau/create-react-app,yosharepoint/react-scripts-ts-sp,IamJoseph/create-react-app,d3ce1t/create-react-app,ro-savage/create-react-app,liamhu/create-react-app,Sonu-sj/cardMatcher,GreenGremlin/create-react-app,vgmr/create-ts-app,Timer/create-react-app,yosharepoint/react-scripts-ts-sp,0xaio/create-react-app,appier/create-react-app,dpoineau/create-react-app,shrynx/react-super-scripts,prontotools/create-react-app,peopleticker/create-react-app,reedsa/create-react-app,just-boris/create-preact-app,jdcrensh/create-react-app,accurat/accurapp,GreenGremlin/create-react-app,whobutsb/create-redux-app,Place1/create-react-app-typescript,timlogemann/create-react-app,RobzDoom/frame_trap,amido/create-react-app,cr101/create-react-app,whobutsb/create-redux-app,TondaHack/create-react-app,mangomint/create-react-app,brysgo/create-react-app,kst404/e8e-react-scripts,TryKickoff/create-kickoff-app,Clearcover/web-build,CodingZeal/create-react-app,lopezator/create-react-app,0xaio/create-react-app,just-boris/create-preact-app,picter/create-react-app,powerreviews/create-react-app,christiantinauer/create-react-app,devex-web-frontend/create-react-app-dx,IamJoseph/create-react-app,appier/create-react-app,TryKickoff/create-kickoff-app,josephfinlayson/create-react-app,prontotools/create-react-app,emvu/create-react-app
|
e96df96e13e47ab983fbdbcf58bd00ebd0ff9e5b
|
public/js/layout.js
|
public/js/layout.js
|
var fixedWidth = 220;
var minWidth = 660;
var fixedPadding = 100;
function layoutWidth()
{
var wWidth = $(window).width();
var bodyPadding = Math.max(Math.floor(wWidth / fixedWidth)-3, 1) * 100;
if ($(".container").length)
{
var width = wWidth - bodyPadding;
var newWidth = Math.floor(width / fixedWidth) * fixedWidth;
if (newWidth < minWidth) newWidth = minWidth;
$(".container").width(newWidth);
}
}
$(document).ready(function() {
layoutWidth();
$(window).resize(function(){
layoutWidth();
});
});
|
var fixedWidth = 220;
var minWidth = 660;
var fixedPadding = 100;
var delayResize = null;
function layoutWidth()
{
var wWidth = $(window).width();
var bodyPadding = Math.max(Math.floor(wWidth / fixedWidth)-3, 1) * 100;
if ($(".container").length)
{
var width = wWidth - bodyPadding;
var newWidth = Math.floor(width / fixedWidth) * fixedWidth;
if (newWidth < minWidth) newWidth = minWidth;
$(".container").width(newWidth);
}
}
function layoutResize()
{
clearTimeout(delayResize);
delayResize = setTimeout(layoutWidth, 250);
}
$(document).ready(function() {
layoutWidth();
$(window).resize(function(){
layoutResize();
});
});
|
Add timeout when resizing container (prevent close multicall that can cause performance issue)
|
Add timeout when resizing container (prevent close multicall that can cause performance issue)
|
JavaScript
|
mit
|
hernantas/MangaReader,hernantas/MangaReader,hernantas/MangaReader
|
3fd410806d1f9cc2f922efde78539671306bd739
|
server/app.js
|
server/app.js
|
Meteor.startup(function () {
Tiqs._ensureIndex({text: 1});
});
Meteor.methods({
associateTags: function(text, tags) {
Tiqs.upsert({text: text}, {$addToSet: {tags: {$each: tags}}});
_.each(tags, function(tag) {
Tiqs.upsert({text: tag}, {$addToSet: {tags: text}});
});
}
});
|
Meteor.startup(function () {
Tiqs._ensureIndex({text: 1});
});
Meteor.methods({
associateTags: function(text, tags) {
Tiqs.upsert({text: text},
{$addToSet: {tags: {$each: tags}},
$setOnInsert: {createdAt: Date.now()}
}
);
_.each(tags, function(tag) {
Tiqs.upsert({text: tag},
{$addToSet: {tags: text}, $setOnInsert: {createdAt: Date.now()}}
);
});
}
});
|
Add createdAt field to Tiqs collection
|
Add createdAt field to Tiqs collection
|
JavaScript
|
mit
|
imiric/tiq-web,imiric/tiq-web
|
f0a2fefc7eced759ad5c639c85df44194c3a89f8
|
rules/temporary-hrdata.js
|
rules/temporary-hrdata.js
|
function (user, context, callback) {
// This is a rule to specifically allow access to _HRData for specific ClientIDs
// _HRData comes from WorkDay, through LDAP Connector
// Ideally the RPs who need this data should request it directly from WorkDay, so this is a work-around.
// Applications that are ALLOWED to see _HRData
var ALLOWED_CLIENTIDS = [
'IU80mVpKPtIZyUZtya9ZnSTs6fKLt3JO', //biztera.com
'R4djNlyXSl3i8N2KXWkfylghDa9kFQ84' //mozilla.tap.thinksmart.com
];
if (ALLOWED_CLIENTIDS.indexOf(context.clientID) >= 0) {
var extend = require('extend');
context.samlConfiguration = context.samlConfiguration || {};
//Remap SAML attributes as SAML cannot show Javascript objects
for(var value in user._HRData){
var nname = "http://schemas.security.allizom.org/claims/HRData/"+encodeURIComponent(value);
var nvalue = "_HRData."+value;
var obj = {};
obj[nname] = nvalue;
context.samlConfiguration.mappings = extend(true, context.samlConfiguration.mappings, obj);
}
callback(null, user, context);
} else {
// Wipe _HRData (do use non-dot notation)
user['_HRData'] = {"placeholder": "empty"};
callback(null, user, context);
}
}
|
function (user, context, callback) {
// This is a rule to specifically allow access to _HRData for specific ClientIDs
// _HRData comes from WorkDay, through LDAP Connector
// Ideally the RPs who need this data should request it directly from WorkDay, so this is a work-around.
// Applications that are ALLOWED to see _HRData
var ALLOWED_CLIENTIDS = [
'IU80mVpKPtIZyUZtya9ZnSTs6fKLt3JO', //biztera.com
'R4djNlyXSl3i8N2KXWkfylghDa9kFQ84', //mozilla.tap.thinksmart.com
'fNzzMG3XfkxQJcnUpgrGyH2deII3nFFM' //pto1.dmz.mdc1.mozilla.com
];
if (ALLOWED_CLIENTIDS.indexOf(context.clientID) >= 0) {
var extend = require('extend');
context.samlConfiguration = context.samlConfiguration || {};
//Remap SAML attributes as SAML cannot show Javascript objects
for(var value in user._HRData){
var nname = "http://schemas.security.allizom.org/claims/HRData/"+encodeURIComponent(value);
var nvalue = "_HRData."+value;
var obj = {};
obj[nname] = nvalue;
context.samlConfiguration.mappings = extend(true, context.samlConfiguration.mappings, obj);
}
callback(null, user, context);
} else {
// Wipe _HRData (do use non-dot notation)
user['_HRData'] = {"placeholder": "empty"};
callback(null, user, context);
}
}
|
Add pto app to hrdata rule
|
Add pto app to hrdata rule
this will allow the pto app to get manager info and no longer need an LDAP connection
|
JavaScript
|
mpl-2.0
|
mozilla-iam/auth0-deploy,jdow/auth0-deploy,jdow/auth0-deploy,mozilla-iam/auth0-deploy
|
2f61e76a50034cd06611bf0086d57deeaf61a2dd
|
schema/me/save_artwork.js
|
schema/me/save_artwork.js
|
import gravity from '../../lib/loaders/gravity';
import { GraphQLString, GraphQLBoolean } from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay';
import { artworkFields } from '../artwork/index';
export default mutationWithClientMutationId({
name: 'SaveArtwork',
decription: 'Save (or remove) an artwork to (from) a users default collection.',
inputFields: {
artwork_id: {
type: GraphQLString,
},
remove: {
type: GraphQLBoolean,
},
},
outputFields: artworkFields(),
mutateAndGetPayload: ({
artwork_id,
remove,
}, request, { rootValue: { accessToken, userID } }) => {
if (!accessToken) return new Error('You need to be signed in to perform this action');
const saveMethod = remove ? 'DELETE' : 'POST';
return gravity.with(accessToken, {
method: saveMethod,
})(`/collection/saved-artwork/artwork/${artwork_id}`, {
user_id: userID,
}).then(() => gravity(`artwork/${artwork_id}`));
},
});
|
import gravity from '../../lib/loaders/gravity';
import { GraphQLString, GraphQLBoolean } from 'graphql';
import { mutationWithClientMutationId } from 'graphql-relay';
import { ArtworkType } from '../artwork/index';
export default mutationWithClientMutationId({
name: 'SaveArtwork',
decription: 'Save (or remove) an artwork to (from) a users default collection.',
inputFields: {
artwork_id: {
type: GraphQLString,
},
remove: {
type: GraphQLBoolean,
},
},
outputFields: {
artwork: {
type: ArtworkType,
resolve: ({ artwork_id }) => gravity(`artwork/${artwork_id}`),
},
},
mutateAndGetPayload: ({
artwork_id,
remove,
}, request, { rootValue: { accessToken, userID } }) => {
if (!accessToken) return new Error('You need to be signed in to perform this action');
const saveMethod = remove ? 'DELETE' : 'POST';
return gravity.with(accessToken, {
method: saveMethod,
})(`/collection/saved-artwork/artwork/${artwork_id}`, {
user_id: userID,
}).then(() => ({ artwork_id }));
},
});
|
Return artwork node instead of fields
|
Return artwork node instead of fields
|
JavaScript
|
mit
|
mzikherman/metaphysics-1,craigspaeth/metaphysics,artsy/metaphysics,craigspaeth/metaphysics,artsy/metaphysics,mzikherman/metaphysics-1,artsy/metaphysics,mzikherman/metaphysics-1,broskoski/metaphysics,mzikherman/metaphysics-1
|
27e1d21c375b16697c4ca4eef0f6c14193262797
|
test/DropdownAlert-test.js
|
test/DropdownAlert-test.js
|
const React = require('react')
const should = require('should')
const { shallow } = require('enzyme')
const { expect } = require('chai')
import DropdownAlert from '../DropdownAlert'
import {
View,
Text,
StyleSheet,
TouchableHighlight,
Animated,
Modal,
StatusBar,
Image
} from "react-native"
describe('DropdownAlert', () => {
let dropdownAlert
before(() => {
dropdownAlert = shallow(<DropdownAlert />)
})
it('should exist', () => {
DropdownAlert.should.be.ok
})
})
|
const React = require('react')
const should = require('should')
const { shallow } = require('enzyme')
const { expect } = require('chai')
import DropdownAlert from '../DropdownAlert'
import {
View,
Text,
StyleSheet,
TouchableHighlight,
Animated,
Modal,
StatusBar,
Image
} from "react-native"
describe('DropdownAlert', () => {
it('should exist', () => {
let wrapper = shallow(<DropdownAlert />)
should.exist(wrapper)
})
it('should find custom sub components', () => {
let wrapper = shallow(<DropdownAlert imageUri={'https://facebook.github.io/react/img/logo_og.png'} />)
wrapper.instance().alert('custom', 'Title', 'Message')
wrapper.update()
expect(wrapper.find(Modal)).to.have.length(1)
expect(wrapper.find(StatusBar)).to.have.length(1)
expect(wrapper.find(View)).to.have.length(2)
expect(wrapper.find(Animated.View)).to.have.length(1)
expect(wrapper.find(TouchableHighlight)).to.have.length(1)
expect(wrapper.find(Text)).to.have.length(2)
expect(wrapper.find(Image)).to.have.length(1)
})
it('should dismiss', () => {
let wrapper = shallow(<DropdownAlert />)
wrapper.instance().dismiss()
wrapper.update()
wrapper.instance().should.be.ok
})
})
|
Add sub components test; Add dismiss test
|
Add sub components test; Add dismiss test
|
JavaScript
|
mit
|
testshallpass/react-native-dropdownalert,testshallpass/react-native-dropdownalert,shotozuro/react-native-dropdownalert,devBrian/react-native-dropdownalert,devBrian/react-native-dropdownalert,shotozuro/react-native-dropdownalert,shotozuro/react-native-dropdownalert,devBrian/react-native-dropdownalert,testshallpass/react-native-dropdownalert
|
9f26f41123b6fcda8ade34325161d8d433f4ec61
|
test/unit/api/component.js
|
test/unit/api/component.js
|
import { Component } from '../../../src';
describe('api/Component', () => {
if (!classStaticsInheritance()) {
return;
}
describe('property getters', () => {
it('observedAttributes', () => {
class Test extends Component {
static get observedAttributes() {
return ['test'];
}
};
expect(Test.observedAttributes).to.deep.equal(['test']);
});
it('props', () => {
class Test extends Component {
static get props() {
return {
test: { attribute: true }
};
}
};
expect(Test.props).to.deep.equal({
test: { attribute: true }
});
});
});
describe('property initialisers', () => {
it('observedAttributes', () => {
class Test extends Component {
static observedAttributes = ['test'];
};
expect(Test.observedAttributes).to.deep.equal(['test']);
});
it('props', () => {
class Test extends Component {
static props = {
test: { attribute: true }
};
};
expect(Test.props).to.deep.equal({
test: { attribute: true }
});
});
});
});
|
import { Component } from '../../../src';
import { classStaticsInheritance } from '../lib/support';
describe('api/Component', () => {
if (!classStaticsInheritance()) {
return;
}
describe('property getters', () => {
it('observedAttributes', () => {
class Test extends Component {
static get observedAttributes() {
return ['test'];
}
};
expect(Test.observedAttributes).to.deep.equal(['test']);
});
it('props', () => {
class Test extends Component {
static get props() {
return {
test: { attribute: true }
};
}
};
expect(Test.props).to.deep.equal({
test: { attribute: true }
});
});
});
describe('property initialisers', () => {
it('observedAttributes', () => {
class Test extends Component {
static observedAttributes = ['test'];
};
expect(Test.observedAttributes).to.deep.equal(['test']);
});
it('props', () => {
class Test extends Component {
static props = {
test: { attribute: true }
};
};
expect(Test.props).to.deep.equal({
test: { attribute: true }
});
});
});
});
|
Fix test by adding a missing import.
|
test: Fix test by adding a missing import.
|
JavaScript
|
mit
|
skatejs/skatejs,skatejs/skatejs,skatejs/skatejs,chrisdarroch/skatejs,chrisdarroch/skatejs
|
ea22ee1596e2f9d93ce01349f06a3c99143f21bb
|
test/absUrl.js
|
test/absUrl.js
|
var should = require('chai').should();
var LocationUtil = require('../src/location-util.js').LocationUtil;
describe('#absUrl', function () {
it('should get full URL', function () {
var l = new LocationUtil('http://example.com:8080/foo?bar=buz#frag');
l.absUrl().should.equal('http://example.com:8080/foo?bar=buz#frag');
});
});
|
var should = require('chai').should();
var LocationUtil = require('../src/location-util.js').LocationUtil;
describe('#absUrl', function () {
it('should get full URL', function () {
var l = new LocationUtil('http://example.com:8080/foo?bar=buz#frag');
l.absUrl().should.equal('http://example.com:8080/foo?bar=buz#frag');
});
it('documents behavior', function () {
var l = new LocationUtil('http://example.com:3000/foo?bar=buz#frag');
l.url('/user?id=123#name').absUrl().should.equal('http://example.com:3000/user?id=123#name');
l.path('/entry').absUrl().should.equal('http://example.com:3000/entry?id=123#name');
l.search('date', '20140401', 'id', null).absUrl().should.equal('http://example.com:3000/entry?date=20140401#name');
l.hash('').absUrl().should.equal('http://example.com:3000/entry?date=20140401');
});
});
|
Add some test cases that are in doc
|
Add some test cases that are in doc
|
JavaScript
|
mit
|
moznion/location-util
|
56efaa7f095ffef29decbb0942f37f24851b4847
|
js/DataObjectPreviewer.js
|
js/DataObjectPreviewer.js
|
(function($) {
$.entwine('ss', function($){
$('.ss-gridfield-orderable tbody .handle').entwine({
onmousedown: function () {
this.closest('tbody').addClass('ss-gridfield-sorting');
},
onmouseup: function () {
this.closest('tbody').removeClass('ss-gridfield-sorting');
}
});
$('.dataobjectpreview').entwine({
onadd: function () {
var $tr = this.closest('tr');
if ($tr.length && $tr.hasClass('ui-sortable-helper')) {
return;
}
var $iframe = $('<iframe style="width: 100%; overflow: hidden" scrolling="no"></iframe>');
$iframe.bind('load', function () {
var iframeWindow = $iframe.get(0).contentWindow,
$iframeWindow = $(iframeWindow),
iframeBody = iframeWindow.document.body,
iframeHeight;
$iframeWindow.resize(function () {
var newHeight = iframeBody.offsetHeight;
if (newHeight !== iframeHeight) {
$iframe.height(newHeight + "px");
iframeHeight = newHeight;
}
});
if ($iframe.is(":visible")) {
$iframeWindow.resize();
}
});
$iframe.attr('src', this.data('src'));
this.append($iframe);
}
});
});
}(jQuery));
|
(function($) {
function getDocumentHeight(doc) {
return Math.max(
doc.documentElement.clientHeight,
doc.body.scrollHeight, doc.documentElement.scrollHeight,
doc.body.offsetHeight, doc.documentElement.offsetHeight);
}
$.entwine('ss', function($){
$('.ss-gridfield-orderable tbody .handle').entwine({
onmousedown: function () {
this.closest('tbody').addClass('ss-gridfield-sorting');
},
onmouseup: function () {
this.closest('tbody').removeClass('ss-gridfield-sorting');
}
});
$('.dataobjectpreview').entwine({
onadd: function () {
var $tr = this.closest('tr');
if ($tr.length && $tr.hasClass('ui-sortable-helper')) {
return;
}
var $iframe = $('<iframe style="width: 100%; overflow: hidden" scrolling="no"></iframe>');
$iframe.bind('load', function () {
var iframeWindow = $iframe.get(0).contentWindow,
$iframeWindow = $(iframeWindow),
iframeHeight;
$iframeWindow.resize(function () {
var newHeight = getDocumentHeight( iframeWindow.document );
if (newHeight !== iframeHeight) {
$iframe.height(newHeight + "px");
iframeHeight = newHeight;
}
});
if ($iframe.is(":visible")) {
$iframeWindow.resize();
}
});
$iframe.attr('src', this.data('src'));
this.append($iframe);
}
});
});
}(jQuery));
|
Use a cross-browser compatible method of determining document height
|
Use a cross-browser compatible method of determining document height
The automatic setting of height for the preview iframe stopped working in
Chrome. This change fixes this.
|
JavaScript
|
mit
|
heyday/silverstripe-dataobjectpreview,heyday/silverstripe-dataobjectpreview
|
cadc76aaac836b8a13fd0c6da5b36b70d8c54ad7
|
example/examples/HLSSource.js
|
example/examples/HLSSource.js
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Hls from 'hls.js';
const propTypes = {
src: PropTypes.string.isRequired,
type: PropTypes.string,
video: PropTypes.object,
};
export default class HLSSource extends Component {
constructor(props, context) {
super(props, context);
this.hls = new Hls();
}
componentDidMount() {
// `src` is the property get from this component
// `video` is the property insert from `Video` component
// `video` is the html5 video element
const { src, video } = this.props;
// load hls video source base on hls.js
if (Hls.isSupported()) {
this.hls.loadSource(src);
this.hls.attachMedia(video);
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play();
});
}
}
render() {
return (
<source
src={this.props.src}
type={this.props.type || 'application/x-mpegURL'}
/>
);
}
}
HLSSource.propTypes = propTypes;
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Hls from 'hls.js';
const propTypes = {
src: PropTypes.string.isRequired,
type: PropTypes.string,
video: PropTypes.object,
};
export default class HLSSource extends Component {
constructor(props, context) {
super(props, context);
this.hls = new Hls();
}
componentDidMount() {
// `src` is the property get from this component
// `video` is the property insert from `Video` component
// `video` is the html5 video element
const { src, video } = this.props;
// load hls video source base on hls.js
if (Hls.isSupported()) {
this.hls.loadSource(src);
this.hls.attachMedia(video);
this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
video.play();
});
}
}
componentWillUnmount() {
// destroy hls video source
if (this.hls) {
this.hls.destroy();
}
}
render() {
return (
<source
src={this.props.src}
type={this.props.type || 'application/x-mpegURL'}
/>
);
}
}
HLSSource.propTypes = propTypes;
|
Destroy HLS source before component unmount
|
Destroy HLS source before component unmount
|
JavaScript
|
mit
|
video-react/video-react,video-react/video-react
|
a60b407bf182c852b9d6e841e1f0511fb770411b
|
client/templates/course/sidebar/section/add-lesson/add-lesson.js
|
client/templates/course/sidebar/section/add-lesson/add-lesson.js
|
Template.sectionAddLesson.events({
'click .add-lesson-button': function (event, template) {
// Get lesson name
var lessonName = template.find(".lesson-name").value;
// Create temporary lesson object
var lessonObject = {'name': lessonName};
// Add lesson to database,
// getting lesson ID in return
var lessonId = Lessons.insert(lessonObject);
if (!this.lessonIDs) {
this.lessonIDs = [];
}
// Add lesson ID to array
this.lessonIDs.push(lessonId);
// Get course sections array from parent template
var courseSections = Template.parentData().sections;
// Get course ID from parent template
var courseID = Template.parentData()._id;
// Save course.lessonIDs array to database
Courses.update(courseID, {$set: {"sections": courseSections}});
}
});
|
Template.sectionAddLesson.events({
'click .add-lesson-button': function (event, template) {
// Get lesson name
var lessonName = template.find(".lesson-name").value;
// Create temporary lesson object
var lessonObject = {'name': lessonName};
// Add lesson to database,
// getting lesson ID in return
var lessonId = Lessons.insert(lessonObject);
if (!this.lessonIDs) {
this.lessonIDs = [];
}
// Add lesson ID to array
this.lessonIDs.push(lessonId);
// Get course sections array from parent template
var courseSections = Template.parentData().sections;
// Get course ID from parent template
var courseID = Template.parentData()._id;
// Save course.lessonIDs array to database
Courses.update(courseID, {$set: {"sections": courseSections}});
// Clear the lesson name field
$(".lesson-name").val('');
}
});
|
Clear lesson field on add.
|
Clear lesson field on add.
|
JavaScript
|
agpl-3.0
|
Crowducate/crowducate-platform,Crowducate/crowducate-platform,Crowducate/crowducate-next,Crowducate/crowducate-next,KshirsagarNaidu/bodhiprocessor,KshirsagarNaidu/bodhiprocessor
|
ef773f16dbaf0d2ef922f061d50fb1462c98036b
|
tests/index.js
|
tests/index.js
|
/**
* Check If Image Path Exists
*/
var http = require('http'),
url = 'http://sirocco.accuweather.com/adc_images2/english/feature/400x300/worstwx.jpg'
;
http.get(url, function(response) {
if (response.statusCode == '200') return;
throw new Error(response.statusCode);
}).on('error', function(error) {
throw error;
});
|
/**
* Check If Image Path Exists
*/
var http = require('http'),
url = 'http://sirocco.accuweather.com/adc_images2/english/feature/400x300/worstwx.jpg'
;
http.get(url, function(response) {
if (response.statusCode == '200') process.exit(0);
throw new Error(response.statusCode);
}).on('error', function(error) {
throw error;
});
|
Use process.exit to make test faster
|
Use process.exit to make test faster
|
JavaScript
|
apache-2.0
|
matthewspencer/worstweather
|
995d2be6e56ba2b2f1b44e1e0f05c56d842da448
|
src/components/candidatethumbnail/CandidateThumbnail.js
|
src/components/candidatethumbnail/CandidateThumbnail.js
|
import React from 'react';
import { Image } from 'react-bootstrap'
import CandidateCounter from './CandidateCounter'
import styles from './candidatethumbnail.css'
export default class CandidateThumbnail extends React.Component {
render() {
return (
<div className="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div className="card">
<div className="candidate-card-title">
<h3>{this.props.name}</h3>
</div>
<div className="candidate-card-divider"></div>
<div className="candidate-card-image-link">
<Image className="candidate-card-image" src={this.props.img} responsive/>
</div>
<div className="candidate-card-counter">
<CandidateCounter counter={this.props.counter}/>
</div>
</div>
</div>
);
}
}
|
import React from 'react';
import { Image } from 'react-bootstrap'
import { Route } from 'react-router-dom'
import CandidateCounter from './CandidateCounter'
import styles from './candidatethumbnail.css'
export default class CandidateThumbnail extends React.Component {
render() {
return (
<Route render={({ history}) => (
<div className="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div className="card" onClick = {() => { history.push('/election/dkijakarta/candidate/'+this.props.name) }}>
<div className="candidate-card-title">
<h3>{this.props.name}</h3>
</div>
<div className="candidate-card-divider"></div>
<div className="candidate-card-image-link" >
<Image className="candidate-card-image" src={this.props.img} responsive/>
</div>
<div className="candidate-card-counter">
<CandidateCounter counter={this.props.counter}/>
</div>
</div>
</div>
)} />
);
}
}
|
Add link from candidate thumbnail to candidate detail page
|
Add link from candidate thumbnail to candidate detail page
|
JavaScript
|
mit
|
imrenagi/rojak-web-frontend,imrenagi/rojak-web-frontend
|
ed0df4c15952d3b00ca0de3b01cc4697ee6e9570
|
app/react/data/exclude_images.js
|
app/react/data/exclude_images.js
|
module.exports = [
'https://upload.wikimedia.org/wikipedia/en/e/e7/Cscr-featured.svg',
'.webm',
'https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg',
'https://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg',
'https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg',
'https://upload.wikimedia.org/wikipedia/commons/a/a8/Office-book.svg',
'.tif',
'Commons-logo',
'assets/file-type-icons',
'_Icon.svg',
'Question_book-new.svg',
'P_vip.svg',
'Cscr-featured.svg',
'Portal-puzzle.svg',
'Office-book.svg',
'commons/thumb/b/b4/Ambox_important.svg/600px-Ambox_important'
]
|
module.exports = [
'https://upload.wikimedia.org/wikipedia/en/e/e7/Cscr-featured.svg',
'.webm',
'https://upload.wikimedia.org/wikipedia/en/4/4a/Commons-logo.svg',
'https://upload.wikimedia.org/wikipedia/en/f/fd/Portal-puzzle.svg',
'https://upload.wikimedia.org/wikipedia/en/4/48/Folder_Hexagonal_Icon.svg',
'https://upload.wikimedia.org/wikipedia/commons/a/a8/Office-book.svg',
'.tif',
'Commons-logo',
'assets/file-type-icons',
'_Icon.svg',
'Question_book-new.svg',
'P_vip.svg',
'Cscr-featured.svg',
'Portal-puzzle.svg',
'Office-book.svg'
]
|
Revert "Added new exclude image"
|
Revert "Added new exclude image"
This reverts commit cbc4520fcc0b6744113bee40ee21571eb787ea25.
|
JavaScript
|
mit
|
WikiEducationFoundation/Wiki-Playlist,WikiEducationFoundation/Wiki-Playlist,WikiEducationFoundation/Wiki-Playlist
|
317f7ca114f80cf2c4d995938b9f262b50fa02fb
|
app/scenes/SearchScreen/index.js
|
app/scenes/SearchScreen/index.js
|
import React, { Component } from 'react';
import { View } from 'react-native';
import RepoSearchBar from './components/RepoSearchBar';
import RepoSearchButton from './components/RepoSearchButton';
import RepoList from './components/RepoList';
export default class SearchScreen extends Component {
constructor(props) {
super(props);
this.state = {
username: '',
repos: []
};
}
render() {
return (
<View style={{
flex: 1,
flexDirection: 'column',
}}>
<RepoSearchBar />
<RepoSearchButton />
<RepoList />
</View>
);
}
}
|
import React, { Component } from 'react';
import { View } from 'react-native';
import RepoSearchBar from './components/RepoSearchBar';
import RepoSearchButton from './components/RepoSearchButton';
import RepoList from './components/RepoList';
export default class SearchScreen extends Component {
constructor(props) {
super(props);
this.state = {
username: '',
repos: []
};
}
render() {
return (
<View style={{
flex: 1,
flexDirection: 'column',
}}>
<RepoSearchBar />
<RepoSearchButton />
<RepoList />
</View>
);
}
changeUsername(newUsername) {
this.setState({
username: newUsername
});
}
updateRepos(newRepos) {
this.setSate({
repos: newRepos
});
}
}
|
Add helper functions to change screen states
|
Add helper functions to change screen states
|
JavaScript
|
mit
|
msanatan/GitHubProjects,msanatan/GitHubProjects,msanatan/GitHubProjects
|
4036b9f7009c65aa1889b80ddbb81f2ad95dc873
|
src/handler_adaptor.js
|
src/handler_adaptor.js
|
define(['lib/def', 'handler'], function(Def, Handler) {
var HandlerAdaptor = Def.type(Handler, function(handler) {
Handler.call(this);
this.def_prop('handler', handler);
});
HandlerAdaptor.def_method(function on_message(msg, cont) {
if (this.handler.match(msg))
return msg.respond(this.handler.execute(msg), cont);
return cont(msg);
});
return HandlerAdaptor;
});
|
define(['lib/def', 'handler'], function(Def, Handler) {
var HandlerAdaptor = Def.type(Handler, function(handler) {
this.constructor.__super__.call(this);
this.def_prop('handler', handler);
});
HandlerAdaptor.def_method(function on_message(msg, cont) {
if (this.handler.match(msg))
return msg.respond(this.handler.execute(msg), cont);
return cont(msg);
});
return HandlerAdaptor;
});
|
Refactor constructor to take advantage of __super__ member.
|
Refactor constructor to take advantage of __super__ member.
|
JavaScript
|
mit
|
bassettmb/slack-bot-dev
|
2b82c65e398a66d3dc23f0fdf366549e5565219f
|
src/main/webapp/resources/js/utilities/url-utilities.js
|
src/main/webapp/resources/js/utilities/url-utilities.js
|
/**
* Since IRIDA can be served within a container, all requests need to have
* the correct base url. This will add, if required, the base url.
*
* NOTE: THIS ONLY NEEDS TO BE CALLED FOR LINKS, ASYNCHRONOUS REQUESTS WILL
* BE AUTOMATICALLY HANDLED.
*
* @param {string} url
* @return {string|*}
*/
export function setBaseUrl(url) {
// Remove any leading slashes
url = url.replace(/^\/+/, "");
/*
Get the base url which is set via the thymeleaf template engine.
*/
const BASE_URL = window.TL?._BASE_URL || "/";
/*
Check to make sure that the given url has not already been given the
base url.
*/
if (
(BASE_URL !== "/" && url.startsWith(BASE_URL)) ||
url.startsWith("http")
) {
return url;
}
/*
Create the new url
*/
return `${BASE_URL}${url}`;
}
|
/**
* Since IRIDA can be served within a container, all requests need to have
* the correct base url. This will add, if required, the base url.
*
* NOTE: THIS ONLY NEEDS TO BE CALLED FOR LINKS, ASYNCHRONOUS REQUESTS WILL
* BE AUTOMATICALLY HANDLED.
*
* @param {string} url
* @return {string|*}
*/
export function setBaseUrl(url) {
/*
Get the base url which is set via the thymeleaf template engine.
*/
const BASE_URL = window.TL?._BASE_URL || "/";
/*
Check to make sure that the given url has not already been given the
base url.
*/
if (url.startsWith(BASE_URL) || url.startsWith("http")) {
return url;
}
// Remove any leading slashes
url = url.replace(/^\/+/, "");
/*
Create the new url
*/
return `${BASE_URL}${url}`;
}
|
Check to see if the url has the context path first.
|
Check to see if the url has the context path first.
|
JavaScript
|
apache-2.0
|
phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida,phac-nml/irida
|
ff2bb7a079a88eb9a60061de9f4481cee1141889
|
spec/specs.js
|
spec/specs.js
|
describe('pingPong', function() {
it("is true for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal(true);
});
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
});
|
describe('pingPong', function() {
it("is true for a number that is divisible by 3", function() {
expect(pingPong(6)).to.equal(true);
});
it("is true for a number that is divisible by 5", function() {
expect(pingPong(10)).to.equal(true);
});
it("is true for a number that is divisible by 15", function() {
expect(pingPong(30)).to.equal.(true);
});
});
|
Add an additional spec test for userNumbers divisible by 15
|
Add an additional spec test for userNumbers divisible by 15
|
JavaScript
|
mit
|
kcmdouglas/pingpong,kcmdouglas/pingpong
|
1dde5df3c6fdfe555f7258d1a697735bc6f3b7a8
|
src/App.js
|
src/App.js
|
import React from 'react';
import {
HashRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
import ComponentsPage from './pages/Components';
import ContentPage from './pages/Content';
import UtilsPage from './pages/Utils';
function App() {
return (
<Router>
<div className="p-5">
<h1>Gateway</h1>
<p>Gateway is Findaway's boilerplate for React sites/applications.</p>
<p>This repository can be copied to start any react project.</p>
<p>By default this repository contains CSS (SCSS), React Components, and utilities to help get any project up-and-running quickly with consistency to all other projects.</p>
<ul className="list-inline">
<li><Link to="content">Content</Link></li>
<li><Link to="components">Components</Link></li>
<li><Link to="utils">Utils</Link></li>
</ul>
<Switch>
<Route path="/components">
<ComponentsPage />
</Route>
<Route path="/content">
<ContentPage />
</Route>
<Route path="/utils">
<UtilsPage />
</Route>
</Switch>
</div>
</Router>
);
}
export default App;
|
import React from 'react';
import {
HashRouter as Router,
Switch,
Route,
Link
} from "react-router-dom";
import ComponentsPage from './pages/Components';
import ContentPage from './pages/Content';
import UtilsPage from './pages/Utils';
function App() {
return (
<Router>
<div className="p-5">
<h1>Gateway</h1>
<p>Gateway is Findaway's boilerplate for React sites/applications.</p>
<p>This repository can be copied to start any react project. Get the latest from <a href="https://github.com/FindawayWorld/gateway">https://github.com/FindawayWorld/gateway</a></p>
<p>By default this repository contains CSS (SCSS), React Components, and utilities to help get any project up-and-running quickly with consistency to all other projects.</p>
<p></p>
<ul className="list-inline">
<li><Link to="content">Content</Link></li>
<li><Link to="components">Components</Link></li>
<li><Link to="utils">Utils</Link></li>
</ul>
<Switch>
<Route path="/components">
<ComponentsPage />
</Route>
<Route path="/content">
<ContentPage />
</Route>
<Route path="/utils">
<UtilsPage />
</Route>
</Switch>
</div>
</Router>
);
}
export default App;
|
Add link to GH repo
|
Add link to GH repo
|
JavaScript
|
mit
|
FindawayWorld/gateway,FindawayWorld/gateway
|
1ebfc2f9d228811b45955e1d7ddd1f61407a3809
|
src/App.js
|
src/App.js
|
import React from 'react';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Home from './Home';
const App = () => (
<React.Fragment>
<Router>
<Route exact path="/" component={Home} />
</Router>
</React.Fragment>
);
export default App;
|
import React from 'react';
import CssBaseline from '@material-ui/core/CssBaseline';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import Home from './Home';
const App = () => (
<React.Fragment>
<CssBaseline />
<Router>
<Route exact path="/" component={Home} />
</Router>
</React.Fragment>
);
export default App;
|
Use CssNormalize to normalize padding/margin for entire app
|
Use CssNormalize to normalize padding/margin
for entire app
|
JavaScript
|
mit
|
jasongforbes/jforbes.io,jasongforbes/jforbes.io,jasongforbes/jforbes.io
|
22d63bf978e351a22515248600a8cd7a1d56a07d
|
src/pages/home/page.js
|
src/pages/home/page.js
|
import React from 'react';
import ReactDom from 'react-dom';
import { Link } from 'react-router';
import _ from 'lodash';
import client from '../../common/store/Contentful';
import marked from 'marked';
import styles from "./style.css";
export default class HomePage extends React.Component {
constructor(props) {
super(props);
var self = this;
this.state = {
fonts: this.props.fontStore.fonts,
content: ''
};
client.getEntries({
'content_type': 'page',
'fields.title': 'Home'
})
.then(function (entries) {
var content = _.get(entries, 'items[0].fields.content');
console.log(content)
self.setState({ content });
})
.catch(function(error) {
console.error(error);
});
}
render() {
var fontItems = _.map(this.state.fonts, function(font, index) {
var link = '/karaoke/' + font.name;
return (
<li key={ index } style={{ backgroundColor: font.color }}>
<Link to={ link }>
<p>{ font.name }</p>
</Link>
</li>
);
});
return (
<div id="content">
<ul className={ styles.directory }>
{ fontItems }
</ul>
<div className={ styles['page-content'] } dangerouslySetInnerHTML={{__html: marked(this.state.content)}}>
</div>
</div>
);
}
}
|
import React from 'react';
import ReactDom from 'react-dom';
import { Link } from 'react-router';
import _ from 'lodash';
import client from '../../common/store/Contentful';
import marked from 'marked';
import styles from "./style.css";
export default class HomePage extends React.Component {
constructor(props) {
super(props);
var self = this;
this.state = {
fonts: this.props.fontStore.fonts,
content: ''
};
client.getEntries({
'content_type': 'page',
'fields.title': 'Home'
})
.then(function (entries) {
var content = _.get(entries, 'items[0].fields.content');
self.setState({ content });
})
.catch(function(error) {
console.error(error);
});
}
render() {
var fontItems = _.map(this.state.fonts, function(font, index) {
var link = '/karaoke/' + font.name;
return (
<li key={ index } style={{ backgroundColor: font.color }}>
<Link to={ link }>
<p>{ font.name }</p>
</Link>
</li>
);
});
return (
<div id="content">
<ul className={ styles.directory }>
{ fontItems }
</ul>
<div className={ styles['page-content'] } dangerouslySetInnerHTML={{__html: marked(this.state.content)}}>
</div>
</div>
);
}
}
|
Remove my dumb logging statement
|
Remove my dumb logging statement
|
JavaScript
|
mit
|
mhgbrown/typography-karaoke,mhgbrown/typography-karaoke
|
5d3474ab83dcf9931ee480fbe7d1119642e7355f
|
test/conf/karma-sauce.conf.js
|
test/conf/karma-sauce.conf.js
|
module.exports = function(config) {
var commonConfig = (require("./karma-common.conf"))(config);
var customLaunchers = {
sl_chrome: {
base: "SauceLabs",
browserName: "chrome",
platform: "Windows 8.1"
},
sl_firefox: {
base: "SauceLabs",
browserName: "firefox",
platform: "Windows 8.1"
},
sl_safari: {
base: "SauceLabs",
browserName: "safari",
platform: "OS X 10.10"
},
sl_ie_11: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows 8.1"
}
};
var options = {
reporters: ["verbose", "saucelabs"],
sauceLabs: {
testName: "Vivliostyle.js",
recordScreenshots: false,
startConnect: false, // Sauce Connect is started by Travis CI
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
},
captureTimeout: 120000,
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
singleRun: true
};
for (var key in commonConfig) {
if (commonConfig.hasOwnProperty(key)) {
options[key] = commonConfig[key];
}
}
config.set(options);
};
|
module.exports = function(config) {
var commonConfig = (require("./karma-common.conf"))(config);
var customLaunchers = {
sl_chrome: {
base: "SauceLabs",
browserName: "chrome",
platform: "Windows 8.1"
},
sl_firefox: {
base: "SauceLabs",
browserName: "firefox",
platform: "Windows 8.1",
version: "beta"
},
sl_safari: {
base: "SauceLabs",
browserName: "safari",
platform: "OS X 10.10"
},
sl_ie_11: {
base: "SauceLabs",
browserName: "internet explorer",
platform: "Windows 8.1"
}
};
var options = {
reporters: ["verbose", "saucelabs"],
sauceLabs: {
testName: "Vivliostyle.js",
recordScreenshots: false,
startConnect: false, // Sauce Connect is started by Travis CI
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
},
captureTimeout: 120000,
customLaunchers: customLaunchers,
browsers: Object.keys(customLaunchers),
singleRun: true
};
for (var key in commonConfig) {
if (commonConfig.hasOwnProperty(key)) {
options[key] = commonConfig[key];
}
}
config.set(options);
};
|
Use beta version of Firefox (supports vertical writing-mode) in tests on Sauce Labs
|
Use beta version of Firefox (supports vertical writing-mode) in tests on Sauce Labs
|
JavaScript
|
apache-2.0
|
kuad9/vivliostyle.js_study,vivliostyle/vivliostyle.js,nulltask/vivliostyle.js,vivliostyle/vivliostyle.js,kuad9/vivliostyle.js_study,vivliostyle/vivliostyle.js,nulltask/vivliostyle.js,kuad9/vivliostyle.js_study,nulltask/vivliostyle.js,vivliostyle/vivliostyle.js,kuad9/vivliostyle.js_study,nulltask/vivliostyle.js
|
f4c10acf35c802049cb59fec2af813766821c83f
|
src/String.js
|
src/String.js
|
/**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
/**
* To Upper
*
* toUpper converts its calling string to all uppercase characters
*
* @param {void}
* @return {String} returns an upperCase version of the calling string
*/
String.prototype.toUpper = function() {
// the 'this' keyword represents the string calling the function
return this.replace(/[a-z]/g, function(item, position, string) {
return String.fromCharCode(string.charCodeAt(position)-32);
});
};
String.prototype.toLower = function() {
// the 'this' keyword represents the string calling the function
return this.replace(/[A-Z]/g, function(item, position, string) {
return String.fromCharCode(string.charCodeAt(position)+32);
});
};
/**
* Uc First
*
* ucFirst capitalises the first character of its calling string
*
* @param {void}
* @return {String} returns the calling string with the first character
* capitalised
*/
String.prototype.ucFirst = function() {
return '';
};
|
/**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
/**
* To Upper
*
* toUpper converts its calling string to all uppercase characters
*
* @param {void}
* @return {String} returns an upperCase version of the calling string
*/
String.prototype.toUpper = function() {
// the 'this' keyword represents the string calling the function
return this.replace(/[a-z]/g, function(item, position, string) {
return String.fromCharCode(string.charCodeAt(position)-32);
});
};
String.prototype.toLower = function() {
// the 'this' keyword represents the string calling the function
return this.replace(/[A-Z]/g, function(item, position, string) {
return String.fromCharCode(string.charCodeAt(position)+32);
});
};
/**
* Uc First
*
* ucFirst capitalises the first character of its calling string
*
* @param {void}
* @return {String} returns the calling string with the first character
* capitalised
*/
String.prototype.ucFirst = function() {
return this.replace(/^[a-z]/g, function(item, position, string) {
return item.toUpper();
});
};
|
Implement ucFirst() to pass test
|
Implement ucFirst() to pass test
|
JavaScript
|
mit
|
andela-oolutola/string-class,andela-oolutola/string-class
|
242dff01801b14ea10df218d0d967e9afef2b144
|
app/assets/javascripts/displayMap.js
|
app/assets/javascripts/displayMap.js
|
function initMap() {
var map;
var $business_object;
var biz_loc_collection;
var i;
$business_object = $('#businesses').data('url');
biz_loc_collection = [];
for (i = 0; i < $business_object.length; ++i) {
biz_loc_collection.push({ lat: $business_object[i].latitude, lng: $business_object[i].longitude});
}
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: {lat: 47.6062, lng: -122.3321},
// center: should be the lat and long of leading biz
zoom: 12
});
for (i = 0; i < biz_loc_collection.length; ++i) {
marker = new google.maps.Marker({
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
position: biz_loc_collection[i]
});
marker.addListener('click', toggleBounce);
}
function toggleBounce() {
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
}
|
function initMap() {
var map;
var $business_object;
var biz_loc_collection;
var i;
$business_object = $('#businesses').data('url');
biz_loc_collection = [];
for (i = 0; i < $business_object.length; ++i) {
biz_loc_collection.push({ lat: $business_object[i].latitude, lng: $business_object[i].longitude});
}
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: {lat: 47.6062, lng: -122.3321},
// center: should be the lat and long of leading biz
zoom: 12
});
biz_loc_collection.forEach(addMarker);
function addMarker(business){
var marker;
marker = new google.maps.Marker({
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
position: business
});
marker.addListener('click', toggleBounce);
}
function toggleBounce() {
var marker;
marker = this;
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
setTimeout(function(){ marker.setAnimation(null); }, 750);
}
}
}
|
Fix the marker bouncing function.
|
Fix the marker bouncing function.
|
JavaScript
|
mit
|
DBC-Huskies/flight-app,DBC-Huskies/flight-app,DBC-Huskies/flight-app
|
a59413dc688077d0f1c4d8ae26fce464b837faa6
|
src/scripts/scripts.js
|
src/scripts/scripts.js
|
$(document).foundation();
$('a.disabled').click(function(e) {
e.preventDefault();
});
// Show shadow when content slides under the page header
$(document).ready(function() {
var $content = $('#site-body .content');
var $header = $('#page-head .inner');
if ($header.length > 0) {
$content.css('margin-top', $header.outerHeight());
$(document).resize(function() {
$content.css('margin-top', $header.outerHeight());
});
$(window).scroll(function() {
if($(this).scrollTop() > 0) {
$header.addClass('overlay');
}
else {
$header.removeClass('overlay');
}
});
}
});
|
$(document).foundation();
$('a.disabled').click(function(e) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
});
// Show shadow when content slides under the page header
$(document).ready(function() {
var $content = $('#site-body .content');
var $header = $('#page-head .inner');
if ($header.length > 0) {
$content.css('margin-top', $header.outerHeight());
$(document).resize(function() {
$content.css('margin-top', $header.outerHeight());
});
$(window).scroll(function() {
if($(this).scrollTop() > 0) {
$header.addClass('overlay');
}
else {
$header.removeClass('overlay');
}
});
}
// ================================================================
// Fake form submits and confirmation buttons.
//
// To create a confirmation button add ( data-confirm-action="message" )
// to the button. This will trigger a confirmation box. If the answer
// is affirmative the button action will fire.
//
// For fake submit buttons add ( data-trigger-submit="id" ) and replace
// id with the id of the submit button.
// ================================================================
$('[data-confirm-action]').click(function(e) {
var message = $(this).attr('data-confirm-action');
var confirm = window.confirm(message);
if (!confirm) {
e.preventDefault();
e.stopImmediatePropagation();
}
});
$('[data-trigger-submit]').click(function(e) {
e.preventDefault();
var id = $(this).attr('data-trigger-submit');
$('#' + id).click();
});
});
|
Implement fake form submits and confirmation buttons
|
Implement fake form submits and confirmation buttons
|
JavaScript
|
bsd-3-clause
|
flipside-org/aw-datacollection,flipside-org/aw-datacollection,flipside-org/aw-datacollection
|
ba8371191ca468d1648e83324455d24a314725f8
|
src/portal.js
|
src/portal.js
|
import { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDom from 'react-dom';
class Portal extends Component {
componentWillMount() {
this.popup = document.createElement('div');
document.body.appendChild(this.popup);
this.renderLayer();
}
componentDidUpdate() {
this.renderLayer();
}
componentWillUnmount() {
ReactDom.unmountComponentAtNode(this.popup);
document.body.removeChild(this.popup);
}
renderLayer() {
ReactDom.unstable_renderSubtreeIntoContainer(this, this.props.children, this.popup);
}
render() {
return null;
}
}
Portal.propTypes = {
children: PropTypes.node, // eslint-disable-line
};
export default Portal;
|
import { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDom from 'react-dom';
const useCreatePortal = typeof ReactDom.unstable_createPortal === 'function';
class Portal extends Component {
componentWillMount() {
this.popup = document.createElement('div');
document.body.appendChild(this.popup);
this.renderLayer();
}
componentDidUpdate() {
this.renderLayer();
}
componentWillUnmount() {
if (!useCreatePortal) {
ReactDom.unmountComponentAtNode(this.popup);
}
document.body.removeChild(this.popup);
}
renderLayer() {
if (!useCreatePortal) {
ReactDom.unstable_renderSubtreeIntoContainer(this, this.props.children, this.popup);
}
}
render() {
if (useCreatePortal) {
return ReactDom.unstable_createPortal(this.props.children, this.popup);
}
return null;
}
}
Portal.propTypes = {
children: PropTypes.node, // eslint-disable-line
};
export default Portal;
|
Add support for new React Core (v16)
|
Add support for new React Core (v16)
Old react (v15) still working
|
JavaScript
|
mit
|
pradel/react-minimalist-portal
|
9cadbca18e044b0b20b7a3316c7007eb1540711b
|
test/builder/graphql/query.js
|
test/builder/graphql/query.js
|
import {parse, Source} from 'graphql';
import {createSpecBuilderClass} from './base';
import {RepositoryBuilder} from './repository';
import {PullRequestBuilder} from './pr';
class SearchResultItemBuilder {
static resolve() { return this; }
constructor(...args) {
this.args = args;
this._value = null;
}
bePullRequest(block = () => {}) {
const b = new PullRequestBuilder(...this.args);
block(b);
this._value = b.build();
}
build() {
return this._value;
}
}
const SearchResultBuilder = createSpecBuilderClass('SearchResultItemConnection', {
issueCount: {default: 0},
nodes: {linked: SearchResultItemBuilder, plural: true, singularName: 'node'},
});
const QueryBuilder = createSpecBuilderClass('Query', {
repository: {linked: RepositoryBuilder},
search: {linked: SearchResultBuilder},
});
export function queryBuilder(...nodes) {
return QueryBuilder.onFragmentQuery(nodes);
}
class RelayResponseBuilder extends QueryBuilder {
static onOperation(op) {
const doc = parse(new Source(op.text));
return this.onFullQuery(doc);
}
build() {
return {data: super.build()};
}
}
export function relayResponseBuilder(op) {
return RelayResponseBuilder.onOperation(op);
}
|
import {parse, Source} from 'graphql';
import {createSpecBuilderClass} from './base';
import {RepositoryBuilder} from './repository';
import {PullRequestBuilder} from './pr';
class SearchResultItemBuilder {
static resolve() { return this; }
constructor(...args) {
this.args = args;
this._value = null;
}
bePullRequest(block = () => {}) {
const b = new PullRequestBuilder(...this.args);
block(b);
this._value = b.build();
}
build() {
return this._value;
}
}
const SearchResultBuilder = createSpecBuilderClass('SearchResultItemConnection', {
issueCount: {default: 0},
nodes: {linked: SearchResultItemBuilder, plural: true, singularName: 'node'},
});
const QueryBuilder = createSpecBuilderClass('Query', {
repository: {linked: RepositoryBuilder},
search: {linked: SearchResultBuilder},
});
export function queryBuilder(...nodes) {
return QueryBuilder.onFragmentQuery(nodes);
}
class RelayResponseBuilder extends QueryBuilder {
static onOperation(op) {
const doc = parse(new Source(op.text));
return this.onFullQuery(doc);
}
constructor(...args) {
super(...args);
this._errors = [];
}
addError(string) {
this._errors.push(string);
return this;
}
build() {
if (this._errors.length > 0) {
return {data: null, errors: this._errors};
}
return {data: super.build()};
}
}
export function relayResponseBuilder(op) {
return RelayResponseBuilder.onOperation(op);
}
|
Build a GraphQL response with errors reported
|
Build a GraphQL response with errors reported
|
JavaScript
|
mit
|
atom/github,atom/github,atom/github
|
2561471eea20a9d1ca762d402ba538661cfd2f64
|
module/Connector.js
|
module/Connector.js
|
const mysql = require('mysql')
const qBuilder = require('./QueryBuilder')
let query = ''
let params = []
module.exports = (dbSetting) => {
let connection = mysql.createConnection({
host: dbSetting.hostname,
user: dbSetting.username,
password: dbSetting.password,
database: dbSetting.database
})
connection.connect()
return {
makeQuery: () => {
return qBuilder
},
prepare: () => {
query = qBuilder.prepare()
},
setParameters: (params) => {
qBuilder.setParameters(params)
},
getParameters: () => {
params = qBuilder.getParameters()
},
execute: () => {
// connection.query(query)
},
get: () => {
}
}
}
|
const mysql = require('mysql')
const qBuilder = require('./QueryBuilder')
let _query = ''
let _params = []
module.exports = (dbSetting) => {
let connection = mysql.createConnection({
host: dbSetting.hostname,
user: dbSetting.username,
password: dbSetting.password,
database: dbSetting.database
})
return {
makeQuery: () => {
return qBuilder
},
prepare: () => {
_query = qBuilder.prepare()
},
setParameters: (params) => {
_params = params
qBuilder.setParameters(params)
},
getParameters: () => {
_params = qBuilder.getParameters()
},
execute: () => {
// connection.query(_query)
},
get: () => {
},
connectToDatabase: () => {
connection.connect()
},
endConnection: () => {
connection.end()
}
}
}
|
Add few functions and connect to query builder
|
Add few functions and connect to query builder
|
JavaScript
|
mit
|
evelikov92/mysql-qbuilder
|
0f3c7f95b03b5e6b3b731158185ae12078c9b606
|
web/test/bootstrap.test.js
|
web/test/bootstrap.test.js
|
var Sails = require('sails');
before(function (done) {
Sails.lift({
//config
}, function (err, sails) {
if (err) return done(err);
// load fixtures, etc
done (err, sails);
});
});
after(function (done) {
Sails.lower(done);
});
|
var Sails = require('sails');
before(function (done) {
this.timeout(5 * 1000);
Sails.lift({
//config
}, function (err, sails) {
if (err) return done(err);
// load fixtures, etc
done (err, sails);
});
});
after(function (done) {
Sails.lower(done);
});
|
Allow sails lift to take longer than 2 seconds
|
Allow sails lift to take longer than 2 seconds
|
JavaScript
|
apache-2.0
|
section-io-gists/vclfiddle,vclfiddle/vclfiddle,vclfiddle/vclfiddle,vclfiddle/vclfiddle,vclfiddle/vclfiddle,section-io-gists/vclfiddle,section-io-gists/vclfiddle,section-io-gists/vclfiddle
|
d2d68cb5ff8982f897b2805f57b73724def65208
|
feder/main/static/init_map.js
|
feder/main/static/init_map.js
|
(function($) {
$("#pl_map path").on("click", function() {
document.location.pathname = $(this).data("href")
});
$('[data-toggle="tooltip"]').tooltip({'container': 'body'});
})(jQuery);
|
(function($) {
$("#pl_map path").on("click", function() {
document.location.pathname = $(this).data("href")
});
})(jQuery);
|
Remove unused tooltip initialization code
|
Remove unused tooltip initialization code
|
JavaScript
|
mit
|
watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder
|
63d2829207a9968412fb332371774f3c1ca00601
|
src/config.js
|
src/config.js
|
var _ = require('underscore');
var fs = require('fs');
function Config(filePath) {
var data = this.parse(filePath);
this.validate(data);
return Object.freeze(data);
}
Config.prototype.parse = function(filePath) {
var content = fs.readFileSync(filePath, {
encoding: 'utf8'
});
return JSON.parse(content);
};
Config.prototype.validate = function(data) {
var pulsarApi = data.pulsarApi;
if (!pulsarApi) {
throw new Error('Define `pulsarApi` config options');
}
this.validatePulsarApiInstance(pulsarApi, 'pulsarApi');
return _.each(pulsarApi.auxiliary, (function(_this) {
return function(api, apiName) {
if (!/^\w+\/\w+$/i.test(apiName)) {
throw new Error("Wrong pulsarApi auxiliary API name: '" + apiName + "'. The acceptable format is: [{application}/{environment}].");
}
return _this.validatePulsarApiInstance(api, apiName);
};
})(this));
};
Config.prototype.validatePulsarApiInstance = function(api, apiName) {
if (!api.url) {
throw new Error("Define `" + apiName + ".url` in the config");
}
};
module.exports = Config;
|
var _ = require('underscore');
var fs = require('fs');
/**
* @param {String|Object} filePath. If param is a String then it is treated as a file path to a config file.
* If param is an Object then it is treated as a parsed config file.
* @constructor
*/
function Config(filePath) {
var data;
if (_.isObject(filePath)) {
data = filePath;
} else {
data = this.parse(filePath);
}
this.validate(data);
return Object.freeze(data);
}
Config.prototype.parse = function(filePath) {
var content = fs.readFileSync(filePath, {
encoding: 'utf8'
});
return JSON.parse(content);
};
Config.prototype.validate = function(data) {
var pulsarApi = data.pulsarApi;
if (!pulsarApi) {
throw new Error('Define `pulsarApi` config options');
}
this.validatePulsarApiInstance(pulsarApi, 'pulsarApi');
return _.each(pulsarApi.auxiliary, (function(_this) {
return function(api, apiName) {
if (!/^\w+\/\w+$/i.test(apiName)) {
throw new Error("Wrong pulsarApi auxiliary API name: '" + apiName + "'. The acceptable format is: [{application}/{environment}].");
}
return _this.validatePulsarApiInstance(api, apiName);
};
})(this));
};
Config.prototype.validatePulsarApiInstance = function(api, apiName) {
if (!api.url) {
throw new Error("Define `" + apiName + ".url` in the config");
}
};
module.exports = Config;
|
Allow to pass hash instead of filepath to Config.
|
Allow to pass hash instead of filepath to Config.
|
JavaScript
|
mit
|
vogdb/pulsar-rest-api-client-node,cargomedia/pulsar-rest-api-client-node
|
5609d591ab892348b17f0bccef800dcd46ca431f
|
test/index.js
|
test/index.js
|
GLOBAL.projRequire = function (module) {
return require('../' + module);
};
|
GLOBAL.projRequire = function (module) {
return require('../' + module);
};
const log = projRequire('lib');
const tc = require('test-console');
const test = require('tape');
|
Add imports to test suite
|
Add imports to test suite
|
JavaScript
|
mit
|
cuvva/cuvva-log-sentry-node,TheTree/branch,TheTree/branch,TheTree/branch
|
c50035bb85a86aa7adb292ef74385388c391912c
|
test/index.js
|
test/index.js
|
require('./unit/index');
require('./test_multiple_payloads');
require('./test_misc');
require('./test_loop');
require('./test_capture');
require('./test_arrivals');
require('./test_reuse');
require('./test_loop');
require('./test_probability');
require('./test_if');
//require('./test_worker_http');
//require('./test_environments.js');
//require('./test_think');
//require('./test_tls');
|
require('./unit/index');
require('./test_multiple_payloads');
require('./test_misc');
require('./test_loop');
require('./test_capture');
require('./test_arrivals');
require('./test_reuse');
require('./test_loop');
require('./test_probability');
require('./test_if');
require('./ws/test_options');
//require('./test_worker_http');
//require('./test_environments.js');
//require('./test_think');
//require('./test_tls');
|
Include WS TLS test in the test suite
|
Include WS TLS test in the test suite
|
JavaScript
|
mpl-2.0
|
hassy/artillery,erikerikson/artillery-core,shoreditch-ops/artillery-core,shoreditch-ops/artillery,hassy/artillery-core,erikerikson/artillery-core,shoreditch-ops/artillery-core,shoreditch-ops/artillery,hassy/artillery,shoreditch-ops/artillery,hassy/artillery-core,hassy/artillery
|
58b4a325f06e178c398d96513f5ac7bd69ad0b1e
|
src/export.js
|
src/export.js
|
'use strict'
/**
* @class Elastic
*/
var Elastic = {
klass : klass,
domain: {
Layout : LayoutDomain,
View : ViewDomain,
Compontnt: ComponentDomain
},
exception: {
Runtime : RuntimeException,
Logic : LogicException
},
util: {
History : History,
Router : Router,
Storage : Storage,
Validator: Validator
},
trait: {
AsyncCallback: AsyncCallbackTrait,
Observable : ObservableTrait
}
};
// for RequireJS
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
window.define(function() {
return Elastic;
});
}
// for Node.js & browserify
else if (typeof module == 'object' && module &&
typeof exports == 'object' && exports &&
module.exports == exports
) {
module.exports = Elastic;
}
// for Browser
else {
window.Elastic = Elastic;
}
|
'use strict'
/**
* @class Elastic
*/
var Elastic = {
// like OOP
klass : klass,
// shorthand
Layout : LayoutDomain,
View : ViewDomain,
Component: ComponentDomain,
// classes
domain: {
Layout : LayoutDomain,
View : ViewDomain,
Compontnt: ComponentDomain
},
exception: {
Runtime : RuntimeException,
Logic : LogicException
},
util: {
History : History,
Router : Router,
Storage : Storage,
Validator: Validator
},
trait: {
AsyncCallback: AsyncCallbackTrait,
Observable : ObservableTrait
}
};
// for RequireJS
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
window.define(function() {
return Elastic;
});
}
// for Node.js & browserify
else if (typeof module == 'object' && module &&
typeof exports == 'object' && exports &&
module.exports == exports
) {
module.exports = Elastic;
}
// for Browser
else {
window.Elastic = Elastic;
}
|
Add Domain class's shorthand name
|
Add Domain class's shorthand name
|
JavaScript
|
mit
|
ahomu/Elastic
|
8b6b89e438c963ed0f3cb563cdfd60b6c0d0a7e0
|
shared/util/set-notifications.js
|
shared/util/set-notifications.js
|
/* @flow */
import engine from '../engine'
import {notifyCtlSetNotificationsRpc} from '../constants/types/flow-types'
type NotificationChannels = {
session?: true,
users?: true,
kbfs?: true,
tracking?: true,
favorites?: true,
paperkeys?: true,
keyfamily?: true,
service?: true,
chat?: true,
}
let channelsSet = {}
export default function (channels: NotificationChannels): Promise<void> {
return new Promise((resolve, reject) => {
channelsSet = {...channelsSet, ...channels}
const toSend = {
session: !!channelsSet.session,
users: !!channelsSet.users,
kbfs: !!channelsSet.kbfs,
tracking: !!channelsSet.tracking,
favorites: !!channelsSet.favorites,
paperkeys: !!channelsSet.paperkeys,
keyfamily: !!channelsSet.keyfamily,
service: !!channelsSet.service,
app: !!channelsSet.app,
chat: !!channelsSet.chat,
}
engine.listenOnConnect('setNotifications', () => {
notifyCtlSetNotificationsRpc({
param: {channels: toSend},
callback: (error, response) => {
if (error != null) {
console.warn('error in toggling notifications: ', error)
reject(error)
} else {
resolve()
}
},
})
})
})
}
|
/* @flow */
import engine from '../engine'
import {notifyCtlSetNotificationsRpc} from '../constants/types/flow-types'
type NotificationChannels = {
chat?: true,
favorites?: true,
kbfs?: true,
keyfamily?: true,
paperkeys?: true,
pgp?: true,
service?: true,
session?: true,
tracking?: true,
users?: true,
}
let channelsSet = {}
export default function (channels: NotificationChannels): Promise<void> {
return new Promise((resolve, reject) => {
channelsSet = {...channelsSet, ...channels}
const toSend = {
app: !!channelsSet.app,
chat: !!channelsSet.chat,
favorites: !!channelsSet.favorites,
kbfs: !!channelsSet.kbfs,
keyfamily: !!channelsSet.keyfamily,
paperkeys: !!channelsSet.paperkeys,
pgp: !!channelsSet.pgp,
service: !!channelsSet.service,
session: !!channelsSet.session,
tracking: !!channelsSet.tracking,
users: !!channelsSet.users,
}
engine.listenOnConnect('setNotifications', () => {
notifyCtlSetNotificationsRpc({
param: {channels: toSend},
callback: (error, response) => {
if (error != null) {
console.warn('error in toggling notifications: ', error)
reject(error)
} else {
resolve()
}
},
})
})
})
}
|
Add pgp to notification channels
|
Add pgp to notification channels
|
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
|
66b31b6659968968d3354fb5d114c77b72aac6af
|
test/mouse.js
|
test/mouse.js
|
var test = require('tape');
var robot = require('..');
var lastKnownPos, currentPos;
test('Get the initial mouse position.', function(t)
{
t.plan(3);
t.ok(lastKnownPos = robot.getMousePos(), 'successfully retrieved mouse position.');
t.ok(lastKnownPos.x !== undefined, 'mousepos.x is a valid value.');
t.ok(lastKnownPos.y !== undefined, 'mousepos.y is a valid value.');
});
test('Move the mouse.', function(t)
{
t.plan(3);
lastKnownPos = robot.moveMouse(0, 0);
t.ok(robot.moveMouse(100, 100), 'successfully moved the mouse.');
currentPos = robot.getMousePos();
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
t.ok(currentPos.y === 100, 'mousepos.y is correct.');
});
|
var test = require('tape');
var robot = require('..');
var lastKnownPos, currentPos;
//Increase delay to help test reliability.
robot.setMouseDelay(100);
test('Get the initial mouse position.', function(t)
{
t.plan(3);
t.ok(lastKnownPos = robot.getMousePos(), 'successfully retrieved mouse position.');
t.ok(lastKnownPos.x !== undefined, 'mousepos.x is a valid value.');
t.ok(lastKnownPos.y !== undefined, 'mousepos.y is a valid value.');
});
test('Move the mouse.', function(t)
{
t.plan(3);
lastKnownPos = robot.moveMouse(0, 0);
t.ok(robot.moveMouse(100, 100), 'successfully moved the mouse.');
currentPos = robot.getMousePos();
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
t.ok(currentPos.y === 100, 'mousepos.y is correct.');
});
|
Increase delay to help test reliability.
|
Increase delay to help test reliability.
|
JavaScript
|
mit
|
hristoterezov/robotjs,BHamrick1/robotjs,BHamrick1/robotjs,hristoterezov/robotjs,hristoterezov/robotjs,hristoterezov/robotjs,octalmage/robotjs,BHamrick1/robotjs,octalmage/robotjs,BHamrick1/robotjs,octalmage/robotjs,octalmage/robotjs
|
932c3d27364eb4cfb09189f90afb92c8bfeaa07c
|
src/server.js
|
src/server.js
|
/*
* Initialize the Restify server.
*/
var restify = require('restify');
var config = require('./config');
var routes = require('./routes');
var log = require('./logging').getLogger();
exports.create = function () {
var server = restify.createServer();
server.pre(restify.pre.sanitizePath());
server.name = config.info.name;
server.use(function (req, res, next) {
log.verbose(req.method + ' ' + req.url);
next();
});
server.use(restify.fullResponse());
server.on('uncaughtException', function (req, res, route, err) {
log.error({
statusCode: err.statusCode || 500,
requestURL: req.url,
stack: err.stack,
error: err.message,
message: 'Uncaught exception'
});
res.send(err);
});
routes.loadRoutes(server);
return server;
};
|
/*
* Initialize the Restify server.
*/
var restify = require('restify');
var config = require('./config');
var routes = require('./routes');
var log = require('./logging').getLogger();
exports.create = function () {
var server = restify.createServer();
server.server.setTimeout(600000);
server.pre(restify.pre.sanitizePath());
server.name = config.info.name;
server.use(function (req, res, next) {
log.verbose(req.method + ' ' + req.url);
next();
});
server.use(restify.fullResponse());
server.on('uncaughtException', function (req, res, route, err) {
log.error({
statusCode: err.statusCode || 500,
requestURL: req.url,
stack: err.stack,
error: err.message,
message: 'Uncaught exception'
});
res.send(err);
});
routes.loadRoutes(server);
return server;
};
|
Set a nice, generous timeout on requests.
|
Set a nice, generous timeout on requests.
|
JavaScript
|
mit
|
deconst/content-service,deconst/content-service
|
86f7ec4efb24be276590df7c2304065a1b81027a
|
lib/response.js
|
lib/response.js
|
"use strict";
var Response = function(error, res) {
res = res || {};
this.raw = res.body;
this.headers = res.headers;
this.status = res.statusCode || 500;
if (error) {
this._error = { error: (res.body || "Unknown error: empty response") };
} else {
if (res.headers["content-type"].includes("application/json")) {
try {
this.json = res.body ? JSON.parse(res.body) : {};
} catch (ex) {
this._error = { error: ex.toString() };
}
}
}
};
Response.prototype.error = function() {
if (!this._error && this.isError()) {
this._error = this.json || {};
}
return this._error;
};
Response.prototype.isError = function() {
return (this._error || this.isClientError() || this.isServerError());
};
Response.prototype.isSuccess = function() {
return !this.isError();
};
Response.prototype.isClientError = function() {
return this.status >= 400 && this.status < 500;
};
Response.prototype.isServerError = function() {
return this.status >= 500;
};
module.exports = Response;
|
"use strict";
var Response = function(error, res) {
res = res || {};
this.raw = res.body;
this.headers = res.headers;
this.status = res.statusCode || 500;
if (error) {
this._error = { error: (res.body || "Unknown error: empty response") };
} else {
if (res.headers["content-type"].startsWith("application/json")) {
try {
this.json = res.body ? JSON.parse(res.body) : {};
} catch (ex) {
this._error = { error: ex.toString() };
}
}
}
};
Response.prototype.error = function() {
if (!this._error && this.isError()) {
this._error = this.json || {};
}
return this._error;
};
Response.prototype.isError = function() {
return (this._error || this.isClientError() || this.isServerError());
};
Response.prototype.isSuccess = function() {
return !this.isError();
};
Response.prototype.isClientError = function() {
return this.status >= 400 && this.status < 500;
};
Response.prototype.isServerError = function() {
return this.status >= 500;
};
module.exports = Response;
|
Use String.prototype.startsWith() instead of includes() for checking the content type
|
Use String.prototype.startsWith() instead of includes() for checking the content type
|
JavaScript
|
mit
|
skazska/m2x-nodejs,attm2x/m2x-nodejs
|
578355c255e533622462c49d2a10b5e2fb5dc029
|
fetch-browser.js
|
fetch-browser.js
|
(function () {
'use strict';
function fetchPonyfill(options) {
var Promise = options && options.Promise || self.Promise;
var XMLHttpRequest = options && options.XMLHttpRequest || self.XMLHttpRequest;
var global = self;
return (function () {
var self = Object.create(global, {
fetch: {
value: undefined,
writable: true
}
});
// {{whatwgFetch}}
return {
fetch: self.fetch,
Headers: self.Headers,
Request: self.Request,
Response: self.Response
};
}());
}
if (typeof define === 'function' && define.amd) {
define(function () {
return fetchPonyfill;
});
} else if (typeof exports === 'object') {
module.exports = fetchPonyfill;
} else {
self.fetchPonyfill = fetchPonyfill;
}
}());
|
(function (self) {
'use strict';
function fetchPonyfill(options) {
var Promise = options && options.Promise || self.Promise;
var XMLHttpRequest = options && options.XMLHttpRequest || self.XMLHttpRequest;
var global = self;
return (function () {
var self = Object.create(global, {
fetch: {
value: undefined,
writable: true
}
});
// {{whatwgFetch}}
return {
fetch: self.fetch,
Headers: self.Headers,
Request: self.Request,
Response: self.Response
};
}());
}
if (typeof define === 'function' && define.amd) {
define(function () {
return fetchPonyfill;
});
} else if (typeof exports === 'object') {
module.exports = fetchPonyfill;
} else {
self.fetchPonyfill = fetchPonyfill;
}
}(typeof self === 'undefined' ? this : self));
|
Allow passing of self rather than just globally uses it
|
Allow passing of self rather than just globally uses it
|
JavaScript
|
mit
|
qubyte/fetch-ponyfill,qubyte/fetch-ponyfill
|
f36b511e9b9fc339a11c8c8acc758dc05009622c
|
lib/database.js
|
lib/database.js
|
var log4js = require('log4js');
var logger = log4js.getLogger('BOT-LOG');
function updateUserList(dyDb, userId){
}
module.exports = {
updateUserList:updateUserList
}
|
var log4js = require('log4js');
var logger = log4js.getLogger('BOT-LOG');
function updateUserList(dyDb, userId, cb){
dydb.listTables({}, function(err, result){
if(err){
logger.error(err);
cb(err, null);
return;
}
});
}
module.exports = {
updateUserList:updateUserList
}
|
Add listTables part into updateUserList
|
Add listTables part into updateUserList
|
JavaScript
|
mit
|
dollars0427/mtrupdate-bot
|
ce7d42edbf76e334eccc0897ed2283fbd0feb2d5
|
client/templates/posts/posts_list.js
|
client/templates/posts/posts_list.js
|
Template.postsList.helpers({
posts: function() {
return Posts.find();
}
});
|
Template.postsList.helpers({
posts: function() {
return Posts.find({}, {sort: {submitted: -1}});
}
});
|
Sort posts by submitted timestamp.
|
Sort posts by submitted timestamp.
|
JavaScript
|
mit
|
mtchllbrrn/microscope,mtchllbrrn/microscope
|
5fd1908efa1add699d7a5169c8f05a64ec43f27b
|
src/global-components/info.js
|
src/global-components/info.js
|
let Vue = require('../../node_modules/vue/dist/vue.min');
let template = '<div style="border-radius: 4px; margin:5px; color: #31708f;background-color: #d9edf7; border: 1px solid #bce8f1;text-align: center">' +
'<p>{{ message }}</p>' +
'</div>';
Vue.component('info', {
template: template,
props: ['message']
});
|
let Vue = require('../../node_modules/vue/dist/vue.min');
let style = 'border-radius: 4px; margin:5px; color: #31708f;background-color: #d9edf7; border: 1px solid #bce8f1;text-align: center';
let template = `
<div style="${style}">
<p>{{ message }}</p>
</div>`;
Vue.component('info', {
template: template,
props: ['message']
});
|
Make use of ecma 6 template
|
Make use of ecma 6 template
|
JavaScript
|
mit
|
funcoding/vuetron-mail,funcoding/vuetron-mail
|
9a3be57d1ea6a2cd88a6e0f029405be65bb305e1
|
src/jsturbo-date.js
|
src/jsturbo-date.js
|
import str from '../src/jsturbo-string'
function toStringDMY (date) {
return [
str.pad(date.getDate().toString(), 2),
str.pad((date.getMonth() + 1).toString(), 2),
str.pad(date.getFullYear().toString(), 4)
].join('/')
};
function isToday (date) {
return toStringDMY(date) === toStringDMY(new Date())
};
function fromStringDMY (stringDdMmYyyy) {
stringDdMmYyyy = stringDdMmYyyy.replace(/\D/g, '')
var day = parseInt(stringDdMmYyyy.substr(0, 2))
var month = parseInt(stringDdMmYyyy.substr(2, 2)) - 1
var year = parseInt(stringDdMmYyyy.substr(4, 4))
return new Date(year, month, day, 0, 0, 0, 0)
};
const mainExport = {
toStringDMY: toStringDMY,
isToday: isToday,
fromStringDMY: fromStringDMY
}
export default mainExport
module.exports = mainExport // for CommonJS compatibility
|
import str from '../src/jsturbo-string'
/**
* Converts a date to string in the format 'dd/MM/yyyy'
* @param {Date} Date object
* @return {string}
*/
function toStringDMY (date) {
return [
str.pad(date.getDate().toString(), 2),
str.pad((date.getMonth() + 1).toString(), 2),
str.pad(date.getFullYear().toString(), 4)
].join('/')
};
/**
* Check if a date object represents the current day
* @param {Date}
* @return {Boolean}
*/
function isToday (date) {
return toStringDMY(date) === toStringDMY(new Date())
};
/**
* Create a Date object based on a string in the format 'dd/MM/yyyy'
* @param {string} string with a date in the format 'dd/MM/yyyy'
* @return {Date}
*/
function fromStringDMY (stringDdMmYyyy) {
stringDdMmYyyy = stringDdMmYyyy.replace(/\D/g, '')
var day = parseInt(stringDdMmYyyy.substr(0, 2))
var month = parseInt(stringDdMmYyyy.substr(2, 2)) - 1
var year = parseInt(stringDdMmYyyy.substr(4, 4))
return new Date(year, month, day, 0, 0, 0, 0)
};
const mainExport = {
toStringDMY: toStringDMY,
isToday: isToday,
fromStringDMY: fromStringDMY
}
export default mainExport
module.exports = mainExport // for CommonJS compatibility
|
Add documentation to the date module
|
docs(date): Add documentation to the date module
|
JavaScript
|
mit
|
eduardoportilho/jsturbo
|
cf0542fe9895207d9ce9f68b458aba49fabfd9f0
|
app/assets/javascripts/application/codemirror-builder.js
|
app/assets/javascripts/application/codemirror-builder.js
|
var mumuki = mumuki || {};
(function (mumuki) {
function CodeMirrorBuilder(textarea) {
this.textarea = textarea;
this.$textarea = $(textarea);
}
CodeMirrorBuilder.prototype = {
setupEditor: function () {
this.editor = CodeMirror.fromTextArea(this.textarea);
},
setupLanguage: function () {
var language = $(this.textarea).data('editor-language');
if (language === 'dynamic') {
mumuki.page.dynamicEditors.push(this.editor);
} else {
mumuki.editor.setOption('mode', language);
}
},
setupPlaceholder: function (text) {
this.editor.setOption('placeholder', text);
},
setupOptions: function (minLines) {
this.editor.setOption('tabSize', 2);
this.editor.setOption('indentWithTabs', true);
this.editor.setOption('lineWrapping', true);
this.editor.setOption('lineNumbers', true);
this.editor.setOption('showCursorWhenSelecting', true);
this.editor.setOption('lineWiseCopyCut', true);
this.editor.setOption('cursorHeight', 1);
},
build: function () {
return this.editor;
}
};
mumuki.editor = mumuki.editor || {};
mumuki.editor.CodeMirrorBuilder = CodeMirrorBuilder;
}(mumuki));
|
var mumuki = mumuki || {};
(function (mumuki) {
function CodeMirrorBuilder(textarea) {
this.textarea = textarea;
this.$textarea = $(textarea);
}
CodeMirrorBuilder.prototype = {
setupEditor: function () {
this.editor = CodeMirror.fromTextArea(this.textarea);
},
setupLanguage: function () {
var language = this.$textarea.data('editor-language');
if (language === 'dynamic') {
mumuki.page.dynamicEditors.push(this.editor);
} else {
mumuki.editor.setOption('mode', language);
}
},
setupPlaceholder: function (text) {
this.editor.setOption('placeholder', text);
},
setupOptions: function (minLines) {
this.editor.setOption('tabSize', 2);
this.editor.setOption('lineWrapping', true);
this.editor.setOption('lineNumbers', true);
this.editor.setOption('showCursorWhenSelecting', true);
this.editor.setOption('lineWiseCopyCut', true);
this.editor.setOption('cursorHeight', 1);
},
build: function () {
return this.editor;
}
};
mumuki.editor = mumuki.editor || {};
mumuki.editor.CodeMirrorBuilder = CodeMirrorBuilder;
}(mumuki));
|
Remove indent with spaces option
|
Remove indent with spaces option
|
JavaScript
|
agpl-3.0
|
mumuki/mumuki-laboratory,mumuki/mumuki-laboratory,mumuki/mumuki-laboratory,mumuki/mumuki-laboratory
|
3061897a2508c1226dcd1a153542539cdf17fdaa
|
src/routes/index.js
|
src/routes/index.js
|
import App from '../containers/App'
function createRedirect(from, to) {
return {
path: from,
onEnter(nextState, replaceState) {
replaceState(nextState, to)
},
}
}
const routes = [
createRedirect('/', '/explore'),
{
path: '/',
component: App,
// order matters, so less specific routes should go at the bottom
childRoutes: [
require('./post_detail'),
...require('./authentication'),
...require('./discover'),
...require('./streams'),
require('./notifications'),
...require('./settings'),
...require('./invitations'),
createRedirect('onboarding', '/onboarding/communities'),
require('./onboarding'),
...require('./search'),
require('./user_detail'),
],
},
]
export default routes
|
import App from '../containers/App'
function createRedirect(from, to) {
return {
path: from,
onEnter(nextState, replaceState) {
replaceState(nextState, to)
},
}
}
const routes = [
createRedirect('/', '/explore'),
{
path: '/',
component: App,
// order matters, so less specific routes should go at the bottom
childRoutes: [
require('./post_detail'),
...require('./authentication'),
...require('./discover'),
...require('./streams'),
require('./notifications'),
...require('./invitations'),
createRedirect('onboarding', '/onboarding/communities'),
require('./onboarding'),
...require('./search'),
require('./user_detail'),
],
},
]
export default routes
|
Remove settings from the routes for the moment
|
Remove settings from the routes for the moment
|
JavaScript
|
mit
|
ello/webapp,ello/webapp,ello/webapp
|
3b850511df407a35f803118ca14c78b7e240cb8f
|
src/routes/index.js
|
src/routes/index.js
|
var express = require('express');
var os = require('os');
var router = express.Router();
var ifaces = os.networkInterfaces();
var localAddress = '';
var environment = process.env.NODE_ENV === 'production' ? 'production' : 'development';
var environmentNotice = environment === 'production' ? '' : environment + ' environment';
Object.keys(ifaces).forEach(function (ifname) {
var alias = 0;
ifaces[ifname].forEach(function (iface) {
if ('IPv4' !== iface.family || iface.internal !== false) {
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
return;
}
localAddress = iface.address;
});
});
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', {
title: 'Accumulator',
environment: environment,
environmentNotice: environmentNotice,
localAddress: localAddress
});
});
module.exports = router;
|
var express = require('express');
var os = require('os');
var router = express.Router();
var ifaces = os.networkInterfaces();
var localAddress = '';
var environment = process.env.NODE_ENV === 'production' ? 'production' : 'development';
var environmentNotice = environment === 'production' ? '' : environment + ' environment';
Object.keys(ifaces).forEach(function (ifname) {
var alias = 0;
ifaces[ifname].forEach(function (iface) {
if ('IPv4' !== iface.family || iface.internal !== false || localAddress !== '') {
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
return;
}
localAddress = iface.address;
});
});
/* GET home page. */
router.get('/', function (req, res, next) {
res.render('index', {
title: 'Accumulator',
environment: environment,
environmentNotice: environmentNotice,
localAddress: localAddress
});
});
module.exports = router;
|
Select first network interface IP for localAddress display
|
Select first network interface IP for localAddress display
|
JavaScript
|
mit
|
lrakai/docker-software-delivery,lrakai/docker-software-delivery,lrakai/docker-software-delivery
|
daa5604ff4397caf02158634803d9a50e3b179a9
|
public/themes/lightweight/controllers/cart/checkout.as.guest.controller.js
|
public/themes/lightweight/controllers/cart/checkout.as.guest.controller.js
|
'use strict';
angular.module('lightweight').controller('CheckoutAsGuestController',
['$scope', '$rootScope', '$location', '$state', '$timeout', '$stateParams', '$window', 'Global', 'UserService','CartService',
function($scope, $rootScope, $location, $state, $timeout, $stateParams, $window, Global, UserService, CartService) {
$scope.global = Global;
var returnState = $stateParams.returnUrl;
$scope.userCredential = {};
$scope.items = [];
CartService.getItemsWithoutPopulate()
.$promise
.then(function (items) {
$scope.items = items;
});
$scope.loginFromCheckout = function() {
if($scope.items && $scope.items.length) {
$scope.user.items = $scope.items;
UserService.signInUserWithGuestUserItems($scope.user)
.$promise
.then(function(user) {
$scope.global.user = user;
//$window.location.reload();
$rootScope.$emit('cart:updated');
$timeout(function() {
$state.go(returnState, {}, { reload: true });
});
}, function(error) {
console.log('error== ',error);
$scope.errorLogin = error.data.message;
});
}
};
$scope.checkoutAsGuest = function() {
$state.go(returnState);
};
}
]);
|
'use strict';
angular.module('lightweight').controller('CheckoutAsGuestController',
['$scope', '$rootScope', '$location', '$state', '$timeout', '$stateParams', '$window', 'Global', 'UserService','CartService',
function($scope, $rootScope, $location, $state, $timeout, $stateParams, $window, Global, UserService, CartService) {
$scope.global = Global;
var returnState = $stateParams.returnUrl;
$scope.userCredential = {};
$scope.items = [];
CartService.getItemsWithoutPopulate()
.$promise
.then(function (items) {
$scope.items = items;
});
$scope.loginFromCheckout = function() {
if($scope.items && $scope.items.length) {
$scope.user.items = $scope.items;
UserService.signInUserWithGuestUserItems($scope.user)
.$promise
.then(function(user) {
$rootScope.$emit('cart:updated');
$timeout(function() {
$scope.global.user = user;
$scope.global.isRegistered = true;
$state.go(returnState);
});
}, function(error) {
$scope.errorLogin = error.data.message;
});
}
};
$scope.checkoutAsGuest = function() {
$state.go(returnState);
};
}
]);
|
Update to set register user after logged in
|
Update to set register user after logged in
|
JavaScript
|
mit
|
shaishab/BS-Commerce,shaishab/BS-Commerce,shaishab/BS-Commerce
|
0c9680bfad90854bc47409466afd77c3f28f62d5
|
tests/docs.js
|
tests/docs.js
|
'use strict';
require('../examples/demo-only-stuff/docs');
var expect = require('chai').expect;
var sinon = require('sinon');
var stub = sinon.stub;
var utils = require('./helpers/utils');
var each = utils.each;
var any = utils.any;
var getContextStub = require('./helpers/get-context-stub');
var Canvas = require('../lib/index.js');
describe('docs', function () {
var element = document.createElement('canvas');
stub(element, 'getContext', getContextStub);
var canvas = new Canvas(element);
var docs = window.docs;
it('is a list of groups', function () {
expect(docs.length).to.be.above(1);
each(docs, function (value) {
expect(value.name).to.exist;
expect(value.methods).to.exist;
});
});
it('should contain all of the canvasimo methods (or aliases)', function () {
each(canvas, function (value, key) {
var anyGroupContainsTheMethod = any(docs, function (group) {
return any(group.methods, function (method) {
return method.name === key || method.alias === key;
});
});
expect(anyGroupContainsTheMethod).to.be.true;
});
});
});
|
'use strict';
require('../examples/demo-only-stuff/docs');
var expect = require('chai').expect;
var sinon = require('sinon');
var stub = sinon.stub;
var utils = require('./helpers/utils');
var each = utils.each;
var any = utils.any;
var getContextStub = require('./helpers/get-context-stub');
var Canvas = require('../lib/index.js');
describe('docs', function () {
var element = document.createElement('canvas');
stub(element, 'getContext', getContextStub);
var canvas = new Canvas(element);
var docs = window.docs;
it('is a list of groups', function () {
expect(docs.length).to.be.above(1);
each(docs, function (value) {
expect(value.name).to.exist;
expect(value.methods).to.exist;
});
});
it('should contain all of the canvasimo methods (or aliases)', function () {
each(canvas, function (value, key) {
var anyGroupContainsTheMethod = any(docs, function (group) {
return any(group.methods, function (method) {
return method.name === key || method.alias === key;
});
});
expect(anyGroupContainsTheMethod).to.be.true;
});
});
it('should have names and descriptions for all methods', function () {
each(docs, function (group) {
each(group.methods, function (method) {
expect(method.name).to.exist;
expect(method.description).to.exist;
expect(method.name.length).to.be.above(5);
expect(method.description.length).to.be.above(5);
});
});
});
});
|
Test that all methods have a name and description
|
Test that all methods have a name and description
|
JavaScript
|
mit
|
JakeSidSmith/canvasimo,JakeSidSmith/sensible-canvas-interface,JakeSidSmith/canvasimo
|
86d78236569bda8954e157576be7cbdd3078ded2
|
src/server/index.js
|
src/server/index.js
|
const DB = require('./Persistence/database');
require('dotenv').config();
const App = require('./app');
DB.init().then((db) => {
App(db).listen(3000);
});
|
const DB = require('./Persistence/database');
require('dotenv').config();
const App = require('./app');
const port = process.env.PORT || 3000;
DB.init().then((db) => {
App(db).listen(port, () => {
console.log(`Secure Drop running on port ${port}`);
});
});
|
Add support for port changing
|
Add support for port changing
|
JavaScript
|
mit
|
RossCasey/SecureDrop,RossCasey/SecureDrop
|
4a937b4779f1f8357a0da777846ce5e406222721
|
tasks/grunt-sass.js
|
tasks/grunt-sass.js
|
const path = require('path');
const fs = require('fs');
const sass = require('node-sass');
const { promisify } = require('util');
const mkdirp = require('mkdirp');
const renderAsPromised = promisify(sass.render);
const writeFileAsPromised = promisify(fs.writeFile);
const mkdirpAsPromised = promisify(mkdirp);
module.exports = function (grunt) {
grunt.registerMultiTask('sass', 'compile sass', function () {
let done = this.async(),
promises;
mkdirpAsPromised(path.dirname(this.data.dest))
.then(
Promise.all(this.filesSrc.map((file) =>
renderAsPromised({ file })
.then(({ css }) => writeFileAsPromised(this.data.dest, css)))
))
.then(() => {
grunt.log.ok(`Written ${this.data.dest}`);
done();
})
.catch(error => {
grunt.log.error(error);
done(false);
});
});
};
|
const path = require('path');
const fs = require('fs');
const sass = require('node-sass');
const { promisify } = require('util');
const mkdirp = require('mkdirp');
const renderAsPromised = promisify(sass.render);
const writeFileAsPromised = promisify(fs.writeFile);
const mkdirpAsPromised = promisify(mkdirp);
module.exports = function (grunt) {
grunt.registerMultiTask('sass', 'compile sass', function () {
let done = this.async(),
promises;
mkdirpAsPromised(path.dirname(this.data.dest))
.then(() => Promise.all(this.filesSrc.map((file) =>
renderAsPromised({ file })
.then(({ css }) => writeFileAsPromised(this.data.dest, css))
.then(() => grunt.log.ok(`Written ${this.data.dest}`))
)))
.then(done)
.catch(error => {
grunt.log.error(error);
done(false);
});
});
};
|
Fix grunt task on watch
|
Fix grunt task on watch
|
JavaScript
|
apache-2.0
|
stryker-mutator/stryker-mutator.github.io,stryker-mutator/stryker-mutator.github.io,stryker-mutator/stryker-mutator.github.io,stryker-mutator/stryker-mutator.github.io
|
a942a1e476879f298cb06b4fd14a213f212aa081
|
public/designs/templates/lefttopright/javascripts/template.js
|
public/designs/templates/lefttopright/javascripts/template.js
|
$(document).ready(function() {
alert("Yup, i'm here !");
});
|
$(document).ready(function() {
var box_4_height = $(".box-4").height();
// Make box-2(the most left one) stay align with box-4
$(".box-2").css("margin-top", "-"+box_4_height+"px");
});
|
Make box-2 stay align with box-4
|
Make box-2 stay align with box-4
Signed-off-by: Fabio Teixeira <a90b0aa793b4509973a022e6fee8cf8a263dd84e@gmail.com>
Signed-off-by: Thiago Ribeiro <25630c3dd4509f5915a846461794b51273be2039@hotmail.com>
|
JavaScript
|
agpl-3.0
|
larissa/noosfero,coletivoEITA/noosfero,hebertdougl/noosfero,coletivoEITA/noosfero,arthurmde/noosfero,coletivoEITA/noosfero-ecosol,AlessandroCaetano/noosfero,evandrojr/noosferogov,abner/noosfero,uniteddiversity/noosfero,tallysmartins/noosfero,uniteddiversity/noosfero,samasti/noosfero,CIRANDAS/noosfero-ecosol,vfcosta/noosfero,uniteddiversity/noosfero,vfcosta/noosfero,AlessandroCaetano/noosfero,AlessandroCaetano/noosfero,abner/noosfero,alexandreab/noosfero,coletivoEITA/noosfero-ecosol,alexandreab/noosfero,tallysmartins/noosfero,blogoosfero/noosfero,EcoAlternative/noosfero-ecosol,LuisBelo/tccnoosfero,evandrojr/noosferogov,larissa/noosfero,coletivoEITA/noosfero-ecosol,LuisBelo/tccnoosfero,marcosronaldo/noosfero,coletivoEITA/noosfero,abner/noosfero,AlessandroCaetano/noosfero,larissa/noosfero,hebertdougl/noosfero,alexandreab/noosfero,vfcosta/noosfero,samasti/noosfero,samasti/noosfero,AlessandroCaetano/noosfero,hebertdougl/noosfero,blogoosfero/noosfero,EcoAlternative/noosfero-ecosol,arthurmde/noosfero,larissa/noosfero,evandrojr/noosfero,abner/noosfero,marcosronaldo/noosfero,EcoAlternative/noosfero-ecosol,evandrojr/noosfero,coletivoEITA/noosfero-ecosol,EcoAlternative/noosfero-ecosol,samasti/noosfero,evandrojr/noosfero,blogoosfero/noosfero,tallysmartins/noosfero,marcosronaldo/noosfero,AlessandroCaetano/noosfero,macartur/noosfero,tallysmartins/noosfero,EcoAlternative/noosfero-ecosol,AlessandroCaetano/noosfero,arthurmde/noosfero,arthurmde/noosfero,abner/noosfero,samasti/noosfero,uniteddiversity/noosfero,evandrojr/noosfero,coletivoEITA/noosfero-ecosol,larissa/noosfero,vfcosta/noosfero,arthurmde/noosfero,abner/noosfero,LuisBelo/tccnoosfero,coletivoEITA/noosfero-ecosol,alexandreab/noosfero,marcosronaldo/noosfero,uniteddiversity/noosfero,coletivoEITA/noosfero,coletivoEITA/noosfero,tallysmartins/noosfero,blogoosfero/noosfero,coletivoEITA/noosfero,arthurmde/noosfero,macartur/noosfero,evandrojr/noosfero,tallysmartins/noosfero,LuisBelo/tccnoosfero,CIRANDAS/noosfero-ecosol,samasti/noosfero,alexandreab/noosfero,LuisBelo/tccnoosfero,vfcosta/noosfero,uniteddiversity/noosfero,marcosronaldo/noosfero,marcosronaldo/noosfero,evandrojr/noosfero,blogoosfero/noosfero,marcosronaldo/noosfero,macartur/noosfero,EcoAlternative/noosfero-ecosol,hebertdougl/noosfero,vfcosta/noosfero,evandrojr/noosferogov,coletivoEITA/noosfero,hebertdougl/noosfero,hebertdougl/noosfero,LuisBelo/tccnoosfero,larissa/noosfero,evandrojr/noosferogov,uniteddiversity/noosfero,macartur/noosfero,alexandreab/noosfero,evandrojr/noosferogov,abner/noosfero,evandrojr/noosferogov,tallysmartins/noosfero,CIRANDAS/noosfero-ecosol,blogoosfero/noosfero,larissa/noosfero,CIRANDAS/noosfero-ecosol,EcoAlternative/noosfero-ecosol,arthurmde/noosfero,alexandreab/noosfero,evandrojr/noosfero,evandrojr/noosferogov,hebertdougl/noosfero,CIRANDAS/noosfero-ecosol,macartur/noosfero,blogoosfero/noosfero,macartur/noosfero,macartur/noosfero
|
03a1b9af8f4fcaa85534e3889a61ea395e5aa19d
|
test/src/doors.spec.js
|
test/src/doors.spec.js
|
const expect = require('chai').expect;
const Room = require('../../src/rooms').Room;
const Doors = require('../../src/doors').Doors;
const Mocks = require('../mocks/mocks.js');
const testRoom = new Room(Mocks.Room);
describe('Doors & Locks', () => {
it('Should find an exit given a direction', () => {
const found = Doors.findExit(testRoom, 'out');
expect(found.length === 1).to.be.true;
});
});
|
'use strict';
const expect = require('chai').expect;
const Room = require('../../src/rooms').Room;
const Doors = require('../../src/doors').Doors;
const Mocks = require('../mocks/mocks.js');
const testRoom = new Room(Mocks.Room);
describe('Doors & Locks', () => {
describe('findExit', () => {
it('Should find an exit given a direction', () => {
const found = Doors.findExit(testRoom, 'out');
expect(found.length === 1).to.be.true;
});
it('Should not find an exit if the direction doesn\'t exist', () => {
const found = Doors.findExit(testRoom, 'wat');
expect(found.length === 0).to.be.true;
});
});
describe('updateDestination', () => {
const getLocation = () => '1';
const player = { getLocation };
const dest = {
getExits: () => [{
location: '1'
}]
};
it('should call a callback if the exit exists', () => {
let called = false;
Doors.updateDestination(player, dest, () => {
called = true;
});
expect(called).to.be.true;
});
});
});
|
Set up dests for helper funcs in doors.js
|
Set up dests for helper funcs in doors.js
|
JavaScript
|
mit
|
seanohue/ranviermud,shawncplus/ranviermud,seanohue/ranviermud
|
6a359323b5a4b3a4630f65bfb62e1ed531ac01c7
|
defaults/preferences/prefs.js
|
defaults/preferences/prefs.js
|
pref("extensions.torbirdy.protected", false);
pref("extensions.torbirdy.proxy", 0);
pref("extensions.torbirdy.first_run", true);
pref("extensions.torbirdy.warn", true);
|
pref("extensions.torbirdy.protected", false);
pref("extensions.torbirdy.proxy", 0);
pref("extensions.torbirdy.first_run", true);
pref("extensions.torbirdy.warn", true);
pref("extensions.torbirdy.startup_folder", false);
|
Update the preferences to reflect the folder select state
|
Update the preferences to reflect the folder select state
|
JavaScript
|
bsd-2-clause
|
ioerror/torbirdy,viggyprabhu/torbirdy,kartikm/torbirdy,DigiThinkIT/TorBirdy,kartikm/torbirdy,u451f/torbirdy,infertux/torbirdy,u451f/torbirdy,ioerror/torbirdy,viggyprabhu/torbirdy,infertux/torbirdy,DigiThinkIT/TorBirdy
|
5b9936a84f03a49585d8a5570936b15ed2cff387
|
tests/dummy/config/environment.js
|
tests/dummy/config/environment.js
|
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
contentSecurityPolicy: {
"script-src": "'self' 'unsafe-inline'",
"font-src": "'self'",
"style-src": "'self' 'unsafe-inline'",
"img-src": "'self' data:"
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};
|
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
},
contentSecurityPolicy: {
"script-src": "'self' 'unsafe-inline'",
"font-src": "'self'",
"style-src": "'self' 'unsafe-inline'",
"img-src": "'self' data:"
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
// ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
// ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'none';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
ENV.baseURL = '/gloit-component';
}
return ENV;
};
|
Set the base url of the dummy app
|
Set the base url of the dummy app
|
JavaScript
|
mit
|
gloit/gloit-component,gloit/gloit-component
|
ed6107f6bcf6dd0bbf917947d67d35a0a58e85c0
|
models/Users.js
|
models/Users.js
|
var mongoose = require('mongoose');
var UserSchema = new mongoose.Schema({
fname: String,
lname: String,
username: String,
password: String,
salt: String
});
mongoose.model('User', UserSchema);
|
var mongoose = require('mongoose');
var crypto = require('crypto');
var jwt = require('jsonwebtoken');
var UserSchema = new mongoose.Schema({
fname: String,
lname: String,
username: String,
password: String,
salt: String
});
UserSchema.methods.setPassword = function(password) {
this.salt = crypto.randomBytes(16).toString('hex');
this.password = crypto.pbkdf2Sync(password, this.salt, 1000, 64).toString('hex');
};
UserSchema.methods.validPassword = function(password) {
var hash = crypto.pbkdf2Sync(password, this.salt, 1000, 64).toString('hex');
return this.password === hash;
};
UserSchema.methods.generateJWT = function() {
var today = new Date();
var exp = new Date(today);
exp.setDate(today.getDate() + 60);
return jwt.sign({
_id: this._id,
username: this.username,
exp: parseInt(exp.getTime() / 1000)
}, 'SECRET');
};
mongoose.model('User', UserSchema);
|
Create setPassword validPassword and generateJWT methods on User model
|
Create setPassword validPassword and generateJWT methods on User model
|
JavaScript
|
mit
|
zachloubier/stocks,zachloubier/stocks
|
9ccff0afcc20c515804a38e8828317451b15e1bd
|
lib/controllers/geo-tagging.js
|
lib/controllers/geo-tagging.js
|
'use strict';
var request = require('request');
var Q = require('q');
var config = require('../config');
const plugins = require('../../plugins');
const geoTagController = plugins.getFirst('geo-tag-controller');
if(!geoTagController) {
throw new Error('Missing a geo-tag-controller plugin!');
}
function deg(w) {
w = w % 360;
return w < 0 ? w + 360 : w;
}
exports.save = function(req, res, next) {
// Check with the CIP to ensure that the asset has not already been geotagged.
var collection = req.params.collection;
var id = req.params.id;
var latitude = parseFloat(req.body.latitude);
var longitude = parseFloat(req.body.longitude);
// Checking if heading is a key in the body, as a valid heading can be 0.
// Heading is also converted to a degree between 0 and 360
var heading = 'heading' in req.body ?
deg(parseFloat(req.body.heading)) :
null;
if (!config.features.geoTagging) {
throw new Error('Geotagging is disabled.');
}
// Save the new coordinates to the CIP.
geoTagController.save({
collection,
id,
latitude,
longitude,
heading
})
.then(geoTagController.updateIndex)
.then(function(result) {
res.json(result);
}, next);
};
|
'use strict';
var request = require('request');
var Q = require('q');
var config = require('../config');
const plugins = require('../../plugins');
const geoTagController = plugins.getFirst('geo-tag-controller');
if(!geoTagController) {
throw new Error('Missing a geo-tag-controller plugin!');
}
function deg(w) {
w = w % 360;
return w < 0 ? w + 360 : w;
}
exports.save = function(req, res, next) {
// Check with the CIP to ensure that the asset has not already been geotagged.
var collection = req.params.collection;
var id = req.params.id;
var latitude = parseFloat(req.body.latitude);
var longitude = parseFloat(req.body.longitude);
const userId = req.user.id;
// Checking if heading is a key in the body, as a valid heading can be 0.
// Heading is also converted to a degree between 0 and 360
var heading = 'heading' in req.body ?
deg(parseFloat(req.body.heading)) :
null;
if (!config.features.geoTagging) {
throw new Error('Geotagging is disabled.');
}
// Save the new coordinates to the CIP.
geoTagController.save({
collection,
id,
latitude,
longitude,
heading,
userId,
})
.then(geoTagController.updateIndex)
.then(function(result) {
res.json(result);
}, next);
};
|
Add userid to geotagging callback
|
Add userid to geotagging callback
|
JavaScript
|
mit
|
CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder,CopenhagenCityArchives/kbh-billeder
|
8fe68b5a70a10d742d39992714f3b80ca620f88e
|
tests/requests/home.js
|
tests/requests/home.js
|
'use strict';
var app = require('../../app');
var should = require('should');
var request = require('supertest')(app);
describe('No controller home', function() {
it('Must return status 200 when doing GET', function(done) {
request.get('/')
.end(function(err, res) {
res.status.should.eql(200);
});
});
});
|
'use strict';
var server = require('../../server');
var should = require('should');
var request = require('supertest')(server);
describe('The home controller', function() {
it('Must return status 200 when doing GET', function(done) {
request.get('/')
.end(function(err, res) {
res.status.should.eql(200);
done();
});
});
it('Must to go for route / when doing GET /exit', function(done) {
request.get('/exit')
.end(function(err, res) {
res.headers.location.should.eql('/');
done();
});
});
});
|
Add other test: Must to go for route / when doing GET /exit
|
Add other test: Must to go for route / when doing GET /exit
|
JavaScript
|
mit
|
brenopolanski/coffee-club,brenopolanski/coffee-club
|
7f076bd1b43cc53b172c353cf24ee274ea7b5db3
|
lib/helpers/metadata.js
|
lib/helpers/metadata.js
|
'use strict';
var WM = require('es6-weak-map');
var hasNativeWeakMap = require('es6-weak-map/is-native-implemented');
// WeakMap for storing metadata
var metadata = hasNativeWeakMap ? new WeakMap() : new WM();
module.exports = metadata;
|
'use strict';
// WeakMap for storing metadata
var WM = require('es6-weak-map');
var metadata = new WM();
module.exports = metadata;
|
Remove conditional use of es6-weak-map
|
Fix: Remove conditional use of es6-weak-map
|
JavaScript
|
mit
|
phated/undertaker,gulpjs/undertaker
|
d962869bf6059568f39d4c8b5af801cfdcf30d0b
|
js/templates.js
|
js/templates.js
|
var Templates = {};
Templates.ItemListingTemplate = _.template('\
<div class="item media">\
<img class="pull-left" src="<%= imageUrl %>" />\
<div class="media-body">\
<h3 class="media-heading"><%= name %></h3>\
<div class="item-location"><span class="glyphicon glyphicon-globe"></span> <%= location %></div>\
<div class="item-price"><span class="glyphicon glyphicon-usd"></span><%= price %></div>\
<div class="item-buyers"><%= buyers.length %></div>\
</div>\
</div>');
|
var Templates = {};
Templates.ItemListingTemplate = _.template('\
<div class="item media">\
<img class="pull-left" src="<%= imageUrl %>" />\
<div class="media-body">\
<h3 class="media-heading"><%= name %></h3>\
<div class="item-location"><span class="glyphicon glyphicon-globe"></span> <%= location %></div>\
<div class="item-price"><span class="glyphicon glyphicon-usd"></span><%= price %></div>\
<div class="item-buyers"><span class="glyphicon glyphicon-user"></span><%= buyers.length %></div>\
</div>\
</div>');
|
Add icon for amount of buyers.
|
Add icon for amount of buyers.
|
JavaScript
|
mit
|
burnflare/CrowdBuy,burnflare/CrowdBuy
|
9d7b781e57e885233eb5a16e6809ed528d0abe87
|
examples/blog/thinky.js
|
examples/blog/thinky.js
|
//var thinky = require('thinky');
var thinky = require('/home/michel/projects/thinky/lib/index.js');
var config = require('./config');
// Initialize thinky
// The most important thing is to initialize the pool of connection
thinky.init({
host: config.host,
port: config.port,
db: config.db
});
exports.thinky = thinky;
|
var thinky = require('thinky');
var config = require('./config');
// Initialize thinky
// The most important thing is to initialize the pool of connection
thinky.init({
host: config.host,
port: config.port,
db: config.db
});
exports.thinky = thinky;
|
Switch to the npm library
|
Switch to the npm library
|
JavaScript
|
mit
|
gutenye/thinky-websocket,JohnyDays/thinky,soplakanets/thinky,rasapetter/thinky,mbroadst/thinky,bprymicz/thinky,JohnyDays/thinky,gutenye/thinky-websocket,davewasmer/thinky,gjuchault/thinky,soplakanets/thinky,davewasmer/thinky,gutenye/thinky-websocket,rasapetter/thinky
|
157f5524db00970c99cb91e5e1f65e0be31fb245
|
website/app/js/controllers.js
|
website/app/js/controllers.js
|
function HomeController($scope) {
}
function ProjectsController($scope, Restangular) {
var allProjects = Restangular.all('projects');
allProjects.getList().then(function(projects) {
$scope.projects = projects;
});
Restangular.one("projects", "a").customGET("tree").then(function(tree) {
console.dir(tree);
$scope.projectTree = tree;
});
// Restangular.oneUrl("datadirs", "http://localhost:5000/datadirs/tree?apikey=4a3ec8f43cc511e3ba368851fb4688d4")
// .get().then(function(tree) {
// console.dir(tree);
// })
}
function ChangesController($scope) {
}
function ProvenanceController($scope) {
}
function AboutController($scope) {
}
function ContactController($scope) {
}
function EventController($scope) {
}
|
function HomeController($scope) {
}
function ProjectsController($scope, Restangular, $http) {
var allProjects = Restangular.all('projects');
allProjects.getList().then(function(projects) {
$scope.projects = projects;
});
Restangular.one("projects", "a").customGET("tree").then(function(tree) {
$scope.projectTree = tree;
});
}
function ChangesController($scope) {
}
function ProvenanceController($scope) {
}
function AboutController($scope) {
}
function ContactController($scope) {
}
function EventController($scope) {
}
|
Remove testing code for going to materials commons.
|
Remove testing code for going to materials commons.
|
JavaScript
|
mit
|
materials-commons/materials,materials-commons/materials
|
224c56ed7da455e9ec8105e6efd088a4cd8eade2
|
portal/js/controllers/ChartEditController.js
|
portal/js/controllers/ChartEditController.js
|
App.ChartEditController = App.AuthenticationController.extend({
actions: {
registerQuery: function() {
console.log('registering a query');
var chart = this.get('model');
chart.save();
}
}
});
|
App.ChartEditController = App.AuthenticationController.extend({
actions: {
registerQuery: function() {
console.log('registering a query');
var chart = this.get('model');
// Put a dummy chartdata in the chart to trigger the async loading of the chart data
// Since the request will be fulfilled by the query api, don't need to save the record.
var chartdata = this.store.createRecord('chartdata');
chartdata.set('id', chart.id);
chart.get('chartdata').then(function(chartdatas){
chartdatas.pushObject(chartdata);
chart.save();
})
}
}
});
|
Create a dummy chart data object so the chart data loads async
|
Create a dummy chart data object so the chart data loads async
|
JavaScript
|
apache-2.0
|
with-regard/regard-website
|
6caba9f16599101ddf710aa4f322865341582c11
|
lib/foodlogiq-client/users.js
|
lib/foodlogiq-client/users.js
|
module.exports = function(conn) {
return {
list: function(businessId, callback) {
conn.get('/users?businessId=' + businessId, callback);
}
}
};
|
module.exports = function(conn) {
return {
show: function(callback) {conn.get('/user', callback);},
list: function(businessId, callback) {
conn.get('/users?businessId=' + businessId, callback);
}
}
};
|
Add a wrapper method for retrieving the current API user
|
Add a wrapper method for retrieving the current API user
The API route for this already existed, but there was no wrapper method.
|
JavaScript
|
mit
|
ventres/foodlogiq-node,FoodLogiQ/foodlogiq-node
|
3a136a01d0e66bf5a0697fe031c0eb9eab0b81c9
|
app/server/methods/permissions.js
|
app/server/methods/permissions.js
|
Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
|
Meteor.methods({
addSingleUserPermissions(userId, groupIds) {
// Remove existing user permissions
Permissions.remove({ userId });
// add new permissions, if any group IDs provided
if (groupIds.length > 0) {
groupIds.forEach(groupId => {
Permissions.insert({ userId, groupId });
});
}
return true;
}
});
|
Delete existing permission prior to inserting new set
|
Delete existing permission prior to inserting new set
|
JavaScript
|
agpl-3.0
|
brylie/juhani-wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing,GeriLife/wellbeing,GeriLife/wellbeing,brylie/juhani-wellbeing
|
28415ab520751159162e15d42b205352c6ce1e73
|
src/js/components/form.js
|
src/js/components/form.js
|
import React from 'react'
import ReactDOM from 'react-dom'
import DefaultProps from '../default_props.js'
export default class Form extends React.Component {
static displayName = 'FriggingBootstrap.Form'
static defaultProps = {
layout: DefaultProps.layout,
}
static propTypes = {
formHtml: React.PropTypes.shape({
className: React.PropTypes.string,
}),
layout: React.PropTypes.string,
children: React.PropTypes.any.isRequired,
}
_formHtml() {
const className = this.props.layout ? `form-${this.props.layout}` : ''
return Object.assign({}, this.props.formHtml, {
ref: 'form',
className: `${this.props.formHtml.className || ''} ${className}`.trim(),
})
}
formData() {
const formElement = ReactDOM.findDOMNode(this.refs.form)
return new FormData(formElement)
}
render() {
return (
<form {...this._formHtml()}>
{this.props.children}
</form>
)
}
}
|
import React from 'react'
import ReactDOM from 'react-dom'
export default class Form extends React.Component {
static displayName = 'FriggingBootstrap.Form'
static defaultProps = {
layout: 'vertical',
}
static propTypes = {
formHtml: React.PropTypes.shape({
className: React.PropTypes.string,
}),
layout: React.PropTypes.string,
children: React.PropTypes.any.isRequired,
}
_formHtml() {
const className = this.props.layout ? `form-${this.props.layout}` : ''
return Object.assign({}, this.props.formHtml, {
ref: 'form',
className: `${this.props.formHtml.className || ''} ${className}`.trim(),
})
}
formData() {
const formElement = ReactDOM.findDOMNode(this.refs.form)
return new FormData(formElement)
}
render() {
return (
<form {...this._formHtml()}>
{this.props.children}
</form>
)
}
}
|
Remove DefaultProps.js From Form Component
|
Remove DefaultProps.js From Form Component
Remove defaultProps.js from Form component layout prop as it is no
longer in defaultProps.js
|
JavaScript
|
mit
|
frig-js/frigging-bootstrap,frig-js/frigging-bootstrap
|
13752fc80af365ae8c80effd323c8ea2e9bb637f
|
assets/javascripts/application.js
|
assets/javascripts/application.js
|
//= require "lib/moment.min"
//= require "lib/jquery-2.0.3"
//= require "lib/handlebars-v1.1.2"
//= require "lib/ember"
//= require "lib/ember-data"
//= require_self
//= require "models"
//= require "views"
//= require "helpers"
//= require "./routes/authenticated_route"
//= require_tree "./controllers"
//= require_tree "./routes"
window.App = Em.Application.create({LOG_TRANSITIONS: true})
App.ApplicationSerializer = DS.ActiveModelSerializer.extend({})
App.ApplicationAdapter = DS.RESTAdapter.reopen({namespace: "api"})
App.ApplicationView = Em.View.extend({classNames: ["container"]})
App.Router.map(function() {
// login
this.route("login");
// rooms
this.resource("rooms", function() {
this.route("new");
this.resource("room", {path: "/:room_id"}, function() {
this.route("edit");
});
});
// users
// users/new
// users/:user_id
this.resource("users", function() {
this.route("new");
this.resource("user", {path: "/:user_id"}, function() {
this.route("edit");
});
});
});
|
//= require "lib/moment.min"
//= require "lib/jquery-2.0.3"
//= require "lib/handlebars-v1.1.2"
//= require "lib/ember"
//= require "lib/ember-data"
//= require_self
//= require "models"
//= require "views"
//= require "helpers"
//= require "./routes/authenticated_route"
//= require_tree "./controllers"
//= require_tree "./routes"
window.App = Em.Application.create({LOG_TRANSITIONS: true})
App.ApplicationSerializer = DS.ActiveModelSerializer.extend({})
App.ApplicationAdapter = DS.ActiveModelAdapter.reopen({namespace: "api"})
App.ApplicationView = Em.View.extend({classNames: ["container"]})
App.Router.map(function() {
// login
this.route("login");
// rooms
this.resource("rooms", function() {
this.route("new");
this.resource("room", {path: "/:room_id"}, function() {
this.route("edit");
});
});
// users
// users/new
// users/:user_id
this.resource("users", function() {
this.route("new");
this.resource("user", {path: "/:user_id"}, function() {
this.route("edit");
});
});
});
|
Use ActiveModelAdapter instead of RESTAdapter
|
Use ActiveModelAdapter instead of RESTAdapter
|
JavaScript
|
mit
|
louishawkins/mogo-chat,HashNuke/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,louishawkins/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,HashNuke/mogo-chat,HashNuke/mogo-chat,sashafklein/bloc-mogo,di-stars/mogo-chat,louishawkins/mogo-chat
|
ad76d7022d388e7b7a0e4f24c224dc29e4fa03ee
|
webpack/webpack-dev-server.js
|
webpack/webpack-dev-server.js
|
var Express = require('express');
var webpack = require('webpack');
var config = require('../src/config');
var webpackConfig = require('./dev.config');
var compiler = webpack(webpackConfig);
var host = process.env.HOST || 'localhost';
var port = parseInt(config.port, 10) + 1 || 3001;
var serverOptions = {
contentBase: 'http://' + host + ':' + port,
quiet: true,
noInfo: true,
hot: true,
inline: true,
lazy: false,
publicPath: webpackConfig.output.publicPath,
headers: {'Access-Control-Allow-Origin': '*'},
stats: {colors: true}
};
var app = new Express();
app.use(require('webpack-dev-middleware')(compiler, serverOptions));
app.use(require('webpack-hot-middleware')(compiler));
app.listen(port, function onAppListening(err) {
if (err) {
console.error(err);
} else {
console.info('==> 🚧 Webpack development server listening on port %s', port);
}
});
|
var Express = require('express');
var webpack = require('webpack');
var config = require('../src/config');
var webpackConfig = require('./dev.config');
var compiler = webpack(webpackConfig);
var host = config.host || 'localhost';
var port = (config.port + 1) || 3001;
var serverOptions = {
contentBase: 'http://' + host + ':' + port,
quiet: true,
noInfo: true,
hot: true,
inline: true,
lazy: false,
publicPath: webpackConfig.output.publicPath,
headers: {'Access-Control-Allow-Origin': '*'},
stats: {colors: true}
};
var app = new Express();
app.use(require('webpack-dev-middleware')(compiler, serverOptions));
app.use(require('webpack-hot-middleware')(compiler));
app.listen(port, function onAppListening(err) {
if (err) {
console.error(err);
} else {
console.info('==> 🚧 Webpack development server listening on port %s', port);
}
});
|
Use host + port from config
|
Use host + port from config
|
JavaScript
|
mit
|
hitripod/react-redux-universal-hot-example,thomastanhb/ericras,user512/teacher_dashboard,erikras/react-redux-universal-hot-example,mscienski/stpauls,ThatCheck/AutoLib,mull/require_hacker_error_reproduction,ames89/keystone-react-redux,hldzlk/wuhao,bertho-zero/react-redux-universal-hot-example,huangc28/palestine-2,tonykung06/realtime-exchange-rates,ercangursoy/react-dev,CalebEverett/soulpurpose,mscienski/stpauls,Trippstan/elephonky,elbstack/elbstack-hackreact-web-3,ThatCheck/AutoLib,avantcontra/react-redux-custom-starter,sfarthin/youtube-search,tanvip/hackPrinceton,bdefore/universal-redux,sseppola/react-redux-universal-hot-example,frankleng/react-redux-universal-hot-example,sunh11373/t648,RomanovRoman/react-redux-universal-hot-example,TracklistMe/client-react,Widcket/sia,eastonqiu/frontend,trueter/react-redux-universal-hot-example,hldzlk/wuhao,runnables/react-redux-universal-hot-example,Widcket/sia,tpphu/react-pwa,sanyamagrawal/royalgeni,PhilNorfleet/pBot,twomoonsfactory/custom-poll,quicksnap/react-redux-universal-hot-example,TracklistMe/client-web,delwiv/saphir,Kronenberg/WebLabsTutorials,kiyonish/kiyonishimura,lordakshaya/pages,Druddigon/react-redux-learn,Widcket/sia,prgits/react-product,delwiv/tactill-techtest,gihrig/react-redux-universal-hot-example,fiTTrail/fiTTrail,thekevinscott/react-redux-universal-starter-kit,ames89/keystone-react-redux,ipbrennan90/movesort-app,hank7444/react-redux-universal-hot-example,dumbNickname/oasp4js-goes-react,yomolify/cc_material,svsool/react-redux-universal-hot-example,fforres/coworks,guymorita/creditTiger,nathanielks/universal-redux,codejunkienick/katakana,jeremiahrhall/react-redux-universal-hot-example,dieface/react-redux-universal-hot-example,TonyJen/react-redux-universal-hot-example,TribeMedia/react-redux-universal-hot-example,robertSahm/port,Xvakin/quiz,PhilNorfleet/pBot,thingswesaid/seed,EnrikoLabriko/react-redux-universal-hot-example,jairoandre/lance-web-hot,delwiv/saphir,chrisslater/snapperfish,DelvarWorld/some-game,bdefore/react-redux-universal-hot-example,vidaaudrey/avanta,tpphu/react-pwa,danieloliveira079/healthy-life-app,Dengo/bacon-bacon,micooz/react-redux-universal-hot-example,Widcket/react-boilerplate,bazanowsky/react-ssr-exercise,AndriyShepitsen/svredux,MarkPhillips7/happy-holidays,bdefore/universal-redux,codejunkienick/katakana,nathanielks/universal-redux,sars/appetini-front,hokustalkshow/friend-landing-page,andbet39/reactPress,ptim/react-redux-universal-hot-example
|
97e271d4db24cbc89d367d19c6a65ae402972c8e
|
lib/commands/search.js
|
lib/commands/search.js
|
'use strict';
var _ = require('lodash');
var fs = require('fs');
var path = require('path');
var api = require('../api');
function arrayToQueryString(args) {
var searchString = '?q=' + args._.join('+');
if (args.user) {
searchString = searchString.concat('+user:' + args.user);
}
if (args.language) {
searchString = searchString.concat('+language:' + args.language);
}
return searchString;
}
function performQuery(config, request, args) {
api.search(request, arrayToQueryString(args), function(error, result) {
if (error) {
console.log('Something unexpected has happended..');
return;
}
/* jshint camelcase: false */
var res = result.total_count || 0;
console.log('Showing %d out of %d repositories ' +
'that match your search query',
Math.min(res, 30), res);
_.forEach(result.items, function(repo) {
console.log(repo.full_name);
});
/* jshint camelcase: true */
});
}
function help() {
console.log(fs.readFileSync(
path.resolve(__dirname, '../templates/help-search.txt'), 'utf8'));
}
module.exports = function(config, request, args) {
if (args.help) {
help();
} else {
performQuery(config, request, args);
}
};
|
'use strict';
var _ = require('lodash');
var fs = require('fs');
var path = require('path');
var api = require('../api');
function queryStringFromArgs(args) {
var searchString = '?q=' + args._.join('+');
if (args.user) {
searchString = searchString.concat('+user:' + args.user);
}
if (args.language) {
searchString = searchString.concat('+language:' + args.language);
}
return searchString;
}
function performQuery(config, request, args) {
api.search(request, queryStringFromArgs(args), function(error, result) {
if (error) {
console.log('Something unexpected has happended..');
return;
}
/* jshint camelcase: false */
var res = result.total_count || 0;
console.log('Showing %d out of %d repositories ' +
'that match your search query',
Math.min(res, 30), res);
_.forEach(result.items, function(repo) {
console.log(repo.full_name);
});
/* jshint camelcase: true */
});
}
function help() {
console.log(fs.readFileSync(
path.resolve(__dirname, '../templates/help-search.txt'), 'utf8'));
}
module.exports = function(config, request, args) {
if (args.help) {
help();
} else {
performQuery(config, request, args);
}
};
|
Rename function for generating query string.
|
Rename function for generating query string.
|
JavaScript
|
mit
|
stillesjo/buh
|
843c48748261d44331f81ac915621766ce5ca0b6
|
test/index.js
|
test/index.js
|
'use strict';
var angular = require('angular');
var expect = require('chai').use(require('sinon-chai')).expect;
var sinon = require('sinon');
var sap = require('sinon-as-promised');
describe('animate-change', function () {
var $scope, $animate, element;
beforeEach(angular.mock.module(require('../')));
beforeEach(angular.mock.module(function ($provide) {
$provide.value('$animate', ($animate = {}));
}));
beforeEach(angular.mock.inject(function ($injector) {
$compile = $injector.get('$compile');
$scope = $injector.get('$rootScope').$new();
sap($injector.get('$q'));
sap.setScheduler(function (fn) {
$scope.$evalAsync(fn);
});
$animate.addClass = sinon.stub().resolves();
$animate.removeClass = sinon.stub().resolves();
element = $compile('<span animate-change="foo" change-class="on"></span>')($scope);
}));
it('adds the animation class when the model changes', function () {
$scope.$digest();
$scope.foo = 'bar';
$scope.$digest();
expect($animate.addClass).to.have.been.calledWith(element, 'on');
expect($animate.removeClass).to.have.been.calledWith(element, 'on');
});
it('does not animate the initial value', function () {
$scope.foo = 'bar';
$scope.$digest();
expect($animate.addClass).to.not.have.been.called;
});
});
|
'use strict';
var angular = require('angular');
var expect = require('chai').use(require('sinon-chai')).expect;
var sinon = require('sinon');
var sap = require('sinon-as-promised');
describe('animate-change', function () {
var $scope, $animate, element;
beforeEach(angular.mock.module(require('../')));
beforeEach(angular.mock.module(function ($provide) {
$provide.value('$animate', ($animate = {}));
}));
beforeEach(angular.mock.inject(function ($injector) {
$compile = $injector.get('$compile');
$scope = $injector.get('$rootScope').$new();
sap($injector.get('$q'));
sap.setScheduler(function (fn) {
$scope.$evalAsync(fn);
});
$animate.addClass = sinon.stub().resolves();
element = $compile('<span animate-change="foo" change-class="on"></span>')($scope);
}));
it('adds the toggles class when the model changes', function () {
$scope.$digest();
sinon.stub(element, 'removeClass');
$scope.foo = 'bar';
$scope.$digest();
expect($animate.addClass).to.have.been.calledWith(element, 'on');
expect(element.removeClass).to.have.been.calledWith('on');
});
it('does not animate the initial value', function () {
$scope.foo = 'bar';
$scope.$digest();
expect($animate.addClass).to.not.have.been.called;
});
});
|
Update tests for using element.removeClass instead of $animate
|
Update tests for using element.removeClass instead of $animate
|
JavaScript
|
mit
|
bendrucker/angular-animate-change,bendrucker/angular-animate-change
|
56d7dc2661360d21325ac94338556036c774eb1a
|
test/model.js
|
test/model.js
|
var async = require("async");
var bay6 = require("../lib/");
var expect = require("chai").expect;
var mongoose = require("mongoose");
var request = require("supertest");
describe("Model", function() {
var app;
var model;
beforeEach(function() {
app = bay6();
app.options.prefix = "";
model = app.model("Document", {
title: String,
contents: String
});
mongoose.set("debug", true);
});
describe("#limit", function() {
it("should return a maximum of n documents", function(done) {
model.limit(5);
var server = app.serve(9000);
var Document = app.mongoose.model("Document");
async.each([1, 2, 3, 4, 5, 6], function(useless, done2) {
var doc = new Document({ title: "war and peace", contents: "yolo" });
doc.save(done2);
}, function(err) {
if (err) {
throw err;
}
request(server).get("/documents").end(function(err, res) {
expect(res.body.length).to.equal(5);
server.close();
done();
});
});
});
});
afterEach(function(done) {
app.mongoose.db.dropDatabase(done);
});
});
|
var async = require("async");
var bay6 = require("../lib/");
var expect = require("chai").expect;
var mongoose = require("mongoose");
var request = require("supertest");
describe("Model", function() {
var app;
var model;
beforeEach(function() {
app = bay6();
app.options.prefix = "";
model = app.model("Document", {
title: String,
contents: String
});
});
describe("#limit", function() {
it("should return a maximum of n documents", function(done) {
model.limit(5);
var server = app.serve(9000);
var Document = app.mongoose.model("Document");
async.each([1, 2, 3, 4, 5, 6], function(useless, done2) {
var doc = new Document({ title: "war and peace", contents: "yolo" });
doc.save(done2);
}, function(err) {
if (err) {
throw err;
}
request(server).get("/documents").end(function(err, res) {
expect(res.body.length).to.equal(5);
server.close();
done();
});
});
});
});
afterEach(function(done) {
app.mongoose.db.dropDatabase(done);
});
});
|
Remove mongoose debug mode from test
|
Remove mongoose debug mode from test
Signed-off-by: Ian Macalinao <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@ian.pw>
|
JavaScript
|
mit
|
simplyianm/bay6
|
ce8df49212f484ef04b03225b02db5f519b12113
|
lib/display-message.js
|
lib/display-message.js
|
const $ = require('jquery');
function DisplayMessage(){
}
DisplayMessage.prototype.showWinMessage = function(){
var div = $('#post-game');
div.empty()
.show()
.append(`<h1>You Win!</h1>
<p>Click to play the next level.</p>`
);
div.on('click', function(){
div.hide();
});
}
DisplayMessage.prototype.showHighScoreMessage = function(game, leaderboard){
var div = $('#post-game');
div.empty()
.show()
.append(`<h1>High Score!</h1>
<p>Name:</p>
<input class='input'></input>
<button>Submit</button>`
);
div.on('click', 'button', function(){
var input = $('.input').val();
game.getName(input, leaderboard);
div.hide();
});
}
DisplayMessage.prototype.showScore = function(score){
$('#score').empty().append(this.scoreElement(score));
};
DisplayMessage.prototype.scoreElement = function(score){
return '<h1>Score: ' + score + '</h1>';
};
module.exports = DisplayMessage;
|
const $ = require('jquery');
function DisplayMessage(){
}
DisplayMessage.prototype.showWinMessage = function(){
var div = $('#post-game');
div.empty()
.show()
.append(`<h1>You Win!</h1>
<p>Click to play the next level.</p>`
);
div.on('click', function(){
div.hide();
});
}
DisplayMessage.prototype.showHighScoreMessage = function(game, leaderboard){
var div = $('#post-game');
div.empty()
.show()
.append(`<h1>High Score!</h1>
<p>Name:</p>
<input class='input'></input>
<button id="high-submit-button">Submit</button>`
);
div.unbind('click').on('click', 'button', function() {
var input = $('.input').val();
game.getName(input, leaderboard);
div.hide();
});
}
DisplayMessage.prototype.showScore = function(score){
$('#score').empty().append(this.scoreElement(score));
};
DisplayMessage.prototype.scoreElement = function(score){
return '<h1>Score: ' + score + '</h1>';
};
module.exports = DisplayMessage;
|
Remove event listener in game win to avoid multiplication
|
Remove event listener in game win to avoid multiplication
|
JavaScript
|
mit
|
plato721/lights-out,plato721/lights-out
|
3916cb06b6c1d8694eceb25534e67bcd2830ebb2
|
app.js
|
app.js
|
var express = require('express'),
schedule = require('node-schedule'),
cacheService = require('./cache-service.js')(),
app = express(),
dataCache = {
news: null,
weather: null
};
setUpSchedule();
app.get('/', function (req, res) {
res.send('Welcome to Scraper API\n');
});
//news
app.get('/news', function (req, res) {
res.send(dataCache.news);
});
//weather
app.get('/weather', function (req, res) {
res.send(dataCache.weather);
});
//reset-cache
app.get('/reset-cache', function (req, res) {
setUpCache();
res.send(true);
});
app.set('port', process.env.PORT || 8080);
app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
function setUpSchedule() {
schedule.scheduleJob({ hour: 7 }, setUpCache);
schedule.scheduleJob({ hour: 17 }, setUpCache);
}
function setUpCache() {
cacheService.news(dataCache);
//cacheService.weather(dataCache, 'Sofia');
}
|
var express = require('express'),
schedule = require('node-schedule'),
cacheService = require('./cache-service.js')(),
app = express(),
dataCache = {
news: null,
weather: null
};
setUpSchedule();
app.get('/', function (req, res) {
res.send('Welcome to Scraper API\n' + 'Server time: ' + new Date().toString());
});
//news
app.get('/news', function (req, res) {
res.send(dataCache.news);
});
//weather
app.get('/weather', function (req, res) {
res.send(dataCache.weather);
});
//reset-cache
app.get('/reset-cache', function (req, res) {
setUpCache();
res.send(true);
});
app.set('port', process.env.PORT || 8080);
app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
function setUpSchedule() {
schedule.scheduleJob({ hour: 7 }, setUpCache);
schedule.scheduleJob({ hour: 17 }, setUpCache);
}
function setUpCache() {
cacheService.news(dataCache);
//cacheService.weather(dataCache, 'Sofia');
}
|
Add log of server time
|
Add log of server time
|
JavaScript
|
mit
|
AlexanderAntov/scraper-js,AlexanderAntov/scraper-js
|
78826dbdb3e81b084918f550c34527652f8d5de7
|
examples/cli.js
|
examples/cli.js
|
#!/usr/bin/node
var convert = require('../'),
fs = require('fs'),
geojson = JSON.parse(fs.readFileSync(process.argv[2])),
mtl = process.argv[3],
mtllibs = process.argv.slice(4),
options = {
coordToPoint: convert.findLocalProj(geojson),
mtllib: mtllibs
};
if (mtl) {
options.featureMaterial = function() {
return mtl;
};
}
convert.toObj(geojson, process.stdout, options);
|
#!/usr/bin/node
var convert = require('../'),
localProj = require('local-proj'),
fs = require('fs'),
geojson = JSON.parse(fs.readFileSync(process.argv[2])),
mtl = process.argv[3],
mtllibs = process.argv.slice(4),
options = {
coordToPoint: localProj.find(geojson).forward,
mtllib: mtllibs
};
if (mtl) {
options.featureMaterial = function(f, cb) {
process.nextTick(function() { cb(undefined, mtl); });
};
}
convert.toObj(geojson, process.stdout, function(err) {
if (err) {
process.stderr.write(err + '\n');
}
}, options);
|
Update to async; fix problem with missing findLocalProj
|
Update to async; fix problem with missing findLocalProj
|
JavaScript
|
isc
|
perliedman/geojson2obj
|
18957b36ddcd96b41c8897542609c53c166052c3
|
config/initializers/middleware.js
|
config/initializers/middleware.js
|
express = require('express')
expressValidator = require('express-validator')
module.exports = (function(){
function configure(app) {
app.set('port', process.env.PORT || 3000);
app.set('host', process.env.HOST || '127.0.0.1')
app.use(express.static(__dirname + '/public'));
app.use(express.bodyParser())
app.use(expressValidator());
app.use(express.cookieParser());
app.use(express.session({secret: 'oi09ajsdf09fwlkej33lkjpx'}));
app.use(express.methodOverride())
app.use(function(err, req, res, next) {
res.send({ error: err });
});
}
return { configure: configure }
})()
|
express = require('express')
expressValidator = require('express-validator')
module.exports = (function(){
function configure(app) {
app.set('port', process.env.PORT || 3000);
app.set('host', process.env.HOST || '127.0.0.1')
app.use(express.static(__dirname + '/public'));
app.use(function(req,res,next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
})
app.use(express.bodyParser())
app.use(expressValidator());
app.use(express.cookieParser());
app.use(express.session({secret: 'oi09ajsdf09fwlkej33lkjpx'}));
app.use(express.methodOverride())
app.use(function(err, req, res, next) {
res.send({ error: err });
});
}
return { configure: configure }
})()
|
Add access control allow origin middlewar
|
[FEATURE] Add access control allow origin middlewar
|
JavaScript
|
isc
|
zealord/gatewayd,crazyquark/gatewayd,xdv/gatewayd,xdv/gatewayd,Parkjeahwan/awegeeks,whotooktwarden/gatewayd,Parkjeahwan/awegeeks,crazyquark/gatewayd,whotooktwarden/gatewayd,zealord/gatewayd
|
5762d478a22bb76807e3b92a3b881c42686b3b69
|
lib/replace-prelude.js
|
lib/replace-prelude.js
|
'use strict';
var bpack = require('browser-pack');
var fs = require('fs');
var path = require('path');
var xtend = require('xtend');
var preludePath = path.join(__dirname, 'prelude.js');
var prelude = fs.readFileSync(preludePath, 'utf8');
// This plugin replaces the prelude and adds a transform
var plugin = exports.plugin = function (bfy, opts) {
function replacePrelude() {
var packOpts = {
raw : true, // Added in regular Browserifiy as well
preludePath : preludePath,
prelude : prelude
};
// browserify sets "hasExports" directly on bfy._bpack
bfy._bpack = bpack(xtend(bfy._options, packOpts));
// Replace the 'pack' pipeline step with the new browser-pack instance
bfy.pipeline.splice('pack', 1, bfy._bpack);
}
bfy.transform(require('./transform'));
bfy.on('reset', replacePrelude);
replacePrelude();
};
// Maintain support for the old interface
exports.browserify = function (files) {
console.error('You are setting up proxyquireify via the old API which will be deprecated in future versions.');
console.error('It is recommended to use it as a browserify-plugin instead - see the example in the README.');
return require('browserify')(files).plugin(plugin);
};
|
'use strict';
var bpack = require('browser-pack');
var fs = require('fs');
var path = require('path');
var xtend = require('xtend');
var preludePath = path.join(__dirname, 'prelude.js');
var prelude = fs.readFileSync(preludePath, 'utf8');
// This plugin replaces the prelude and adds a transform
var plugin = exports.plugin = function (bfy, opts) {
function replacePrelude() {
var packOpts = {
raw : true, // Added in regular Browserifiy as well
preludePath : preludePath,
prelude : prelude
};
// browserify sets "hasExports" directly on bfy._bpack
bfy._bpack = bpack(xtend(bfy._options, packOpts, {hasExports: bfy._bpack.hasExports}));
// Replace the 'pack' pipeline step with the new browser-pack instance
bfy.pipeline.splice('pack', 1, bfy._bpack);
}
bfy.transform(require('./transform'));
bfy.on('reset', replacePrelude);
replacePrelude();
};
// Maintain support for the old interface
exports.browserify = function (files) {
console.error('You are setting up proxyquireify via the old API which will be deprecated in future versions.');
console.error('It is recommended to use it as a browserify-plugin instead - see the example in the README.');
return require('browserify')(files).plugin(plugin);
};
|
Copy `hasExports` setting from bpack when bundle is reset
|
Copy `hasExports` setting from bpack when bundle is reset
Browserify copies this setting manually in b.reset:
https://github.com/substack/node-browserify/blob/a18657c6f363272ce3c7722528c8ec5f325d0eaf/index.js#L732
Since we replace the bpack instance the `hasExports` value has to be
manually copied from the default bpack
Closes bendrucker/proxyquire-universal#7
@thlorenz this should be released as a patch when you have a chance
|
JavaScript
|
mit
|
royriojas/browsyquire,royriojas/proxyquireify,royriojas/browsyquire,royriojas/proxyquireify,thlorenz/proxyquireify
|
b1aaf8485740f65770acb7b9a20ca9e35c37b9ad
|
lib/htmlfile.js
|
lib/htmlfile.js
|
module.exports = HtmlFile;
function HtmlFile(path) {
this.path = path;
}
HtmlFile.prototype.querySelectorAll = function(ph, style, cb) {
var _this = this;
return new Promise(function(resolve) {
ph.createPage(function(page) {
page.open(_this.path, function() {
page.evaluate((function() {
return 'function() { return document.querySelectorAll("' + style + '"); }';
}()), function(value) {
cb(value);
resolve();
});
});
});
});
};
|
module.exports = HtmlFile;
function HtmlFile(path) {
this.path = path;
}
HtmlFile.prototype.querySelectorAll = function(ph, style, cb) {
var _this = this;
return new Promise(function(resolve) {
ph.createPage(function(page) {
page.open(_this.path, function() {
var func = 'function() { return document.querySelectorAll("' + style + '"); }';
page.evaluate(func, function(value) {
cb(value);
resolve();
});
});
});
});
};
|
Fix "Wrap only the function expression in parens"
|
Fix "Wrap only the function expression in parens"
|
JavaScript
|
mit
|
sinsoku/clairvoyance,sinsoku/clairvoyance
|
41de713c677477bae0548bd9b17c5edb100bc53b
|
aura-components/src/main/components/ui/abstractList/abstractListRenderer.js
|
aura-components/src/main/components/ui/abstractList/abstractListRenderer.js
|
/*
* Copyright (C) 2013 salesforce.com, inc.
*
* 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 required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
/*
* These helper methods are in the renderer due to the many ways
* that abstractList can be implemented. Since controller methods
* can be overridden, and component creation can be dynamic, putting
* the relevant helper method call in the renderer ensures that the
* emptyListContent is handled no matter how the list is implemented.
*/
afterRender : function(component, helper){
this.superAfterRender();
helper.updateEmptyListContent(component);
},
rerender : function(component){
this.superRerender();
var concreteCmp = component.getConcreteComponent();
if (concreteCmp.isDirty('v.items')) {
concreteCmp.getDef().getHelper().updateEmptyListContent(component);
}
}
})// eslint-disable-line semi
|
/*
* Copyright (C) 2013 salesforce.com, inc.
*
* 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 required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
({
/*
* These helper methods are in the renderer due to the many ways
* that abstractList can be implemented. Since controller methods
* can be overridden, and component creation can be dynamic, putting
* the relevant helper method call in the renderer ensures that the
* emptyListContent is handled no matter how the list is implemented.
*/
afterRender : function(component, helper){
this.superAfterRender();
helper.updateEmptyListContent(component);
},
rerender : function(component, helper){
this.superRerender();
if (component.getConcreteComponent().isDirty('v.items')) {
helper.updateEmptyListContent(component);
}
}
})// eslint-disable-line semi
|
Revert "Make renderer polymorphically call updateEmptyListContent"
|
Revert "Make renderer polymorphically call updateEmptyListContent"
This reverts commit ff82e198ca173fdbb5837982c3795af1dec3a15d.
|
JavaScript
|
apache-2.0
|
forcedotcom/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,forcedotcom/aura,madmax983/aura,madmax983/aura,forcedotcom/aura,forcedotcom/aura,madmax983/aura,madmax983/aura
|
ce52b37873c55045b97c4288e9d6b8dfdd3a03f8
|
test/testCacheAllTheThings.js
|
test/testCacheAllTheThings.js
|
var Assert = require('assert');
var CacheAllTheThings = require('../');
describe('CacheAllTheThings', function() {
it('When asked to boot a Redis instance, it should do so', function() {
var inst = new CacheAllTheThings('redis');
Assert(inst.name, 'RedisCache');
});
});
|
var Assert = require('assert');
var CacheAllTheThings = require('../');
describe('CacheAllTheThings', function() {
it('When asked to boot a Redis instance, it should do so', function() {
var inst = new CacheAllTheThings('redis');
Assert(inst.name, 'RedisCache');
});
describe('Redis', function() {
it('Should set a key', function(done) {
var redisInst = new CacheAllTheThings('redis');
redisInst
.set('lol', 'hai')
.then(function(e) {
Assert.equal(e, null);
done();
});
});
it('Should get a key that exists', function(done) {
var redisInst = new CacheAllTheThings('redis');
redisInst
.get('lol')
.then(function(val) {
Assert(val, 'hai');
done();
}, function(e) {
Assert.notEqual(e, null);
done();
});
});
it('Should get a key that does not exist', function(done) {
var redisInst = new CacheAllTheThings('redis');
redisInst
.get('lols')
.then(function(val) {
Assert(true);
done();
}, function(e) {
Assert.notEqual(e, null);
done();
});
});
});
});
|
Add more tests to set and get values from Redis
|
Add more tests to set and get values from Redis
|
JavaScript
|
mit
|
andrewhathaway/CacheAllTheThings,andrewhathaway/CacheAllTheThings
|
687b8066a908dc6a9bbd4c184e143981dec5493a
|
src/features/header/header-main/styled-components/Wrapper.js
|
src/features/header/header-main/styled-components/Wrapper.js
|
//@flow
import styled, { css } from "styled-components";
export const Wrapper = styled.div`
${({ theme }: { theme: Theme }) => css`
box-sizing: border-box;
position: relative;
width: 100%;
background-color: ${theme.color.background};
padding-top: ${theme.scale.s4(-1)};
@media (min-width: 675px) {
padding-top: 0;
}
`}
`;
|
//@flow
import styled, { css } from "styled-components";
export const Wrapper = styled.div`
${({ theme }: { theme: Theme }) => css`
box-sizing: border-box;
position: relative;
width: 100%;
background-color: ${theme.color.background};
`}
`;
|
Remove media query that accounds for status bar
|
Remove media query that accounds for status bar
Testing if the necessary space will be added by the mobile browser automatically
TODO: verify no additional padding required.
|
JavaScript
|
mit
|
slightly-askew/portfolio-2017,slightly-askew/portfolio-2017
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.