commit
stringlengths 40
40
| old_file
stringlengths 4
264
| new_file
stringlengths 4
264
| old_contents
stringlengths 0
3.26k
| new_contents
stringlengths 1
4.43k
| subject
stringlengths 15
624
| message
stringlengths 15
4.7k
| lang
stringclasses 3
values | license
stringclasses 13
values | repos
stringlengths 5
91.5k
|
---|---|---|---|---|---|---|---|---|---|
8ee09efd28cfce24b0d712d5a1713caef4dd6819
|
app/assets/javascripts/comments.js
|
app/assets/javascripts/comments.js
|
/* All related comment actions will be managed here */
/* appending comment see views/comments/create.js.erb */
$(function(){
// declare variables for link, button, form ids
var viewCommentForm = '#view_comment_form';
var commentForm = '#comment_form';
var newComment = '#new_comment';
toggleLink(commentForm); // initially hide comment form
// show/hide form when user clicks on comment
$('h3').on('click', viewCommentForm, function(e) {
e.preventDefault();
toggleLink(commentForm);
});
// edit form text when user clicks on comment
$('h3').on('click', viewCommentForm, function(e) {
e.preventDefault();
$(viewCommentForm).text(toggleLinkText($(viewCommentForm))); // set text depending on current text
});
// remove comments form when user submits
$(commentForm).on('submit', newComment, function(e) {
e.preventDefault();
toggleLink(commentForm);
$(viewCommentForm).text(toggleLinkText($(viewCommentForm)));
});
});
/*** Helper Methods Below ***/
// toggle between show and hidden
function toggleLink(selector) {
$(selector).toggle("medium");
}
// toggle text on link/button depending on what is currently set
function toggleLinkText(linkText) {
text = linkText.text();
var text = text === "Add a comment" ? "Cancel comment" : "Add a comment";
return text;
}
|
/* All related comment actions will be managed here */
/* appending comment see views/comments/create.js.erb */
$(function(){
// declare variables for link, button, form ids
var viewCommentForm = '#view_comment_form';
var commentForm = '#comment_form';
var newComment = '#new_comment';
toggleLink(commentForm); // initially hide comment form
// show/hide form when user clicks on comment
$('h3').on('click', viewCommentForm, function(e) {
e.preventDefault();
toggleLink(commentForm);
});
// edit form text when user clicks on comment
$('h3').on('click', viewCommentForm, function(e) {
e.preventDefault();
changeFormText(viewCommentForm); // set text depending on current text
});
// remove comments form when user submits
$(commentForm).on('submit', newComment, function(e) {
e.preventDefault();
clearFormText(); // clear form contents
toggleLink(commentForm); // remove form from view
changeFormText(viewCommentForm); // toggle link/button text
});
});
/*** Helper Methods Below ***/
// toggle between show and hidden
function toggleLink(selector) {
$(selector).toggle("medium");
}
// toggle text on link/button depending on what is currently set
function toggleLinkText(linkText) {
text = linkText.text();
var text = text === "Add a comment" ? "Cancel comment" : "Add a comment";
return text;
}
// change text on comment form link/button
function changeFormText(form) {
$(form).text(toggleLinkText($(form)));
}
// clear tiny mce form text after user submits
function clearFormText() {
tinyMCE.activeEditor.setContent('');
}
|
Clean up file and remove editor text on submit
|
Clean up file and remove editor text on submit
|
JavaScript
|
mit
|
pratikmshah/myblog,pratikmshah/myblog,pratikmshah/myblog
|
6e0974dc5db259931419a64cd4d13a61425283b5
|
app/components/DeleteIcon/index.js
|
app/components/DeleteIcon/index.js
|
import React, { Component, PropTypes } from 'react';
import { openModal } from 'actions/uiActions';
import Icon from 'utils/icons';
import ConfirmModal from '../Modals/ConfirmModal';
export default class DeleteIcon extends Component {
static propTypes = {
onClick: PropTypes.func.isRequired,
message: PropTypes.string.isRequired,
dispatch: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick() {
const { onClick, message, dispatch } = this.props;
dispatch(openModal(
<ConfirmModal
confirm={onClick}
message={message}
/>),
);
}
render() {
return (
<button className="table__delete" onClick={this.onClick}><Icon icon="circleWithLine" /></button>
);
}
}
|
import React, { Component, PropTypes } from 'react';
import { openModal } from 'actions/uiActions';
import Icon from 'utils/icons';
import ConfirmModal from '../Modals/ConfirmModal';
export default class DeleteIcon extends Component {
static propTypes = {
onClick: PropTypes.func.isRequired,
message: PropTypes.string,
dispatch: PropTypes.func.isRequired,
}
static defaultProps = {
message: undefined,
}
constructor(props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick() {
const { onClick, message, dispatch } = this.props;
dispatch(openModal(
<ConfirmModal
confirm={onClick}
message={message}
/>),
);
}
render() {
return (
<button type="button" className="table__delete" onClick={this.onClick}><Icon icon="circleWithLine" /></button>
);
}
}
|
Fix defaults for DeleteIcon message
|
:wrench: Fix defaults for DeleteIcon message
|
JavaScript
|
mit
|
JasonEtco/flintcms,JasonEtco/flintcms
|
aadce336447569e40160034e87fa3e674540239d
|
routes/api.js
|
routes/api.js
|
var express = require('express');
_ = require('underscore')._
var request = require('request');
var router = express.Router({mergeParams: true});
var exec = require('child_process').exec;
var path = require('path');
var parentDir = path.resolve(process.cwd());
var jsonStream = require('express-jsonstream');
router.get('/', function(req, res, next) {
res.json({'info' : 'This is the ControCurator API v0.1'});
});
router.post('/',function(req,res) {
req.jsonStream()
.on('object',console.log);
return;
var input = req.body;
var amountofitems = input.length;
var gooditems = 0;
var baditems = 0;
for (var i=0; i < amountofitems; i++)
{
var currentitem = input[i];
if (!currentitem.hasOwnProperty('id') || !currentitem.hasOwnProperty('text')) //Test for an id and an actual body
{
baditems++;
continue;
}
gooditems++;
}
var controscore = Math.random();
res.json({'controversy':controscore,'totalItems':amountofitems,'goodItems':gooditems,'badItems':baditems});
});
module.exports = router;
|
var express = require('express');
_ = require('underscore')._
var request = require('request');
var router = express.Router({mergeParams: true});
var exec = require('child_process').exec;
var path = require('path');
var parentDir = path.resolve(process.cwd());
router.get('/', function(req, res, next) {
res.json({'info' : 'This is the ControCurator API v0.1'});
});
router.post('/',function(req,res) {
var input = req.body;
var amountofitems = input.length;
var gooditems = 0;
var baditems = 0;
for (var i=0; i < amountofitems; i++)
{
var currentitem = input[i];
if (!currentitem.hasOwnProperty('id') || !currentitem.hasOwnProperty('text')) //Test for an id and an actual body
{
baditems++;
continue;
}
gooditems++;
}
var controscore = Math.random();
res.json({'controversy':controscore,'totalItems':amountofitems,'goodItems':gooditems,'badItems':baditems});
});
module.exports = router;
|
Revert back to limited situation
|
Revert back to limited situation
|
JavaScript
|
mit
|
ControCurator/controcurator,ControCurator/controcurator,ControCurator/controcurator
|
2268bfb7be50412878eaa38627ab0a06c981aef8
|
assets/js/EditorApp.js
|
assets/js/EditorApp.js
|
var innerInitialize = function() {
console.log("It's the editor, man");
}
|
$(document).ready(function() {
innerInitialize();
});
var innerInitialize = function() {
// Create the canvas and context
initCanvas($(window).width(), $(window).height());
// initialize the camera
camera = new Camera();
}
|
Create the canvas on editor start
|
Create the canvas on editor start
|
JavaScript
|
mit
|
Tactique/jswars
|
77f69e6f30817e31a34203cce6dbdbdc6eed86dd
|
server/app.js
|
server/app.js
|
// node dependencies
var express = require('express');
var db = require('./db');
var passport = require('passport');
var morgan = require('morgan');
var parser = require('body-parser');
// custom dependencies
var db = require('../db/Listings.js');
var db = require('../db/Users.js');
var db = require('../db/Categories.js');
// use middleware
server.use(session({
secret: 'hackyhackifiers',
resave: false,
saveUninitialized: true
}));
server.use(passport.initialize());
server.use(passport.session());
// Router
var app = express();
// configure passport
// passport.use(new LocalStrategy(User.authenticate()));
// passport.serializeUser(User.serializeUser());
// passport.deserializeUser(User.deserializeUser());
// Set what we are listening on.
app.set('port', 3000);
// Logging and parsing
app.use(morgan('dev'));
app.use(parser.json());
// Set up and use our routes
// app.use('/', router);
// var router = require('./routes.js');
// Serve the client files
app.use(express.static(__dirname + '/../client'));
// If we are being run directly, run the server.
if (!module.parent) {
app.listen(app.get('port'));
console.log('Listening on', app.get('port'));
}
module.exports.app = app;
|
// node dependencies
var express = require('express');
var session = require('express-session');
var passport = require('passport');
var morgan = require('morgan');
var parser = require('body-parser');
// custom dependencies
var db = require('../db/db.js');
// var db = require('../db/Listings.js');
// var db = require('../db/Users.js');
// var db = require('../db/Categories.js');
var app = express();
// use middleware
app.use(session({
secret: 'hackyhackifiers',
resave: false,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());
// Router
// configure passport
// passport.use(new LocalStrategy(User.authenticate()));
// passport.serializeUser(User.serializeUser());
// passport.deserializeUser(User.deserializeUser());
// Set what we are listening on.
app.set('port', 3000);
// Logging and parsing
app.use(morgan('dev'));
app.use(parser.json());
// Set up and use our routes
// app.use('/', router);
// var router = require('./routes.js');
// Serve the client files
app.use(express.static(__dirname + '/../client'));
// If we are being run directly, run the server.
if (!module.parent) {
app.listen(app.get('port'));
console.log('Listening on', app.get('port'));
}
module.exports.app = app;
|
Fix db-connect commit (to working server state!)
|
Fix db-connect commit (to working server state!)
- Note: eventually, the node directive that requires 'db.js' will be
replaced by the commented out directives that require the
Listings/Users/Categories models.
|
JavaScript
|
mit
|
aphavichitr/hackifieds,glistening-gibus/hackifieds,Hackifieds/hackifieds,glistening-gibus/hackifieds,Hackifieds/hackifieds,glistening-gibus/hackifieds,aphavichitr/hackifieds
|
a394119b4badf2fda57fa48989bff0e9810b7c79
|
server-dev.js
|
server-dev.js
|
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import config from './webpack.config.babel';
import open from 'open';
const webpackServer = new WebpackDevServer(webpack(config), config.devServer);
webpackServer.listen(config.port, 'localhost', (err) => {
if (err) {
console.log(err);
}
console.log(`Listening at localhost: ${config.devServer.port}`);
console.log('Opening your system browser...');
open(`http://localhost:${config.devServer.port}/webpack-dev-server/`);
});
|
/* eslint no-console: 0 */
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import config from './webpack.config.babel';
import open from 'open';
const webpackServer = new WebpackDevServer(webpack(config), config.devServer);
webpackServer.listen(config.port, 'localhost', (err) => {
if (err) {
console.log(err);
}
console.log(`Listening at localhost: ${config.devServer.port}`);
console.log('Opening your system browser...');
open(`http://localhost:${config.devServer.port}/webpack-dev-server/`);
});
|
Allow console.log statement in server
|
Allow console.log statement in server
|
JavaScript
|
mit
|
frostney/react-app-starterkit,frostney/react-app-starterkit
|
061c79c86dec927d07c9566f982c9909abfbccad
|
app/rollDataRefresher.js
|
app/rollDataRefresher.js
|
const i = require('itemDataRefresher.js');
fateBus.subscribe(module, 'fate.configurationLoaded', function(topic, configuration) {
new i.ItemDataRefresher('roll', configuration.shaderDataTSV)
});
|
const i = require('itemDataRefresher.js');
fateBus.subscribe(module, 'fate.configurationLoaded', function(topic, configuration) {
new i.ItemDataRefresher('roll', configuration.rollDataTSV)
});
|
Use the right TSV data source
|
Use the right TSV data source
|
JavaScript
|
mit
|
rslifka/fate_of_all_fools,rslifka/fate_of_all_fools
|
c313bafe3cf063cf0f32318363050f4cce43afae
|
www/cdvah/js/app.js
|
www/cdvah/js/app.js
|
var myApp = angular.module('CordovaAppHarness', ['ngRoute']);
myApp.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/', {
templateUrl: 'views/list.html',
controller: 'ListCtrl'
});
$routeProvider.when('/add', {
templateUrl: 'views/add.html',
controller: 'AddCtrl'
});
$routeProvider.when('/edit/:appId', {
templateUrl: 'views/add.html',
controller: 'AddCtrl'
});
$routeProvider.when('/details/:index', {
templateUrl: 'views/details.html',
controller: 'DetailsCtrl'
});
}]);
// foo
document.addEventListener('deviceready', function() {
cordova.plugins.fileextras.getDataDirectory(false, function(dirEntry) {
var path = dirEntry.fullPath;
myApp.value('INSTALL_DIRECTORY', path + '/apps');
myApp.value('APPS_JSON', path + '/apps.json');
myApp.factory('UrlCleanup', function() {
return function(url) {
url = url.replace(/\/$/, '').replace(new RegExp(cordova.platformId + '$'), '').replace(/\/$/, '');
if (!/^[a-z]+:/.test(url)) {
url = 'http://' + url;
}
return url;
};
});
angular.bootstrap(document, ['CordovaAppHarness']);
});
}, false);
|
var myApp = angular.module('CordovaAppHarness', ['ngRoute']);
myApp.config(['$routeProvider', function($routeProvider){
$routeProvider.when('/', {
templateUrl: 'views/list.html',
controller: 'ListCtrl'
});
$routeProvider.when('/add', {
templateUrl: 'views/add.html',
controller: 'AddCtrl'
});
$routeProvider.when('/edit/:appId', {
templateUrl: 'views/add.html',
controller: 'AddCtrl'
});
$routeProvider.when('/details/:index', {
templateUrl: 'views/details.html',
controller: 'DetailsCtrl'
});
}]);
// foo
document.addEventListener('deviceready', function() {
cordova.filesystem.getDataDirectory(false, function(dirEntry) {
var path = dirEntry.fullPath;
myApp.value('INSTALL_DIRECTORY', path + '/apps');
myApp.value('APPS_JSON', path + '/apps.json');
myApp.factory('UrlCleanup', function() {
return function(url) {
url = url.replace(/\/$/, '').replace(new RegExp(cordova.platformId + '$'), '').replace(/\/$/, '');
if (!/^[a-z]+:/.test(url)) {
url = 'http://' + url;
}
return url;
};
});
angular.bootstrap(document, ['CordovaAppHarness']);
});
}, false);
|
Use updated symbol path for file-system-roots plugin
|
Use updated symbol path for file-system-roots plugin
|
JavaScript
|
apache-2.0
|
guozanhua/chrome-app-developer-tool,apache/cordova-app-harness,guozanhua/chrome-app-developer-tool,feedhenry/cordova-app-harness,feedhenry/cordova-app-harness,apache/cordova-app-harness,apache/cordova-app-harness,feedhenry/cordova-app-harness,guozanhua/chrome-app-developer-tool,apache/cordova-app-harness,guozanhua/chrome-app-developer-tool,feedhenry/cordova-app-harness
|
00a621ec5e411bf070d789c8f7a6344b30986844
|
main.start.js
|
main.start.js
|
//electron entry-point
const REACT_DEVELOPER_TOOLS = require('electron-devtools-installer').REACT_DEVELOPER_TOOLS;
var installExtension = require('electron-devtools-installer').default;
var app = require('electron').app;
var BrowserWindow = require('electron').BrowserWindow;
var path = require( "path" );
if (process.env.NODE_ENV === 'development') {
require('electron-debug')(); // eslint-disable-line global-require
}
app.on('ready',function() {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
var mainWindow = new BrowserWindow({
width: 1200,
height: 600
});
mainWindow.loadURL('file://' + __dirname + '/src/index-electron.html');
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.show();
mainWindow.focus();
});
mainWindow.on('closed', () => {
mainWindow = null;
});
if (process.env.NODE_ENV === 'development') {
mainWindow.openDevTools();
}
});
|
//electron entry-point
var app = require('electron').app;
var BrowserWindow = require('electron').BrowserWindow;
var path = require( "path" );
if (process.env.NODE_ENV === 'development') {
require('electron-debug')(); // eslint-disable-line global-require
}
app.on('ready',function() {
if(process.env.NODE_ENV === 'development') {
const REACT_DEVELOPER_TOOLS = require('electron-devtools-installer').REACT_DEVELOPER_TOOLS;
var installExtension = require('electron-devtools-installer').default;
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
}
var mainWindow = new BrowserWindow({
width: 1200,
height: 600
});
mainWindow.loadURL('file://' + __dirname + '/src/index-electron.html');
mainWindow.webContents.on('did-finish-load', () => {
mainWindow.show();
mainWindow.focus();
});
mainWindow.on('closed', () => {
mainWindow = null;
});
if (process.env.NODE_ENV === 'development') {
mainWindow.openDevTools();
}
});
|
Load react-devtools in dev env only
|
Load react-devtools in dev env only
|
JavaScript
|
mit
|
cynicaldevil/gitrobotic,cynicaldevil/gitrobotic
|
67b10db38f23873d832009c29519b57fb1e769e2
|
blueocean-web/gulpfile.js
|
blueocean-web/gulpfile.js
|
//
// See https://github.com/jenkinsci/js-builder
//
var builder = require('@jenkins-cd/js-builder');
// Disable js-builder based linting for now.
// Will get fixed with https://github.com/cloudbees/blueocean/pull/55
builder.lint('none');
//
// Create the main "App" bundle.
// generateNoImportsBundle makes it easier to test with zombie.
//
builder.bundle('src/main/js/blueocean.js')
.withExternalModuleMapping('jquery-detached', 'jquery-detached:jquery2')
.inDir('target/classes/io/jenkins/blueocean')
.less('src/main/less/blueocean.less')
.generateNoImportsBundle();
|
//
// See https://github.com/jenkinsci/js-builder
//
var builder = require('@jenkins-cd/js-builder');
// Disable js-builder based linting for now.
// Will get fixed with https://github.com/cloudbees/blueocean/pull/55
builder.lint('none');
// Explicitly setting the src paths in order to allow the rebundle task to
// watch for changes in the JDL (js, css, icons etc).
// See https://github.com/jenkinsci/js-builder#setting-src-and-test-spec-paths
builder.src(['src/main/js', 'src/main/less', 'node_modules/@jenkins-cd/design-language']);
//
// Create the main "App" bundle.
// generateNoImportsBundle makes it easier to test with zombie.
//
builder.bundle('src/main/js/blueocean.js')
.withExternalModuleMapping('jquery-detached', 'jquery-detached:jquery2')
.inDir('target/classes/io/jenkins/blueocean')
.less('src/main/less/blueocean.less')
.generateNoImportsBundle();
|
Watch for changes in the JDL package (rebundle)
|
Watch for changes in the JDL package (rebundle)
|
JavaScript
|
mit
|
ModuloM/blueocean-plugin,kzantow/blueocean-plugin,jenkinsci/blueocean-plugin,tfennelly/blueocean-plugin,jenkinsci/blueocean-plugin,jenkinsci/blueocean-plugin,kzantow/blueocean-plugin,jenkinsci/blueocean-plugin,tfennelly/blueocean-plugin,ModuloM/blueocean-plugin,alvarolobato/blueocean-plugin,kzantow/blueocean-plugin,jenkinsci/blueocean-plugin,tfennelly/blueocean-plugin,alvarolobato/blueocean-plugin,alvarolobato/blueocean-plugin,ModuloM/blueocean-plugin,ModuloM/blueocean-plugin,kzantow/blueocean-plugin,alvarolobato/blueocean-plugin,tfennelly/blueocean-plugin
|
80a8734522b5aaaf12ff2fb4e1f93500bd33b423
|
src/Backdrop.js
|
src/Backdrop.js
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View, StyleSheet, TouchableWithoutFeedback, Animated } from 'react-native';
import { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from './constants';
class Backdrop extends Component {
constructor(...args) {
super(...args);
this.fadeAnim = new Animated.Value(0.001);
}
open() {
return new Promise(resolve => {
Animated.timing(this.fadeAnim, {
duration: OPEN_ANIM_DURATION,
toValue: 1,
useNativeDriver: true,
}).start(resolve);
});
}
close() {
return new Promise(resolve => {
Animated.timing(this.fadeAnim, {
duration: CLOSE_ANIM_DURATION,
toValue: 0,
useNativeDriver: true,
}).start(resolve);
});
}
render() {
const { onPress, style } = this.props;
return (
<TouchableWithoutFeedback onPress={onPress}>
<Animated.View style={[styles.fullscreen, { opacity: this.fadeAnim }]}>
<View style={[styles.fullscreen, style]} />
</Animated.View>
</TouchableWithoutFeedback>
);
}
}
Backdrop.propTypes = {
onPress: PropTypes.func.isRequired,
};
const styles = StyleSheet.create({
fullscreen: {
opacity: 0,
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});
export default Backdrop;
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View, StyleSheet, TouchableWithoutFeedback, Animated, Platform } from 'react-native';
import { OPEN_ANIM_DURATION, CLOSE_ANIM_DURATION } from './constants';
class Backdrop extends Component {
constructor(...args) {
super(...args);
this.fadeAnim = new Animated.Value(0.001);
}
open() {
return new Promise(resolve => {
Animated.timing(this.fadeAnim, {
duration: OPEN_ANIM_DURATION,
toValue: 1,
useNativeDriver: (Platform.OS !== "web"),
}).start(resolve);
});
}
close() {
return new Promise(resolve => {
Animated.timing(this.fadeAnim, {
duration: CLOSE_ANIM_DURATION,
toValue: 0,
useNativeDriver: (Platform.OS !== "web"),
}).start(resolve);
});
}
render() {
const { onPress, style } = this.props;
return (
<TouchableWithoutFeedback onPress={onPress}>
<Animated.View style={[styles.fullscreen, { opacity: this.fadeAnim }]}>
<View style={[styles.fullscreen, style]} />
</Animated.View>
</TouchableWithoutFeedback>
);
}
}
Backdrop.propTypes = {
onPress: PropTypes.func.isRequired,
};
const styles = StyleSheet.create({
fullscreen: {
opacity: 0,
position: 'absolute',
top: 0,
left: 0,
bottom: 0,
right: 0,
},
});
export default Backdrop;
|
Fix web warning about useNativeDriver
|
Fix web warning about useNativeDriver
|
JavaScript
|
isc
|
instea/react-native-popup-menu
|
48b03917df05a8c9892a3340d93ba4b92b16b81c
|
client/config/environment.js
|
client/config/environment.js
|
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'client',
environment: environment,
baseURL: '/',
locationType: 'auto',
'ember-simple-auth-token': {
serverTokenEndpoint: 'http://localhost:8080/api-token-auth/',
serverTokenRefreshEndpoint: 'http://localhost:8080/api-token-refresh/',
refreshLeeway: 20
},
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
}
};
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: 'client',
environment: environment,
baseURL: '/',
locationType: 'auto',
'ember-simple-auth-token': {
serverTokenEndpoint: 'http://localhost:8080/api-token-auth/',
serverTokenRefreshEndpoint: 'http://localhost:8080/api-token-refresh/',
refreshLeeway: 20,
timeFactor: 1000, // backend is in seconds and the frontend is in ms.
},
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
}
};
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;
};
|
Adjust the time factor to align frontent and backend auth.
|
Adjust the time factor to align frontent and backend auth.
Fixes #27
|
JavaScript
|
bsd-2-clause
|
mblayman/lcp,mblayman/lcp,mblayman/lcp
|
9d19611474e61db68fcf2f7b9ee8505fea59092e
|
src/Camera.js
|
src/Camera.js
|
/**
* @depends MatrixStack.js
*/
var Camera = new Class({
initialize: function() {
this.projection = new MatrixStack();
this.modelview = new MatrixStack();
},
perspective: function(fovy, aspect, near, far) {
mat4.perspective(fovy, aspect, near, far, this.projection);
},
ortho: function(left, right, top, bottom, near, far) {
mat4.ortho(left, right, top, bottom, near, far, this.projection);
},
lookAt: function(eye, center, up) {
mat4.lookAt(eye, center, up, this.modelview);
}
});
|
/**
* @depends MatrixStack.js
*/
var Camera = new Class({
initialize: function() {
this.projection = new MatrixStack();
this.modelview = new MatrixStack();
},
perspective: function(fovy, aspect, near, far) {
mat4.perspective(fovy, aspect, near, far, this.projection.matrix);
},
ortho: function(left, right, top, bottom, near, far) {
mat4.ortho(left, right, top, bottom, near, far, this.projection.matrix);
},
lookAt: function(eye, center, up) {
mat4.lookAt(eye, center, up, this.modelview.matrix);
}
});
|
Make camera function actually affect the matrices
|
Make camera function actually affect the matrices
|
JavaScript
|
mit
|
oampo/webglet
|
1a3aeafe8f22d5e80276a7e0caaae99a274f2641
|
Analyser/src/External.js
|
Analyser/src/External.js
|
/* Copyright (c) Royal Holloway, University of London | Contact Blake Loring ([email protected]), Duncan Mitchell ([email protected]), or Johannes Kinder ([email protected]) for details or support | LICENSE.md for license details */
"use strict";
/**
* This is a function that detects whether we are using Electron and
* if so does a remote call through IPC rather than a direct require.
*/
const ELECTRON_PATH_MAGIC = '/electron/';
export default function (library) {
let lrequire = require;
if (process && process.execPath && process.execPath.indexOf(ELECTRON_PATH_MAGIC) != -1) {
lrequire = require('electron').remote.require;
}
const result = lrequire(library);
return result.default ? result.default : result;
}
|
/* Copyright (c) Royal Holloway, University of London | Contact Blake Loring ([email protected]), Duncan Mitchell ([email protected]), or Johannes Kinder ([email protected]) for details or support | LICENSE.md for license details */
"use strict";
export default function (library) {
return require(library);
}
|
Remove external electron link as we're rethinking that for now
|
Remove external electron link as we're rethinking that for now
|
JavaScript
|
mit
|
ExpoSEJS/ExpoSE,ExpoSEJS/ExpoSE,ExpoSEJS/ExpoSE
|
fa09a1300bb527ad8c804e06bc33edc1b9213ea4
|
test/integration-test.js
|
test/integration-test.js
|
var injection = require('../services/injection.js');
var Q = require('q');
var mongoose = require('mongoose');
module.exports = function (test, fixtureName, testFn) {
var dbUrl = 'mongodb://localhost:27017/' + fixtureName;
var cleanUp = function () {
return Q.nbind(mongoose.connect, mongoose)(dbUrl).then(function () {
var db = mongoose.connection.db;
return Q.nbind(db.dropDatabase, db)().then(function () {
db.close();
});
});
};
cleanUp().then(function () {
var allcountServer = require('../allcount-server.js');
injection.resetInjection();
injection.bindFactory('port', 9080);
injection.bindFactory('dbUrl', dbUrl);
injection.bindFactory('gitRepoUrl', 'test-fixtures/' + fixtureName);
allcountServer.reconfigureAllcount();
return allcountServer.inject('allcountServerStartup');
}).then(function (server) {
return Q.nbind(server.startup, server)().then(function (errors) {
if (errors) {
throw new Error(errors.join('\n'));
}
return Q(testFn()).then(function () {
return server.stop().then(function () {
injection.resetInjection();
});
});
});
}).finally(cleanUp).done(function () {
test.done();
});
};
|
var injection = require('../services/injection.js');
var Q = require('q');
var mongoose = require('mongoose');
module.exports = function (test, fixtureName, testFn) {
var dbUrl = 'mongodb://localhost:27017/' + fixtureName;
var cleanUp = function () {
return Q.nbind(mongoose.connect, mongoose)(dbUrl).then(function () {
var db = mongoose.connection.db;
return Q.nbind(db.dropDatabase, db)().then(function () {
db.close();
});
});
};
cleanUp().then(function () {
var allcountServer = require('../allcount-server.js');
injection.resetInjection();
injection.bindFactory('port', 9080);
injection.bindFactory('dbUrl', dbUrl);
injection.bindFactory('gitRepoUrl', 'test-fixtures/' + fixtureName);
allcountServer.reconfigureAllcount();
return allcountServer.inject('allcountServerStartup');
}).then(function (server) {
return Q.nbind(server.startup, server)().then(function (errors) {
if (errors) {
throw new Error(errors.join('\n'));
}
return Q(testFn()).then(function () {
return server.stop().then(function () {
injection.resetInjection();
});
});
});
}).finally(cleanUp).finally(function () {
test.done();
}).done();
};
|
Fix endless execution of integration tests
|
Fix endless execution of integration tests
|
JavaScript
|
mit
|
allcount/allcountjs,chikh/allcountjs,chikh/allcountjs,allcount/allcountjs
|
11c5510b06900c328ff61101bbf11cabf00419c4
|
tests/e2e/jest.config.js
|
tests/e2e/jest.config.js
|
const path = require( 'path' );
module.exports = {
preset: 'jest-puppeteer',
setupFilesAfterEnv: [
'<rootDir>/config/bootstrap.js',
'@wordpress/jest-console',
'expect-puppeteer',
],
testMatch: [
'<rootDir>/**/*.test.js',
'<rootDir>/specs/**/__tests__/**/*.js',
'<rootDir>/specs/**/?(*.)(spec|test).js',
'<rootDir>/specs/**/test/*.js',
],
transform: {
'^.+\\.[jt]sx?$': path.join( __dirname, 'babel-transform' ),
},
transformIgnorePatterns: [ 'node_modules' ],
testPathIgnorePatterns: [ '.git', 'node_modules' ],
};
|
const path = require( 'path' );
module.exports = {
preset: 'jest-puppeteer',
setupFilesAfterEnv: [
'<rootDir>/config/bootstrap.js',
'@wordpress/jest-console',
'expect-puppeteer',
],
testMatch: [
'<rootDir>/**/*.test.js',
'<rootDir>/specs/**/__tests__/**/*.js',
'<rootDir>/specs/**/?(*.)(spec|test).js',
'<rootDir>/specs/**/test/*.js',
],
transform: {
'^.+\\.[jt]sx?$': path.join( __dirname, 'babel-transform' ),
},
transformIgnorePatterns: [ 'node_modules' ],
testPathIgnorePatterns: [ '.git', 'node_modules' ],
verbose: true,
};
|
Add verbose option to E2E tests.
|
Add verbose option to E2E tests.
|
JavaScript
|
apache-2.0
|
google/site-kit-wp,google/site-kit-wp,google/site-kit-wp,google/site-kit-wp
|
0ab42696086c681302a2718f89b557bbe40442e8
|
src/foam/u2/HTMLElement.js
|
src/foam/u2/HTMLElement.js
|
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.u2',
name: 'HTMLValidator',
extends: 'foam.u2.DefaultValidator',
axioms: [ foam.pattern.Singleton.create() ],
methods: [
function sanitizeText(text) {
// TODO: validate text
return text;
}
]
});
// An Element which does not escape HTML content
foam.CLASS({
package: 'foam.u2',
name: 'HTMLElement',
extends: 'foam.u2.Element',
exports: [ 'validator as elementValidator' ],
properties: [
{
class: 'Proxy',
of: 'foam.u2.DefaultValidator',
name: 'validator',
value: foam.u2.HTMLValidator.create()
}
]
});
|
/**
* @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.CLASS({
package: 'foam.u2',
name: 'HTMLValidator',
extends: 'foam.u2.DefaultValidator',
axioms: [ foam.pattern.Singleton.create() ],
methods: [
function sanitizeText(text) {
// TODO: validate text
return text;
}
]
});
// An Element which does not escape HTML content
foam.CLASS({
package: 'foam.u2',
name: 'HTMLElement',
extends: 'foam.u2.Element',
requires: [ 'foam.u2.HTMLValidator' ],
exports: [ 'validator as elementValidator' ],
properties: [
{
class: 'Proxy',
of: 'foam.u2.DefaultValidator',
name: 'validator',
factory: function() { return this.HTMLValidator.create() }
}
]
});
|
Use a factory instead of creating an HTMLValidator inline.
|
Use a factory instead of creating an HTMLValidator inline.
|
JavaScript
|
apache-2.0
|
foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,foam-framework/foam2,jacksonic/vjlofvhjfgm,jacksonic/vjlofvhjfgm,foam-framework/foam2,jacksonic/vjlofvhjfgm
|
fee641c22a50f685055139a8abb34a6a6159378e
|
src/js/index.js
|
src/js/index.js
|
require("../scss/index.scss");
var React = require('react');
var Locale = require('grommet/utils/Locale');
var Cabler = require('./components/Cabler');
var locale = Locale.getCurrentLocale();
var localeData;
try {
localeData = Locale.getLocaleData(require('../messages/' + locale));
} catch (e) {
localeData = Locale.getLocaleData(require('../messages/en-US'));
}
var element = document.getElementById('content');
React.render(React.createElement(Cabler, {locales: localeData.locale, messages: localeData.messages}), element);
document.body.classList.remove('loading');
|
require("../scss/index.scss");
var React = require('react');
var ReactDOM = require('react-dom');
var Locale = require('grommet/utils/Locale');
var Cabler = require('./components/Cabler');
var locale = Locale.getCurrentLocale();
var localeData;
try {
localeData = Locale.getLocaleData(require('../messages/' + locale));
} catch (e) {
localeData = Locale.getLocaleData(require('../messages/en-US'));
}
var element = document.getElementById('content');
ReactDOM.render(React.createElement(Cabler, {locales: localeData.locale, messages: localeData.messages}), element);
document.body.classList.remove('loading');
|
Use react-dom package for rendering application
|
Use react-dom package for rendering application
|
JavaScript
|
apache-2.0
|
grommet/grommet-cabler,grommet/grommet-cabler
|
dadee563a1ea459c588b1507a4a98078e20d0dc6
|
javascript/cucumber-blanket.js
|
javascript/cucumber-blanket.js
|
(function (){
/* ADAPTER
*
* This blanket.js adapter is designed to autostart coverage
* immediately. The other side of this is handled from Cucumber
*
* Required blanket commands:
* blanket.setupCoverage(); // Do it ASAP
* blanket.onTestStart(); // Do it ASAP
* blanket.onTestDone(); // After Scenario Hook
* blanket.onTestsDone(); // After Scenario Hook
*/
blanket.beforeStartTestRunner({
callback: function() {
blanket.setupCoverage();
blanket.onTestStart();
}
});
/* REPORTER
*
* Blanket.js docs speak of blanket.customReporter but
* that doesn't actually work so we'll override defaultReporter
*/
blanket.defaultReporter = function(coverage_results){
window.COVERAGE_RESULTS = coverage_results; // We'll grab this on selenium side
};
})();
|
(function (){
/* ADAPTER
*
* This blanket.js adapter is designed to autostart coverage
* immediately. The other side of this is handled from Cucumber
*
* Required blanket commands:
* blanket.setupCoverage(); // Do it ASAP
* blanket.onTestStart(); // Do it ASAP
* blanket.onTestDone(); // After Scenario Hook (Not necessary)
* blanket.onTestsDone(); // After Scenario Hook
*/
blanket.beforeStartTestRunner({
callback: function() {
blanket.setupCoverage();
blanket.onTestStart();
window.CUCUMBER_BLANKET = {
files: {},
sources: {},
done: false,
is_setup: true
};
}
});
/* REPORTER
*
* Blanket.js docs speak of blanket.customReporter but
* that doesn't actually work so we'll override defaultReporter
*/
blanket.defaultReporter = function(coverage_results){
window.CUCUMBER_BLANKET.files = coverage_results.files;
// Strangely enough it looks like we need to iterate in order to grab the `source`
// data which is necessary to know which lines of code are being reported on.
var files = Object.keys(coverage_results.files);
for (var i = 0, l = files.length; i < l; i ++) {
var file = files[i];
window.CUCUMBER_BLANKET.sources[file] = window.CUCUMBER_BLANKET.files[file].source;
}
window.CUCUMBER_BLANKET.done = true;
// Now we can grab all this on the selenium side through window.CUCUMBER_BLANKET
};
})();
|
Update javascript blanket adapter to include sources data.
|
Update javascript blanket adapter to include sources data.
|
JavaScript
|
mit
|
vemperor/capybara-blanket,kfatehi/cucumber-blanket,kfatehi/cucumber-blanket,keyvanfatehi/cucumber-blanket,keyvanfatehi/cucumber-blanket
|
a37ea675122ca7da96a84090aa86f7e7eaa038d4
|
src/lib/get-costume-url.js
|
src/lib/get-costume-url.js
|
import storage from './storage';
import {SVGRenderer} from 'scratch-svg-renderer';
// Contains 'font-family', but doesn't only contain 'font-family="none"'
const HAS_FONT_REGEXP = 'font-family(?!="none")';
const getCostumeUrl = (function () {
let cachedAssetId;
let cachedUrl;
return function (asset) {
if (cachedAssetId === asset.assetId) {
return cachedUrl;
}
cachedAssetId = asset.assetId;
// If the SVG refers to fonts, they must be inlined in order to display correctly in the img tag.
// Avoid parsing the SVG when possible, since it's expensive.
if (asset.assetType === storage.AssetType.ImageVector) {
const svgString = asset.decodeText();
if (svgString.match(HAS_FONT_REGEXP)) {
const svgRenderer = new SVGRenderer();
svgRenderer.loadString(svgString);
const svgText = svgRenderer.toString(true /* shouldInjectFonts */);
cachedUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svgText)}`;
} else {
cachedUrl = asset.encodeDataURI();
}
} else {
cachedUrl = asset.encodeDataURI();
}
return cachedUrl;
};
}());
export {
getCostumeUrl as default,
HAS_FONT_REGEXP
};
|
import storage from './storage';
import {inlineSvgFonts} from 'scratch-svg-renderer';
// Contains 'font-family', but doesn't only contain 'font-family="none"'
const HAS_FONT_REGEXP = 'font-family(?!="none")';
const getCostumeUrl = (function () {
let cachedAssetId;
let cachedUrl;
return function (asset) {
if (cachedAssetId === asset.assetId) {
return cachedUrl;
}
cachedAssetId = asset.assetId;
// If the SVG refers to fonts, they must be inlined in order to display correctly in the img tag.
// Avoid parsing the SVG when possible, since it's expensive.
if (asset.assetType === storage.AssetType.ImageVector) {
const svgString = asset.decodeText();
if (svgString.match(HAS_FONT_REGEXP)) {
const svgText = inlineSvgFonts(svgString);
cachedUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svgText)}`;
} else {
cachedUrl = asset.encodeDataURI();
}
} else {
cachedUrl = asset.encodeDataURI();
}
return cachedUrl;
};
}());
export {
getCostumeUrl as default,
HAS_FONT_REGEXP
};
|
Use fontInliner instead of entire SVGRenderer for showing costume tiles.
|
Use fontInliner instead of entire SVGRenderer for showing costume tiles.
The fontInliner from the scratch-svg-renderer was changed recently to work entirely on strings, so we can use that instead of parsing/loading/possibly drawing/stringifying the entire SVG.
This does not address the size-1 cache issue where the cache is invalidated any time there is more than 1 sprite. But that can be handled later.
Using the 4x CPU slowdown in chrome dev tools, on a simple costume that just has a single text element the getCostumeUrl time goes from 10ms to 1ms, very important for updating in a timely way.
|
JavaScript
|
bsd-3-clause
|
LLK/scratch-gui,LLK/scratch-gui
|
69772952eaa4bbde2a35fc767ac5f496e1c57e99
|
src/filter.js
|
src/filter.js
|
function hide_covers() {
// Remove covers
$(".mix_element div.cover").remove()
// Add class so cards can be restyled
$(".mix_card.half_card").addClass("ext-coverless_card")
// Remove covers on track page
$("#cover_art").remove()
// Remove covers in the sidebar of a track page
$(".card.sidebar_mix .cover").remove()
$(".card.sidebar_mix").addClass("ext-coverless_card")
}
function filter() {
chrome.storage.local.get("state", function(result) {
if(result["state"] == "on") {
hide_covers()
}
});
}
// Make sure that when we navigate the site (which doesn't refresh the page), the filter is still run
$('#body_container').bind('DOMSubtreeModified',filter);
filter();
|
function hide_covers() {
// Remove covers
$(".mix_element div.cover").remove()
// Add class so cards can be restyled
$(".mix_card.half_card").addClass("ext-coverless_card")
// Remove covers on track page
$("#cover_art").remove()
// Remove covers in the sidebar of a track page
$(".card.sidebar_mix .cover").remove()
$(".card.sidebar_mix").addClass("ext-coverless_card")
}
function filter() {
chrome.storage.local.get("state", function(result) {
if(result["state"] == "on") {
hide_covers()
}
});
}
// Make sure that when we navigate the site (which doesn't refresh the page), the filter is still run
var observer = new MutationObserver(filter)
observer.observe(document.getElementById("main"), {childList: true, subtree: true})
filter();
|
Use MutationObserver API to catch dom updates
|
Use MutationObserver API to catch dom updates
|
JavaScript
|
mit
|
pbhavsar/8tracks-Filter
|
63625631eafd8b8d68bcc213243f8105d76269dd
|
src/js/app.js
|
src/js/app.js
|
// JS Goes here - ES6 supported
if (window.netlifyIdentity) {
window.netlifyIdentity.on('login', () => {
document.location.href = '/admin/';
});
}
|
// JS Goes here - ES6 supported
if (window.netlifyIdentity && !window.netlifyIdentity.currentUser()) {
window.netlifyIdentity.on('login', () => {
document.location.href = '/admin/';
});
}
|
Fix issue with always redirecting to /admin when logged in
|
Fix issue with always redirecting to /admin when logged in
|
JavaScript
|
mit
|
netlify-templates/one-click-hugo-cms,chromicant/blog,doudigit/doudigit.github.io,netlify-templates/one-click-hugo-cms,chromicant/blog,doudigit/doudigit.github.io
|
b2648c0b5fa32934d24b271fdb050d11d0484c21
|
src/index.js
|
src/index.js
|
/**
* Detects if only the primary button has been clicked in mouse events.
* @param {MouseEvent} e Event instance (or Event-like, i.e. `SyntheticEvent`)
* @return {Boolean}
*/
export const isPrimaryClick = e =>
!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) &&
(("button" in e && e.button === 0) || ("buttons" in e && e.buttons === 1));
/**
* Decorates a function so it calls if only the primary button has been
* pressed in mouse events.
* @param {Function} fn
* @return {Function}
*/
export const onPrimaryClick = fn => e => (isPrimaryClick(e) ? fn(e) : true);
|
/**
* Detects if only the primary button has been clicked in mouse events.
* @param {MouseEvent} e Event instance (or Event-like, i.e. `SyntheticEvent`)
* @return {Boolean}
*/
export const isPrimaryClick = e =>
!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) &&
(("button" in e && e.button === 0) || ("buttons" in e && e.buttons === 1));
/**
* Decorates a function so it calls if only the primary button has been
* pressed in mouse events.
* @param {Function} fn
* @return {Function}
*/
export const onPrimaryClick = fn => (e, ...args) =>
isPrimaryClick(e, ...args) ? fn(e) : true;
|
Update onPrimaryClick to pass down multiple args
|
Update onPrimaryClick to pass down multiple args
|
JavaScript
|
mit
|
jacobbuck/primary-click
|
d54e3be13f374f3aa9b2f1e24bc476e7aadbfbcb
|
src/index.js
|
src/index.js
|
require('Common');
var win = new Window();
application.exitAfterWindowsClose = true;
win.visible = true;
win.title = "Hi Tint World!";
var webview = new WebView(); // Create a new webview for HTML.
win.appendChild(webview); // attach the webview to the window.
// position the webview 0 pixels from all the window's edges.
webview.left=webview.right=webview.top=webview.bottom=0;
// What we should do when the web-page loads.
webview.addEventListener('load', function() {
webview.postMessage(JSON.stringify(process.versions));
});
webview.location = "app://src/index.html"; // Tell the webview to render the index.html
|
require('Common');
var win = new Window();
var toolbar = new Toolbar();
application.exitAfterWindowsClose = true;
win.visible = true;
win.title = "Hi Tint World!";
btn = new Button();
btn.image = 'back';
toolbar.appendChild( btn );
win.toolbar = toolbar;
var webview = new WebView(); // Create a new webview for HTML.
win.appendChild(webview); // attach the webview to the window.
// position the webview 0 pixels from all the window's edges.
webview.left=webview.right=webview.top=webview.bottom=0;
// What we should do when the web-page loads.
webview.addEventListener('load', function() {
webview.postMessage(JSON.stringify(process.versions));
});
webview.location = "app://src/index.html"; // Tell the webview to render the index.html
|
Add toolbar with back button
|
Add toolbar with back button
|
JavaScript
|
mit
|
niaxi/hello-tint,niaxi/hello-tint
|
0c28f538d9382d85c69ecb06a208ae1b0874b29c
|
src/index.js
|
src/index.js
|
/**
* Created by thram on 21/01/17.
*/
import forEach from "lodash/forEach";
import assign from "lodash/assign";
import isArray from "lodash/isArray";
import {observe, state, removeObserver} from "thrux";
export const connect = (stateKey, ReactComponent) => {
class ThruxComponent extends ReactComponent {
observers = {};
constructor(props) {
super(props);
this.state = assign(this.state || {}, state([].concat(stateKey)));
}
addObserver = (key) => {
this.observers[key] = (state) => {
let newState = {};
newState[key] = state;
this.setState(newState);
};
observe(key, this.observers[key]);
};
componentDidMount(...args) {
isArray(stateKey) ? forEach(stateKey, this.addObserver) : this.addObserver(stateKey);
super.componentDidMount.apply(this, args);
}
componentWillUnmount(...args) {
super.componentWillUnmount.apply(this, args);
forEach(this.observers, (observer, key) => removeObserver(key, observer));
}
}
return ThruxComponent;
};
|
/**
* Created by thram on 21/01/17.
*/
import forEach from "lodash/forEach";
import assign from "lodash/assign";
import isArray from "lodash/isArray";
import {observe, state, removeObserver} from "thrux";
export const connect = (stateKey, ReactComponent) => {
class ThruxComponent extends ReactComponent {
observers = {};
constructor(props) {
super(props);
this.state = assign(this.state || {}, state([].concat(stateKey)));
}
addObserver = (key) => {
this.observers[key] = (state) => {
let newState = {};
newState[key] = state;
this.setState(newState);
};
observe(key, this.observers[key]);
};
componentDidMount(...args) {
isArray(stateKey) ? forEach(stateKey, this.addObserver) : this.addObserver(stateKey);
super.componentDidMount && super.componentDidMount.apply(this, args);
}
componentWillUnmount(...args) {
super.componentWillUnmount && super.componentWillUnmount.apply(this, args);
forEach(this.observers, (observer, key) => removeObserver(key, observer));
}
}
return ThruxComponent;
};
|
Check first if the componentDidMount and componentWillUnmount are defined
|
fix(mount): Check first if the componentDidMount and componentWillUnmount are defined
|
JavaScript
|
mit
|
Thram/react-thrux
|
f563f24c06d6de9401aa7d43fea0d5319bf5df0e
|
src/index.js
|
src/index.js
|
#! /usr/bin/env node
import chalk from 'chalk';
import console from 'console';
import gitAuthorStats from './git-author-stats';
gitAuthorStats().forEach((gitAuthorStat) => {
const author = chalk.bold(gitAuthorStat.author);
const commits = `${gitAuthorStat.commits} commits`;
const added = chalk.green(`${gitAuthorStat.added} ++`);
const removed = chalk.red(`${gitAuthorStat.removed} --`);
const authorStats = [commits, added, removed].join(' / ');
console.log(`${author}: ${authorStats}`);
});
|
#! /usr/bin/env node
import { bold, green, red } from 'chalk';
import console from 'console';
import gitAuthorStats from './git-author-stats';
gitAuthorStats().forEach((gitAuthorStat) => {
const {
author,
commits,
added,
removed,
} = gitAuthorStat;
const gitAuthorText = [
`${commits} commits`,
green(`${added} ++`),
red(`${removed} --`),
].join(' / ');
console.log(`${bold(author)}: ${gitAuthorText}`);
});
|
Refactor Git author text writing
|
Refactor Git author text writing
|
JavaScript
|
mit
|
caedes/git-author-stats
|
15093e0594b007941d29d17751bc8de40e65a346
|
src/index.js
|
src/index.js
|
const path = require('path')
const parse = require('./parsers/index')
// TODO Fix ampersand in selectors
// TODO ENFORCE THESE RULES
// value-no-vendor-prefix – don't allow vendor prefixes
// property-no-vendor-prefix – don't allow vendor prefixes
const ignoredRules = [
// Don't throw if there's no styled-components in a file
'no-empty-source',
// We don't care about end-of-source newlines, users cannot control them
'no-missing-end-of-source-newline'
]
const sourceMapsCorrections = {}
module.exports = (/* options */) => ({
// Get string for stylelint to lint
code(input, filepath) {
const absolutePath = path.resolve(process.cwd(), filepath)
sourceMapsCorrections[absolutePath] = {}
const { extractedCSS, sourceMap } = parse(input, absolutePath)
// Save source location, merging existing corrections with current corrections
sourceMapsCorrections[absolutePath] = Object.assign(
sourceMapsCorrections[absolutePath],
sourceMap
)
return extractedCSS
},
// Fix sourcemaps
result(stylelintResult, filepath) {
const lineCorrection = sourceMapsCorrections[filepath]
const newWarnings = stylelintResult.warnings.reduce((prevWarnings, warning) => {
if (ignoredRules.includes(warning.rule)) return prevWarnings
const correctedWarning = Object.assign(warning, {
// Replace "brace" with "backtick" in warnings, e.g.
// "Unexpected empty line before closing backtick" (instead of "brace")
text: warning.text.replace(/brace/, 'backtick'),
line: lineCorrection[warning.line]
})
prevWarnings.push(correctedWarning)
return prevWarnings
}, [])
if (newWarnings.length === 0) {
// eslint-disable-next-line no-param-reassign
stylelintResult.errored = false
}
return Object.assign(stylelintResult, { warnings: newWarnings })
}
})
|
const path = require('path')
const parse = require('./parsers/index')
// TODO Fix ampersand in selectors
const sourceMapsCorrections = {}
module.exports = (/* options */) => ({
// Get string for stylelint to lint
code(input, filepath) {
const absolutePath = path.resolve(process.cwd(), filepath)
sourceMapsCorrections[absolutePath] = {}
const { extractedCSS, sourceMap } = parse(input, absolutePath)
// Save source location, merging existing corrections with current corrections
sourceMapsCorrections[absolutePath] = Object.assign(
sourceMapsCorrections[absolutePath],
sourceMap
)
return extractedCSS
},
// Fix sourcemaps
result(stylelintResult, filepath) {
const lineCorrection = sourceMapsCorrections[filepath]
const warnings = stylelintResult.warnings.map(warning =>
Object.assign(warning, {
// Replace "brace" with "backtick" in warnings, e.g.
// "Unexpected empty line before closing backtick" (instead of "brace")
text: warning.text.replace(/brace/, 'backtick'),
line: lineCorrection[warning.line]
})
)
return Object.assign(stylelintResult, { warnings })
}
})
|
Remove ignoring of stylelint rules
|
Remove ignoring of stylelint rules
|
JavaScript
|
mit
|
styled-components/stylelint-processor-styled-components
|
af6776fc87f7a18c18355f40e58364e5ca3237b7
|
components/base/Footer.js
|
components/base/Footer.js
|
import React from 'react'
class Footer extends React.PureComponent {
render () {
return <footer className='container row'>
<p className='col-xs-12'>
Copyright 2017 Junyoung Choi. <a href='https://github.com/CarbonStack/carbonstack' target='_blank'>Source code of Carbonstack</a> is published under MIT.
</p>
<style jsx>{`
p {
text-align: center;
margin: 0 auto;
line-height: 60px;
}
`}</style>
</footer>
}
}
export default Footer
|
import React from 'react'
class Footer extends React.PureComponent {
render () {
return <footer>
<p>
Copyright 2017 Junyoung Choi. <a href='https://github.com/CarbonStack/carbonstack' target='_blank'>Source code of Carbonstack</a> is published under MIT.
</p>
<style jsx>{`
p {
text-align: center;
padding: 15px 0;
}
`}</style>
</footer>
}
}
export default Footer
|
Fix stye bug of footer again
|
Fix stye bug of footer again
|
JavaScript
|
mit
|
CarbonStack/carbonstack
|
f01915febfe98c8dd27a97af00473a64030d5e4f
|
src/index.js
|
src/index.js
|
import isPromise from './isPromise';
const defaultTypes = ['PENDING', 'FULFILLED', 'REJECTED'];
export default function promiseMiddleware(config={}) {
const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypes;
return (_ref) => {
const dispatch = _ref.dispatch;
return next => action => {
if (!isPromise(action.payload)) {
return next(action);
}
const { type, payload, meta } = action;
const { promise, data } = payload;
const [ PENDING, FULFILLED, REJECTED ] = (meta || {}).promiseTypeSuffixes || promiseTypeSuffixes;
/**
* Dispatch the first async handler. This tells the
* reducer that an async action has been dispatched.
*/
next({
type: `${type}_${PENDING}`,
...data && { payload: data },
...meta && { meta }
});
/**
* Return either the fulfilled action object or the rejected
* action object.
*/
return promise.then(
(resolved={}) => dispatch({
type: `${type}_${FULFILLED}`,
...resolved.meta || resolved.payload ? resolved : {
...resolved && { payload: resolved },
...meta && { meta }
}
}),
error => dispatch({
type: `${type}_${REJECTED}`,
payload: error,
error: true,
...meta && { meta }
})
);
};
};
}
|
import isPromise from './isPromise';
const defaultTypes = ['PENDING', 'FULFILLED', 'REJECTED'];
export default function promiseMiddleware(config={}) {
const promiseTypeSuffixes = config.promiseTypeSuffixes || defaultTypes;
return (_ref) => {
const dispatch = _ref.dispatch;
return next => action => {
if (!isPromise(action.payload)) {
return next(action);
}
const { type, payload, meta } = action;
const { promise, data } = payload;
const [ PENDING, FULFILLED, REJECTED ] = (meta || {}).promiseTypeSuffixes || promiseTypeSuffixes;
/**
* Dispatch the first async handler. This tells the
* reducer that an async action has been dispatched.
*/
next({
type: `${type}_${PENDING}`,
...data && { payload: data },
...meta && { meta }
});
/**
* Return either the fulfilled action object or the rejected
* action object.
*/
return promise.then(
(resolved={}) => dispatch({
type: `${type}_${FULFILLED}`,
...resolved.meta || resolved.payload ? resolved : {
...resolved && { payload: resolved },
...meta && { meta }
}
}),
error => dispatch({
type: `${type}_${REJECTED}`,
payload: error,
error: true,
...meta && { meta }
})
);
};
};
}
|
Use default parameters for default suffixes
|
Use default parameters for default suffixes
|
JavaScript
|
mit
|
pburtchaell/redux-promise-middleware
|
08cad5105b71b10b063af27ed256bc4ab7571896
|
src/index.js
|
src/index.js
|
import _ from './utils';
export default {
has: (value = {}, conditions = {}) => {
if (!_.isObject(conditions)) return false;
if (_.isArray(value)) return !!_.find(value, conditions);
if (_.isObject(value)) return !!_.find(value.transitions, conditions);
return false;
},
find: (value = {}, conditions = {}) => {
if (!_.isObject(conditions) && typeof (conditions) !== 'function') return undefined;
if (_.isArray(value)) return _.find(value, conditions);
if (_.isObject(value)) return _.find(value.transitions, conditions);
return undefined;
},
filter: (value = {}, conditions = {}) => {
if (!_.isObject(conditions) && typeof (conditions) !== 'function') return [];
if (_.isArray(value)) return _.filter(value, conditions);
if (_.isObject(value)) return _.filter(value.transitions, conditions);
return [];
},
metaAttributes: (obj = {}) => {
if (!_.isObject(obj)) return {};
if (!_.isObject(obj.meta)) return {};
return obj.meta.attributes || {};
},
metaLinks: (obj = {}) => {
if (!_.isObject(obj)) return [];
if (!_.isObject(obj.meta)) return [];
return obj.meta.links || [];
},
attributes: (obj = {}) => {
if (!_.isObject(obj)) return {};
return obj.attributes || {};
},
transitions: (obj = {}) => {
if (!_.isObject(obj)) return [];
return obj.transitions || [];
},
get: _.get,
};
|
import _ from './utils';
function getTransitions(value) {
if (_.isArray(value)) return value;
if (_.isObject(value)) return value.transitions;
}
export default {
has: (value = {}, conditions = {}) => {
return !!_.find(getTransitions(value), conditions);
},
find: (value = {}, conditions = {}) => {
return _.find(getTransitions(value), conditions);
},
filter: (value = {}, conditions = {}) => {
return _.filter(getTransitions(value), conditions);
},
metaAttributes: (obj = {}) => {
if (!_.isObject(obj)) return {};
if (!_.isObject(obj.meta)) return {};
return obj.meta.attributes || {};
},
metaLinks: (obj = {}) => {
if (!_.isObject(obj)) return [];
if (!_.isObject(obj.meta)) return [];
return obj.meta.links || [];
},
attributes: (obj = {}) => {
if (!_.isObject(obj)) return {};
return obj.attributes || {};
},
transitions: (obj = {}) => {
if (!_.isObject(obj)) return [];
return obj.transitions || [];
},
get: _.get,
};
|
Trim code a little more
|
Trim code a little more
|
JavaScript
|
mit
|
smizell/hf
|
236683fb55facf7062e6d3e95ddff7ce37c2ef1b
|
client/app/TrustLineService/TrustLineService.service.spec.js
|
client/app/TrustLineService/TrustLineService.service.spec.js
|
'use strict';
describe('Service: trustLineService', function () {
// load the service's module
beforeEach(module('riwebApp'));
// instantiate service
var trustLineService;
beforeEach(inject(function (_trustLineService_) {
trustLineService = _trustLineService_;
}));
it('should do something', function () {
expect(!!trustLineService).toBe(true);
});
});
|
'use strict';
describe('Service: TrustLineService', function () {
// load the service's module
beforeEach(module('riwebApp'));
// instantiate service
var TrustLineService;
beforeEach(inject(function (_trustLineService_) {
TrustLineService = _trustLineService_;
}));
it('should do something', function () {
expect(!!TrustLineService).toBe(true);
});
});
|
Rename service var to TrustLineService just in case.
|
Rename service var to TrustLineService just in case.
|
JavaScript
|
agpl-3.0
|
cegeka/riweb,cegeka/riweb,andreicristianpetcu/riweb,andreicristianpetcu/riweb,cegeka/riweb,crazyquark/riweb,andreicristianpetcu/riweb,crazyquark/riweb,crazyquark/riweb
|
f47b43cee6bbd40a6879f5ce09eb2612c83496f9
|
src/index.js
|
src/index.js
|
import AtomControl from './components/AtomControl';
import CardControl from './components/CardControl';
import { classToDOMCard } from './utils/classToCard';
import Container, { EMPTY_MOBILEDOC } from './components/Container';
import DropWrapper from './components/DropWrapper';
import Editor from './components/Editor';
import LinkControl from './components/LinkControl';
import LinkForm from './components/LinkForm';
import MarkupControl from './components/MarkupControl';
import SectionControl from './components/SectionControl';
import Toolbar from './components/Toolbar';
export {
AtomControl,
CardControl,
classToDOMCard,
Container,
DropWrapper,
Editor,
EMPTY_MOBILEDOC,
LinkControl,
LinkForm,
MarkupControl,
SectionControl,
Toolbar
};
|
import AtomControl from './components/AtomControl';
import CardControl from './components/CardControl';
import { classToDOMCard } from './utils/classToCard';
import Container, { EMPTY_MOBILEDOC } from './components/Container';
import Editor from './components/Editor';
import LinkControl from './components/LinkControl';
import LinkForm from './components/LinkForm';
import MarkupControl from './components/MarkupControl';
import SectionControl from './components/SectionControl';
import Toolbar from './components/Toolbar';
export {
AtomControl,
CardControl,
classToDOMCard,
Container,
Editor,
EMPTY_MOBILEDOC,
LinkControl,
LinkForm,
MarkupControl,
SectionControl,
Toolbar
};
|
Remove drop wrapper from exports
|
Remove drop wrapper from exports
|
JavaScript
|
bsd-3-clause
|
upworthy/react-mobiledoc-editor
|
7390f356615c375960ebf49bca2001a1fee43788
|
lib/dasher.js
|
lib/dasher.js
|
var url = require('url')
var dashButton = require('node-dash-button');
var request = require('request')
function DasherButton(button) {
var options = {headers: button.headers, body: button.body, json: button.json}
this.dashButton = dashButton(button.address, button.interface)
this.dashButton.on("detected", function() {
console.log(button.name + " pressed.")
doRequest(button.url, button.method, options)
})
console.log(button.name + " added.")
}
function doRequest(requestUrl, method, options, callback) {
options = options || {}
options.query = options.query || {}
options.json = options.json || false
options.headers = options.headers || {}
var reqOpts = {
url: url.parse(requestUrl),
method: method || 'GET',
qs: options.query,
body: options.body,
json: options.json,
headers: options.headers
}
request(reqOpts, function onResponse(error, response, body) {
if (error) {
console.log("there was an error");
console.log(error);
}
if (response.statusCode === 401) {
console.log("Not authenticated");
console.log(error);
}
if (response.statusCode !== 200) {
console.log("Not a 200");
console.log(error);
}
if (callback) {
callback(error, response, body)
}
})
}
module.exports = DasherButton
|
var url = require('url')
var dashButton = require('node-dash-button');
var request = require('request')
function DasherButton(button) {
var options = {headers: button.headers, body: button.body, json: button.json}
this.dashButton = dashButton(button.address, button.interface)
this.dashButton.on("detected", function() {
console.log(button.name + " pressed.")
doRequest(button.url, button.method, options)
})
console.log(button.name + " added.")
}
function doRequest(requestUrl, method, options, callback) {
options = options || {}
options.query = options.query || {}
options.json = options.json || false
options.headers = options.headers || {}
var reqOpts = {
url: url.parse(requestUrl),
method: method || 'GET',
qs: options.query,
body: options.body,
json: options.json,
headers: options.headers
}
request(reqOpts, function onResponse(error, response, body) {
if (error) {
console.log("there was an error");
console.log(error);
}
if (response && response.statusCode === 401) {
console.log("Not authenticated");
console.log(error);
}
if (response && response.statusCode !== 200) {
console.log("Not a 200");
console.log(error);
}
if (callback) {
callback(error, response, body)
}
})
}
module.exports = DasherButton
|
Add check for nil response
|
Add check for nil response
The app was erroring on missing statusCode when no response
was received. This allows the app not to crash if the url
doesn't respond.
|
JavaScript
|
mit
|
maddox/dasher,maddox/dasher
|
f234cf043c80a66e742862cff36218fa04589398
|
src/index.js
|
src/index.js
|
'use strict';
import AssetLoader from './assetloader';
import Input from './input';
import Loop from './loop';
import Log from './log';
import Timer from './timer';
import Math from './math';
export default {
AssetLoader,
Input,
Loop,
Log,
Timer,
Math
};
|
'use strict';
import AssetLoader from './assetloader';
import Input from './input';
import Loop from './loop';
import Log from './log';
import Timer from './timer';
import Math from './math';
import Types from './types';
export default {
AssetLoader,
Input,
Loop,
Log,
Timer,
Math
};
|
Add types to be exported
|
Add types to be exported
|
JavaScript
|
unknown
|
freezedev/gamebox,gamebricks/gamebricks,freezedev/gamebox,gamebricks/gamebricks,maxwerr/gamebox
|
4aa75606353bd190240cbfd559eb291a891a7432
|
src/ui/app.js
|
src/ui/app.js
|
angular.module('proxtop', ['ngMaterial', 'ui.router', 'angular-progress-arc', 'pascalprecht.translate'])
.config(['$stateProvider', '$urlRouterProvider', '$translateProvider', function($stateProvider, $urlRouterProvider, $translateProvider) {
$urlRouterProvider.otherwise('/');
$translateProvider.useStaticFilesLoader({
prefix: 'ui/locale/locale-',
suffix: '.json'
});
$translateProvider.preferredLanguage('de');
$translateProvider.useSanitizeValueStrategy('sanitizeParameters');
}]);
|
angular.module('proxtop', ['ngMaterial', 'ui.router', 'angular-progress-arc', 'pascalprecht.translate'])
.config(['$stateProvider', '$urlRouterProvider', '$translateProvider', function($stateProvider, $urlRouterProvider, $translateProvider) {
$urlRouterProvider.otherwise('/');
$translateProvider.useStaticFilesLoader({
prefix: 'ui/locale/locale-',
suffix: '.json'
});
$translateProvider.preferredLanguage('de');
$translateProvider.useSanitizeValueStrategy('escape');
}]);
|
Fix missing dependency when using ng-translate
|
Fix missing dependency when using ng-translate
|
JavaScript
|
mit
|
kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop,kumpelblase2/proxtop
|
cbb27012bb0c8ffc338d92b2cf3ef4449a65e4a4
|
src/config.js
|
src/config.js
|
const config = Object.assign({
development: {
api: {
trade_events: {
host: 'https://intrasearch.govwizely.com/v1/trade_events',
},
},
},
production: {
api: {
trade_events: {
host: 'https://intrasearch.export.gov/v1/trade_events',
},
},
},
});
export default config[process.env.NODE_ENV];
|
import assign from 'object-assign';
const config = assign({
development: {
api: {
trade_events: {
host: 'https://intrasearch.govwizely.com/v1/trade_events',
},
},
},
production: {
api: {
trade_events: {
host: 'https://intrasearch.export.gov/v1/trade_events',
},
},
},
});
export default config[process.env.NODE_ENV];
|
Use object-assign instead of Object.assign
|
Use object-assign instead of Object.assign
|
JavaScript
|
mit
|
GovWizely/trade-event-search-app,GovWizely/trade-event-search-app
|
8295d27a906f850cefd86321d212162cba7ef296
|
local-cli/wrong-react-native.js
|
local-cli/wrong-react-native.js
|
#!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
console.error([
'\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?',
'To fix the issue, run:\033[0m',
'npm uninstall -g react-native',
'npm install -g react-native-cli'
].join('\n'));
process.exit(1);
|
#!/usr/bin/env node
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var script = process.argv[1];
var installedGlobally = script.indexOf('node_modules/.bin/react-native') === -1;
if (installedGlobally) {
console.error([
'\033[31mLooks like you installed react-native globally, maybe you meant react-native-cli?',
'To fix the issue, run:\033[0m',
'npm uninstall -g react-native',
'npm install -g react-native-cli'
].join('\n'));
process.exit(1);
} else {
require('./cli').run();
}
|
Fix usage of react-native cli inside package.json scripts
|
Fix usage of react-native cli inside package.json scripts
Summary:
IIRC we made `wrong-react-native` to warn people in case they installed `react-native` globally (instead of `react-native-cli` what the guide suggests). To do that we added `bin` entry to React Native's `package.json` that points to `local-cli/wrong-react-native.js`
However, this means that if we have a project that uses `react-native` package and has call to `react-native` CLI inside its package.json, npm will execute *local* override (which just prints a confusing in this context error message).
In fact, the template we generate with `react-native init` has `react-native start` as `start` script, which makes it useless. Let's fix it by making `wrong-react-native` script smarter – it can detect that it has been executed from local `node_modules` and run the actual CLI.
cc vjeux ide
Closes https://github.com/facebook/react-native/pull/7243
Differential Revision: D3226645
Pulled By: frantic
fb-gh-sync-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
fbshipit-source-id: be094eb0e70e491da4ebefc2abf11cff56c4c5b7
|
JavaScript
|
bsd-3-clause
|
CodeLinkIO/react-native,imjerrybao/react-native,shrutic123/react-native,tszajna0/react-native,gitim/react-native,DanielMSchmidt/react-native,jadbox/react-native,ndejesus1227/react-native,tsjing/react-native,exponent/react-native,naoufal/react-native,martinbigio/react-native,mironiasty/react-native,browniefed/react-native,corbt/react-native,InterfaceInc/react-native,makadaw/react-native,doochik/react-native,happypancake/react-native,jhen0409/react-native,shrutic123/react-native,dikaiosune/react-native,InterfaceInc/react-native,rickbeerendonk/react-native,nickhudkins/react-native,Bhullnatik/react-native,myntra/react-native,DannyvanderJagt/react-native,salanki/react-native,facebook/react-native,jadbox/react-native,jadbox/react-native,gitim/react-native,jaggs6/react-native,catalinmiron/react-native,BretJohnson/react-native,tsjing/react-native,tadeuzagallo/react-native,makadaw/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,arthuralee/react-native,facebook/react-native,negativetwelve/react-native,skevy/react-native,cdlewis/react-native,hoangpham95/react-native,luqin/react-native,wenpkpk/react-native,negativetwelve/react-native,dikaiosune/react-native,skatpgusskat/react-native,arthuralee/react-native,hammerandchisel/react-native,tgoldenberg/react-native,farazs/react-native,Swaagie/react-native,cdlewis/react-native,Ehesp/react-native,Swaagie/react-native,esauter5/react-native,cosmith/react-native,doochik/react-native,cosmith/react-native,BretJohnson/react-native,htc2u/react-native,jadbox/react-native,alin23/react-native,Maxwell2022/react-native,CntChen/react-native,wenpkpk/react-native,hoastoolshop/react-native,forcedotcom/react-native,imjerrybao/react-native,rickbeerendonk/react-native,browniefed/react-native,cpunion/react-native,formatlos/react-native,shrutic/react-native,PlexChat/react-native,csatf/react-native,myntra/react-native,pandiaraj44/react-native,nickhudkins/react-native,foghina/react-native,imDangerous/react-native,aaron-goshine/react-native,rickbeerendonk/react-native,eduardinni/react-native,arthuralee/react-native,aaron-goshine/react-native,ndejesus1227/react-native,jaggs6/react-native,peterp/react-native,thotegowda/react-native,BretJohnson/react-native,PlexChat/react-native,cdlewis/react-native,dikaiosune/react-native,xiayz/react-native,CodeLinkIO/react-native,hoastoolshop/react-native,pandiaraj44/react-native,cdlewis/react-native,jevakallio/react-native,jhen0409/react-native,htc2u/react-native,frantic/react-native,DanielMSchmidt/react-native,adamjmcgrath/react-native,peterp/react-native,jadbox/react-native,tadeuzagallo/react-native,Guardiannw/react-native,xiayz/react-native,naoufal/react-native,lelandrichardson/react-native,pandiaraj44/react-native,catalinmiron/react-native,Swaagie/react-native,luqin/react-native,catalinmiron/react-native,alin23/react-native,dikaiosune/react-native,aljs/react-native,catalinmiron/react-native,xiayz/react-native,tadeuzagallo/react-native,peterp/react-native,hoangpham95/react-native,orenklein/react-native,ptomasroos/react-native,jevakallio/react-native,christopherdro/react-native,PlexChat/react-native,pandiaraj44/react-native,shrutic123/react-native,Bhullnatik/react-native,ndejesus1227/react-native,brentvatne/react-native,peterp/react-native,ankitsinghania94/react-native,Maxwell2022/react-native,foghina/react-native,formatlos/react-native,orenklein/react-native,tarkus/react-native-appletv,Maxwell2022/react-native,frantic/react-native,farazs/react-native,happypancake/react-native,hoangpham95/react-native,esauter5/react-native,forcedotcom/react-native,catalinmiron/react-native,farazs/react-native,gitim/react-native,adamjmcgrath/react-native,shrutic123/react-native,tgoldenberg/react-native,clozr/react-native,BretJohnson/react-native,facebook/react-native,nathanajah/react-native,foghina/react-native,charlesvinette/react-native,CntChen/react-native,javache/react-native,javache/react-native,corbt/react-native,jevakallio/react-native,martinbigio/react-native,tsjing/react-native,InterfaceInc/react-native,skevy/react-native,Swaagie/react-native,callstack-io/react-native,chnfeeeeeef/react-native,csatf/react-native,nickhudkins/react-native,cosmith/react-native,InterfaceInc/react-native,chnfeeeeeef/react-native,corbt/react-native,gilesvangruisen/react-native,jhen0409/react-native,xiayz/react-native,thotegowda/react-native,negativetwelve/react-native,eduardinni/react-native,aljs/react-native,Livyli/react-native,PlexChat/react-native,Andreyco/react-native,tszajna0/react-native,ptmt/react-native-macos,foghina/react-native,tgoldenberg/react-native,CntChen/react-native,mironiasty/react-native,negativetwelve/react-native,hoangpham95/react-native,brentvatne/react-native,tadeuzagallo/react-native,Maxwell2022/react-native,CntChen/react-native,Emilios1995/react-native,DannyvanderJagt/react-native,htc2u/react-native,janicduplessis/react-native,cpunion/react-native,skatpgusskat/react-native,Bhullnatik/react-native,farazs/react-native,salanki/react-native,esauter5/react-native,salanki/react-native,Guardiannw/react-native,ankitsinghania94/react-native,tsjing/react-native,lelandrichardson/react-native,myntra/react-native,chnfeeeeeef/react-native,Livyli/react-native,kesha-antonov/react-native,mironiasty/react-native,salanki/react-native,janicduplessis/react-native,ptmt/react-native-macos,chnfeeeeeef/react-native,shrutic/react-native,imjerrybao/react-native,ptmt/react-native-macos,htc2u/react-native,xiayz/react-native,myntra/react-native,eduardinni/react-native,csatf/react-native,adamjmcgrath/react-native,adamjmcgrath/react-native,martinbigio/react-native,esauter5/react-native,forcedotcom/react-native,janicduplessis/react-native,jaggs6/react-native,jevakallio/react-native,rickbeerendonk/react-native,browniefed/react-native,forcedotcom/react-native,peterp/react-native,wenpkpk/react-native,exponentjs/react-native,gitim/react-native,doochik/react-native,skevy/react-native,ndejesus1227/react-native,InterfaceInc/react-native,Guardiannw/react-native,mrspeaker/react-native,iodine/react-native,cpunion/react-native,christopherdro/react-native,Andreyco/react-native,browniefed/react-native,CntChen/react-native,mironiasty/react-native,facebook/react-native,naoufal/react-native,jhen0409/react-native,lprhodes/react-native,exponentjs/react-native,farazs/react-native,forcedotcom/react-native,Emilios1995/react-native,doochik/react-native,tarkus/react-native-appletv,doochik/react-native,alin23/react-native,Maxwell2022/react-native,Guardiannw/react-native,doochik/react-native,christopherdro/react-native,brentvatne/react-native,lelandrichardson/react-native,facebook/react-native,doochik/react-native,Livyli/react-native,Livyli/react-native,esauter5/react-native,clozr/react-native,javache/react-native,naoufal/react-native,pandiaraj44/react-native,mrspeaker/react-native,Bhullnatik/react-native,iodine/react-native,Purii/react-native,tarkus/react-native-appletv,wenpkpk/react-native,shrutic123/react-native,luqin/react-native,thotegowda/react-native,eduardinni/react-native,skatpgusskat/react-native,aljs/react-native,gre/react-native,alin23/react-native,gre/react-native,gre/react-native,Emilios1995/react-native,browniefed/react-native,callstack-io/react-native,browniefed/react-native,catalinmiron/react-native,exponentjs/react-native,gilesvangruisen/react-native,peterp/react-native,adamjmcgrath/react-native,jaggs6/react-native,makadaw/react-native,salanki/react-native,clozr/react-native,Andreyco/react-native,luqin/react-native,negativetwelve/react-native,charlesvinette/react-native,ptmt/react-native-macos,InterfaceInc/react-native,ptomasroos/react-native,shrutic123/react-native,hammerandchisel/react-native,chnfeeeeeef/react-native,nathanajah/react-native,happypancake/react-native,jhen0409/react-native,hammerandchisel/react-native,hoangpham95/react-native,jaggs6/react-native,lprhodes/react-native,clozr/react-native,Livyli/react-native,cpunion/react-native,javache/react-native,luqin/react-native,exponent/react-native,ptmt/react-native-macos,CodeLinkIO/react-native,jasonnoahchoi/react-native,iodine/react-native,lelandrichardson/react-native,jaggs6/react-native,satya164/react-native,jasonnoahchoi/react-native,Maxwell2022/react-native,gre/react-native,Swaagie/react-native,tarkus/react-native-appletv,corbt/react-native,tszajna0/react-native,gre/react-native,cdlewis/react-native,tgoldenberg/react-native,makadaw/react-native,tgoldenberg/react-native,Livyli/react-native,cpunion/react-native,Andreyco/react-native,forcedotcom/react-native,doochik/react-native,htc2u/react-native,aljs/react-native,cosmith/react-native,DannyvanderJagt/react-native,dikaiosune/react-native,lelandrichardson/react-native,thotegowda/react-native,iodine/react-native,tsjing/react-native,csatf/react-native,corbt/react-native,aaron-goshine/react-native,kesha-antonov/react-native,foghina/react-native,kesha-antonov/react-native,tgoldenberg/react-native,nickhudkins/react-native,orenklein/react-native,christopherdro/react-native,jadbox/react-native,PlexChat/react-native,callstack-io/react-native,tadeuzagallo/react-native,kesha-antonov/react-native,nathanajah/react-native,mironiasty/react-native,Swaagie/react-native,lprhodes/react-native,farazs/react-native,makadaw/react-native,lprhodes/react-native,csatf/react-native,rickbeerendonk/react-native,Purii/react-native,gitim/react-native,cdlewis/react-native,kesha-antonov/react-native,Purii/react-native,htc2u/react-native,orenklein/react-native,tszajna0/react-native,cosmith/react-native,satya164/react-native,forcedotcom/react-native,shrutic/react-native,formatlos/react-native,salanki/react-native,DanielMSchmidt/react-native,gre/react-native,csatf/react-native,adamjmcgrath/react-native,Swaagie/react-native,wenpkpk/react-native,Purii/react-native,mironiasty/react-native,rickbeerendonk/react-native,Guardiannw/react-native,hammerandchisel/react-native,DannyvanderJagt/react-native,aljs/react-native,gilesvangruisen/react-native,arthuralee/react-native,alin23/react-native,christopherdro/react-native,charlesvinette/react-native,gilesvangruisen/react-native,formatlos/react-native,martinbigio/react-native,alin23/react-native,nickhudkins/react-native,DannyvanderJagt/react-native,myntra/react-native,brentvatne/react-native,naoufal/react-native,hoangpham95/react-native,imDangerous/react-native,lelandrichardson/react-native,jhen0409/react-native,pandiaraj44/react-native,mrspeaker/react-native,thotegowda/react-native,rickbeerendonk/react-native,Bhullnatik/react-native,hoastoolshop/react-native,exponentjs/react-native,iodine/react-native,Emilios1995/react-native,jasonnoahchoi/react-native,BretJohnson/react-native,adamjmcgrath/react-native,imDangerous/react-native,cosmith/react-native,PlexChat/react-native,luqin/react-native,exponentjs/react-native,happypancake/react-native,dikaiosune/react-native,Ehesp/react-native,formatlos/react-native,nickhudkins/react-native,tgoldenberg/react-native,corbt/react-native,alin23/react-native,makadaw/react-native,martinbigio/react-native,mrspeaker/react-native,DanielMSchmidt/react-native,DanielMSchmidt/react-native,forcedotcom/react-native,janicduplessis/react-native,imjerrybao/react-native,Swaagie/react-native,orenklein/react-native,Purii/react-native,BretJohnson/react-native,htc2u/react-native,ankitsinghania94/react-native,skatpgusskat/react-native,PlexChat/react-native,Livyli/react-native,mironiasty/react-native,imDangerous/react-native,gre/react-native,Ehesp/react-native,brentvatne/react-native,Ehesp/react-native,pandiaraj44/react-native,satya164/react-native,tadeuzagallo/react-native,ankitsinghania94/react-native,mrspeaker/react-native,hoangpham95/react-native,skatpgusskat/react-native,salanki/react-native,jasonnoahchoi/react-native,lprhodes/react-native,tsjing/react-native,mironiasty/react-native,ptomasroos/react-native,Emilios1995/react-native,facebook/react-native,shrutic/react-native,Andreyco/react-native,martinbigio/react-native,aaron-goshine/react-native,Guardiannw/react-native,mrspeaker/react-native,gilesvangruisen/react-native,satya164/react-native,wenpkpk/react-native,BretJohnson/react-native,thotegowda/react-native,Emilios1995/react-native,Maxwell2022/react-native,kesha-antonov/react-native,salanki/react-native,aaron-goshine/react-native,nathanajah/react-native,jevakallio/react-native,esauter5/react-native,jadbox/react-native,facebook/react-native,lprhodes/react-native,Guardiannw/react-native,gitim/react-native,imDangerous/react-native,DanielMSchmidt/react-native,orenklein/react-native,gitim/react-native,formatlos/react-native,gilesvangruisen/react-native,jadbox/react-native,janicduplessis/react-native,martinbigio/react-native,Bhullnatik/react-native,InterfaceInc/react-native,farazs/react-native,CodeLinkIO/react-native,hammerandchisel/react-native,ankitsinghania94/react-native,ptomasroos/react-native,exponentjs/react-native,imjerrybao/react-native,shrutic/react-native,dikaiosune/react-native,satya164/react-native,jasonnoahchoi/react-native,jasonnoahchoi/react-native,naoufal/react-native,tsjing/react-native,exponent/react-native,Bhullnatik/react-native,jaggs6/react-native,rickbeerendonk/react-native,happypancake/react-native,callstack-io/react-native,imDangerous/react-native,happypancake/react-native,doochik/react-native,shrutic123/react-native,charlesvinette/react-native,nickhudkins/react-native,Andreyco/react-native,brentvatne/react-native,Ehesp/react-native,iodine/react-native,exponent/react-native,hammerandchisel/react-native,catalinmiron/react-native,imDangerous/react-native,arthuralee/react-native,jevakallio/react-native,Purii/react-native,hammerandchisel/react-native,clozr/react-native,exponent/react-native,charlesvinette/react-native,tszajna0/react-native,janicduplessis/react-native,skatpgusskat/react-native,farazs/react-native,eduardinni/react-native,tszajna0/react-native,christopherdro/react-native,makadaw/react-native,xiayz/react-native,satya164/react-native,hoangpham95/react-native,jasonnoahchoi/react-native,satya164/react-native,Livyli/react-native,cpunion/react-native,ndejesus1227/react-native,shrutic/react-native,lprhodes/react-native,naoufal/react-native,makadaw/react-native,tszajna0/react-native,frantic/react-native,DannyvanderJagt/react-native,cpunion/react-native,browniefed/react-native,skevy/react-native,aljs/react-native,jasonnoahchoi/react-native,aaron-goshine/react-native,clozr/react-native,aljs/react-native,wenpkpk/react-native,aaron-goshine/react-native,BretJohnson/react-native,lprhodes/react-native,eduardinni/react-native,csatf/react-native,hoastoolshop/react-native,myntra/react-native,gilesvangruisen/react-native,CntChen/react-native,cosmith/react-native,hoastoolshop/react-native,tadeuzagallo/react-native,callstack-io/react-native,Ehesp/react-native,Purii/react-native,myntra/react-native,eduardinni/react-native,skevy/react-native,janicduplessis/react-native,ptomasroos/react-native,esauter5/react-native,thotegowda/react-native,luqin/react-native,makadaw/react-native,shrutic/react-native,tarkus/react-native-appletv,Emilios1995/react-native,aljs/react-native,dikaiosune/react-native,jaggs6/react-native,nickhudkins/react-native,brentvatne/react-native,mrspeaker/react-native,orenklein/react-native,Bhullnatik/react-native,hoastoolshop/react-native,wenpkpk/react-native,shrutic123/react-native,formatlos/react-native,CntChen/react-native,skevy/react-native,nathanajah/react-native,ptomasroos/react-native,myntra/react-native,imDangerous/react-native,brentvatne/react-native,thotegowda/react-native,clozr/react-native,jhen0409/react-native,javache/react-native,ndejesus1227/react-native,adamjmcgrath/react-native,kesha-antonov/react-native,jevakallio/react-native,negativetwelve/react-native,cdlewis/react-native,tgoldenberg/react-native,mironiasty/react-native,exponentjs/react-native,negativetwelve/react-native,alin23/react-native,cosmith/react-native,naoufal/react-native,CodeLinkIO/react-native,tarkus/react-native-appletv,hammerandchisel/react-native,aaron-goshine/react-native,javache/react-native,mrspeaker/react-native,lelandrichardson/react-native,frantic/react-native,exponentjs/react-native,cdlewis/react-native,nathanajah/react-native,csatf/react-native,DannyvanderJagt/react-native,orenklein/react-native,tadeuzagallo/react-native,nathanajah/react-native,peterp/react-native,eduardinni/react-native,myntra/react-native,callstack-io/react-native,CntChen/react-native,ankitsinghania94/react-native,foghina/react-native,tszajna0/react-native,shrutic/react-native,happypancake/react-native,PlexChat/react-native,cpunion/react-native,rickbeerendonk/react-native,charlesvinette/react-native,facebook/react-native,gilesvangruisen/react-native,lelandrichardson/react-native,Ehesp/react-native,Andreyco/react-native,christopherdro/react-native,xiayz/react-native,imjerrybao/react-native,foghina/react-native,corbt/react-native,kesha-antonov/react-native,chnfeeeeeef/react-native,clozr/react-native,foghina/react-native,xiayz/react-native,janicduplessis/react-native,DanielMSchmidt/react-native,skevy/react-native,facebook/react-native,esauter5/react-native,javache/react-native,jhen0409/react-native,imjerrybao/react-native,InterfaceInc/react-native,catalinmiron/react-native,Andreyco/react-native,imjerrybao/react-native,farazs/react-native,javache/react-native,martinbigio/react-native,CodeLinkIO/react-native,DannyvanderJagt/react-native,kesha-antonov/react-native,gre/react-native,CodeLinkIO/react-native,browniefed/react-native,Purii/react-native,formatlos/react-native,jevakallio/react-native,chnfeeeeeef/react-native,ankitsinghania94/react-native,happypancake/react-native,ptmt/react-native-macos,Guardiannw/react-native,luqin/react-native,callstack-io/react-native,nathanajah/react-native,tsjing/react-native,tarkus/react-native-appletv,CodeLinkIO/react-native,ndejesus1227/react-native,iodine/react-native,charlesvinette/react-native,htc2u/react-native,negativetwelve/react-native,hoastoolshop/react-native,DanielMSchmidt/react-native,christopherdro/react-native,exponent/react-native,skatpgusskat/react-native,corbt/react-native,tarkus/react-native-appletv,ptmt/react-native-macos,frantic/react-native,Emilios1995/react-native,chnfeeeeeef/react-native,ndejesus1227/react-native,peterp/react-native,Ehesp/react-native,ptomasroos/react-native,cdlewis/react-native,brentvatne/react-native,ptomasroos/react-native,pandiaraj44/react-native,exponent/react-native,gitim/react-native,charlesvinette/react-native,satya164/react-native,callstack-io/react-native,iodine/react-native,jevakallio/react-native,negativetwelve/react-native,hoastoolshop/react-native,skevy/react-native,exponent/react-native,ptmt/react-native-macos,javache/react-native,Maxwell2022/react-native,formatlos/react-native
|
1aac1de738fdef73676948be8e4d5d8fc18eb27c
|
caspy/static/js/api.js
|
caspy/static/js/api.js
|
(function(){
var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']);
mod.config(['$resourceProvider',
function($resourceProvider) {
$resourceProvider.defaults.stripTrailingSlashes = false;
}]
);
mod.factory('caspyAPI',
['$q', '$http', '$resource', 'Constants',
function($q, $http, $resource, Constants) {
var api = {
root: null
, resources: {}
, resolve: function(name) {
var d = $q.defer();
if (typeof api.root[name] === 'undefined') {
d.reject(new Error(name + ' endpoint not available'));
}
else {
d.resolve(api.root[name]);
}
return d.promise;
}
, get_endpoint: function(name) {
if (api.root)
return api.resolve(name);
return $http.get(Constants.apiRootUrl)
.then(function(response) {
api.root = response.data;
return api.resolve(name);
})
}
, get_resource: function(name) {
if (typeof api.resources[name] !== 'undefined')
return api.resources[name];
return api.resources[name] = api.get_endpoint(name)
.then(api.build_resource);
}
, build_resource: function(endpoint) {
return $resource(endpoint);
}
};
return api;
}]
);
})();
|
(function(){
var mod = angular.module('caspy.api', ['ngResource', 'caspy.server']);
mod.config(['$resourceProvider',
function($resourceProvider) {
$resourceProvider.defaults.stripTrailingSlashes = false;
}]
);
mod.factory('caspyAPI',
['$q', '$http', '$resource', 'Constants',
function($q, $http, $resource, Constants) {
var api = {
root: null
, resources: {}
, get_resource: function(name) {
if (typeof api.resources[name] !== 'undefined')
return api.resources[name];
return api.resources[name] = api.get_endpoint(name)
.then(api.build_resource);
}
, get_endpoint: function(name) {
if (api.root)
return api.resolve(name);
return $http.get(Constants.apiRootUrl)
.then(function(response) {
api.root = response.data;
return api.resolve(name);
})
}
, build_resource: function(endpoint) {
return $resource(endpoint);
}
, resolve: function(name) {
var d = $q.defer();
if (typeof api.root[name] === 'undefined') {
d.reject(new Error(name + ' endpoint not available'));
}
else {
d.resolve(api.root[name]);
}
return d.promise;
}
};
return api;
}]
);
})();
|
Put higher level functions first
|
Put higher level functions first
|
JavaScript
|
bsd-3-clause
|
altaurog/django-caspy,altaurog/django-caspy,altaurog/django-caspy
|
cb754daf342cdea42225efca3834966bd5328fba
|
src/footer.js
|
src/footer.js
|
/*
backgrid
http://github.com/wyuenho/backgrid
Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
Licensed under the MIT @license.
*/
/**
A Footer is a generic class that only defines a default tag `tfoot` and
number of required parameters in the initializer.
@abstract
@class Backgrid.Footer
@extends Backbone.View
*/
var Footer = Backgrid.Footer = Backbone.View.extend({
/** @property */
tagName: "tfoot",
/**
Initializer.
@param {Object} options
@param {*} options.parent The parent view class of this footer.
@param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns
Column metadata.
@param {Backbone.Collection} options.collection
@throws {TypeError} If options.columns or options.collection is undefined.
*/
initialize: function (options) {
Backgrid.requireOptions(options, ["columns", "collection"]);
this.parent = options.parent;
this.columns = options.columns;
if (!(this.columns instanceof Backbone.Collection)) {
this.columns = new Backgrid.Columns(this.columns);
}
}
});
|
/*
backgrid
http://github.com/wyuenho/backgrid
Copyright (c) 2013 Jimmy Yuen Ho Wong and contributors
Licensed under the MIT @license.
*/
/**
A Footer is a generic class that only defines a default tag `tfoot` and
number of required parameters in the initializer.
@abstract
@class Backgrid.Footer
@extends Backbone.View
*/
var Footer = Backgrid.Footer = Backbone.View.extend({
/** @property */
tagName: "tfoot",
/**
Initializer.
@param {Object} options
@param {*} options.parent The parent view class of this footer.
@param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns
Column metadata.
@param {Backbone.Collection} options.collection
@throws {TypeError} If options.columns or options.collection is undefined.
*/
initialize: function (options) {
Backgrid.requireOptions(options, ["columns", "collection"]);
this.columns = options.columns;
if (!(this.columns instanceof Backbone.Collection)) {
this.columns = new Backgrid.Columns(this.columns);
}
}
});
|
Remove extraneous parent reference from Footer
|
Remove extraneous parent reference from Footer
|
JavaScript
|
mit
|
goodwall/backgrid,blackducksoftware/backgrid,wyuenho/backgrid,wyuenho/backgrid,digideskio/backgrid,qferr/backgrid,bryce-gibson/backgrid,aboieriu/backgrid,ludoo0d0a/backgrid,bryce-gibson/backgrid,blackducksoftware/backgrid,aboieriu/backgrid,digideskio/backgrid,Acquisio/backgrid,kirill-zhirnov/backgrid,crealytics/backgrid,ludoo0d0a/backgrid,kirill-zhirnov/backgrid,getjaco/backgrid,jesseditson/backgrid,qferr/backgrid,goodwall/backgrid,jesseditson/backgrid,getjaco/backgrid,Acquisio/backgrid
|
c51089b4f5be53d7657aecf9cfa721ced5895fa4
|
lib/health.js
|
lib/health.js
|
var express = require('express');
var geocode = require('./geocode');
var mongoose = require('./mongo');
var otp = require('./otp');
/**
* Expose `router`
*/
var router = module.exports = express.Router();
/**
* Main check
*/
router.all('/', checkGeocoder, checkOTP, function(req, res) {
var checks = {
api: true,
db: mongoose.connection.readyState === 1,
geocoder: !req.geocoder,
logger: 'not implemented',
otp: !req.otp,
worker: 'not implemented'
};
// TODO: implement checks
res.status(200).send(checks);
});
/**
* OTP
*/
router.all('/otp', checkOTP, function(req, res) {
if (!req.otp) {
res.status(204).end();
} else {
res.status(400).send(req.otp);
}
});
/**
* Check Geocoder
*/
function checkGeocoder(req, res, next) {
geocode.suggest('1133 15th St NW, Washington, DC', function(err, suggestions) {
req.geocoder = err;
next();
});
}
/**
* Check OTP
*/
function checkOTP(req, res, next) {
otp.get({
url: '/index/routes'
}, function(err, routes) {
req.otp = err;
next();
});
}
|
var express = require('express');
var geocode = require('./geocode');
var mongoose = require('./mongo');
var otp = require('./otp');
/**
* Expose `router`
*/
var router = module.exports = express.Router();
/**
* Main check
*/
router.all('/', checkGeocoder, checkOTP, function(req, res) {
var checks = {
api: true,
db: mongoose.connection.readyState === 1,
geocoder: !req.geocoder,
logger: 'not implemented',
otp: !req.otp,
worker: 'not implemented'
};
// TODO: implement checks
res.status(200).send(checks);
});
/**
* OTP
*/
router.all('/otp', checkOTP, function(req, res) {
if (!req.otp) {
res.status(204).end();
} else {
res.status(400).send(req.otp);
}
});
/**
* Check Geocoder
*/
function checkGeocoder(req, res, next) {
geocode.encode('1133 15th St NW, Washington, DC', function(err, suggestions) {
req.geocoder = err;
next();
});
}
/**
* Check OTP
*/
function checkOTP(req, res, next) {
otp.get({
url: '/index/routes'
}, function(err, routes) {
req.otp = err;
next();
});
}
|
Use encode to check geocoder status
|
Use encode to check geocoder status
|
JavaScript
|
bsd-3-clause
|
amigocloud/modified-tripplanner,tismart/modeify,miraculixx/modeify,miraculixx/modeify,tismart/modeify,arunnair80/modeify,amigocloud/modeify,tismart/modeify,amigocloud/modeify,miraculixx/modeify,arunnair80/modeify-1,arunnair80/modeify-1,arunnair80/modeify,miraculixx/modeify,amigocloud/modeify,amigocloud/modified-tripplanner,tismart/modeify,arunnair80/modeify,amigocloud/modified-tripplanner,amigocloud/modeify,amigocloud/modified-tripplanner,arunnair80/modeify,arunnair80/modeify-1,arunnair80/modeify-1
|
8d46d03dd81046fb1e9821ab5e3c4c85e7eba747
|
lib/modules/storage/class_static_methods/is_secured.js
|
lib/modules/storage/class_static_methods/is_secured.js
|
function isSecured(operation) {
if (_.has(this.schema.secured, operation)) {
return this.schema.secured[operation];
}
else {
return this.schema.secured.common || false;
}
};
export default isSecured;
|
import _ from 'lodash';
function isSecured(operation) {
if (_.has(this.schema.secured, operation)) {
return this.schema.secured[operation];
}
else {
return this.schema.secured.common || false;
}
};
export default isSecured;
|
Fix lack of loads import
|
Fix lack of loads import
|
JavaScript
|
mit
|
jagi/meteor-astronomy
|
f6397f79ef1471f87aa113a4dc4bab900e07935c
|
lib/routes.js
|
lib/routes.js
|
var addFollowers = require('./follow');
var checkAuth = require('./check_auth');
var checkPrivilege = require('./privilege_check');
var githubOAuth = require('./github_oauth');
var users = require('./db').get('users');
module.exports = function(app) {
app.get('/me', checkAuth, function(req, res) {
checkPrivilege(req.session.user.login, function(err, privilege) {
users.find({
following: req.session.user.login
}, function(err, following) {
res.json({
privilege: privilege,
following: following
});
});
});
});
app.get('/user', checkAuth, function(req, res) {
return res.json(req.session.user);
});
app.post('/follow/:login', function(req, res) {
if (!req.session.user) {
return res.status(401).json({
error: 'Not logged in'
});
}
var amount = req.body.amount;
if (!amount) {
amount = 10;
}
addFollowers(req.session.user.login, -1, function(err, result) {
res.json(result);
});
});
githubOAuth.addRoutes(app, function(err, token, res, ignore, req) {
if (token.error) {
return res.send('There was an error logging in: ' + token.error_description);
}
req.session.token = token.access_token;
res.redirect('/');
});
};
|
var addFollowers = require('./follow');
var checkAuth = require('./check_auth');
var checkPrivilege = require('./privilege_check');
var githubOAuth = require('./github_oauth');
var users = require('./db').get('users');
module.exports = function(app) {
app.get('/me', checkAuth, function(req, res) {
checkPrivilege(req.session.user.login, function(err, privilege) {
users.find({
following: req.session.user.login
}, function(err, following) {
res.json({
privilege: privilege,
following: following
});
});
});
});
app.get('/user', checkAuth, function(req, res) {
return res.json(req.session.user);
});
app.post('/follow/:login', checkAuth, function(req, res) {
checkPrivilege(req.session.user.login, function(err, privilege) {
users.findOne({
login: req.session.user.login
}, function(error, user) {
var amount = privilege.following - user.following;
addFollowers(req.session.user.login, amount, function(err, result) {
res.json(result);
});
});
});
});
githubOAuth.addRoutes(app, function(err, token, res, ignore, req) {
if (token.error) {
return res.send('There was an error logging in: ' + token.error_description);
}
req.session.token = token.access_token;
res.redirect('/');
});
};
|
Add privilege check on follow button
|
Add privilege check on follow button
|
JavaScript
|
mit
|
simplyianm/ghfollowers,legoboy0215/ghfollowers,simplyianm/ghfollowers,legoboy0215/ghfollowers
|
3bed3dbca37e1e2072581ae8fc1a532c63c1afd7
|
js/plugins/EncryptedInsightStorage.js
|
js/plugins/EncryptedInsightStorage.js
|
var cryptoUtil = require('../util/crypto');
var InsightStorage = require('./InsightStorage');
var inherits = require('inherits');
function EncryptedInsightStorage(config) {
InsightStorage.apply(this, [config]);
}
inherits(EncryptedInsightStorage, InsightStorage);
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
var key = cryptoUtil.kdfbinary(this.password + this.email);
InsightStorage.prototype.getItem.apply(this, [name,
function(err, body) {
if (err) {
return callback(err);
}
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
}
return callback(null, decryptedJson);
}
]);
};
EncryptedInsightStorage.prototype.setItem = function(name, value, callback) {
var key = cryptoUtil.kdfbinary(this.password + this.email);
var record = cryptoUtil.encrypt(key, value);
InsightStorage.prototype.setItem.apply(this, [name, record, callback]);
};
EncryptedInsightStorage.prototype.removeItem = function(name, callback) {
var key = cryptoUtil.kdfbinary(this.password + this.email);
InsightStorage.prototype.removeItem.apply(this, [name, callback]);
};
module.exports = EncryptedInsightStorage;
|
var cryptoUtil = require('../util/crypto');
var InsightStorage = require('./InsightStorage');
var inherits = require('inherits');
function EncryptedInsightStorage(config) {
InsightStorage.apply(this, [config]);
}
inherits(EncryptedInsightStorage, InsightStorage);
EncryptedInsightStorage.prototype.getItem = function(name, callback) {
var key = cryptoUtil.kdf(this.password + this.email);
InsightStorage.prototype.getItem.apply(this, [name,
function(err, body) {
if (err) {
return callback(err);
}
var decryptedJson = cryptoUtil.decrypt(key, body);
if (!decryptedJson) {
return callback('Internal Error');
}
return callback(null, decryptedJson);
}
]);
};
EncryptedInsightStorage.prototype.setItem = function(name, value, callback) {
var key = cryptoUtil.kdf(this.password + this.email);
var record = cryptoUtil.encrypt(key, value);
InsightStorage.prototype.setItem.apply(this, [name, record, callback]);
};
EncryptedInsightStorage.prototype.removeItem = function(name, callback) {
var key = cryptoUtil.kdf(this.password + this.email);
InsightStorage.prototype.removeItem.apply(this, [name, callback]);
};
module.exports = EncryptedInsightStorage;
|
Use the same kdf for Insight Storage
|
Use the same kdf for Insight Storage
|
JavaScript
|
mit
|
LedgerHQ/copay,troggy/unicoisa,Bitcoin-com/Wallet,BitGo/copay,wallclockbuilder/copay,msalcala11/copay,cmgustavo/copay,BitGo/copay,Kirvx/copay,DigiByte-Team/copay,mpolci/copay,Neurosploit/copay,payloadtech/wallet,mzpolini/copay,mpolci/copay,wallclockbuilder/copay,wallclockbuilder/copay,ObsidianCryptoVault/copay,fr34k8/copay,ionux/copay,habibmasuro/copay,Neurosploit/copay,robjohnson189/copay,msalcala11/copay,msalcala11/copay,jameswalpole/copay,JDonadio/copay,urv2/wallet,Tetpay/copay,gabrielbazan7/copay,gabrielbazan7/copay,kleetus/copay,wallclockbuilder/copay,troggy/unicoisa,julianromera/copay,DigiByte-Team/copay,troggy/copay,habibmasuro/copay,kleetus/copay,BitGo/copay,gabrielbazan7/copay,wyrdmantis/copay,solderzzc/copay,jameswalpole/copay,isocolsky/copay,bitchk-wallet/copay,ajp8164/copay,solderzzc/copay,payloadtech/wallet,troggy/colu-copay-wallet,wyrdmantis/copay,johnsmith76/Lite-Wallet,fr34k8/copay,urv2/wallet,matiu/copay,payloadpk/wallet,philosodad/copay,gabrielbazan7/copay,Bitcoin-com/Wallet,DigiByte-Team/copay,tanojaja/copay,wyrdmantis/copay,johnsmith76/Lite-Wallet,mpolci/copay,Neurosploit/copay,Groestlcoin/GroestlPay,Kirvx/copay,bitchk-wallet/copay,DigiByte-Team/copay,matiu/copay,robjohnson189/copay,MonetaryUnit/copay,JDonadio/copay,isocolsky/copay,CryptArc/platinumpay,ionux/copay,bitjson/copay,Neurosploit/copay,dabura667/copay,payloadpk/wallet,troggy/colu-copay-wallet,janko33bd/copay,willricketts/copay,troggy/colu-copay-wallet,ObsidianCryptoVault/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,bankonme/copay,mzpolini/copay,matiu/copay,JDonadio/copay,troggy/copay,javierbitpay/copay,startcoin-project/startwallet,Kirvx/copay,julianromera/copay,jameswalpole/copay,DigiByte-Team/copay,payloadpk/wallet,johnsmith76/Lite-Wallet,startcoin-project/startwallet,javierbitpay/copay,solderzzc/copay,LedgerHQ/copay,Bitcoin-com/Wallet,troggy/unicoisa,bankonme/copay,bankonme/copay,fr34k8/copay,cobit-wallet/cobit,cobit-wallet/cobit,julianromera/copay,tanojaja/copay,kleetus/copay,Groestlcoin/GroestlPay,hideoussquid/aur-copay,Kirvx/copay,bitjson/copay,willricketts/copay,jmaurice/copay,ionux/copay,jmaurice/copay,payloadpk/wallet,bechi/copay,mzpolini/copay,robjohnson189/copay,isocolsky/copay,mpolci/copay,ObsidianCryptoVault/copay,cmgustavo/copay,digibyte/digibytego,JDonadio/copay,isocolsky/copay,cobit-wallet/cobit,Groestlcoin/GroestlPay,digibyte/digibytego,MonetaryUnit/copay,ztalker/copay,troggy/colu-copay-wallet,bitchk-wallet/copay,MonetaryUnit/copay,BitGo/copay,bankonme/copay,javierbitpay/copay,ajp8164/copay,hideoussquid/aur-copay,troggy/copay,julianromera/copay,payloadtech/wallet,CryptArc/platinumpay,troggy/unicoisa,CryptArc/platinumpay,dabura667/copay,jmaurice/copay,cmgustavo/copay,fr34k8/copay,bechi/copay,mzpolini/copay,msalcala11/copay,ionux/copay,habibmasuro/copay,robjohnson189/copay,startcoin-project/startwallet,philosodad/copay,philosodad/copay,CryptArc/platinumpay,ztalker/copay,startcoin-project/startwallet,DigiByte-Team/copay,ObsidianCryptoVault/copay,hideoussquid/aur-copay,janko33bd/copay,wyrdmantis/copay,Tetpay/copay,tanojaja/copay,payloadtech/wallet,bechi/copay,kleetus/copay,willricketts/copay,dabura667/copay,matiu/copay,urv2/wallet,cmgustavo/copay,ztalker/copay,habibmasuro/copay,willricketts/copay,jameswalpole/copay,janko33bd/copay,LedgerHQ/copay,philosodad/copay,digibyte/digibytego,johnsmith76/Lite-Wallet,Bitcoin-com/Wallet,ztalker/copay,DigiByte-Team/copay,jmaurice/copay,ajp8164/copay,solderzzc/copay,troggy/copay,bitjson/copay,MonetaryUnit/copay,urv2/wallet,tanojaja/copay,LedgerHQ/copay,bitjson/copay,javierbitpay/copay
|
197b667ca677c5961c9c1d116fb86032bd2ef861
|
app/assets/javascripts/application.js
|
app/assets/javascripts/application.js
|
//= require jquery
$(function() {
$('.login-trello').click(function() {
Trello.authorize({
type: "redirect",
name: "Reportrello",
scope: {
read: true,
write: true
}
});
});
})
|
//= require jquery
$(function() {
$('.login-trello').click(function() {
Reportrello.authorize();
});
Reportrello = {
authorize: function() {
var self = this
Trello.authorize({
type: 'popup',
name: 'Reportrello',
fragment: 'postmessage',
scope: {
read: true,
write: true
},
expiration: 'never',
success: function() {
self.getMe();
},
error: function() {
alert("Failed authentication");
}
});
},
getMe: function() {
var token = localStorage.getItem('trello_token');
Trello.rest(
'GET',
'members/me',
{
fields: 'username,fullName,avatar',
token: token
},
function (object) {
location.href = '/authentication/?user[token]=' + token + '&user[username]=' + object.username + '&user[fullname]=' + object.fullName
},
function (a) { alert("Failed authentication"); }
);
},
newReport: function() {
}
}
})
|
Add JS to authentication and get user information by token
|
Add JS to authentication and get user information by token
|
JavaScript
|
mit
|
SauloSilva/reportrello,SauloSilva/reportrello,SauloSilva/reportrello
|
3578177e3e10ebb0c5c0403b2df13fa472c70edb
|
app/assets/javascripts/application.js
|
app/assets/javascripts/application.js
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require turbolinks
//= require_tree .
|
Enable JavaScript code of bootstrap
|
Enable JavaScript code of bootstrap
|
JavaScript
|
mit
|
eqot/petroglyph3,eqot/petroglyph3
|
9716b2cd82d4f4a778f798b88838a5685db2b7ea
|
app/assets/javascripts/application.js
|
app/assets/javascripts/application.js
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require turbolinks
//= require_tree .
|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require turbolinks
//= require rails-ujs
//= require_tree .
|
Enable rails-ujs to make working REST methods on link by js
|
Enable rails-ujs to make working REST methods on link by js
|
JavaScript
|
mit
|
gadzorg/gram2_api_server,gadzorg/gram2_api_server,gadzorg/gram2_api_server
|
e467997d760eeb7c3b9282a645568e4b3bcc13e8
|
app/services/stripe.js
|
app/services/stripe.js
|
/* global Stripe */
import config from '../config/environment';
import Ember from 'ember';
var debug = config.LOG_STRIPE_SERVICE;
function createToken (card) {
if (debug) {
Ember.Logger.info('StripeService: getStripeToken - card:', card);
}
// manually start Ember loop
Ember.run.begin();
return new Ember.RSVP.Promise(function (resolve, reject) {
Stripe.card.createToken(card, function (status, response) {
if (debug) {
Ember.Logger.info('StripeService: createToken handler - status %s, response:', status, response);
}
if (response.error) {
reject(response);
return Ember.run.end();
}
resolve(response);
Ember.run.end();
});
});
}
export default Ember.Object.extend({
createToken: createToken
});
|
/* global Stripe */
import config from '../config/environment';
import Ember from 'ember';
var debug = config.LOG_STRIPE_SERVICE;
function createToken (card) {
if (debug) {
Ember.Logger.info('StripeService: getStripeToken - card:', card);
}
// manually start Ember loop
Ember.run.begin();
return new Ember.RSVP.Promise(function (resolve, reject) {
Stripe.card.createToken(card, function (status, response) {
if (debug) {
Ember.Logger.info('StripeService: createToken handler - status %s, response:', status, response);
}
if (response.error) {
reject(response);
return Ember.run.end();
}
resolve(response);
Ember.run.end();
});
});
}
function createBankAccountToken(bankAccount) {
if (debug) {
Ember.Logger.info('StripeService: getStripeToken - bankAccount:', bankAccount);
}
// manually start Ember loop
Ember.run.begin();
return new Ember.RSVP.Promise(function (resolve, reject) {
Stripe.bankAccount.createToken(bankAccount, function (status, response) {
if (debug) {
Ember.Logger.info('StripeService: createBankAccountToken handler - status %s, response:', status, response);
}
if (response.error) {
reject(response);
return Ember.run.end();
}
resolve(response);
Ember.run.end();
});
});
}
export default Ember.Object.extend({
createToken: createToken,
createBankAccountToken: createBankAccountToken,
});
|
Add a create bank account token method to the service
|
Add a create bank account token method to the service
|
JavaScript
|
mit
|
iezer/ember-stripe-service,iezer/ember-stripe-service,sescobb27/ember-stripe-service,samselikoff/ember-stripe-service,samselikoff/ember-stripe-service,ride/ember-stripe-service,fastly/ember-stripe-service,fastly/ember-stripe-service,sescobb27/ember-stripe-service,ride/ember-stripe-service
|
fecd1be97cfd7539a738effe8a870ed71470b56a
|
src/lib/HttpApi.js
|
src/lib/HttpApi.js
|
export default class HttpApi {
constructor (prefix = '') {
this.prefix = prefix
this.opts = {
credentials: 'same-origin',
headers: new Headers({
'Content-Type': 'application/json',
})
}
return this.callApi
}
callApi = (method, url, opts = {}) => {
opts = Object.assign({}, this.opts, opts)
opts.method = method
if (typeof opts.body === 'object') {
opts.body = JSON.stringify(opts.body)
}
return fetch(`/api/${this.prefix}${url}`, opts)
.then(res => {
if (res.ok) {
const type = res.headers.get('Content-Type')
return (type && type.includes('application/json')) ? res.json() : res.text()
}
// error
return res.text().then(txt => {
return Promise.reject(new Error(txt))
})
})
}
}
|
export default class HttpApi {
constructor (prefix = '') {
this.prefix = prefix
this.opts = {
credentials: 'same-origin',
headers: new Headers({
'Content-Type': 'application/json',
})
}
return this.callApi
}
callApi = (method, url, opts = {}) => {
opts = Object.assign({}, this.opts, opts)
opts.method = method
if (typeof opts.body === 'object') {
opts.body = JSON.stringify(opts.body)
}
return fetch(`/api/${this.prefix}${url}`, opts)
.then(res => {
if (res.ok) {
const type = res.headers.get('Content-Type')
return (type && type.includes('application/json')) ? res.json() : res
}
// error
return res.text().then(txt => {
return Promise.reject(new Error(txt))
})
})
}
}
|
Fix fetch api when returning non-JSON
|
Fix fetch api when returning non-JSON
|
JavaScript
|
isc
|
bhj/karaoke-forever,bhj/karaoke-forever
|
700f316c0ca9aa873181111752ba99b0f17a1d35
|
src-es6/test/classTest.js
|
src-es6/test/classTest.js
|
import test from 'tape'
import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..'
test('Polygon#contains', t => {
t.plan(5)
//Disable warning about missing 'new'. That's what we are testing
/*jshint -W064 */
/*eslint-disable new-cap */
t.throws(()=> Polygon(), TypeError)
t.throws(()=> Rectangle(), TypeError)
t.throws(()=> Vector(), TypeError)
t.throws(()=> Circle(), TypeError)
t.throws(()=> ShapeEventEmitter(), TypeError)
/*eslint-enable new-cap */
})
|
import test from 'tape'
import { Vector, Polygon, Rectangle, Circle, ShapeEventEmitter } from '..'
test('Classtest', t => {
t.plan(5)
//Disable warning about missing 'new'. That's what we are testing
/*jshint -W064 */
/*eslint-disable new-cap */
t.throws(()=> Polygon(), TypeError)
t.throws(()=> Rectangle(), TypeError)
t.throws(()=> Vector(), TypeError)
t.throws(()=> Circle(), TypeError)
t.throws(()=> ShapeEventEmitter(), TypeError)
/*eslint-enable new-cap */
})
|
Fix name for the classtest
|
Fix name for the classtest
|
JavaScript
|
mit
|
tillarnold/shapes
|
1cf21242ccd82a54bf1b0da0f61184065f3bd765
|
WebContent/js/moe-list.js
|
WebContent/js/moe-list.js
|
/* Cached Variables *******************************************************************************/
var context = sessionStorage.getItem('context');
var rowThumbnails = document.querySelector('.row-thumbnails');
/* Initialization *********************************************************************************/
rowThumbnails.addEventListener("click", moeRedirect, false);
function moeRedirect(event) {
var target = event.target;
var notImage = target.className !== 'thumbnail-image';
if(notImage) return;
var pageId = target.getAttribute('data-page-id');
window.location.href = context + '/page/' + pageId;
}
var thumbnails = window.document.querySelectorAll('.thumbnail');
var tallestThumbnailSize = 0;
thumbnails.forEach(function(value, key, listObj, argument) {
var offsetHeight = listObj[key].offsetHeight;
if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight;
});
thumbnails.forEach(function(value, key, listObj, argument) {
listObj[key].setAttribute('style','min-height:' + tallestThumbnailSize + 'px');
});
//After thumbnail processing, remove the page-loading blocker
document.querySelector('body').classList.remove('content-loading');
|
/* Cached Variables *******************************************************************************/
var context = sessionStorage.getItem('context');
var rowThumbnails = document.querySelector('.row-thumbnails');
/* Initialization *********************************************************************************/
rowThumbnails.addEventListener("click", moeRedirect, false);
function moeRedirect(event) {
var target = event.target;
var notImage = target.className !== 'thumbnail-image';
if(notImage) return;
var pageId = target.getAttribute('data-page-id');
window.location.href = context + '/page/' + pageId;
}
var thumbnails = window.document.querySelectorAll('.thumbnail');
var tallestThumbnailSize = 0;
for (var i = 0; i < thumbnails.length; i++) {
var offsetHeight = thumbnails[i].offsetHeight;
if(offsetHeight > tallestThumbnailSize) tallestThumbnailSize = offsetHeight;
};
for (var i = 0; i < thumbnails.length; i++) {
thumbnails[i].setAttribute('style','min-height:' + tallestThumbnailSize + 'px');
};
//After thumbnail processing, remove the page-loading blocker
document.querySelector('body').classList.remove('content-loading');
|
Change nodelist.foreach to a normal for loop
|
Change nodelist.foreach to a normal for loop
This should bring much greater browser compatibility the the nodelist foreach allowing it to work on all the major browser vendors.
Fixes #95
|
JavaScript
|
mit
|
NYPD/moe-sounds,NYPD/moe-sounds
|
0a5d4a96c4f656ff2aa154274dc19cfa3f4d3d17
|
openstack_dashboard/static/fiware/contextualHelp.js
|
openstack_dashboard/static/fiware/contextualHelp.js
|
$( document ).ready(function () {
$('.contextual-help').click(function (){
$(this).find('i').toggleClass('active');
});
$('body').click(function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
$(this).find('i').removeClass('active');
}
});
});
});
|
$( document ).ready(function () {
$('.contextual-help').click(function (){
$(this).find('i').toggleClass('active');
});
$('body').click(function (e) {
$('[data-toggle="popover"].contextual-help').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
$(this).find('i').removeClass('active');
}
});
});
});
|
Improve usability of contextual-help popovers
|
Improve usability of contextual-help popovers
|
JavaScript
|
apache-2.0
|
ging/horizon,ging/horizon,ging/horizon,ging/horizon
|
6655280140920d0697a5bf1ef8cff12c7bcee5d0
|
src/twig.header.js
|
src/twig.header.js
|
/**
* Twig.js 0.8.2
*
* @copyright 2011-2015 John Roepke and the Twig.js Contributors
* @license Available under the BSD 2-Clause License
* @link https://github.com/justjohn/twig.js
*/
var Twig = (function (Twig) {
Twig.VERSION = "0.8.2";
return Twig;
})(Twig || {});
|
/**
* Twig.js 0.8.2-1
*
* @copyright 2011-2015 John Roepke and the Twig.js Contributors
* @license Available under the BSD 2-Clause License
* @link https://github.com/justjohn/twig.js
*/
var Twig = (function (Twig) {
Twig.VERSION = "0.8.2-1";
return Twig;
})(Twig || {});
|
Bump internal Twig.js version to "0.8.2-1"
|
Bump internal Twig.js version to "0.8.2-1"
|
JavaScript
|
bsd-2-clause
|
FoxyCart/twig.js,FoxyCart/twig.js,FoxyCart/twig.js
|
f4ac2aad1922930d4c27d4841e5665714a509a14
|
src/command-line/index.js
|
src/command-line/index.js
|
var program = require("commander");
var pkg = require("../../package.json");
var fs = require("fs");
var mkdirp = require("mkdirp");
var Helper = require("../helper");
program.version(pkg.version, "-v, --version");
program.option("");
program.option(" --home <path>" , "home path");
require("./start");
require("./config");
require("./list");
require("./add");
require("./remove");
require("./reset");
require("./edit");
var argv = program.parseOptions(process.argv);
if (program.home) {
Helper.HOME = program.home;
}
var config = Helper.HOME + "/config.js";
if (!fs.existsSync(config)) {
mkdirp.sync(Helper.HOME);
fs.writeFileSync(
config,
fs.readFileSync(__dirname + "/../../defaults/config.js")
);
console.log("Config created:");
console.log(config);
}
program.parse(argv.args);
if (!program.args.length) {
program.parse(process.argv.concat("start"));
}
|
var program = require("commander");
var pkg = require("../../package.json");
var fs = require("fs");
var mkdirp = require("mkdirp");
var Helper = require("../helper");
program.version(pkg.version, "-v, --version");
program.option("");
program.option(" --home <path>" , "home path");
var argv = program.parseOptions(process.argv);
if (program.home) {
Helper.HOME = program.home;
}
var config = Helper.HOME + "/config.js";
if (!fs.existsSync(config)) {
mkdirp.sync(Helper.HOME);
fs.writeFileSync(
config,
fs.readFileSync(__dirname + "/../../defaults/config.js")
);
console.log("Config created:");
console.log(config);
}
require("./start");
require("./config");
require("./list");
require("./add");
require("./remove");
require("./reset");
require("./edit");
program.parse(argv.args);
if (!program.args.length) {
program.parse(process.argv.concat("start"));
}
|
Fix loading config before HOME variable is set
|
Fix loading config before HOME variable is set
|
JavaScript
|
mit
|
realies/lounge,ScoutLink/lounge,realies/lounge,rockhouse/lounge,rockhouse/lounge,FryDay/lounge,williamboman/lounge,rockhouse/lounge,sebastiencs/lounge,sebastiencs/lounge,libertysoft3/lounge-autoconnect,metsjeesus/lounge,FryDay/lounge,williamboman/lounge,williamboman/lounge,metsjeesus/lounge,ScoutLink/lounge,sebastiencs/lounge,MaxLeiter/lounge,thelounge/lounge,FryDay/lounge,metsjeesus/lounge,thelounge/lounge,realies/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge,ScoutLink/lounge,libertysoft3/lounge-autoconnect,MaxLeiter/lounge
|
2135e956f28bafdfe11786d3157f52ea05bccf33
|
config/env/production.js
|
config/env/production.js
|
'use strict';
module.exports = {
db: 'mongodb://localhost/mean',
app: {
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
|
'use strict';
module.exports = {
app: {
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
|
Use MONGOHQ_URL for database connection in prod
|
Use MONGOHQ_URL for database connection in prod
|
JavaScript
|
bsd-2-clause
|
asm-products/barrtr,asm-products/barrtr
|
a92f5fd72560341022223b039b9282f0c360627e
|
addon/transitions/fade.js
|
addon/transitions/fade.js
|
import opacity from 'ember-animated/motions/opacity';
/**
Fades inserted, removed, and kept sprites.
```js
import fade from 'ember-animated/transitions/fade'
export default Component.extend({
transition: fade
});
```
```hbs
{{#animated-if use=transition}}
...
{{/animated-if}}
```
@function fade
@export default
*/
export default function*({
removedSprites,
insertedSprites,
keptSprites,
duration,
}) {
// We yield Promise.all here because we want to wait for this
// step before starting what comes after.
yield Promise.all(
removedSprites.map(s => {
if (s.revealed) {
return opacity(s, {
to: 0,
duration: duration / 2,
});
}
}),
);
// Once all fading out has happened, we can fade in the inserted
// or kept sprites. Note that we get keptSprites if some things
// were fading out and then we get interrupted and decide to
// keep them around after all.
insertedSprites.concat(keptSprites).map(s =>
opacity(s, {
to: 1,
duration: duration / 2,
}),
);
}
|
import opacity from 'ember-animated/motions/opacity';
/**
Fades inserted, removed, and kept sprites.
```js
import fade from 'ember-animated/transitions/fade';
export default Component.extend({
transition: fade
});
```
```hbs
{{#animated-if use=transition}}
...
{{/animated-if}}
```
@function fade
@export default
*/
export default function*({
removedSprites,
insertedSprites,
keptSprites,
duration,
}) {
// We yield Promise.all here because we want to wait for this
// step before starting what comes after.
yield Promise.all(
removedSprites.map(s => {
if (s.revealed) {
return opacity(s, {
to: 0,
duration: duration / 2,
});
}
}),
);
// Once all fading out has happened, we can fade in the inserted
// or kept sprites. Note that we get keptSprites if some things
// were fading out and then we get interrupted and decide to
// keep them around after all.
insertedSprites.concat(keptSprites).map(s =>
opacity(s, {
to: 1,
duration: duration / 2,
}),
);
}
|
Add missing semicolon to example
|
Add missing semicolon to example
Adds a missing semicolon to the fade transition example.
|
JavaScript
|
mit
|
ember-animation/ember-animated,ember-animation/ember-animated,ember-animation/ember-animated
|
f6f3afda12313c5093774b47b62fa79789efccc0
|
dev/_/components/js/sourceModel.js
|
dev/_/components/js/sourceModel.js
|
// Source Model
AV.source = Backbone.Model.extend({
url: 'php/redirect.php/source',
defaults: {
name: '',
type: 'raw',
contentType: 'txt',
data: ''
},
});
// Source Model Tests
// test_source = new AV.source({
// name: 'The Wind and the Rain',
// type: 'raw',
// contentType: 'txt',
// data: "When that I was and a little tiny boy, with a hey-ho, the wind and the rain, a foolish thing was but a toy, for the rain it raineth every day."
// });
// alert('potato');
// test_source.save( {
// success: function () {
// alert('success');
// },
// error: function(d){
// alert('everything is terrible');
// }
// });
other_test = new AV.source();
other_test.url = 'php/redirect.php/source/15';
other_test.fetch();
// Source Model End
|
// Source Model
AV.Source = Backbone.Model.extend({
url: 'php/redirect.php/source',
defaults: {
name: '',
type: 'raw',
contentType: 'txt',
data: ''
},
});
// Source Model Tests
// test_Source = new AV.Source({
// name: 'The Wind and the Rain',
// type: 'raw',
// contentType: 'txt',
// data: "When that I was and a little tiny boy, with a hey-ho, the wind and "+
// the rain, a foolish thing was but a toy, for the rain it raineth every day."
// });
// alert('potato');
// test_Source.save( {
// success: function () {
// alert('success');
// },
// error: function(d){
// alert('everything is terrible');
// }
// });
// other_test = new AV.Source();
// other_test.url = 'php/redirect.php/Source/15';
// other_test.fetch();
// alert(other_test.name);
// Source Model End
|
Add some tests, they're commented out right now. Things work!
|
Add some tests, they're commented out right now. Things work!
|
JavaScript
|
bsd-3-clause
|
Swarthmore/juxtaphor,Swarthmore/juxtaphor
|
74e17f622ac60623e4461c5c472e740f292855f6
|
test/index.js
|
test/index.js
|
var callisto = require('callisto');
var users = require('./lib/users.js');
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('database.db3');
callisto.server({
port: 8090,
root: 'www'
});
callisto.addModule('users', users);
|
var callisto = require('callisto');
var users = require('./lib/users.js');
var sqlite3 = require('sqlite3').verbose();
global.db = new sqlite3.Database('database.db3');
callisto.server({
port: 8090,
root: 'www'
});
callisto.addModule('users', users);
|
Add db to the global variables
|
Add db to the global variables
|
JavaScript
|
mit
|
codingvillage/callisto,codingvillage/callisto
|
625fc78ee616baedf64aa37357403b4b72c7363c
|
src/js/select2/i18n/th.js
|
src/js/select2/i18n/th.js
|
define(function () {
// Thai
return {
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร';
return message;
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร';
return message;
},
loadingMore: function () {
return 'กำลังค้นข้อมูลเพิ่ม…';
},
maximumSelected: function (args) {
var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ';
return message;
},
noResults: function () {
return 'ไม่พบข้อมูล';
},
searching: function () {
return 'กำลังค้นข้อมูล…';
}
};
});
|
define(function () {
// Thai
return {
errorLoading: function () {
return 'ไม่สามารถค้นข้อมูลได้';
},
inputTooLong: function (args) {
var overChars = args.input.length - args.maximum;
var message = 'โปรดลบออก ' + overChars + ' ตัวอักษร';
return message;
},
inputTooShort: function (args) {
var remainingChars = args.minimum - args.input.length;
var message = 'โปรดพิมพ์เพิ่มอีก ' + remainingChars + ' ตัวอักษร';
return message;
},
loadingMore: function () {
return 'กำลังค้นข้อมูลเพิ่ม…';
},
maximumSelected: function (args) {
var message = 'คุณสามารถเลือกได้ไม่เกิน ' + args.maximum + ' รายการ';
return message;
},
noResults: function () {
return 'ไม่พบข้อมูล';
},
searching: function () {
return 'กำลังค้นข้อมูล…';
}
};
});
|
Add errorLoading translation of Thai language.
|
Add errorLoading translation of Thai language.
This closes https://github.com/select2/select2/pull/4521.
|
JavaScript
|
mit
|
bottomline/select2,select2/select2,ZaArsProgger/select2,inway/select2,ZaArsProgger/select2,iestruch/select2,inway/select2,bottomline/select2,iestruch/select2,select2/select2
|
263e6691ad0cda4c2adaee1aca584316fedcf382
|
test/index.js
|
test/index.js
|
var assert = require('assert')
var mongo = require('../')
var db = mongo('mongodb://read:[email protected]:31617/esdiscuss')
before(function (done) {
this.timeout(10000)
db._get(done)
})
describe('read only operation', function () {
it('db.getCollectionNames', function (done) {
db.getCollectionNames()
.then(function (names) {
assert(names.indexOf('contents') != -1)
assert(names.indexOf('headers') != -1)
assert(names.indexOf('history') != -1)
assert(names.indexOf('messages') != -1)
assert(names.indexOf('topics') != -1)
})
.nodeify(done)
})
it('db.collection("name").find().limit(10)', function (done) {
db.collection('headers').find().limit(10)
.then(function (headers) {
assert(Array.isArray(headers))
assert(headers.length === 10)
})
.nodeify(done)
})
})
|
var assert = require('assert')
var mongo = require('../')
var db = mongo('mongodb://read:[email protected]:31617/esdiscuss')
before(function (done) {
this.timeout(10000)
db._get(done)
})
describe('read only operation', function () {
it('db.getCollectionNames', function (done) {
db.getCollectionNames()
.then(function (names) {
assert(names.indexOf('contents') != -1)
assert(names.indexOf('headers') != -1)
assert(names.indexOf('history') != -1)
assert(names.indexOf('messages') != -1)
assert(names.indexOf('topics') != -1)
})
.nodeify(done)
})
it('db.collection("name").find().limit(10)', function (done) {
db.collection('headers').find().limit(10)
.then(function (headers) {
assert(Array.isArray(headers))
assert(headers.length === 10)
})
.nodeify(done)
})
it('db.collection("name").find().count()', function (done) {
db.collection('headers').count()
.then(function (count) {
assert(typeof count === 'number');
assert(count > 0);
})
.nodeify(done)
})
})
|
Add test case for `count` method
|
Add test case for `count` method
|
JavaScript
|
mit
|
then/mongod,then/then-mongo
|
74632c81aa309e7d4cfab2bc4fb80effd49da773
|
test/index.js
|
test/index.js
|
'use strict';
var test = require('tape');
var isError = require('../index.js');
test('isError is a function', function t(assert) {
assert.equal(typeof isError, 'function');
assert.end();
});
test('returns true for error', function t(assert) {
assert.equal(isError(new Error('foo')), true);
assert.equal(isError(Error('foo')), true);
assert.end();
});
test('returns false for non-error', function t(assert) {
assert.equal(isError(null), false);
assert.equal(isError(undefined), false);
assert.equal(isError({message: 'hi'}), false);
assert.end();
});
|
'use strict';
var test = require('tape');
var vm = require('vm');
var isError = require('../index.js');
test('isError is a function', function t(assert) {
assert.equal(typeof isError, 'function');
assert.end();
});
test('returns true for error', function t(assert) {
assert.equal(isError(new Error('foo')), true);
assert.equal(isError(Error('foo')), true);
assert.end();
});
test('returns false for non-error', function t(assert) {
assert.equal(isError(null), false);
assert.equal(isError(undefined), false);
assert.equal(isError({message: 'hi'}), false);
assert.end();
});
test('errors that inherit from Error', function t(assert) {
var error = Object.create(new Error());
assert.equal(isError(error), true);
assert.end();
});
test('errors from other contexts', function t(assert) {
var error = vm.runInNewContext('new Error()');
assert.equal(isError(error), true);
assert.end();
});
test('errors that inherit from Error in another context', function t(assert) {
var error = vm.runInNewContext('Object.create(new Error())');
assert.equal(isError(error), true);
assert.end();
});
|
Add breaking tests for foreign/inherited errors
|
Add breaking tests for foreign/inherited errors
|
JavaScript
|
mit
|
Raynos/is-error
|
ce11c728c6aba22c377c9abd563aebc03df71964
|
core/client/views/settings/tags/settings-menu.js
|
core/client/views/settings/tags/settings-menu.js
|
var TagsSettingsMenuView = Ember.View.extend({
saveText: Ember.computed('controller.model.isNew', function () {
return this.get('controller.model.isNew') ?
'Add Tag' :
'Save Tag';
}),
// This observer loads and resets the uploader whenever the active tag changes,
// ensuring that we can reuse the whole settings menu.
updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () {
var uploader = this.get('controller.uploaderReference'),
image = this.get('controller.activeTag.image');
if (uploader && uploader[0]) {
if (image) {
uploader[0].uploaderUi.initWithImage();
} else {
uploader[0].uploaderUi.initWithDropzone();
}
}
})
});
export default TagsSettingsMenuView;
|
var TagsSettingsMenuView = Ember.View.extend({
saveText: Ember.computed('controller.model.isNew', function () {
return this.get('controller.model.isNew') ?
'Add Tag' :
'Save Tag';
}),
// This observer loads and resets the uploader whenever the active tag changes,
// ensuring that we can reuse the whole settings menu.
updateUploader: Ember.observer('controller.activeTag.image', 'controller.uploaderReference', function () {
var uploader = this.get('controller.uploaderReference'),
image = this.get('controller.activeTag.image');
if (uploader && uploader[0]) {
if (image) {
uploader[0].uploaderUi.initWithImage();
} else {
uploader[0].uploaderUi.reset();
}
}
})
});
export default TagsSettingsMenuView;
|
Reset upload component on tag switch
|
Reset upload component on tag switch
Closes #4755
|
JavaScript
|
mit
|
sangcu/Ghost,thinq4yourself/Unmistakable-Blog,JohnONolan/Ghost,ThorstenHans/Ghost,optikalefx/Ghost,wemakeweb/Ghost,jomahoney/Ghost,lanffy/Ghost,tidyui/Ghost,rollokb/Ghost,shrimpy/Ghost,fredeerock/atlabghost,ClarkGH/Ghost,letsjustfixit/Ghost,UsmanJ/Ghost,rito/Ghost,TribeMedia/Ghost,BlueHatbRit/Ghost,e10/Ghost,NovaDevelopGroup/Academy,llv22/Ghost,yundt/seisenpenji,cysys/ghost-openshift,mohanambati/Ghost,Azzurrio/Ghost,Trendy/Ghost,mlabieniec/ghost-env,ashishapy/ghostpy,BayPhillips/Ghost,wspandihai/Ghost,k2byew/Ghost,VillainyStudios/Ghost,ManRueda/Ghost,delgermurun/Ghost,axross/ghost,JonSmith/Ghost,rizkyario/Ghost,TribeMedia/Ghost,no1lov3sme/Ghost,singular78/Ghost,ignasbernotas/nullifer,gcamana/Ghost,lukekhamilton/Ghost,kwangkim/Ghost,Coding-House/Ghost,anijap/PhotoGhost,situkangsayur/Ghost,handcode7/Ghost,Kikobeats/Ghost,k2byew/Ghost,IbrahimAmin/Ghost,flomotlik/Ghost,vainglori0us/urban-fortnight,Trendy/Ghost,chevex/undoctrinate,JonathanZWhite/Ghost,pollbox/ghostblog,sajmoon/Ghost,Dnlyc/Ghost,lukaszklis/Ghost,tidyui/Ghost,JulienBrks/Ghost,ckousik/Ghost,katrotz/blog.katrotz.space,novaugust/Ghost,edsadr/Ghost,TryGhost/Ghost,lukw00/Ghost,NikolaiIvanov/Ghost,davidmenger/nodejsfan,weareleka/blog,ddeveloperr/Ghost,jeonghwan-kim/Ghost,pathayes/FoodBlog,Romdeau/Ghost,rafaelstz/Ghost,load11/ghost,lethalbrains/Ghost,panezhang/Ghost,Coding-House/Ghost,cysys/ghost-openshift,vishnuharidas/Ghost,mayconxhh/Ghost,ErisDS/Ghost,carlyledavis/Ghost,tmp-reg/Ghost,jamesslock/Ghost,alecho/Ghost,Xibao-Lv/Ghost,bsansouci/Ghost,dYale/blog,kortemy/Ghost,duyetdev/islab,madole/diverse-learners,PaulBGD/Ghost-Plus,jin/Ghost,bbmepic/Ghost,Sebastian1011/Ghost,bastianbin/Ghost,memezilla/Ghost,dbalders/Ghost,jeonghwan-kim/Ghost,notno/Ghost,daihuaye/Ghost,kevinansfield/Ghost,wallmarkets/Ghost,neynah/GhostSS,blankmaker/Ghost,diancloud/Ghost,akveo/akveo-blog,diancloud/Ghost,MadeOnMars/Ghost,daihuaye/Ghost,tanbo800/Ghost,shannonshsu/Ghost,ryansukale/ux.ryansukale.com,sangcu/Ghost,gcamana/Ghost,patterncoder/patterncoder,rizkyario/Ghost,dggr/Ghost-sr,ryansukale/ux.ryansukale.com,qdk0901/Ghost,optikalefx/Ghost,praveenscience/Ghost,mohanambati/Ghost,Japh/shortcoffee,Loyalsoldier/Ghost,jorgegilmoreira/ghost,vainglori0us/urban-fortnight,pedroha/Ghost,melissaroman/ghost-blog,rameshponnada/Ghost,greenboxindonesia/Ghost,metadevfoundation/Ghost,akveo/akveo-blog,omaracrystal/Ghost,notno/Ghost,aschmoe/jesse-ghost-app,influitive/crafters,bosung90/Ghost,Kaenn/Ghost,tyrikio/Ghost,situkangsayur/Ghost,Rovak/Ghost,Japh/shortcoffee,NovaDevelopGroup/Academy,greyhwndz/Ghost,skmezanul/Ghost,imjerrybao/Ghost,mattchupp/blog,camilodelvasto/herokughost,KnowLoading/Ghost,ManRueda/Ghost,benstoltz/Ghost,morficus/Ghost,zackslash/Ghost,dggr/Ghost-sr,riyadhalnur/Ghost,GarrethDottin/Habits-Design,carlosmtx/Ghost,allanjsx/Ghost,Japh/Ghost,ITJesse/Ghost-zh,ygbhf/Ghost,ClarkGH/Ghost,telco2011/Ghost,jomofrodo/ccb-ghost,sebgie/Ghost,Yarov/yarov,sfpgmr/Ghost,vloom/blog,velimir0xff/Ghost,trunk-studio/Ghost,RufusMbugua/TheoryOfACoder,allanjsx/Ghost,daimaqiao/Ghost-Bridge,smedrano/Ghost,wangjun/Ghost,LeandroNascimento/Ghost,sifatsultan/js-ghost,blankmaker/Ghost,dai-shi/Ghost,etanxing/Ghost,acburdine/Ghost,mdbw/ghost,kevinansfield/Ghost,psychobunny/Ghost,ladislas/ghost,v3rt1go/Ghost,Xibao-Lv/Ghost,Netazoic/bad-gateway,aroneiermann/GhostJade,acburdine/Ghost,lukekhamilton/Ghost,letsjustfixit/Ghost,Elektro1776/javaPress,darvelo/Ghost,jacostag/Ghost,tksander/Ghost,pbevin/Ghost,patrickdbakke/ghost-spa,disordinary/Ghost,gabfssilva/Ghost,diogogmt/Ghost,r1N0Xmk2/Ghost,jacostag/Ghost,obsoleted/Ghost,Kikobeats/Ghost,nmukh/Ghost,lanffy/Ghost,sceltoas/Ghost,JonSmith/Ghost,metadevfoundation/Ghost,hnarayanan/narayanan.co,smaty1/Ghost,thomasalrin/Ghost,Shauky/Ghost,rmoorman/Ghost,telco2011/Ghost,johngeorgewright/blog.j-g-w.info,karmakaze/Ghost,alecho/Ghost,sunh3/Ghost,laispace/laiblog,phillipalexander/Ghost,letsjustfixit/Ghost,dqj/Ghost,gabfssilva/Ghost,Azzurrio/Ghost,bisoe/Ghost,dYale/blog,rouanw/Ghost,dqj/Ghost,carlosmtx/Ghost,hoxoa/Ghost,jiangjian-zh/Ghost,exsodus3249/Ghost,NikolaiIvanov/Ghost,nmukh/Ghost,etdev/blog,wspandihai/Ghost,bastianbin/Ghost,atandon/Ghost,codeincarnate/Ghost,shannonshsu/Ghost,icowan/Ghost,Remchi/Ghost,pensierinmusica/Ghost,ghostchina/Ghost-zh,zhiyishou/Ghost,liftup/ghost,lowkeyfred/Ghost,bisoe/Ghost,ErisDS/Ghost,manishchhabra/Ghost,kaychaks/kaushikc.org,mlabieniec/ghost-env,yangli1990/Ghost,johnnymitch/Ghost,r14r/fork_nodejs_ghost,smaty1/Ghost,trunk-studio/Ghost,kolorahl/Ghost,PDXIII/Ghost-FormMailer,zeropaper/Ghost,Bunk/Ghost,PDXIII/Ghost-FormMailer,schematical/Ghost,patterncoder/patterncoder,javorszky/Ghost,dbalders/Ghost,johngeorgewright/blog.j-g-w.info,memezilla/Ghost,PeterCxy/Ghost,makapen/Ghost,Netazoic/bad-gateway,velimir0xff/Ghost,pensierinmusica/Ghost,melissaroman/ghost-blog,ballPointPenguin/Ghost,UsmanJ/Ghost,dai-shi/Ghost,tchapi/igneet-blog,jgillich/Ghost,dymx101/Ghost,leonli/ghost,schneidmaster/theventriloquist.us,Loyalsoldier/Ghost,dgem/Ghost,Rovak/Ghost,developer-prosenjit/Ghost,gleneivey/Ghost,ananthhh/Ghost,klinker-apps/ghost,NamedGod/Ghost,Klaudit/Ghost,psychobunny/Ghost,yundt/seisenpenji,Smile42RU/Ghost,singular78/Ghost,ITJesse/Ghost-zh,jorgegilmoreira/ghost,telco2011/Ghost,delgermurun/Ghost,Feitianyuan/Ghost,thomasalrin/Ghost,janvt/Ghost,woodyrew/Ghost,olsio/Ghost,ngosinafrica/SiteForNGOs,jiachenning/Ghost,r14r/fork_nodejs_ghost,jiachenning/Ghost,allanjsx/Ghost,darvelo/Ghost,jaswilli/Ghost,flpms/ghost-ad,UnbounDev/Ghost,ineitzke/Ghost,achimos/ghost_as,lf2941270/Ghost,Sebastian1011/Ghost,ljhsai/Ghost,sfpgmr/Ghost,greenboxindonesia/Ghost,wangjun/Ghost,TryGhost/Ghost,lukw00/Ghost,devleague/uber-hackathon,load11/ghost,NovaDevelopGroup/Academy,uploadcare/uploadcare-ghost-demo,Brunation11/Ghost,SkynetInc/steam,arvidsvensson/Ghost,ngosinafrica/SiteForNGOs,GroupxDev/javaPress,davidmenger/nodejsfan,AlexKVal/Ghost,weareleka/blog,tandrewnichols/ghost,benstoltz/Ghost,veyo-care/Ghost,r1N0Xmk2/Ghost,julianromera/Ghost,BayPhillips/Ghost,ManRueda/manrueda-blog,woodyrew/Ghost,sebgie/Ghost,singular78/Ghost,hoxoa/Ghost,jomofrodo/ccb-ghost,bosung90/Ghost,KnowLoading/Ghost,anijap/PhotoGhost,ManRueda/manrueda-blog,JohnONolan/Ghost,ErisDS/Ghost,veyo-care/Ghost,cqricky/Ghost,FredericBernardo/Ghost,Kikobeats/Ghost,sebgie/Ghost,tyrikio/Ghost,djensen47/Ghost,devleague/uber-hackathon,dylanchernick/ghostblog,schematical/Ghost,no1lov3sme/Ghost,neynah/GhostSS,adam-paterson/blog,manishchhabra/Ghost,PepijnSenders/whatsontheotherside,YY030913/Ghost,yanntech/Ghost,javorszky/Ghost,dbalders/Ghost,ddeveloperr/Ghost,pbevin/Ghost,lowkeyfred/Ghost,edurangel/Ghost,Netazoic/bad-gateway,tandrewnichols/ghost,codeincarnate/Ghost,edsadr/Ghost,kaychaks/kaushikc.org,denzelwamburu/denzel.xyz,hnarayanan/narayanan.co,VillainyStudios/Ghost,ryanbrunner/crafters,mnitchie/Ghost,jaswilli/Ghost,augbog/Ghost,camilodelvasto/herokughost,tmp-reg/Ghost,stridespace/Ghost,Klaudit/Ghost,hyokosdeveloper/Ghost,ryanbrunner/crafters,cqricky/Ghost,liftup/ghost,petersucks/blog,francisco-filho/Ghost,zackslash/Ghost,panezhang/Ghost,duyetdev/islab,Alxandr/Blog,e10/Ghost,mhhf/ghost-latex,ignasbernotas/nullifer,GarrethDottin/Habits-Design,LeandroNascimento/Ghost,rafaelstz/Ghost,morficus/Ghost,ineitzke/Ghost,javimolla/Ghost,cwonrails/Ghost,klinker-apps/ghost,ballPointPenguin/Ghost,djensen47/Ghost,Feitianyuan/Ghost,Alxandr/Blog,pedroha/Ghost,trepafi/ghost-base,zeropaper/Ghost,ckousik/Ghost,jiangjian-zh/Ghost,cicorias/Ghost,jin/Ghost,olsio/Ghost,ManRueda/manrueda-blog,cncodog/Ghost-zh-codog,jamesslock/Ghost,jaguerra/Ghost,STANAPO/Ghost,carlyledavis/Ghost,jparyani/GhostSS,flpms/ghost-ad,rchrd2/Ghost,devleague/uber-hackathon,influitive/crafters,yangli1990/Ghost,rameshponnada/Ghost,aschmoe/jesse-ghost-app,atandon/Ghost,jgillich/Ghost,pollbox/ghostblog,bitjson/Ghost,PeterCxy/Ghost,handcode7/Ghost,madole/diverse-learners,SkynetInc/steam,mohanambati/Ghost,rouanw/Ghost,acburdine/Ghost,epicmiller/pages,kortemy/Ghost,dgem/Ghost,hyokosdeveloper/Ghost,prosenjit-itobuz/Ghost,epicmiller/pages,claudiordgz/Ghost,phillipalexander/Ghost,netputer/Ghost,daimaqiao/Ghost-Bridge,Remchi/Ghost,tanbo800/Ghost,sceltoas/Ghost,mayconxhh/Ghost,neynah/GhostSS,icowan/Ghost,ladislas/ghost,fredeerock/atlabghost,daimaqiao/Ghost-Bridge,greyhwndz/Ghost,bsansouci/Ghost,theonlypat/Ghost,vloom/blog,cncodog/Ghost-zh-codog,yanntech/Ghost,andrewconnell/Ghost,chris-yoon90/Ghost,schneidmaster/theventriloquist.us,arvidsvensson/Ghost,mtvillwock/Ghost,novaugust/Ghost,Kaenn/Ghost,Elektro1776/javaPress,ivanoats/ivanstorck.com,ghostchina/Ghost-zh,virtuallyearthed/Ghost,denzelwamburu/denzel.xyz,virtuallyearthed/Ghost,BlueHatbRit/Ghost,sifatsultan/js-ghost,laispace/laiblog,barbastan/Ghost,lukaszklis/Ghost,adam-paterson/blog,imjerrybao/Ghost,FredericBernardo/Ghost,hilerchyn/Ghost,ThorstenHans/Ghost,Bunk/Ghost,Dnlyc/Ghost,PaulBGD/Ghost-Plus,ljhsai/Ghost,kevinansfield/Ghost,sajmoon/Ghost,disordinary/Ghost,NamedGod/Ghost,v3rt1go/Ghost,leninhasda/Ghost,Netazoic/bad-gateway,cicorias/Ghost,developer-prosenjit/Ghost,cwonrails/Ghost,zumobi/Ghost,stridespace/Ghost,beautyOfProgram/Ghost,novaugust/Ghost,barbastan/Ghost,julianromera/Ghost,nneko/Ghost,netputer/Ghost,RufusMbugua/TheoryOfACoder,ashishapy/ghostpy,smedrano/Ghost,lf2941270/Ghost,katrotz/blog.katrotz.space,Japh/Ghost,Gargol/Ghost,theonlypat/Ghost,GroupxDev/javaPress,johnnymitch/Ghost,dymx101/Ghost,kwangkim/Ghost,rito/Ghost,jparyani/GhostSS,JonathanZWhite/Ghost,pathayes/FoodBlog,aroneiermann/GhostJade,davidenq/Ghost-Blog,JulienBrks/Ghost,xiongjungit/Ghost,hnq90/Ghost,beautyOfProgram/Ghost,andrewconnell/Ghost,petersucks/blog,rollokb/Ghost,syaiful6/Ghost,leonli/ghost,jomahoney/Ghost,thinq4yourself/Unmistakable-Blog,dylanchernick/ghostblog,hnq90/Ghost,Yarov/yarov,jparyani/GhostSS,chris-yoon90/Ghost,shrimpy/Ghost,obsoleted/Ghost,nneko/Ghost,Kaenn/Ghost,GroupxDev/javaPress,lethalbrains/Ghost,leninhasda/Ghost,syaiful6/Ghost,prosenjit-itobuz/Ghost,ManRueda/Ghost,Alxandr/Blog,augbog/Ghost,thehogfather/Ghost,mnitchie/Ghost,camilodelvasto/localghost,gleneivey/Ghost,hilerchyn/Ghost,jomofrodo/ccb-ghost,etanxing/Ghost,Romdeau/Ghost,vainglori0us/urban-fortnight,jaguerra/Ghost,mdbw/ghost,davidenq/Ghost-Blog,etdev/blog,riyadhalnur/Ghost,ASwitlyk/Ghost,uploadcare/uploadcare-ghost-demo,sunh3/Ghost,rmoorman/Ghost,praveenscience/Ghost,camilodelvasto/localghost,cwonrails/Ghost,TryGhost/Ghost,SachaG/bjjbot-blog,stridespace/Ghost,laispace/laiblog,ASwitlyk/Ghost,qdk0901/Ghost,JohnONolan/Ghost,davidenq/Ghost-Blog,llv22/Ghost,leonli/ghost,tadityar/Ghost,axross/ghost,STANAPO/Ghost,edurangel/Ghost,AnthonyCorrado/Ghost,ivantedja/ghost,omaracrystal/Ghost,ivanoats/ivanstorck.com,Jai-Chaudhary/Ghost,makapen/Ghost,zhiyishou/Ghost,claudiordgz/Ghost,Elektro1776/javaPress,YY030913/Ghost,Smile42RU/Ghost,zumobi/Ghost,wemakeweb/Ghost,tadityar/Ghost,ygbhf/Ghost,cncodog/Ghost-zh-codog,francisco-filho/Ghost,DesenTao/Ghost,bitjson/Ghost,jorgegilmoreira/ghost,kolorahl/Ghost,xiongjungit/Ghost,uniqname/everydaydelicious,MadeOnMars/Ghost,janvt/Ghost,mhhf/ghost-latex,ananthhh/Ghost,exsodus3249/Ghost,bbmepic/Ghost,mlabieniec/ghost-env,DesenTao/Ghost,AnthonyCorrado/Ghost,achimos/ghost_as,mtvillwock/Ghost,skmezanul/Ghost,thehogfather/Ghost,rizkyario/Ghost,cysys/ghost-openshift,rchrd2/Ghost,diogogmt/Ghost,wallmarkets/Ghost,UnbounDev/Ghost,sergeylukin/Ghost,Brunation11/Ghost,kortemy/Ghost,SachaG/bjjbot-blog,dggr/Ghost-sr,tksander/Ghost,AlexKVal/Ghost,sergeylukin/Ghost,PepijnSenders/whatsontheotherside,flomotlik/Ghost,mattchupp/blog,karmakaze/Ghost,Gargol/Ghost,IbrahimAmin/Ghost,javimolla/Ghost,Jai-Chaudhary/Ghost
|
9d75d13fcca1105093170e6b98d1e690fc9cbd29
|
system-test/env.js
|
system-test/env.js
|
const expect = require('chai').expect;
const version = process.env.QB_VERSION;
describe('check compiler version inside docker', function () {
it('should have the same version', async () => {
const exec = require('child_process').exec;
let options = {
timeout: 60000,
killSignal: 'SIGKILL'
};
const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => {
resolve(stdout + stderr);
}));
expect(result).to.eql(version);
}).timeout(60000);
});
|
const expect = require('chai').expect;
const version = process.env.QB_VERSION;
describe('check compiler version inside docker', function () {
it('should have the same version', async () => {
const exec = require('child_process').exec;
let options = {
timeout: 60000,
killSignal: 'SIGKILL'
};
const result = await new Promise(resolve => exec(`docker run --rm -v ${__dirname}/env/version.cpp:/home/builder/bench-file.cpp -t fredtingaud/quick-bench:${version} /bin/bash -c "./build && ./run"`, options, (error, stdout, stderr) => {
resolve(stdout + stderr);
}));
expect(result).to.eql(version);
}).timeout(60000);
});
describe('check available standards', function() {
it('should contain multiple standards', async() =>{
const exec = require('child_process').exec;
let options = {
timeout: 60000,
killSignal: 'SIGKILL'
};
const result = await new Promise(resolve => exec(`docker run --rm -t fredtingaud/quick-bench:${version} /bin/bash -c "./std-versions"`, options, (error, stdout, stderr) => {
resolve(stdout + stderr);
}));
expect(result).to.not.be.empty();
expect(result).to.contain('c++11');
})
})
|
Add a test for std-versions script
|
Add a test for std-versions script
|
JavaScript
|
bsd-2-clause
|
FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end,FredTingaud/quick-bench-back-end
|
210babd039054adf81522da01f55b10b5e0dc06f
|
tests/dev.js
|
tests/dev.js
|
var f_ = require('../index.js');
var TaskList = require('./TaskList');
var f_config = {
functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED
resetOnRetryAll: true,
toLog: ['all'],
desc: 'Test taskList',
maxRetries: {
all: 2
}
};
TaskList = f_.augment(TaskList, f_config);
var runSingle = function (){
var taskListInstance = new TaskList();
taskListInstance = f_.setup(taskListInstance);
taskListInstance.start();
}();
var runMultiple = function (){
var startTime = Date.now();
for(var i=0; i<10000; i+=1){
var taskListInstance = new TaskList();
taskListInstance = f_.setup(taskListInstance);
taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i;
taskListInstance.start();
}
var endTime = Date.now(),
timeTaken = endTime - startTime;
console.log(timeTaken);
};
|
var f_ = require('../index.js');
var TaskList = require('./TaskList');
var f_config = {
/**
* `start` method is not given here, since we call it manualy
* This is just a matter of personal taste, I do not like auto starts!
*/
functionFlow: ['getSource', 'writeSource', 'notify'], // REQUIRED
resetOnRetryAll: true,
toLog: ['all'],
desc: 'Test taskList',
maxRetries: {
all: 2
}
};
TaskList = f_.augment(TaskList, f_config);
var runSingle = function (){
var taskListInstance = new TaskList();
taskListInstance = f_.setup(taskListInstance);
taskListInstance.start();
}();
var runMultiple = function (){
var startTime = Date.now();
for(var i=0; i<10000; i+=1){
var taskListInstance = new TaskList();
taskListInstance = f_.setup(taskListInstance);
taskListInstance.f_desc = taskListInstance.f_desc + ' #' + i;
taskListInstance.start();
}
var endTime = Date.now(),
timeTaken = endTime - startTime;
console.log(timeTaken);
};
|
Comment about start method not being present in functionFlow
|
Comment about start method not being present in functionFlow
|
JavaScript
|
mit
|
opensoars/f_
|
e34ec4cde226f760dc21926e9f2fb504fdb7fdb5
|
src/Drivers/Cache/index.js
|
src/Drivers/Cache/index.js
|
'use strict'
/**
* Abstract base class that ensures required public methods are implemented by
* inheriting classes.
*
* @example
*
* class BloomFilterCache extends Cache {
* constructor() {
* super()
* }
*
* get(key) {}
* put(key, value, milliseconds) {}
* increment(key) {}
* incrementExpiration(key, seconds) {}
* }
*
*/
class Cache {
/**
* Do not call this constructor directly.
*/
constructor() {
if (new.target === Cache) {
throw new TypeError('Cannot instantiate abstract base class: Cache')
}
const abstractMethods = [
'get',
'put',
'increment',
'incrementExpiration'
].map(name => {
const implemented = typeof this[name] === 'function'
return { name, implemented }
})
if (!abstractMethods.every(method => method.implemented)) {
const message = 'Implementing class does not override abstract methods: '
const unimplemented = abstractMethods
.filter(method => !method.implemented)
.map(method => method.name)
.join(', ')
throw new TypeError(message + unimplemented)
}
}
}
module.exports = Cache
|
'use strict'
/**
* Abstract base class that ensures required public methods are implemented by
* inheriting classes.
*
* @example
*
* class BloomFilterCache extends Cache {
* constructor() {
* super()
* }
*
* get(key) {}
* put(key, value, milliseconds) {}
* increment(key) {}
* incrementExpiration(key, seconds) {}
* }
*
*/
class Cache {
/**
* Do not call this constructor directly.
*/
constructor() {
if (new.target === Cache) {
throw new TypeError('Cannot instantiate abstract base class: Cache')
}
const abstractMethods = [
'get',
'put',
'increment',
'incrementExpiration',
'secondsToExpiration'
].map(name => {
const implemented = typeof this[name] === 'function'
return { name, implemented }
})
if (!abstractMethods.every(method => method.implemented)) {
const message = 'Implementing class does not override abstract methods: '
const unimplemented = abstractMethods
.filter(method => !method.implemented)
.map(method => method.name)
.join(', ')
throw new TypeError(message + unimplemented)
}
}
}
module.exports = Cache
|
Mark secondsToExpiration as abstract method
|
Mark secondsToExpiration as abstract method
|
JavaScript
|
mit
|
masasron/adonis-throttle,masasron/adonis-throttle
|
3f5e236d5a23f13e8f683a550d31ff44080ecb01
|
transforms.js
|
transforms.js
|
/**
* Module dependencies
*/
var accounting = require('accounting')
, util = require('util')
, currency = require('currency-symbol-map');
/**
* formatPrice - format currency code and price nicely
* @param {Object} value
* @returns {String} formatted price
* @note Value is expected to be of the form:
* {
* CurrencyCode: [ 'EUR' ],
* Amount: [ '130' ] // Cents
* }
*/
module.exports.formatPrice = function (val) {
var code = val && val.CurrencyCode && val.CurrencyCode[0]
, amount = val && val.Amount && val.Amount[0];
if (!code || !amount) return null;
return accounting.formatMoney(amount / 100, currency(code));
};
|
/**
* Module dependencies
*/
var accounting = require('accounting')
, util = require('util')
, currency = require('currency-symbol-map');
/**
* formatPrice - format currency code and price nicely
* @param {Object} value
* @returns {String} formatted price
* @note Value is expected to be of the form:
* {
* CurrencyCode: [ 'EUR' ],
* Amount: [ '130' ] // Cents
* }
*/
module.exports.formatPrice = function (val) {
var code = val && val.CurrencyCode && val.CurrencyCode[0]
, amount = val && val.Amount && val.Amount[0]
, decimal, thousand;
if (!code || !amount) return null;
// Set separator
if (~['DE'].indexOf(this.country)) {
decimal = ',';
thousand = '.';
} else {
decimal = '.';
thousand = ',';
}
return accounting.formatMoney(amount / 100, currency(code), 2, thousand, decimal);
};
|
Format prices differently for germany
|
Format prices differently for germany
|
JavaScript
|
mit
|
urgeiolabs/aws-price
|
351e1eb2093ff4cfb87f17f6bcfccb95f0f589f0
|
source/assets/javascripts/locastyle/_toggle-text.js
|
source/assets/javascripts/locastyle/_toggle-text.js
|
var locastyle = locastyle || {};
locastyle.toggleText = (function() {
'use strict';
var config = {
trigger: '[data-ls-module=toggleText]',
triggerChange: 'toggleText:change'
};
function eventHandler(el, target, text) {
el.trigger(config.triggerChange, [target, text]);
}
function bindToggle(el) {
var $target = el.data('target-text') ? $(el.data('target-text')) : el;
var textChange = el.data('toggle-text');
var textOriginal = $target.text();
el.data('toggle-text', textOriginal);
$target.text(textChange);
eventHandler(el, $target, textChange);
}
function bindEventOnClick() {
$(config.trigger).on('click.ls', function(event) {
event.preventDefault();
bindToggle($(this));
event.stopPropagation();
});
}
function unbind() {
$(config.trigger).off('click.ls');
}
function init() {
unbind();
bindEventOnClick();
}
return {
init: init
};
}());
|
var locastyle = locastyle || {};
locastyle.toggleText = (function() {
'use strict';
var config = {
trigger: '[data-ls-module=toggleText]',
triggerChange: 'toggleText:change'
};
function eventHandler(el, target, text) {
el.trigger(config.triggerChange, [target, text]);
}
function bindToggle(el) {
var $target = el.data('target-text') ? $(el.data('target-text')) : el;
var textChange = el.data('toggle-text');
var textOriginal = $target.text();
el.data('toggle-text', textOriginal);
$target.text(textChange);
eventHandler(el, $target, textChange);
}
function bindEventOnClick() {
$(config.trigger).on('click.ls', function(event) {
event.preventDefault();
bindToggle($(this));
});
}
function unbind() {
$(config.trigger).off('click.ls');
}
function init() {
unbind();
bindEventOnClick();
}
return {
init: init
};
}());
|
Remove stop propagation from toggle text module
|
Remove stop propagation from toggle text module
|
JavaScript
|
mit
|
locaweb/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,deividmarques/locawebstyle,locaweb/locawebstyle,locaweb/locawebstyle
|
c090cf03c81639622df3f7d3b0414aea926d95a3
|
bonfires/sum-all-odd-fibonacci-numbers/logic.js
|
bonfires/sum-all-odd-fibonacci-numbers/logic.js
|
/* Bonfire: Sum All Odd Fibonacci Numbers */
function sumFibs(num) {
var f1 = 1;
var f2 = 1;
function fib(){
}
return num;
}
sumFibs(4);
|
/* Bonfire: Sum All Odd Fibonacci Numbers */
function sumFibs(num) {
var tmp = num;
while (num > 2){
}
return num;
}
sumFibs(4);
|
Edit Fibonacci project in Bonfires Directory
|
Edit Fibonacci project in Bonfires Directory
|
JavaScript
|
mit
|
witblacktype/freeCodeCamp_projects,witblacktype/freeCodeCamp_projects
|
069d6ac19107f126cc71b37dad5d8d0821d3c249
|
app/controllers/stream.js
|
app/controllers/stream.js
|
import Ember from 'ember';
import ENV from 'plenario-explorer/config/environment';
export default Ember.Controller.extend({
modelArrived: Ember.observer('model', function() {
const nodeList = this.get('model.nodes');
const nodeTuples = nodeList.map(node => {
return [node.properties.id, node.properties];
});
const nodeMap = new Map(nodeTuples);
this.set('nodeMap', nodeMap);
// TODO: Move magic node id to environment config
this.set('selectedNode', nodeMap.get(ENV.defaultNode));
}),
actions: {
onSelect(nodeId) {
const newNode = this.get('nodeMap').get(nodeId);
this.set('selectedNode', newNode);
}
}
});
|
import Ember from 'ember';
// import ENV from 'plenario-explorer/config/environment';
export default Ember.Controller.extend({
modelArrived: Ember.observer('model', function() {
const nodeList = this.get('model.nodes');
const nodeTuples = nodeList.map(node => {
return [node.properties.id, node.properties];
});
const nodeMap = new Map(nodeTuples);
this.set('nodeMap', nodeMap);
this.set('selectedNode', nodeList[0].properties);
}),
actions: {
onSelect(nodeId) {
const newNode = this.get('nodeMap').get(nodeId);
this.set('selectedNode', newNode);
}
}
});
|
Set default node as first returned from API
|
Set default node as first returned from API
|
JavaScript
|
mit
|
UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer,UrbanCCD-UChicago/plenario-explorer
|
c8edf1a27fe1a9142793a071b079d079138c6851
|
schema/sorts/fair_sorts.js
|
schema/sorts/fair_sorts.js
|
import { GraphQLEnumType } from 'graphql';
export default {
type: new GraphQLEnumType({
name: 'FairSorts',
values: {
created_at_asc: {
value: 'created_at',
},
created_at_desc: {
value: '-created_at',
},
start_at_asc: {
value: 'start_at',
},
start_at_desc: {
value: '-start_at',
},
name_asc: {
value: 'name',
},
name_desc: {
value: '-name',
},
},
}),
};
|
import { GraphQLEnumType } from 'graphql';
export default {
type: new GraphQLEnumType({
name: 'FairSorts',
values: {
CREATED_AT_ASC: {
value: 'created_at',
},
CREATED_AT_DESC: {
value: '-created_at',
},
START_AT_ASC: {
value: 'start_at',
},
START_AT_DESC: {
value: '-start_at',
},
NAME_ASC: {
value: 'name',
},
NAME_DESC: {
value: '-name',
},
},
}),
};
|
Use uppercase for fair sort enum
|
Use uppercase for fair sort enum
|
JavaScript
|
mit
|
artsy/metaphysics,broskoski/metaphysics,artsy/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,craigspaeth/metaphysics,1aurabrown/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,artsy/metaphysics,craigspaeth/metaphysics
|
50b994a3873b14b50a28660547ea7d4a36e4d429
|
config/pathresolver.js
|
config/pathresolver.js
|
/*jslint node: true */
const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver;
const path = require('path');
pathresolver.baseDir = function(req) {
if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) {
throw new Error("No valid user!");
}
// Admin users can see all the directories
if(req.user.global_roles.indexOf('admin') >= 0) {
return process.env.DATA_DIR;
}
// Other users can only see their own directory
return path.join(process.env.DATA_DIR, req.user.username);
};
|
/*jslint node: true */
const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver;
const path = require('path');
const fs = require('fs.extra');
pathresolver.baseDir = function(req) {
if(!req.user || !req.user.username || !Array.isArray(req.user.global_roles)) {
throw new Error("No valid user!");
}
// Admin users can see all the directories
if(req.user.global_roles.indexOf('admin') >= 0) {
return process.env.DATA_DIR;
}
// Other users can only see their own directory
var baseDir = path.join(process.env.DATA_DIR, req.user.username);
// Create the directory if it does not exist already
fs.mkdirpSync(baseDir);
return baseDir;
};
|
Create user directories if they do not exist
|
Create user directories if they do not exist
|
JavaScript
|
agpl-3.0
|
fkoester/purring-flamingo,fkoester/purring-flamingo
|
c8ac6f48aae5a473f712231bbad389f9b788cfc7
|
discord-client/src/bot.js
|
discord-client/src/bot.js
|
const Discord = require('discord.js');
const { ChannelProcessor } = require('./channelProcessor');
const {discordApiToken } = require('./secrets.js');
const client = new Discord.Client();
const channelProcessorMap = {};
client.on('ready', () => {
console.log('Bot is ready');
});
client.on('message', (message) => {
const channel = message.channel;
const channelID = message.channel.id;
if(channelProcessorMap[channelID] == null) {
const newChannelProcessor = new ChannelProcessor(channelID);
newChannelProcessor.setOnHaikuFunction((haiku) => {
channel.send(
`${haiku.author} has created a beautiful Haiku!
${haiku.lines[0]}
${haiku.lines[1]}
${haiku.lines[2]}`);
});
channelProcessorMap[channelID] = newChannelProcessor;
}
channelProcessorMap[channelID].processMessage(message);
});
client.login(discordApiToken);
|
const Discord = require('discord.js');
const { ChannelProcessor } = require('./channelProcessor');
const {discordApiToken } = require('./secrets.js');
const client = new Discord.Client();
const channelProcessorMap = {};
client.on('ready', () => {
console.log('Bot is ready');
});
client.on('message', (message) => {
const channel = message.channel;
const channelID = message.channel.id;
if(channelProcessorMap[channelID] == null) {
const newChannelProcessor = new ChannelProcessor(channelID);
newChannelProcessor.setOnHaikuFunction((haiku) => {
console.log(
`Haiku triggered:
author: ${haiku.author}
lines: ${haiku.lines}`);
channel.send(
`${haiku.author} has created a beautiful Haiku!
${haiku.lines[0]}
${haiku.lines[1]}
${haiku.lines[2]}`);
});
channelProcessorMap[channelID] = newChannelProcessor;
}
channelProcessorMap[channelID].processMessage(message);
});
client.login(discordApiToken);
|
Add console logging upon haiku trigger
|
Add console logging upon haiku trigger
|
JavaScript
|
mit
|
bumblepie/haikubot
|
cc472a3d07b2803c9e3b4cb80624d1c312d519f7
|
test/fetch.js
|
test/fetch.js
|
'use strict';
var http = require('http');
var assert = require('assertive');
var fetch = require('../lib/fetch');
describe('fetch', function() {
var server;
before('start echo server', function(done) {
server = http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Type': 'application/json',
});
res.end(JSON.stringify({
method: req.method,
url: req.url,
headers: req.headers,
}));
});
server.on('error', done);
server.listen(3000, function() { done(); });
});
after('close echo server', function(done) {
server.close(done);
});
it('can fetch stuff', function() {
var headers = { 'x-Fancy': 'stuff' };
headers['X-Fancy'] = 'other stuff';
return fetch('http://localhost:3000/foo', { headers: headers })
.json()
.then(function(echo) {
assert.equal('GET', echo.method);
assert.equal('/foo', echo.url);
assert.equal('overriding headers works thanks to key ordering',
'other stuff', echo.headers['x-fancy']);
});
});
});
|
'use strict';
var http = require('http');
var assert = require('assertive');
var fetch = require('../lib/fetch');
describe('fetch', function() {
var server;
before('start echo server', function(done) {
server = http.createServer(function(req, res) {
var chunks = [];
req.on('data', function(chunk) {
chunks.push(chunk);
});
req.on('end', function() {
res.writeHead(200, {
'Content-Type': 'application/json',
});
res.end(JSON.stringify({
method: req.method,
url: req.url,
headers: req.headers,
body: Buffer.concat(chunks).toString()
}));
});
});
server.on('error', done);
server.listen(3000, function() { done(); });
});
after('close echo server', function(done) {
server.close(done);
});
it('can fetch stuff', function() {
var headers = { 'x-Fancy': 'stuff' };
headers['X-Fancy'] = 'other stuff';
return fetch('http://localhost:3000/foo', { headers: headers })
.json()
.then(function(echo) {
assert.equal('GET', echo.method);
assert.equal('/foo', echo.url);
assert.equal('', echo.body);
assert.equal('overriding headers works thanks to key ordering',
'other stuff', echo.headers['x-fancy']);
});
});
});
|
Add test for empty body
|
Add test for empty body
|
JavaScript
|
bsd-3-clause
|
jkrems/srv-gofer
|
f8339c53d8b89ebb913088be19954ad8d0c44517
|
src/providers/sh/index.js
|
src/providers/sh/index.js
|
module.exports = {
title: 'now.sh',
subcommands: new Set([
'login',
'deploy',
'ls',
'list',
'alias',
'scale',
'certs',
'dns',
'domains',
'rm',
'remove',
'whoami',
'secrets',
'logs',
'upgrade',
'teams',
'switch'
]),
get deploy() {
return require('./deploy')
},
get login() {
return require('./login')
},
get ls() {
return require('./commands/bin/list')
},
get list() {
return require('./commands/bin/list')
},
get alias() {
return require('./commands/bin/alias')
},
get scale() {
return require('./commands/bin/scale')
},
get certs() {
return require('./commands/bin/certs')
},
get dns() {
return require('./commands/bin/dns')
},
get domains() {
return require('./commands/bin/domains')
},
get rm() {
return require('./commands/bin/remove')
},
get remove() {
return require('./commands/bin/remove')
},
get whoami() {
return require('./commands/bin/whoami')
},
get secrets() {
return require('./commands/bin/secrets')
},
get logs() {
return require('./commands/bin/logs')
},
get upgrade() {
return require('./commands/bin/upgrade')
},
get teams() {
return require('./commands/bin/teams')
},
get switch() {
return require('./commands/bin/teams')
}
}
|
const mainCommands = new Set([
'help',
'list',
'remove',
'alias',
'domains',
'dns',
'certs',
'secrets',
'billing',
'upgrade',
'teams',
'logs',
'scale',
'logout',
'whoami'
])
const aliases = {
list: ['ls'],
remove: ['rm'],
alias: ['ln', 'aliases'],
domains: ['domain'],
certs: ['cert'],
secrets: ['secret'],
billing: ['cc'],
upgrade: ['downgrade'],
teams: ['team', 'switch'],
logs: ['log']
}
const subcommands = new Set(mainCommands)
// Add aliases to available sub commands
for (const alias in aliases) {
const items = aliases[alias]
for (const item of items) {
subcommands.add(item)
}
}
const list = {
title: 'now.sh',
subcommands,
get deploy() {
return require('./deploy')
},
get login() {
return require('./login')
}
}
for (const subcommand of mainCommands) {
let handlers = [subcommand]
if (aliases[subcommand]) {
handlers = handlers.concat(aliases[subcommand])
}
for (const handler of handlers) {
Object.defineProperty(list, handler, {
get() {
return require(`./commands/bin/${subcommand}`)
}
})
}
}
module.exports = list
|
Support for all aliases added
|
Support for all aliases added
|
JavaScript
|
apache-2.0
|
zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli,zeit/now-cli
|
d1709007440080cc4b1ced6dbebe0096164f15fb
|
model/file.js
|
model/file.js
|
'use strict';
var memoize = require('memoizee/plain')
, validDb = require('dbjs/valid-dbjs')
, defineFile = require('dbjs-ext/object/file')
, defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file')
, docMimeTypes = require('../utils/microsoft-word-doc-mime-types');
module.exports = memoize(function (db) {
var File, JpegFile;
validDb(db);
File = defineFile(db);
File.prototype.url = function () {
return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null;
};
JpegFile = defineJpegFile(db);
File.prototype.defineProperties({
preview: { type: File, value: function () {
return this.isPreviewGenerated ? this.generatedPreview : this;
} },
isPreviewGenerated: { type: db.Boolean, value: true },
generatedPreview: { type: File, nested: true },
thumb: { type: JpegFile, nested: true }
});
File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes);
return File;
}, { normalizer: require('memoizee/normalizers/get-1')() });
|
'use strict';
var memoize = require('memoizee/plain')
, validDb = require('dbjs/valid-dbjs')
, defineFile = require('dbjs-ext/object/file')
, defineJpegFile = require('dbjs-ext/object/file/image-file/jpeg-file')
, docMimeTypes = require('../utils/microsoft-word-doc-mime-types');
module.exports = memoize(function (db) {
var File, JpegFile;
validDb(db);
File = defineFile(db);
File.prototype.url = function () {
return this.path ? '/' + this.path.split('/').map(encodeURIComponent).join('/') : null;
};
JpegFile = defineJpegFile(db);
File.prototype.defineProperties({
preview: { type: File, value: function () {
return this.isPreviewGenerated ? this.generatedPreview : this;
} },
isPreviewGenerated: { type: db.Boolean, value: true },
generatedPreview: { type: File, nested: true },
thumb: { type: JpegFile, nested: true },
toJSON: { value: function (descriptor) {
return { kind: 'file', url: this.url, thumbUrl: this.thumb.url };
} },
isEmpty: { value: function (ignore) { return !this.path; } }
});
File.accept = ['image/jpeg', 'application/pdf', 'image/png'].concat(docMimeTypes);
return File;
}, { normalizer: require('memoizee/normalizers/get-1')() });
|
Add File methods for proper JSON snapshots
|
Add File methods for proper JSON snapshots
|
JavaScript
|
mit
|
egovernment/eregistrations,egovernment/eregistrations,egovernment/eregistrations
|
f1c0c236e8b6d3154781c9f30f91b3eae59b60e4
|
region-score-lead.meta.js
|
region-score-lead.meta.js
|
// ==UserScript==
// @id iitc-plugin-region-score-lead@hansolo669
// @name IITC plugin: region score lead
// @category Tweaks
// @version 0.2.3
// @namespace https://github.com/hansolo669/iitc-tweaks
// @updateURL https://iitc.reallyawesomedomain.com/region-score-lead.meta.js
// @downloadURL https://iitc.reallyawesomedomain.com/region-score-lead.user.js
// @description Small modification to the region scores to show the current mu lead.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/mission/*
// @include http://www.ingress.com/mission/*
// @match https://www.ingress.com/mission/*
// @match http://www.ingress.com/mission/*
// @grant none
// ==/UserScript==
|
// ==UserScript==
// @id iitc-plugin-region-score-lead@hansolo669
// @name IITC plugin: region score lead
// @category Tweaks
// @version 0.2.4
// @namespace https://github.com/hansolo669/iitc-tweaks
// @updateURL https://iitc.reallyawesomedomain.com/region-score-lead.meta.js
// @downloadURL https://iitc.reallyawesomedomain.com/region-score-lead.user.js
// @description Small modification to the region scores to show the current mu lead.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
// @match http://www.ingress.com/intel*
// @include https://www.ingress.com/mission/*
// @include http://www.ingress.com/mission/*
// @match https://www.ingress.com/mission/*
// @match http://www.ingress.com/mission/*
// @grant none
// ==/UserScript==
|
Fix for intel routing changes
|
Fix for intel routing changes
|
JavaScript
|
mit
|
hansolo669/iitc-tweaks,hansolo669/iitc-tweaks
|
85db50188bcf660bdf83fc09c0c50eed9f0433c4
|
test/index.js
|
test/index.js
|
'use strict';
var assert = require('assert');
var chromedriver = require('chromedriver');
var browser = require('../');
chromedriver.start();
browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('20s');
after(function () {
chromedriver.stop();
});
var getHeadingText = browser.async(function* (browser) {
var heading = yield browser.elementByTagName('h1').text();
return heading;
});
describe('www.example.com', function () {
it('Has a header that reads "Example Domain"', browser(function* (browser) {
yield browser.get('http://www.example.com');
var heading = yield getHeadingText(browser);
assert(heading.trim() == 'Example Domain');
}));
});
|
'use strict';
var assert = require('assert');
var chromedriver = require('chromedriver');
var browser = require('../');
var LOCAL = !process.env.CI;
if (LOCAL) {
chromedriver.start();
browser.remote('http://localhost:9515/').timeout('60s').operationTimeout('5s');
after(function () {
chromedriver.stop();
});
} else {
browser.remote('ondemand.saucelabs.com', 80, 'sauce-runner', 'c71a5c75-7c28-483f-9053-56da13b40bc2').timeout('240s').operationTimeout('30s');
}
var getHeadingText = browser.async(function* (browser) {
var heading = yield browser.elementByTagName('h1').text();
return heading;
});
describe('www.example.com', function () {
it('Has a header that reads "Example Domain"', browser(function* (browser) {
console.log('getting url');
yield browser.get('http://www.example.com');
console.log('getting heading text');
var heading = yield getHeadingText(browser);
console.log('checking heading text');
assert(heading.trim() == 'Example Domain');
}));
});
|
Support CI using sauce labs
|
Support CI using sauce labs
|
JavaScript
|
mit
|
ForbesLindesay/selenium-mocha
|
67ad246f902b2c04a426d16d5fe877ffa1fee5d0
|
tests/integration/angular-meteor-session-spec.js
|
tests/integration/angular-meteor-session-spec.js
|
describe('$meteorSession service', function () {
var $meteorSession,
$rootScope,
$scope;
beforeEach(angular.mock.module('angular-meteor'));
beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) {
$meteorSession = _$meteorSession_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
}));
it('should update the scope variable when session variable changes', function () {
Session.set('myVar', 3);
$meteorSession('myVar').bind($scope, 'myVar');
Session.set('myVar', 4);
Tracker.flush(); // get the computations to run
expect($scope.myVar).toEqual(4);
});
it('should update the session variable when the scope variable changes', function() {
$scope.myVar = 3;
$meteorSession('myVar').bind($scope, 'myVar');
$scope.myVar = 4;
$rootScope.$apply();
expect(Session.get('myVar')).toEqual(4);
});
});
|
describe('$meteorSession service', function () {
var $meteorSession,
$rootScope,
$scope;
beforeEach(angular.mock.module('angular-meteor'));
beforeEach(angular.mock.inject(function(_$meteorSession_, _$rootScope_) {
$meteorSession = _$meteorSession_;
$rootScope = _$rootScope_;
$scope = $rootScope.$new();
}));
it('should update the scope variable when session variable changes', function () {
Session.set('myVar', 3);
$meteorSession('myVar').bind($scope, 'myVar');
Session.set('myVar', 4);
Tracker.flush(); // get the computations to run
expect($scope.myVar).toEqual(4);
});
it('should update the session variable when the scope variable changes', function() {
$scope.myVar = 3;
$meteorSession('myVar').bind($scope, 'myVar');
$scope.myVar = 4;
$rootScope.$apply();
expect(Session.get('myVar')).toEqual(4);
});
it('should update the scope variable nested property when session variable changes', function () {
Session.set('myVar', 3);
$scope.a ={
b:{
myVar: 3
}
};
$meteorSession('myVar').bind($scope, 'a.b.myVar');
Session.set('myVar', 4);
Tracker.flush(); // get the computations to run
expect($scope.a.b.myVar).toEqual(4);
});
it('should update the session variable when the scope variable nested property changes', function() {
$scope.a ={
b:{
myVar: 3
}
};
$meteorSession('myVar').bind($scope, 'a.b.myVar');
$scope.a.b.myVar = 4;
$rootScope.$apply();
expect(Session.get('myVar')).toEqual(4);
});
});
|
Add test for $meteorSession service to support scope variable nested property
|
Add test for $meteorSession service to support scope variable nested property
|
JavaScript
|
mit
|
IgorMinar/angular-meteor,omer72/angular-meteor,IgorMinar/angular-meteor,zhoulvming/angular-meteor,dszczyt/angular-meteor,craigmcdonald/angular-meteor,divramod/angular-meteor,aleksander351/angular-meteor,thomkaufmann/angular-meteor,Urigo/angular-meteor,Unavi/angular-meteor,manhtuongbkhn/angular-meteor,dszczyt/angular-meteor,michelalbers/angular-meteor,dj0nes/angular-meteor,kamilkisiela/angular-meteor,kyroskoh/angular-meteor,DAB0mB/angular-meteor,pbastowski/angular-meteor,aleksander351/angular-meteor,ccortezia/angular-meteor,idanwe/angular-meteor,efosao12/angular-meteor,gonengar/angular-meteor,dszczyt/angular-meteor,DAB0mB/angular-meteor,okland/angular-meteor,kyroskoh/angular-meteor,Wanderfalke/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,DAB0mB/angular-meteor,ccortezia/angular-meteor,okland/angular-meteor,mauricionr/angular-meteor,michelalbers/angular-meteor,dszczyt/angular-meteor,Tallyb/angular-meteor,omer72/angular-meteor,klenis/angular-meteor,barbatus/angular-meteor,craigmcdonald/angular-meteor,cuitianze/angular-meteor,pbastowski/angular-meteor,barbatus/angular-meteor,ahmedshuhel/angular-meteor,thomkaufmann/angular-meteor,okland/angular-meteor,omer72/angular-meteor,MarkPhillips7/angular-meteor,simonv3/angular-meteor,divramod/angular-meteor,gonengar/angular-meteor,Unavi/angular-meteor,sebakerckhof/angular-meteor,michelalbers/angular-meteor,cuitianze/angular-meteor,ShMcK/angular-meteor,tgienger/angular-meteor,kyroskoh/angular-meteor,ahmedshuhel/angular-meteor,zhoulvming/angular-meteor,tgienger/angular-meteor,evanliomain/angular-meteor,alexandr2110pro/angular-meteor,nhducit/angular-meteor,efosao12/angular-meteor,ajbarry/angular-meteor,Unavi/angular-meteor,ahmedshuhel/angular-meteor,davidyaha/angular-meteor,mauricionr/angular-meteor,cuitianze/angular-meteor,dtruel/angular-meteor,idanwe/angular-meteor,evanliomain/angular-meteor,manhtuongbkhn/angular-meteor,gonengar/angular-meteor,gonengar/angular-meteor,efosao12/angular-meteor,mauricionr/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,zhoulvming/angular-meteor,IgorMinar/angular-meteor,klenis/angular-meteor,dj0nes/angular-meteor,evanliomain/angular-meteor,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,simonv3/angular-meteor,revspringjake/angular-meteor-tutorial,jonmc12/angular-meteor,alexandr2110pro/angular-meteor,ShMcK/angular-meteor,ahmedshuhel/angular-meteor,revspringjake/angular-meteor-tutorial,ajbarry/angular-meteor,craigmcdonald/angular-meteor,Urigo/angular-meteor-legacy,efosao12/angular-meteor,pbastowski/angular-meteor,davidyaha/angular-meteor,manhtuongbkhn/angular-meteor,jonmc12/angular-meteor,Wanderfalke/angular-meteor,sebakerckhof/angular-meteor,zhoulvming/angular-meteor,kyroskoh/angular-meteor,evanliomain/angular-meteor,Wanderfalke/angular-meteor,revspringjake/angular-meteor-tutorial,nhducit/angular-meteor,michelalbers/angular-meteor,kamilkisiela/angular-meteor,divramod/angular-meteor,jonmc12/angular-meteor,barbatus/angular-meteor,dtruel/angular-meteor,mauricionr/angular-meteor,sebakerckhof/angular-meteor,okland/angular-meteor,kamilkisiela/angular-meteor,omer72/angular-meteor,simonv3/angular-meteor,mushkab/angular-meteor,mushkab/angular-meteor,Tallyb/angular-meteor,nhducit/angular-meteor,aleksander351/angular-meteor,tgienger/angular-meteor,tgienger/angular-meteor,pbastowski/angular-meteor,jonmc12/angular-meteor,Unavi/angular-meteor,dtruel/angular-meteor,alexandr2110pro/angular-meteor,mushkab/angular-meteor,darkbasic/angular-meteor,klenis/angular-meteor,divramod/angular-meteor,mushkab/angular-meteor,dj0nes/angular-meteor,alexandr2110pro/angular-meteor,dj0nes/angular-meteor,ajbarry/angular-meteor,nhducit/angular-meteor,thomkaufmann/angular-meteor,dtruel/angular-meteor,Wanderfalke/angular-meteor,klenis/angular-meteor,IgorMinar/angular-meteor,aleksander351/angular-meteor,ajbarry/angular-meteor,thomkaufmann/angular-meteor,MarkPhillips7/angular-meteor
|
67567c4809789b1896b470c621085125450cf845
|
src/renderer/ui/components/generic/PlatformSpecific.js
|
src/renderer/ui/components/generic/PlatformSpecific.js
|
import { Component, PropTypes } from 'react';
import os from 'os';
import semver from 'semver';
export const semverValidator = (props, propName, componentName) => {
if (props[propName]) {
return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`);
}
return null;
};
export default class PlatformSpecific extends Component {
static propTypes = {
children: PropTypes.object,
platform: PropTypes.string.isRequired,
versionRange: semverValidator,
};
render() {
if (process.platform === this.props.platform) {
if (!this.props.versionRange) return this.props.children;
if (semver.validRange(this.props.versionRange) && semver.satisfies(os.release(), this.props.versionRange)) {
return this.props.children;
}
}
return null;
}
}
|
import { Component, PropTypes } from 'react';
import os from 'os';
import semver from 'semver';
const parsedOSVersion = semver.parse(os.release());
const osVersion = `${parsedOSVersion.major}.${parsedOSVersion.minor}.${parsedOSVersion.patch}`;
export const semverValidator = (props, propName, componentName) => {
if (props[propName]) {
return semver.validRange(props[propName]) ? null : new Error(`${propName} in ${componentName} is not a valid semver string`);
}
return null;
};
export default class PlatformSpecific extends Component {
static propTypes = {
children: PropTypes.object,
platform: PropTypes.string.isRequired,
versionRange: semverValidator,
};
render() {
if (process.platform === this.props.platform) {
if (!this.props.versionRange) return this.props.children;
if (semver.validRange(this.props.versionRange) && semver.satisfies(osVersion, this.props.versionRange)) {
return this.props.children;
}
}
return null;
}
}
|
Fix version tests on linux
|
Fix version tests on linux
|
JavaScript
|
mit
|
petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-,petuhovskiy/Google-Play-Music-Desktop-Player-UNOFFICIAL-
|
0aad07073773a20898d950c649a7fa74b22497fc
|
Emix.Web/ngApp/emixApp.js
|
Emix.Web/ngApp/emixApp.js
|
angular.module('emixApp',
['ngRoute',
'emixApp.controllers',
'emixApp.directives',
'emixApp.services',
'mgcrea.ngStrap',
'ngMorris',
//'ngGoogleMap'
'pascalprecht.translate'
])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/dashboard', {
controller: 'dashboard_index',
templateUrl: 'ngApp/pages/dashboard/index.html'
})
.when('/section', {
controller: 'section_index',
templateUrl: 'ngApp/pages/section/index.html'
})
.otherwise({
redirectTo: '/dashboard'
});
}])
.config(['$translateProvider', function ($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: Emix.Web.translationsFolder,
suffix: '.json'
});
$translateProvider.preferredLanguage('it_IT');
$translateProvider.storageKey('lang');
$translateProvider.storagePrefix('emix');
// $translateProvider.useLocalStorage();
}]);
angular.module('emixApp.services', []);
angular.module('emixApp.controllers', []);
angular.module('emixApp.directives', []);
|
angular.module('emixApp',
['ngRoute',
'ngCookies',
'emixApp.controllers',
'emixApp.directives',
'emixApp.services',
'mgcrea.ngStrap',
'ngMorris',
'pascalprecht.translate'
])
.config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/dashboard', {
controller: 'dashboard_index',
templateUrl: 'ngApp/pages/dashboard/index.html'
})
.when('/section', {
controller: 'section_index',
templateUrl: 'ngApp/pages/section/index.html'
})
.otherwise({
redirectTo: '/dashboard'
});
}])
.config(['$translateProvider', function ($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: Emix.Web.translationsFolder,
suffix: '.json'
});
$translateProvider.preferredLanguage('it_IT');
$translateProvider.storageKey('lang');
$translateProvider.storagePrefix('emix');
$translateProvider.useLocalStorage();
}]);
angular.module('emixApp.services', []);
angular.module('emixApp.controllers', []);
angular.module('emixApp.directives', []);
|
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
|
Allow translator plugin to store selected language in sessionStorage/cookie and remember the settings
|
JavaScript
|
mit
|
sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed,sierrodc/ASP.NET-MVC-AngularJs-Seed
|
e42f8f09fa04b1893a96479e004f06fa964efc67
|
test/assets/javascripts/specs/login-controller-spec.js
|
test/assets/javascripts/specs/login-controller-spec.js
|
'use strict';
describe('Login controller', function () {
var scope;
var loginCtrl;
var $httpBackend;
beforeEach(module('todo.controllers'));
beforeEach(inject(function(_$httpBackend_, $controller, $rootScope) {
$httpBackend = _$httpBackend_;
scope = $rootScope.$new();
loginCtrl = $controller('LandingCtrl', {
$scope: scope
});
}));
it('should submit the user credentials', inject(function($location, $rootScope) {
$httpBackend.expectPOST('/login', {username: 'testuser', password: 'secret'}).respond(200, {username: 'testuser'});
scope.formData.username = 'testuser';
scope.formData.password = 'secret';
scope.setUsername();
$httpBackend.flush();
expect($rootScope.login.username).toBe('testuser');
expect($location.url()).toBe('/tasks');
}));
});
|
'use strict';
describe('Login controller', function () {
var scope;
var loginCtrl;
var $httpBackend;
beforeEach(module('todo.controllers'));
beforeEach(inject(function (_$httpBackend_, $controller, $rootScope) {
$httpBackend = _$httpBackend_;
scope = $rootScope.$new();
loginCtrl = $controller('LandingCtrl', {
$scope: scope
});
}));
it('should submit the user credentials', inject(function ($location, $rootScope) {
$httpBackend.expectPOST('/users/authenticate/userpass',
{username: 'testuser', password: 'secret'})
.respond(200, {username: 'testuser'});
scope.formData.username = 'testuser';
scope.formData.password = 'secret';
scope.setUsername();
$httpBackend.flush();
expect($rootScope.login.username).toBe('testuser');
expect($location.url()).toBe('/tasks');
}));
});
|
Fix login JS test to use SecureSocial endpoint.
|
Fix login JS test to use SecureSocial endpoint.
|
JavaScript
|
mit
|
timothygordon32/reactive-todolist,timothygordon32/reactive-todolist
|
62f676d0f493689dc877b12f9067c32179d81788
|
app/events/routes.js
|
app/events/routes.js
|
var eventSource = require('express-eventsource'),
logger = require('radiodan-client').utils.logger('event-routes');
module.exports = function (app, eventBus, services) {
var eventStream = eventSource();
// Shared eventsource
// To send data call: eventStream.send(dataObj, 'eventName');
app.use('/', eventStream.middleware());
['nowAndNext', 'nowPlaying', 'liveText'].forEach(function (topic) {
services.events.on('*.' + topic, createMessageEmitter(topic));
});
function createMessageEmitter(topic) {
return function (data, metadata) {
eventStream.send({ topic: topic, serviceId: metadata.serviceId, data: data });
};
}
['settings.*', 'service.changed', 'power', 'exit', 'shutdown'].forEach(function (topic) {
eventBus.on(topic, function (args) {
if (args && args.length === 1) {
args = args[0];
}
eventStream.send({ topic: this.event, data: args });
});
});
return app;
};
|
var eventSource = require('express-eventsource'),
logger = require('radiodan-client').utils.logger('event-routes');
module.exports = function (app, eventBus, services) {
var eventStream = eventSource();
// Shared eventsource
// To send data call: eventStream.send(dataObj, 'eventName');
app.use('/', eventStream.middleware());
['nowAndNext', 'nowPlaying', 'liveText'].forEach(function (topic) {
services.events.on('*.' + topic, createMessageEmitter(topic));
});
function createMessageEmitter(topic) {
return function (data, metadata) {
eventStream.send({ topic: topic, serviceId: metadata.serviceId, data: data });
};
}
['settings.*', 'service.changed', 'power', 'exit', 'shutdown', 'audio'].forEach(function (topic) {
eventBus.on(topic, function (args) {
if (args && args.length === 1) {
args = args[0];
}
eventStream.send({ topic: this.event, data: args });
});
});
return app;
};
|
Fix bug where volume changes not emitted to client through event stream
|
Fix bug where volume changes not emitted to client through event stream
|
JavaScript
|
apache-2.0
|
radiodan/magic-button,radiodan/magic-button
|
78b046830969751e89f34683938a58154ec4ce1f
|
public/script/project.js
|
public/script/project.js
|
function sortProject(changeEvent) {
var data = {};
// Get old and new index from event
data.oldIndex = changeEvent.oldIndex;
data.newIndex = changeEvent.newIndex;
// Get filters
data.filters = {};
data.filters = getCurrentFilters();
// Get project id from event item
data.projectId = $(changeEvent.item).children('input.cb-completed').val();
console.log(data);
// Make AJAX call to sort
// TODO: Function to match index with task
// TODO: Function to update sequences on update
// TODO: make this queue-able
}
|
function sortProject(changeEvent) {
var data = {};
// Get old and new index from event
data.oldIndex = changeEvent.oldIndex;
data.newIndex = changeEvent.newIndex;
// Get filters
data.filters = {};
data.filters = getCurrentFilters();
// Get project id from event item
data.projectId = $(changeEvent.item).children('input.cb-completed').val();
console.log(data);
// Make AJAX call to sort
// TODO: Function to match index with task
// TODO: Function to update sequences on update
// TODO: make this queue-able
}
|
Clean up unfinished work + conflict
|
Clean up unfinished work + conflict
|
JavaScript
|
mit
|
BBBThunda/projectify,BBBThunda/projectify,BBBThunda/projectify
|
05975f56e6561e789dfb8fedaf4954cc751c787c
|
src/common.js
|
src/common.js
|
function findByIds(items, ids) {
return ids
.map((id) => {
return items.find((item) => item.id === id)
})
.filter((item) => item)
}
function findOneById(items, id) {
return items.find((item) => item.id === id)
}
function findOneByAliases(items, aliases) {
if (Array.isArray(aliases)) {
return items.find((item) => {
let { name, alias } = item
return aliases.find((n) => n === name || (alias && alias.includes(n)))
})
}
return items.find((item) => {
return item.name === aliases || (item.alias && item.alias.includes(aliases))
})
}
module.exports = {
findByIds, findOneById, findOneByAliases,
}
|
function findByIds(items, ids) {
return ids
.map((id) => {
return items.find((item) => item.id === id)
})
.filter((item) => item)
}
function findOneById(items, id) {
return items.find((item) => item.id === id)
}
function findOneByAliases(items, aliases) {
if (Array.isArray(aliases)) {
return items.find((item) => {
let { name, alias } = item
return aliases.find((n) => n === name || (alias && alias.includes(n)))
})
}
return items.find((item) => {
return item.name === aliases || (item.alias && item.alias.includes(aliases))
})
}
function findOneByName(items, field, name) {
if (arguments.length === 2) {
return findOneByAliases(items, field)
} else if (typeof name === 'string') {
return findOneByAliases(items, name)
}
let result
for (let i = 0; i < name.length && items.length; i++) {
result = findOneByName(items, name[i])
if (result) {
items = findByIds(items, result[field])
}
}
return result
}
module.exports = {
findByIds, findOneById, findOneByAliases, findOneByName,
}
|
Add findOneByName for usage with nested names
|
Add findOneByName for usage with nested names
|
JavaScript
|
isc
|
alex-shnayder/comanche
|
10c8e31cfd598b8f736ba7cdc9d280b607b30042
|
src/config.js
|
src/config.js
|
import * as FrontendPrefsOptions from './utils/frontend-preferences-options';
const config = {
api:{
host: 'http://localhost:3000',
sentinel: null // keep always last
},
auth: {
cookieDomain: 'localhost',
tokenPrefix: 'freefeed_',
userStorageKey: 'USER_KEY',
sentinel: null // keep always last
},
captcha: {
siteKey: '',
sentinel: null // keep always last
},
search: {
searchEngine: null,
sentinel: null // keep always last
},
siteDomains: [ // for transform links in the posts, comments, etc.
'freefeed.net',
'gamma.freefeed.net'
],
sentry: {
publicDSN: null,
sentinel: null // keep always last
},
frontendPreferences: {
clientId: 'net.freefeed',
defaultValues: {
displayNames: {
displayOption: FrontendPrefsOptions.DISPLAYNAMES_DISPLAYNAME,
useYou: true
},
realtimeActive: false,
comments: {
omitRepeatedBubbles: true,
highlightComments: true,
hiddenTypes: []
},
allowLinksPreview: false,
readMoreStyle: 'modern',
homefeed: {
hideUsers: []
}
}
}
};
export default config;
|
import * as FrontendPrefsOptions from './utils/frontend-preferences-options';
const config = {
api:{
host: 'http://localhost:3000',
sentinel: null // keep always last
},
auth: {
cookieDomain: 'localhost',
tokenPrefix: 'freefeed_',
userStorageKey: 'USER_KEY',
sentinel: null // keep always last
},
captcha: {
siteKey: '',
sentinel: null // keep always last
},
search: {
searchEngine: null,
sentinel: null // keep always last
},
siteDomains: [ // for transform links in the posts, comments, etc.
'freefeed.net',
'gamma.freefeed.net'
],
sentry: {
publicDSN: null,
sentinel: null // keep always last
},
frontendPreferences: {
clientId: 'net.freefeed',
defaultValues: {
displayNames: {
displayOption: FrontendPrefsOptions.DISPLAYNAMES_BOTH,
useYou: true
},
realtimeActive: false,
comments: {
omitRepeatedBubbles: true,
highlightComments: true,
hiddenTypes: []
},
allowLinksPreview: false,
readMoreStyle: 'modern',
homefeed: {
hideUsers: []
}
}
}
};
export default config;
|
Change default value of displayname setting
|
Change default value of displayname setting
New default is: "Display name + username"
|
JavaScript
|
mit
|
davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client,kadmil/freefeed-react-client,davidmz/freefeed-react-client,davidmz/freefeed-react-client,FreeFeed/freefeed-react-client,FreeFeed/freefeed-react-client,kadmil/freefeed-react-client
|
6d22dabca3b69a06fb8f3fdc11469b6da7641bfd
|
src/config.js
|
src/config.js
|
// = Server config =============================================================
export const port = 3000
export const enableGraphiQL = true;
export const logFile = 'store.log'
// = App config ================================================================
|
// = Server config =============================================================
export const port = process.env.PORT || 3000
export const enableGraphiQL = true;
export const logFile = 'store.log'
// = App config ================================================================
|
Add ability to define port as environment variable
|
Add ability to define port as environment variable
|
JavaScript
|
mit
|
jukkah/comicstor
|
30f2923409e548ccc4626278509ae158bae6d5e0
|
web_clients/javascript_mvc/www/js/test/test-main.js
|
web_clients/javascript_mvc/www/js/test/test-main.js
|
var allTestFiles = [];
var TEST_REGEXP = /_test\.js$/i;
var pathToModule = function(path) {
return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, '');
};
Object.keys(window.__karma__.files).forEach(function(file) {
if (TEST_REGEXP.test(file)) {
// Normalize paths to RequireJS module names.
allTestFiles.push(pathToModule(file));
}
});
require.config({
baseUrl: '/base/js/vendor',
paths: {
jquery: 'jquery/jquery-2.1.1.min',
squire: 'squire/Squire',
client: '../client'
}
});
// Kick off Jasmine
// NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times.
require( allTestFiles, window.__karma__.start );
|
(function() {
'use strict';
var test_files, coverage_files;
function pathToModule(path) {
return path.replace(/^\/base\/js\//, '..\/').replace(/\.js$/, '');
};
// Configure require's paths
require.config({
baseUrl: '/base/js/vendor',
paths: {
jquery: 'jquery/jquery-2.1.1.min',
squire: 'squire/Squire',
client: '../client'
}
});
// Ensure all client files are included for code coverage
coverage_files = [];
Object.keys(window.__karma__.files).forEach(function(file) {
var regex;
// Only pick up client files
regex = /^\/base\/js\/client\//;
if( !regex.test(file) ) {
return;
}
// Don't pick up main.js - we only want the modules, not to actually start anything up.
if( file === '/base/js/client/main.js' ) {
return;
}
// Convert to a require path
coverage_files.push(pathToModule(file));
});
// Actually get coverage to see the files
require(coverage_files, function() {});
// Find all test files to run in Jasmine
test_files = [];
Object.keys(window.__karma__.files).forEach(function(file) {
var regex;
regex = /_test\.js$/i;
if (regex.test(file)) {
// Normalize paths to RequireJS module names.
test_files.push(pathToModule(file));
}
});
// Kick off Jasmine
// NOTE: this MUST NOT be run via deps+config, otherwise Squire will run the tests multiple times.
require( test_files, window.__karma__.start );
})();
|
Include all client files for coverage reporting
|
Include all client files for coverage reporting
Also: clean up test-main a bit from its original copypasta.
|
JavaScript
|
mit
|
xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz,xaroth8088/tournament-of-lulz
|
32c4655b62a4edf005b4233ad8b0ce8718c10537
|
client/templates/admin/posts/posts.js
|
client/templates/admin/posts/posts.js
|
Template.add_post.events({
'submit .add_post_form': function(){
var title = event.target.title.value;
var body - event.target.body.value;
// Insert the post
Posts.insert({
title: title,
body: body
});
FlashMessages.sendSucess('Post has been successfully added!');
Router.go('/admin/posts');
// Prevent submit
return false;
}
});
|
Save post after submit the form
|
Save post after submit the form
|
JavaScript
|
mit
|
pH-7/pH7Ortfolio,pH-7/pH7Ortfolio
|
|
637d929936c13fb6e5cb96630200df02f615b0a3
|
client/templates/register/register.js
|
client/templates/register/register.js
|
Template.register.rendered = function () {
/*
* Reset form select field values
* to prevent an edge case bug for code push
* where accommodations value was undefined
*/
$('#age').val('');
$('#registration_type').val('');
$('#accommodations').val('');
$('#carbon-tax').val('');
};
Template.register.helpers({
'price': function () {
/*
* Get the dynamically calculated registration fee.
*/
//Set the registration object
// from current registration details.
try {
var registration = {
ageGroup: ageGroupVar.get(),
type: registrationTypeVar.get(),
accommodations: accommodationsVar.get(),
days: daysVar.get(),
firstTimeAttender: firstTimeAttenderVar.get(),
linens: linensVar.get(),
createdAt: new Date(),
carbonTax: carbonTaxVar.get()
};
} catch (error) {
console.log(error.message);
}
// Calculate the price
try {
var registrationPrice = calculateRegistrationPrice(registration);
} catch (error) {
console.log(error.message);
}
return registrationPrice;
}
});
Template.register.events({
'change form': function () {
// Make sure all reactive vars are up to date.
setReactiveVars();
},
'keyup #carbon-tax': function () {
setReactiveVars();
}
});
|
Template.register.rendered = function () {
/*
* Reset form select field values
* to prevent an edge case bug for code push
* where accommodations value was undefined
*/
$('#age').val('');
$('#registration_type').val('');
$('#accommodations').val('');
$('#carbon-tax').val('');
};
Template.register.helpers({
'price': function () {
/*
* Get the dynamically calculated registration fee.
*/
//Set the registration object
// from current registration details.
try {
var registration = {
ageGroup: ageGroupVar.get(),
type: registrationTypeVar.get(),
accommodations: accommodationsVar.get(),
days: daysVar.get(),
firstTimeAttender: firstTimeAttenderVar.get(),
linens: linensVar.get(),
createdAt: new Date(),
carbonTax: carbonTaxVar.get(),
donation: donationVar.get()
};
} catch (error) {
console.log(error.message);
}
// Calculate the price
try {
var registrationPrice = calculateRegistrationPrice(registration);
} catch (error) {
console.log(error.message);
}
return registrationPrice;
}
});
Template.register.events({
'change form': function () {
// Make sure all reactive vars are up to date.
setReactiveVars();
},
'keyup #carbon-tax': function () {
setReactiveVars();
}
});
|
Add donation field to calculation
|
Add donation field to calculation
|
JavaScript
|
agpl-3.0
|
quaker-io/pym-2015,quaker-io/pym-online-registration,quaker-io/pym-online-registration,quaker-io/pym-2015
|
0a0d0c90aab2d5cb50e67e11cac747342eda27ed
|
grunt/tasks/_browserify-bundles.js
|
grunt/tasks/_browserify-bundles.js
|
module.exports = {
'src-specs': {
src: [
'test/fail-tests-if-have-errors-in-src.js',
'test/spec/api/**/*',
'test/spec/core/**/*',
'test/spec/dataviews/**/*',
'test/spec/util/**/*',
'test/spec/geo/**/*',
'test/spec/ui/**/*',
'test/spec/vis/**/*',
'test/spec/windshaft/**/*',
'test/spec/windshaft-integration/**/*',
'test/spec/analysis/**/*',
'test/spec/engine.spec.js',
// not actually used anywhere in cartodb.js, only for editor?
// TODO can be (re)moved?
'!test/spec/ui/common/tabpane.spec.js'
],
dest: '<%= config.tmp %>/src-specs.js'
},
cartodb: {
src: 'src/cartodb.js',
exclude: [
'src/api/v4/'
],
dest: '<%= config.dist %>/internal/cartodb.uncompressed.js'
},
'carto-public': {
src: 'src/api/v4/index.js',
dest: '<%= config.dist %>/public/carto.uncompressed.js',
options: {
external: [ 'leaflet' ]
}
}
};
|
module.exports = {
'src-specs': {
src: [
'test/fail-tests-if-have-errors-in-src.js',
'test/spec/api/**/*',
'test/spec/core/**/*',
'test/spec/dataviews/**/*',
'test/spec/util/**/*',
'test/spec/geo/**/*',
'test/spec/ui/**/*',
'test/spec/vis/**/*',
'test/spec/windshaft/**/*',
'test/spec/windshaft-integration/**/*',
'test/spec/analysis/**/*',
'test/spec/engine.spec.js',
// not actually used anywhere in cartodb.js, only for editor?
// TODO can be (re)moved?
'!test/spec/ui/common/tabpane.spec.js'
],
dest: '<%= config.tmp %>/src-specs.js'
},
cartodb: {
src: 'src/cartodb.js',
exclude: [
'src/api/v4/'
],
dest: '<%= config.dist %>/internal/cartodb.uncompressed.js'
},
'carto-public': {
src: [
'src/api/v4/index.js',
'node_modules/camshaft-reference/versions/0.59.4/reference.json'
],
dest: '<%= config.dist %>/public/carto.uncompressed.js',
options: {
external: [ 'leaflet' ]
}
}
};
|
Add latest camshaft reference in the bundle
|
Add latest camshaft reference in the bundle
|
JavaScript
|
bsd-3-clause
|
splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js,splashblot/cartodb.js
|
791d07b503940051c19fc11187c67859c299b252
|
src/patterns/autosubmit.js
|
src/patterns/autosubmit.js
|
define([
'../jquery/autosubmit'
], function(require) {
var autosubmit = {
initContent: function(root) {
$("[data-autosubmit]", root)
.find("input[type-search]").andSelf()
.patternAutosubmit();
}
};
return autosubmit;
});
// jshint indent: 4, browser: true, jquery: true, quotmark: double
// vim: sw=4 expandtab
|
define([
'../jquery/autosubmit'
], function() {
var autosubmit = {
initContent: function(root) {
$("[data-autosubmit]", root)
.find("input[type-search]").andSelf()
.patternAutosubmit();
}
};
return autosubmit;
});
// jshint indent: 4, browser: true, jquery: true, quotmark: double
// vim: sw=4 expandtab
|
Fix error in define call
|
Fix error in define call
|
JavaScript
|
bsd-3-clause
|
Patternslib/require-experimental-build,Patternslib/Patterns-archive,Patternslib/Patterns-archive,Patternslib/Patterns-archive
|
84e2ef62b1faff132d69ad3384be68fb364d86c9
|
src/string.js
|
src/string.js
|
// =================================================================================================
// Core.js | String Functions
// (c) 2014 Mathigon / Philipp Legner
// =================================================================================================
(function() {
M.extend(String.prototype, {
endsWith: function(search) {
var end = this.length;
var start = end - search.length;
return (this.substring(start, end) === search);
},
strip: function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
},
collapse: function() {
return this.trim().replace(/\s+/g, ' ');
},
toTitleCase: function() {
return this.replace(/\S+/g, function(a){
return a.charAt(0).toUpperCase() + a.slice(1);
});
},
words: function() {
return this.strip().split(/\s+/);
}
}, true);
if ( !String.prototype.contains ) {
M.extend(String.prototype, {
contains: function() {
return String.prototype.indexOf.apply( this, arguments ) !== -1;
}
}, true);
}
})();
|
// =================================================================================================
// Core.js | String Functions
// (c) 2014 Mathigon / Philipp Legner
// =================================================================================================
(function() {
M.extend(String.prototype, {
strip: function() {
return this.replace(/^\s+/, '').replace(/\s+$/, '');
},
collapse: function() {
return this.trim().replace(/\s+/g, ' ');
},
toTitleCase: function() {
return this.replace(/\S+/g, function(a){
return a.charAt(0).toUpperCase() + a.slice(1);
});
},
words: function() {
return this.strip().split(/\s+/);
}
}, true);
if (!String.prototype.endsWith) {
M.extend(String.prototype, {
endsWith: function(search) {
var end = this.length;
var start = end - search.length;
return (this.substring(start, end) === search);
}
}, true);
}
if (!String.prototype.contains) {
M.extend(String.prototype, {
contains: function() {
return String.prototype.indexOf.apply( this, arguments ) !== -1;
}
}, true);
}
})();
|
Fix String endsWith prototype shadowing
|
Fix String endsWith prototype shadowing
|
JavaScript
|
mit
|
Mathigon/core.js
|
a8d74088d41f2bb83336dc242d512193e743385a
|
components/home/events.js
|
components/home/events.js
|
import React from 'react'
import PropTypes from 'prop-types'
import Link from 'next/link'
import { translate } from 'react-i18next'
import Section from './section'
const Events = ({ t }) => (
<Section title={t('eventsSectionTitle')}>
<Link href='/events'>
<a>{t('eventsLink')}</a>
</Link>
<style jsx>{`
@import 'colors';
a {
color: $darkgrey;
display: block;
margin-top: 1em;
&:focus, &:hover {
color: $black;
}
}
`}</style>
</Section>
)
Events.propTypes = {
t: PropTypes.func.isRequired
}
export default translate('home')(Events)
|
import React from 'react'
import PropTypes from 'prop-types'
import { translate } from 'react-i18next'
import Link from '../link'
import Section from './section'
const Events = ({ t }) => (
<Section title={t('eventsSectionTitle')}>
<Link href='/events'>
<a>{t('eventsLink')}</a>
</Link>
<style jsx>{`
@import 'colors';
a {
color: $darkgrey;
display: block;
margin-top: 1em;
&:focus, &:hover {
color: $black;
}
}
`}</style>
</Section>
)
Events.propTypes = {
t: PropTypes.func.isRequired
}
export default translate('home')(Events)
|
Fix link to event page
|
Fix link to event page
|
JavaScript
|
mit
|
sgmap/inspire,sgmap/inspire
|
8bfcc293065a51f365fe574dcf168c3c10af98a6
|
api/controllers/requestHandlers/handleSuggest.js
|
api/controllers/requestHandlers/handleSuggest.js
|
var elasticsearch = require('elasticsearch');
if (sails.config.useElastic === true) {
var CLIENT = new elasticsearch.Client({
host: sails.config.elasticHost,
log: sails.config.elasticLogLevel
})
}
module.exports = function(req, res) {
if (!CLIENT) {
return res.notFound()
}
if (!req.body || !req.body.q || !req.socket) {
return res.badRequest()
}
var query = req.body.q;
CLIENT.search({
index: 'search',
from: 0,
size: 100,
body: {
query: {
query_string : {
fields : ["name", "id"],
query: query.replace(/\:/g, '\\:') + '*',
analyze_wildcard: true
}
}
}
}, function(err, result) {
if (err) {
sails.log.warn(err);
return res.serverError()
} else {
console.log(result[0])
sails.log.debug('Suggest options for %s: %d', query, result.hits.total);
if (result.hits.total > 0) {
return res.json(result.hits.hits)
} else {
return res.notFound()
}
}
})
};
|
var elasticsearch = require('elasticsearch');
if (sails.config.useElastic === true) {
var CLIENT = new elasticsearch.Client({
host: sails.config.elasticHost,
log: sails.config.elasticLogLevel
})
}
module.exports = function(req, res) {
if (!CLIENT) {
return res.notFound()
}
if (!req.body || !req.body.q || !req.socket) {
return res.badRequest()
}
var query = req.body.q;
CLIENT.search({
index: 'search',
from: 0,
size: 100,
body: {
query: {
query_string : {
fields : ["name", "id"],
query: query.replace(/\:/g, '\\\:') + '*',
analyze_wildcard: true,
default_operator: 'AND'
}
}
}
}, function(err, result) {
if (err) {
sails.log.warn(err);
return res.serverError()
} else {
console.log(result[0])
sails.log.debug('Suggest options for %s: %d', query, result.hits.total);
if (result.hits.total > 0) {
return res.json(result.hits.hits)
} else {
return res.notFound()
}
}
})
};
|
Allow searching for HPO term ID's and match only entries that contain all of the query words (instead of one of the query words).
|
Allow searching for HPO term ID's and match only entries that contain all of the query words (instead of one of the query words).
|
JavaScript
|
mit
|
molgenis/gene-network,molgenis/gene-network
|
cf4e0ba45bb8da2f44ea3eccee25f38b69479f45
|
controllers/submission.js
|
controllers/submission.js
|
const Submission = require('../models/Submission');
const moment = require('moment');
/**
* GET /submissions
*/
exports.getSubmissions = (req, res) => {
const page = parseInt(req.query && req.query.page) || 0;
Submission
.find()
.sort({ _id: -1 })
.populate('user')
.populate('language')
.skip(500 * page)
.limit(500)
.exec((err, submissions) => {
res.render('submissions', {
title: 'Submissions',
submissions,
moment,
});
});
};
/**
* GET /submissions/:submission
*/
exports.getSubmission = (req, res) => {
const _id = req.params.submission;
Submission
.findOne({ _id })
.populate('user')
.populate('language')
.exec()
.then((submission) => {
if (submission === null) {
return res.sendStatus(404);
}
res.render('submission', {
title: 'Submission',
submission,
selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team,
});
});
};
|
const Submission = require('../models/Submission');
const User = require('../models/User');
const moment = require('moment');
const Promise = require('bluebird');
/**
* GET /submissions
*/
exports.getSubmissions = (req, res) => {
Promise.try(() => {
if (req.query.author) {
return User.findOne({ email: `${req.query.author}@twitter.com` });
}
return null;
}).then((author) => {
const page = parseInt(req.query && req.query.page) || 0;
const query = {};
if (author) {
query.user = author._id;
}
if (req.query.status) {
query.status = req.query.status;
}
return Submission.find(query)
.sort({ _id: -1 })
.populate('user')
.populate('language')
.skip(500 * page)
.limit(500)
.exec();
}).then((submissions) => {
res.render('submissions', {
title: 'Submissions',
submissions,
moment,
});
});
};
/**
* GET /submissions/:submission
*/
exports.getSubmission = (req, res) => {
const _id = req.params.submission;
Submission
.findOne({ _id })
.populate('user')
.populate('language')
.exec()
.then((submission) => {
if (submission === null) {
return res.sendStatus(404);
}
res.render('submission', {
title: 'Submission',
submission,
selfTeam: req.user && typeof req.user.team === 'number' && req.user.team === submission.user.team,
});
});
};
|
Add author and status parameter
|
Add author and status parameter
|
JavaScript
|
mit
|
hakatashi/esolang-battle,hakatashi/esolang-battle,hakatashi/esolang-battle
|
221ed0e89bf69a169d1110788e0be3e2d10c49f0
|
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
|
lib/node_modules/@stdlib/buffer/from-array/lib/index.js
|
'use strict';
/**
* Allocate a buffer using an octet array.
*
* @module @stdlib/buffer/from-array
*
* @example
* var array2buffer = require( '@stdlib/type/buffer/from-array' );
*
* var buf = array2buffer( [ 1, 2, 3, 4 ] );
* // returns <Buffer>
*/
// MODULES //
var hasFrom = require( './has_from.js' );
// MAIN //
var array2buffer;
if ( hasFrom ) {
array2buffer = require( './main.js' );
} else {
array2buffer = require( './polyfill.js' );
}
// EXPORTS //
module.exports = array2buffer;
|
'use strict';
/**
* Allocate a buffer using an octet array.
*
* @module @stdlib/buffer/from-array
*
* @example
* var array2buffer = require( '@stdlib/type/buffer/from-array' );
*
* var buf = array2buffer( [ 1, 2, 3, 4 ] );
* // returns <Buffer>
*/
// MODULES //
var hasFrom = require( './has_from.js' );
var main = require( './main.js' );
var polyfill = require( './polyfill.js' );
// MAIN //
var array2buffer;
if ( hasFrom ) {
array2buffer = main;
} else {
array2buffer = polyfill;
}
// EXPORTS //
module.exports = array2buffer;
|
Refactor to avoid dynamic module resolution
|
Refactor to avoid dynamic module resolution
|
JavaScript
|
apache-2.0
|
stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib
|
3ac7f2a8044ad8febe16541e9b3683cf00fd1ae0
|
components/search/result/thumbnail.js
|
components/search/result/thumbnail.js
|
import React from 'react'
import PropTypes from 'prop-types'
import { translate } from 'react-i18next'
import { GEODATA_API_URL } from '@env'
const Thumbnail = ({ recordId, thumbnails, t }) => {
const hasThumbnail = thumbnails && thumbnails.length > 0
const thumbnail = hasThumbnail
? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}`
: '/static/images/datasets/default-thumbnail.svg'
return (
<div>
<img src={thumbnail} alt='' />
<style jsx>{`
div {
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
overflow: hidden;
height: 180px;
width: 180px;
@media (max-width: 767px) {
width: 100%;
${!hasThumbnail && (`
display: none;
`)}
}
}
img {
display: flex;
height: 100%;
@media (max-width: 767px) {
max-width: 100%;
height: auto;
margin: auto;
}
}
`}</style>
</div>
)
}
Thumbnail.propTypes = {
thumbnails: PropTypes.arrayOf(PropTypes.shape({
originalUrlHash: PropTypes.isRequired
})),
recordId: PropTypes.string.isRequired,
t: PropTypes.func.isRequired
}
export default translate('search')(Thumbnail)
|
import React from 'react'
import PropTypes from 'prop-types'
import { translate } from 'react-i18next'
import { GEODATA_API_URL } from '@env'
const Thumbnail = ({ recordId, thumbnails, t }) => {
const hasThumbnail = thumbnails && thumbnails.length > 0
const thumbnail = hasThumbnail
? `${GEODATA_API_URL}/records/${recordId}/thumbnails/${thumbnails[0].originalUrlHash}`
: '/static/images/datasets/default-thumbnail.svg'
return (
<div>
<img src={thumbnail} alt='' />
<style jsx>{`
div {
display: flex;
justify-content: center;
align-items: center;
flex-shrink: 0;
overflow: hidden;
height: 180px;
width: 180px;
@media (max-width: 767px) {
width: 100%;
${!hasThumbnail && (`
display: none;
`)}
}
}
img {
display: flex;
max-height: 100%;
@media (max-width: 767px) {
max-width: 100%;
max-height: none;
height: auto;
margin: auto;
}
}
`}</style>
</div>
)
}
Thumbnail.propTypes = {
thumbnails: PropTypes.arrayOf(PropTypes.shape({
originalUrlHash: PropTypes.isRequired
})),
recordId: PropTypes.string.isRequired,
t: PropTypes.func.isRequired
}
export default translate('search')(Thumbnail)
|
Fix search result image sizes
|
Fix search result image sizes
|
JavaScript
|
mit
|
sgmap/inspire,sgmap/inspire
|
5591b4615ec9e88f448ad2a9f777c85e659bd0a0
|
server/helpers/helpers.js
|
server/helpers/helpers.js
|
const handleError = (err, res) => {
switch (err.code) {
case 401:
return res.status(401).send(err.message);
case 404:
return res.status(404).send(err.message);
default:
return res.status(400).send(err);
}
};
const handleSuccess = (code, body, res) => {
switch (code) {
case 201:
return res.status(201).send(body);
default:
return res.status(200).send(body);
}
};
module.exports = { handleError, handleSuccess };
|
const handleError = (err, res) => {
switch (err.code) {
case 401:
return res.status(401).json(err.message);
case 404:
return res.status(404).json(err.message);
default:
return res.status(400).json(err);
}
};
const handleSuccess = (code, body, res) => {
switch (code) {
case 201:
return res.status(201).json(body);
default:
return res.status(200).json(body);
}
};
module.exports = { handleError, handleSuccess };
|
Refactor the helper methods to use json method instead of send method
|
Refactor the helper methods to use json method instead of send method
|
JavaScript
|
mit
|
johadi10/PostIt,johadi10/PostIt
|
c6335c604a1495d2526f6f395e429e065f9317af
|
test/endpoints/account.js
|
test/endpoints/account.js
|
'use strict';
var assert = require('assert');
var sinon = require('sinon');
var Account = require('../../lib/endpoints/account');
var Request = require('../../lib/request');
describe('endpoints/account', function () {
describe('changePassword', function () {
it('should set the request URL', function () {
var request = new Request();
var account;
var stub;
stub = sinon.stub(request, 'post', function (url) {
assert.strictEqual(url, '/account/changepassword');
});
account = new Account(request);
account.changePassword();
assert.ok(stub.called);
});
it('should set the request body', function () {
var request = new Request();
var account;
var stub;
var expected = {
password: 'password',
};
stub = sinon.stub(request, 'post', function (url, data) {
assert.deepEqual(data, expected);
});
account = new Account(request);
account.changePassword(expected);
assert.ok(stub.called);
});
});
describe('info', function () {
it('should set the request URL', function () {
var request = new Request();
var account;
var stub;
stub = sinon.stub(request, 'get', function (url) {
assert.strictEqual(url, '/account/info');
});
account = new Account(request);
account.info();
assert.ok(stub.called);
});
});
});
|
'use strict';
const assert = require('assert');
const sinon = require('sinon');
const Account = require('../../lib/endpoints/account');
const Request = require('../../lib/request');
describe('endpoints/account', () => {
describe('changePassword', () => {
it('should set the request URL', () => {
const request = new Request();
const account = new Account(request);
const stub = sinon.stub(request, 'post', (url) => {
assert.strictEqual(url, '/account/changepassword');
});
account.changePassword();
assert.ok(stub.called);
});
it('should set the request body', () => {
const request = new Request();
const account = new Account(request);
const expected = {
password: 'password',
};
const stub = sinon.stub(request, 'post', (url, data) => {
assert.deepEqual(data, expected);
});
account.changePassword(expected);
assert.ok(stub.called);
});
});
describe('info', () => {
it('should set the request URL', () => {
const request = new Request();
const account = new Account(request);
const stub = sinon.stub(request, 'get', (url) => {
assert.strictEqual(url, '/account/info');
});
account.info();
assert.ok(stub.called);
});
});
});
|
Rewrite Account tests to ES2015
|
Rewrite Account tests to ES2015
|
JavaScript
|
mit
|
jwilsson/glesys-api-node
|
a151d88b94ee726f0450b93df5ede04124a81ded
|
packages/rendering/addon/-private/meta-for-field.js
|
packages/rendering/addon/-private/meta-for-field.js
|
export default function metaForField(content, fieldName) {
if (!content) { return; }
try {
return content.constructor.metaForProperty(fieldName);
} catch (err) {
return;
}
}
|
import { camelize } from "@ember/string";
export default function metaForField(content, fieldName) {
if (!content) { return; }
fieldName = camelize(fieldName);
try {
return content.constructor.metaForProperty(fieldName);
} catch (err) {
return;
}
}
|
Fix field editors not appearing for field names that contain dashes
|
Fix field editors not appearing for field names that contain dashes
|
JavaScript
|
mit
|
cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack
|
8c8c3ef0efabbcf07ead714b3fb79f1f7ed81a41
|
test/spec/test_captcha.js
|
test/spec/test_captcha.js
|
defaultConf = {
height: 100,
width: 300,
fingerprintLength: 20
};
describe("The constructor is supposed a proper Captcha object", function() {
it('Constructor Captcha exists', function(){
expect(Captcha).toBeDefined();
});
var captcha = new Captcha();
it("Captcha object is not null", function(){
expect(captcha).not.toBeNull();
});
it('captcha object should be an instance of Captcha class', function(){
expect(captcha instanceof Captcha).toBeTruthy();
});
it('the height of the svg should be set to the configured height', function(){
expect(Number(captcha.height)).toEqual(defaultConf.height);
});
it('the width of the svg should be set to the configured width', function(){
expect(Number(captcha.width)).toEqual(defaultConf.width);
});
});
|
defaultConf = {
height: 100,
width: 300,
fingerprintLength: 20
};
describe("The constructor is supposed a proper Captcha object", function() {
it('Constructor Captcha exists', function(){
expect(Captcha).toBeDefined();
});
var captcha = new Captcha();
it("Captcha object is not null", function(){
expect(captcha).not.toBeNull();
});
it('captcha object should be an instance of Captcha class', function(){
expect(captcha instanceof Captcha).toBeTruthy();
});
it('the height of the svg should be set to the configured height', function(){
expect(Number(captcha.height)).toEqual(defaultConf.height);
});
it('the width of the svg should be set to the configured width', function(){
expect(Number(captcha.width)).toEqual(defaultConf.width);
});
it('the length of the fingerprint should be set to the configured fingerprintLength', function(){
expect(Number(captcha.fingerprintLength)).toEqual(defaultConf.fingerprintLength);
});
});
|
Add one more test and it fails
|
Add one more test and it fails
|
JavaScript
|
mit
|
sonjahohlfeld/Captcha-Generator,sonjahohlfeld/Captcha-Generator
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.