commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
ad926871ed5df6e2d7e22e99236cd615ce713e2d
git-deploy.js
git-deploy.js
// include flightplan.js var plan = require('flightplan'); // Plan to git deploy via ssh remote plan.remote('gitDeploy', function(remote) { var webRoot = plan.runtime.options.webRoot; // git pull remote.with('cd ' + webRoot, function() { remote.exec('git pull'); }); });
module.exports = function () { /* @method remotGitDeploy Takes a flightplan instance and transport @param remote {Object} Flightplan transport instance @param webRoot {string} path to run git pull on the remote server e.g. /var/www/project */ var remotGitDeploy = function (remote, webRoot) { // git pull remote.with('cd ' + webRoot, function() { remote.exec('git pull'); }); }; /* @method addToPlan Takes a flightplan instance and adds a task called gitDeploy @param plan {Object} Flightplan instance @param plan.runtime.options.webRoot {String} Remote path to run git pull */ var addToPlan = function (plan) { // Plan to git deploy via ssh remote var webRoot = plan.runtime.options.webRoot; plan.remote('gitDeploy', function(remote) { remoteGitDeploy(remote, webRoot); }); }; return { addToPlan: addToPlan, remoteGitDeploy: remoteGitDeploy }; }
Update module to return two different methods for adding the deploy script
Update module to return two different methods for adding the deploy script
JavaScript
mit
grahamgilchrist/flightplan-git-deploy
88be0d0fa047a6b7e9b13db8c59683db85e6794a
app/scripts/themes.js
app/scripts/themes.js
angular.module('GLClient.themes', []) .factory('Templates', function() { var selected_theme = 'default'; return { 'home': 'templates/' + selected_theme + '/views/home.html', 'about': 'templates/' + selected_theme + '/views/about.html', 'status': 'templates/' + selected_theme + '/views/status.html', 'submission': { 'form': 'templates/' + selected_theme + '/views/submission/form.html', 'main': 'templates/' + selected_theme + '/views/submission/main.html' } }; } );
angular.module('GLClient.themes', []) .factory('Templates', function() { // XXX do not add the "default" string to this file as it is used by // build-custom-glclient.sh for matching. var selected_theme = 'default'; return { 'home': 'templates/' + selected_theme + '/views/home.html', 'about': 'templates/' + selected_theme + '/views/about.html', 'status': 'templates/' + selected_theme + '/views/status.html', 'submission': { 'form': 'templates/' + selected_theme + '/views/submission/form.html', 'main': 'templates/' + selected_theme + '/views/submission/main.html' } }; } );
Add note about quirk related to build-custom-glclient.sh
Add note about quirk related to build-custom-glclient.sh
JavaScript
agpl-3.0
vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks
6e81e98a48eeb01bf69e89c3192c48424f364f51
examples/playground/webpack.config.js
examples/playground/webpack.config.js
var webpack = require('webpack') module.exports = { context: __dirname, entry: [ "./index", "webpack-dev-server/client?http://localhost:8080", "webpack/hot/only-dev-server", ], output: { path: __dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ test: /\.khufu$/, loaders: ['babel', '../../src/loader'], exclude: /node_modules/, }, { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/, }], }, resolve: { modulesDirectories: ["/usr/local/lib/node_modules", "../.."], }, resolveLoader: { modulesDirectories: ["/usr/local/lib/node_modules"], }, devServer: { contentBase: '.', hot: true, }, khufu: { static_attrs: false, // for normal hot reload }, plugins: [ new webpack.NoErrorsPlugin(), ], }
var webpack = require('webpack') var DEV = process.env['NODE_ENV'] != 'production'; module.exports = { context: __dirname, entry: DEV ? [ "./index", "webpack-dev-server/client?http://localhost:8080", "webpack/hot/only-dev-server", ] : "./index", output: { path: __dirname + "/public", filename: "bundle.js" }, module: { loaders: [{ test: /\.khufu$/, loaders: ['babel', '../../src/loader'], exclude: /node_modules/, }, { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/, }], }, resolve: { modulesDirectories: ["/usr/local/lib/node_modules", "../.."], }, resolveLoader: { modulesDirectories: ["/usr/local/lib/node_modules"], }, devServer: { contentBase: '.', hot: true, }, khufu: { static_attrs: !DEV, }, plugins: [ new webpack.NoErrorsPlugin(), ], }
Add non-hot-reload build support for playground
Add non-hot-reload build support for playground
JavaScript
apache-2.0
tailhook/khufu
e212a38b3032b1ad19debbb5d7b3b183cc6b9670
webapp/routes/temperature_api.js
webapp/routes/temperature_api.js
'use strict'; const router = require('express').Router(); const temperatureapi = require('../api/temperature'); const requiresApiAuthorization = require('../auth/requiresApiAuthorization'); router.get('/api/temperature/currentTemperature', requiresApiAuthorization(), temperatureapi.getCurrentTemperature); module.exports = router;
'use strict'; const router = require('express').Router(); const temperatureapi = require('../api/temperature'); const requiresApiAuthorization = require('../auth/requiresApiAuthorization'); const auth = require('../auth/Authentication'); router.get('/api/temperature/currentTemperature', requiresApiAuthorization(), temperatureapi.getCurrentTemperature); router.get('/api/temperature/', auth.getBearerHandler(), temperatureapi.getCurrentTemperature); module.exports = router;
Add token authenticated temperature route
Add token authenticated temperature route
JavaScript
apache-2.0
rossharper/raspberrysauce,rossharper/raspberrysauce
1d92056ea7405c5d8d9da577c2baf5d581236bf1
src/server/lib/findFilePath.js
src/server/lib/findFilePath.js
import path from "path"; import config from "config"; export default function findPath(configName) { let configRoot = process.env.FILE_PATH || "files"; if (config.paths && config.paths.files) { configRoot = config.paths.files; } let configPath = path.join(configRoot, configName); if (config.paths && config.paths[configName]) { configPath = config.paths[configName]; } if (configPath[0] !== "/") { configPath = path.join(__dirname, "..", "..", "..", configPath); } return configPath; }
import path from "path"; import config from "config"; export default function findPath(configName) { const configRoot = process.env.FILE_PATH || "files"; let configPath = path.join(configRoot, configName); if (config.paths && config.paths[configName]) { configPath = config.paths[configName]; } if (configPath[0] !== "/") { configPath = path.join(__dirname, "..", "..", "..", configPath); } return configPath; }
Fix shared file path config reading
Fix shared file path config reading
JavaScript
agpl-3.0
strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs
6b50ec716db9b529220500a1ae3d5db2e80f1d83
ci/tagElmRelease.js
ci/tagElmRelease.js
const execSync = require('child_process').execSync; /** A semantic release "publish" plugin to create git tags and publish using elm-package */ async function tagElmRelease(config, context) { const newVersion = context.nextRelease.version; exec(`git tag -a ${newVersion} -m "elm-package release ${newVersion}"`); exec(`git push --tags`); exec(`elm-package publish`); } function exec(command, context) { context.logger.log(`Running: ${command}`); execSync(command); } module.exports = tagElmRelease;
const execSync = require('child_process').execSync; /** A semantic release "publish" plugin to create git tags and publish using elm-package */ async function tagElmRelease(config, context) { function exec(command) { context.logger.log(`Running: ${command}`); execSync(command); } const newVersion = context.nextRelease.version; exec(`git tag -a ${newVersion} -m "elm-package release ${newVersion}"`); exec(`git push --tags`); exec(`elm-package publish`); } module.exports = tagElmRelease;
Fix error with elm deployments
fix(ci): Fix error with elm deployments Note: this update does not change any user facing code and is related to our continuous integration / semantic release process only. I am tagging it as "fix" so we can continue to test the release process.
JavaScript
bsd-3-clause
cultureamp/elm-css-modules-loader,cultureamp/elm-css-modules-loader
0d4f743d87898f101d47a733572f55eae1128be9
lib/actions/upload-actions.js
lib/actions/upload-actions.js
// @flow import type { FetchJSON } from '../utils/fetch-json'; import type { UploadMultimediaResult } from '../types/media-types'; async function uploadMultimedia( fetchJSON: FetchJSON, multimedia: Object, onProgress: (percent: number) => void, abortHandler: (abort: () => void) => void, ): Promise<UploadMultimediaResult> { const response = await fetchJSON( 'upload_multimedia', { multimedia }, { blobUpload: true, onProgress, abortHandler }, ); return { id: response.id, uri: response.uri }; } const assignMediaServerIDToMessageActionType = "ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE"; const assignMediaServerURIToMessageActionType = "ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE"; export { uploadMultimedia, assignMediaServerIDToMessageActionType, assignMediaServerURIToMessageActionType, };
// @flow import type { FetchJSON } from '../utils/fetch-json'; import type { UploadMultimediaResult } from '../types/media-types'; async function uploadMultimedia( fetchJSON: FetchJSON, multimedia: Object, onProgress: (percent: number) => void, abortHandler: (abort: () => void) => void, ): Promise<UploadMultimediaResult> { const response = await fetchJSON( 'upload_multimedia', { multimedia: [ multimedia ] }, { blobUpload: true, onProgress, abortHandler }, ); return { id: response.id, uri: response.uri }; } const assignMediaServerIDToMessageActionType = "ASSIGN_MEDIA_SERVER_ID_TO_MESSAGE"; const assignMediaServerURIToMessageActionType = "ASSIGN_MEDIA_SERVER_URI_TO_MESSAGE"; export { uploadMultimedia, assignMediaServerIDToMessageActionType, assignMediaServerURIToMessageActionType, };
Fix bug in multimedia upload
[lib] Fix bug in multimedia upload `uploadBlob` expects an array of multimedia, not a single one.
JavaScript
bsd-3-clause
Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal,Ashoat/squadcal
c1893a257a0685934607946f4c24758796eb74bf
lib/formatters/codeclimate.js
lib/formatters/codeclimate.js
'use strict'; module.exports = function (err, data) { if (err) { return 'Debug output: %j' + JSON.stringify(data) + '\n' + JSON.stringify(err); } if (!data.length) { return; } var returnString = ''; for (var i = 0, il = data.length; i < il; ++i) { returnString += JSON.stringify({ type: 'issue', check_name: 'Vulnerable module "' + data[i].module + '" identified', description: '`' + data[i].module + '` ' + data[i].title, categories: ['Security'], remediation_points: 300000, content: { body: data[i].content }, location: { path: 'npm-shrinkwrap.json', lines: { begin: data[i].line.start, end: data[i].line.end } } }) + '\0\n'; } return returnString; };
'use strict'; module.exports = function (err, data) { if (err) { return err.stack; } if (!data.length) { return; } var returnString = ''; for (var i = 0, il = data.length; i < il; ++i) { returnString += JSON.stringify({ type: 'issue', check_name: 'Vulnerable module "' + data[i].module + '" identified', description: '`' + data[i].module + '` ' + data[i].title, categories: ['Security'], remediation_points: 300000, content: { body: data[i].content }, location: { path: 'npm-shrinkwrap.json', lines: { begin: data[i].line.start, end: data[i].line.end } } }) + '\0\n'; } return returnString; };
Return error message in Code Climate runs
Return error message in Code Climate runs Stringifying an Error object results in {} so the formatter was not returning the actual underlying error with the Code Climate formatter. This change returns the error so that they user can take action if an analysis run fails. This change returns the Error stack which includes a helpful error message and the backtrace for debugging purposes.
JavaScript
apache-2.0
requiresafe/cli,chetanddesai/nsp,nodesecurity/nsp,ABaldwinHunter/nsp-classic,ABaldwinHunter/nsp
5d4ee69a7d577d2906b08d228bd883afbb22caae
config.js
config.js
export default { "url": process.env.CRN_SERVER_URL, "port": 8111, "location": process.env.CRN_SERVER_LOCATION, "headers": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE", "Access-Control-Allow-Headers": "content-type, Authorization" }, "scitran": { "url": "http://localhost:8110/api/", "secret": process.env.SCITRAN_CORE_DRONE_SECRET, "fileStore": process.env.CRN_SERVER_CORE_FILE_STORE }, "agave": { "url": process.env.CRN_SERVER_AGAVE_URL, "username": process.env.CRN_SERVER_AGAVE_USERNAME, "password": process.env.CRN_SERVER_AGAVE_PASSWORD, "clientName": process.env.CRN_SERVER_AGAVE_CLIENT_NAME, "clientDescription": process.env.CRN_SERVER_AGAVE_CLIENT_DESCRIPTION, "consumerKey": process.env.CRN_SERVER_AGAVE_CONSUMER_KEY, "consumerSecret": process.env.CRN_SERVER_AGAVE_CONSUMER_SECRET, "storage": process.env.CRN_SERVER_AGAVE_STORAGE }, "mongo": { "url": "mongodb://localhost:27017/crn" } };
let config = { "url": process.env.CRN_SERVER_URL, "port": 8111, "location": process.env.CRN_SERVER_LOCATION, "headers": { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE", "Access-Control-Allow-Headers": "content-type, Authorization" }, "scitran": { "url": "http://localhost:8110/api/", "secret": process.env.SCITRAN_CORE_DRONE_SECRET, "fileStore": process.env.CRN_SERVER_CORE_FILE_STORE }, "agave": { "url": process.env.CRN_SERVER_AGAVE_URL, "username": process.env.CRN_SERVER_AGAVE_USERNAME, "password": process.env.CRN_SERVER_AGAVE_PASSWORD, "clientName": process.env.CRN_SERVER_AGAVE_CLIENT_NAME, "clientDescription": process.env.CRN_SERVER_AGAVE_CLIENT_DESCRIPTION, "consumerKey": process.env.CRN_SERVER_AGAVE_CONSUMER_KEY, "consumerSecret": process.env.CRN_SERVER_AGAVE_CONSUMER_SECRET, "storage": process.env.CRN_SERVER_AGAVE_STORAGE }, "mongo": { "url": "mongodb://localhost:27017/crn" } }; console.log(config); export default config;
Add logging for docker debugging
Add logging for docker debugging
JavaScript
mit
poldracklab/crn_server,poldracklab/crn_server
70405b476543b96bbeeb3299ac83c3ffd9aa86be
lib/honyomi/web/public/js/honyomi.js
lib/honyomi/web/public/js/honyomi.js
$(document).ready(function() { $('.star').click(function() { // Toggle a display of star $(this).toggleClass('favorited'); var isFavorited = $(this).hasClass('favorited'); // Get a page info var id = $(this).attr('honyomi-id'); var page_no = $(this).attr('honyomi-page-no'); // ajax $.post( '/command', { kind: 'favorite', id: id, page_no: page_no, favorited: isFavorited }, function(data) { // Return a result of POST } ); }); });
$(document).ready(function() { $(document).on('click', '.star', function(e) { // Toggle a display of star $(this).toggleClass('favorited'); var isFavorited = $(this).hasClass('favorited'); // Get a page info var id = $(this).attr('honyomi-id'); var page_no = $(this).attr('honyomi-page-no'); // ajax $.post( '/command', { kind: 'favorite', id: id, page_no: page_no, favorited: isFavorited }, function(data) { // Return a result of POST } ); e.preventDefault(); }); });
Support the AutoPagerize in the click event
Support the AutoPagerize in the click event
JavaScript
mit
ongaeshi/honyomi,ongaeshi/honyomi,ongaeshi/honyomi
a50bbdcd25e3618112f6515ca64fc2c6fa67f1c3
front_end/app/screens/ShoppingList.js
front_end/app/screens/ShoppingList.js
import React, {Component} from 'react'; import { View, Text, ScrollView, Button } from 'react-native'; import axios from 'axios'; import colors from '../config/colors'; import { UserItem } from '../components/UserItem'; class ShoppingList extends Component { constructor(props) { super(props); this.state = { userItems: [] }; this.getUserItems = this.getUserItems.bind(this); this.handleButtonPress = this.handleButtonPress.bind(this); } componentDidMount() { this.getUserItems(); } getUserItems() { axios.get('http://localhost:3000/user_items') .then(response => { this.setState({userItems: response.data}) }) .catch(error => { console.log(error); }); } handleButtonPress() { this.props.navigation.navigate('PickStop'); }; render() { return ( <View style={{ backgroundColor: colors.background }}> <ScrollView style={{ backgroundColor: colors.background}}> {this.state.userItems.map((userItem, idx) => ( <UserItem user_item={userItem} getUserItems={this.getUserItems} key={idx} /> ))} </ScrollView> <Button onPress={() => this.handleButtonPress()} title="Find Yo' Stop!" color={colors.buttonText} backgroundColor={colors.buttonBackground} accessibilityLabel="Find Your Stop for One Stop Shopping" style={{height: 600}} /> </View> ); } } export default ShoppingList;
import React, {Component} from 'react'; import { View, Text, ScrollView } from 'react-native'; import { Button } from 'native-base'; import axios from 'axios'; import colors from '../config/colors'; import { UserItem } from '../components/UserItem'; class ShoppingList extends Component { constructor(props) { super(props); this.state = { userItems: [] }; this.getUserItems = this.getUserItems.bind(this); this.handleButtonPress = this.handleButtonPress.bind(this); } componentDidMount() { this.getUserItems(); } getUserItems() { axios.get('http://localhost:3000/user_items') .then(response => { this.setState({userItems: response.data}) }) .catch(error => { console.log(error); }); } handleButtonPress() { this.props.navigation.navigate('PickStop'); }; render() { return ( <View style={{ backgroundColor: colors.background }}> <ScrollView style={{ backgroundColor: colors.background}}> {this.state.userItems.map((userItem, idx) => ( <UserItem user_item={userItem} getUserItems={this.getUserItems} key={idx} /> ))} </ScrollView> <Button full onPress={() => this.handleButtonPress()}> <Text>Find Yo' Stop!</Text> </Button> </View> ); } } export default ShoppingList;
Add button full component to shopping list
Add button full component to shopping list
JavaScript
mit
DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop,DaniGlass/OneStopShop
8a81c825a2687f988cd231f458fbc16d39e7c3fa
frontend/app/routes/questions/show.js
frontend/app/routes/questions/show.js
import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { return this.store.find('question', params.id); } });
import Ember from 'ember'; export default Ember.Route.extend({ model: function(params) { return this.store.find('question', params.id); }, actions: { didTransition: function() { this.get('controller').set('isEditing', false); } } });
Reset controller state on didTransition
Reset controller state on didTransition
JavaScript
mit
LaunchAcademy/rescue_mission,LaunchAcademy/rescue_mission,LaunchAcademy/rescue_mission
00b8cf436ea49f4939d1c0790ac19789f713153f
js/app.js
js/app.js
import React from "react"; import { render } from "react-dom"; import { applyRouterMiddleware, Router, Route, browserHistory, IndexRoute } from "react-router"; import { useScroll } from 'react-router-scroll'; import App from "./components/App.react"; import TagList from "./components/TagList.react"; import NotFound from "./components/NotFound"; import PluginList from "./components/PluginList.react"; import { syncHistoryWithStore } from "react-router-redux"; import store from "./stores/CreateStore"; import { Provider } from "react-redux"; import "whatwg-fetch"; import Css from "../css/main.css"; import Tags from "./tags"; const history = syncHistoryWithStore(browserHistory, store); var routes = ( <Router history={history} render={applyRouterMiddleware(useScroll())}> <Route path="/" component={App}> <IndexRoute component={TagList} /> { Tags.map((tag) => <Route key={tag} path={`tag/${tag}`} component={PluginList} tag={tag} />) } <Route path="*" component={NotFound} /> </Route> </Router> ) render( <Provider store={store}> {routes} </Provider>, document.getElementById('app') );
import React from "react"; import { render } from "react-dom"; import { applyRouterMiddleware, Router, Route, browserHistory, IndexRoute } from "react-router"; import { useScroll } from 'react-router-scroll'; import App from "./components/App.react"; import TagList from "./components/TagList.react"; import NotFound from "./components/NotFound"; import PluginList from "./components/PluginList.react"; import { syncHistoryWithStore } from "react-router-redux"; import store from "./stores/CreateStore"; import { Provider } from "react-redux"; import "whatwg-fetch"; import globalStyes from './global-styles'; import Tags from "./tags"; const history = syncHistoryWithStore(browserHistory, store); var routes = ( <Router history={history} render={applyRouterMiddleware(useScroll())}> <Route path="/" component={App}> <IndexRoute component={TagList} /> { Tags.map((tag) => <Route key={tag} path={`tag/${tag}`} component={PluginList} tag={tag} />) } <Route path="*" component={NotFound} /> </Route> </Router> ) render( <Provider store={store}> {routes} </Provider>, document.getElementById('app') );
Remove css import, add global styles
Remove css import, add global styles
JavaScript
mit
mxstbr/postcss.parts,mxstbr/postcss.parts
7d49a20492e4a92afb07c194195856292b72a589
lib/modules/storage/utils/omit_undefined.js
lib/modules/storage/utils/omit_undefined.js
import _ from 'lodash'; function omitUndefined(obj) { const result = {}; _.forOwn(obj, function(value, key) { if (_.isPlainObject(value)) { result[key] = omitUndefined(value); } else if (!_.isUndefined(value)) { result[key] = value; } }); return result; } export default omitUndefined;
import _ from 'lodash'; function omitUndefined(obj) { return _.transform(obj, function(result, value, key) { if (_.isPlainObject(value)) { result[key] = omitUndefined(value); } else if (!_.isUndefined(value)) { result[key] = value; } }); } export default omitUndefined;
Use _.transform instead of _.reduce
Use _.transform instead of _.reduce
JavaScript
mit
jagi/meteor-astronomy
72f827e84ba5e696d0bacdb8b900018c7a51dc55
main-process/native-ui/dialogs/open-file.js
main-process/native-ui/dialogs/open-file.js
var ipc = require('electron').ipcMain; var dialog = require('electron').dialog; module.exports.setup = function () { ipc.on('open-file-dialog', function (event) { var files = dialog.showOpenDialog({properties: ['openFile', 'openDirectory']}); if (files) { event.sender.send('selected-directory', files); } }); };
var ipc = require('electron').ipcMain; var dialog = require('electron').dialog; module.exports.setup = function () { ipc.on('open-file-dialog', function (event) { dialog.showOpenDialog({properties: ['openFile', 'openDirectory']}, function (files) { if (files) { event.sender.send('selected-directory', files); } }); }); };
Use callback for dialog API
Use callback for dialog API
JavaScript
mit
PanCheng111/XDF_Personal_Analysis,PanCheng111/XDF_Personal_Analysis,blep/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,electron/electron-api-demos,blep/electron-api-demos,blep/electron-api-demos,electron/electron-api-demos,PanCheng111/XDF_Personal_Analysis
6c2e22850f428e208acda085417e54bc911b3ddb
config/policies.js
config/policies.js
/** * Policy Mappings * (sails.config.policies) * * Policies are simple functions which run **before** your controllers. * You can apply one or more policies to a given controller, or protect * its actions individually. * * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed * below by its filename, minus the extension, (e.g. "authenticated") * * For more information on how policies work, see: * http://sailsjs.org/#!/documentation/concepts/Policies * * For more information on configuring policies, check out: * http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.policies.html */ module.exports.policies = { // Default behavior request authentication '*': ['jwtAuth', false], // Public routes AuthController: { ipLogin: true, oauthLogin: true, oauthLoginSubmit: true, jwtLogin: true, }, // Authenticated routes MessageController: { find: ['jwtAuth'], findOne: ['jwtAuth'], create: ['jwtAuth'], getChannels: ['jwtAuth'], }, };
/** * Policy Mappings * (sails.config.policies) * * Policies are simple functions which run **before** your controllers. * You can apply one or more policies to a given controller, or protect * its actions individually. * * Any policy file (e.g. `api/policies/authenticated.js`) can be accessed * below by its filename, minus the extension, (e.g. "authenticated") * * For more information on how policies work, see: * http://sailsjs.org/#!/documentation/concepts/Policies * * For more information on configuring policies, check out: * http://sailsjs.org/#!/documentation/reference/sails.config/sails.config.policies.html */ module.exports.policies = { // Default behavior request authentication '*': ['jwtAuth', false], // Public routes AuthController: { ipLogin: true, oauthLogin: true, oauthLoginSubmit: true, jwtLogin: true, }, // Authenticated routes MessageController: { find: ['jwtAuth'], create: ['jwtAuth'], getChannels: ['jwtAuth'], }, };
Remove old route from config
Remove old route from config
JavaScript
mit
ungdev/flux2-server,ungdev/flux2-server,ungdev/flux2-server
e3d2f266ed07b9a98f3a076d0684877e1d141970
config/policies.js
config/policies.js
/** * Policies are simply Express middleware functions which run before your controllers. * You can apply one or more policies for a given controller or action. * * Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder, * at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`) * * For more information on policies, check out: * http://sailsjs.org/#documentation */ module.exports.policies = { // Default policy for all controllers and actions // (`true` allows public access) '*': true, GroupController: { '*': 'authenticated' }, MainController: { 'dashboard': 'authenticated' }, RoomController: { '*': 'authenticated' }, UserController: { '*': 'authenticated', 'create': true } };
/** * Policies are simply Express middleware functions which run before your controllers. * You can apply one or more policies for a given controller or action. * * Any policy file (e.g. `authenticated.js`) can be dropped into the `/policies` folder, * at which point it can be accessed below by its filename, minus the extension, (e.g. `authenticated`) * * For more information on policies, check out: * http://sailsjs.org/#documentation */ module.exports.policies = { // Default policy for all controllers and actions // (`true` allows public access) '*': true, GroupController: { '*': 'authenticated', 'create': ['authenticated', 'admin'], 'manage': ['authenticated', 'admin'], 'user_add': ['authenticated', 'admin'], 'user_delete': ['authenticated', 'admin'], 'destroy': ['authenticated', 'admin'] }, MainController: { 'dashboard': 'authenticated' }, MessageController: { '*': 'authenticated' }, RoomController: { '*': 'authenticated', 'create': ['authenticated', 'admin'], 'manage': ['authenticated', 'admin'], 'destroy': ['authenticated', 'admin'] }, UserController: { '*': 'authenticated', 'manage': ['authenticated', 'admin'], 'create': true } };
Attach admin policy to actions which create or destroy groups, rooms, or users.
Attach admin policy to actions which create or destroy groups, rooms, or users. Signed-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>
JavaScript
mit
maxfierke/WaterCooler
0f21e7aed83f547ced598a9d6c869b7814686eb5
init/rollup.config.js
init/rollup.config.js
const rollupBabel = require('rollup-plugin-babel'); const rollupCommonjs = require('rollup-plugin-commonjs'); const rollupNodeResolve = require('rollup-plugin-node-resolve'); const rollupUglify = require('rollup-plugin-uglify'); const path = require('path'); const pkg = require(path.join(process.cwd(), 'package.json')); const shouldMinify = process.argv.indexOf('--min') !== -1; const presetEs2015 = require('babel-preset-es2015-rollup'); const babel = rollupBabel({ presets: presetEs2015, }); const plugins = [ babel, rollupCommonjs(), rollupNodeResolve(), ]; if (shouldMinify) { plugins.push(rollupUglify()); } const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js'; const moduleName = pkg['build:global'] || pkg.name; module.exports = { dest: `dist/index${shouldMinify ? '.min' : ''}.js`, entry, exports: 'named', format: 'umd', moduleName, plugins, sourceMap: true, useStrict: false, };
const rollupBabel = require('rollup-plugin-babel'); const rollupCommonjs = require('rollup-plugin-commonjs'); const rollupNodeResolve = require('rollup-plugin-node-resolve'); const rollupUglify = require('rollup-plugin-uglify'); const path = require('path'); const pkg = require(path.join(process.cwd(), 'package.json')); const shouldMinify = process.argv.indexOf('--min') !== -1; const presetEs2015 = require('babel-preset-es2015-rollup'); const babel = rollupBabel({ presets: presetEs2015, }); const plugins = [ babel, rollupCommonjs(), rollupNodeResolve(), ]; if (shouldMinify) { plugins.push(rollupUglify()); } const entry = pkg['jsnext:main'] || pkg.main || 'src/index.js'; const moduleName = pkg['build:global'] || pkg.name; module.exports = { dest: 'dist/index' + (shouldMinify ? '.min' : '') + '.js', entry, exports: 'named', format: 'umd', moduleName, plugins, sourceMap: true, useStrict: false, };
Fix template literal issue with underscore templates.
fix(build): Fix template literal issue with underscore templates.
JavaScript
mit
skatejs/build,skatejs/build
bee126e3d4db9860e095f35a3c60b7b94f05b024
blacklisted-sites.js
blacklisted-sites.js
// Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible. // Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py var BLACKLIST = [ 'github', 'agolo.com', 'youtube', 'youtu.be', 'atlassian.net', 'spotify.com', 'twitter.com', 'mail.google', 'imgur.com', 'bit.ly', 'tinyurl', 'vine', 'dropbox' ]; /** Convert the array to an object and export it **/ var empty = {}; // Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object var reducer = function(aggregate, element) { aggregate[element] = 1; return aggregate; } module.exports = BLACKLIST.reduce(reducer, empty);
// Add your blacklisted sites to this array. Subdomain and TLD are optional and flexible. // Should probably be kept in sync with https://github.com/premgane/agolo-twitterbot/blob/master/server.py var BLACKLIST = [ 'github', 'agolo.com', 'youtube', 'youtu.be', 'atlassian.net', 'spotify.com', 'twitter.com', 'mail.google', 'imgur.com', 'bit.ly', 'tinyurl', 'vine', 'dropbox', 'zoom.us', 'appear.in' ]; /** Convert the array to an object and export it **/ var empty = {}; // Adapted from: https://egghead.io/lessons/javascript-introducing-reduce-reducing-an-array-into-an-object var reducer = function(aggregate, element) { aggregate[element] = 1; return aggregate; } module.exports = BLACKLIST.reduce(reducer, empty);
Add zoom.us and appear.in to blacklist
Add zoom.us and appear.in to blacklist
JavaScript
mit
premgane/agolo-slackbot
2b5bd27f0323428e6814b202fefbfb774be97256
lib/engines/scss.js
lib/engines/scss.js
'use strict'; var Engine = require('./engine'); var herit = require('herit'); var path = require('path'); module.exports = herit(Engine, { defaults: function () { return { paths: [], indentedSyntax: false }; }, run: function (asset, cb) { try { var sass = require('node-sass'); sass.render({ data: asset.source, indentedSyntax: this.options.indentedSyntax, includePaths: this.options.paths.concat(path.dirname(asset.abs)), success: function (res) { asset.source = res.css; if (!asset.ext()) asset.exts.push('css'); cb(); }, error: function (er) { cb(new Error(er)); } }); } catch (er) { cb(er); } } });
'use strict'; var Engine = require('./engine'); var herit = require('herit'); var path = require('path'); module.exports = herit(Engine, { defaults: function () { return { paths: [], indentedSyntax: false }; }, run: function (asset, cb) { try { var sass = require('node-sass'); sass.render({ data: asset.source, indentedSyntax: this.options.indentedSyntax, includePaths: this.options.paths.concat(path.dirname(asset.abs)), success: function (res) { asset.source = res.css; if (!asset.ext()) asset.exts.push('css'); cb(); }, error: function (er) { cb(new Error('Line ' + er.line + ': ' + er.message)); } }); } catch (er) { cb(er); } } });
Fix SCSS engine error message
Fix SCSS engine error message
JavaScript
mit
caseywebdev/cogs,caseywebdev/cogs
3f55e7c83a838f2658191d475a00a453fe17157e
lib/infinitedivs.js
lib/infinitedivs.js
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var infinitedivs = function infinitedivs() { _classCallCheck(this, infinitedivs); }; exports.default = infinitedivs;
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var infinitedivs = function infinitedivs() { _classCallCheck(this, infinitedivs); }; exports.default = infinitedivs; /***/ } /******/ ]);
Create infinitediv class and add basic buffer based loading.
Create infinitediv class and add basic buffer based loading.
JavaScript
mit
supreetpal/infinite-divs,supreetpal/infinite-divs
2c082c238124844a8bae0c83eb890455452b7067
lib/services/swf.js
lib/services/swf.js
var AWS = require('../core'); /** * @constant * @readonly * Backwards compatibility for access to the {AWS.SWF} service class. */ AWS.SimpleWorkflow = AWS.SWF;
var AWS = require('../core'); AWS.util.hideProperties(AWS, ['SimpleWorkflow']); /** * @constant * @readonly * Backwards compatibility for access to the {AWS.SWF} service class. */ AWS.SimpleWorkflow = AWS.SWF;
Hide SimpleWorkflow service class from AWS properties
Hide SimpleWorkflow service class from AWS properties
JavaScript
apache-2.0
grimurjonsson/aws-sdk-js,jeskew/aws-sdk-js,mohamed-kamal/aws-sdk-js,mapbox/aws-sdk-js,Blufe/aws-sdk-js,jeskew/aws-sdk-js,chrisradek/aws-sdk-js,chrisradek/aws-sdk-js,beni55/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,chrisradek/aws-sdk-js,guymguym/aws-sdk-js,chrisradek/aws-sdk-js,aws/aws-sdk-js,MitocGroup/aws-sdk-js,MitocGroup/aws-sdk-js,jippeholwerda/aws-sdk-js,odeke-em/aws-sdk-js,j3tm0t0/aws-sdk-js,MitocGroup/aws-sdk-js,Blufe/aws-sdk-js,prembasumatary/aws-sdk-js,jeskew/aws-sdk-js,j3tm0t0/aws-sdk-js,odeke-em/aws-sdk-js,LiuJoyceC/aws-sdk-js,guymguym/aws-sdk-js,dconnolly/aws-sdk-js,michael-donat/aws-sdk-js,GlideMe/aws-sdk-js,ugie/aws-sdk-js,mohamed-kamal/aws-sdk-js,dconnolly/aws-sdk-js,grimurjonsson/aws-sdk-js,beni55/aws-sdk-js,prembasumatary/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,prembasumatary/aws-sdk-js,LiuJoyceC/aws-sdk-js,mohamed-kamal/aws-sdk-js,Blufe/aws-sdk-js,jippeholwerda/aws-sdk-js,GlideMe/aws-sdk-js,guymguym/aws-sdk-js,mapbox/aws-sdk-js,beni55/aws-sdk-js,AdityaManohar/aws-sdk-js,michael-donat/aws-sdk-js,ugie/aws-sdk-js,grimurjonsson/aws-sdk-js,jmswhll/aws-sdk-js,misfitdavidl/aws-sdk-js,prestomation/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,GlideMe/aws-sdk-js,jeskew/aws-sdk-js,guymguym/aws-sdk-js,misfitdavidl/aws-sdk-js,odeke-em/aws-sdk-js,jmswhll/aws-sdk-js,prestomation/aws-sdk-js,jippeholwerda/aws-sdk-js,mapbox/aws-sdk-js,j3tm0t0/aws-sdk-js,LiuJoyceC/aws-sdk-js,michael-donat/aws-sdk-js,dconnolly/aws-sdk-js,aws/aws-sdk-js,AdityaManohar/aws-sdk-js,aws/aws-sdk-js,jmswhll/aws-sdk-js
fb4ae324c3bd986677aa8dfed4b64bf5bae5beb6
entity.js
entity.js
const createTransform = require('./transform') let entityId = 0 function Entity (components, parent, tags) { this.id = entityId++ this.tags = tags || [] this.components = components ? components.slice(0) : [] this.transform = this.getComponent('Transform') if (!this.transform) { this.transform = createTransform({ parent: parent ? parent.transform : null }) this.components.unshift(this.transform) } this.transform.set({ parent: parent ? parent.transform : null }) this.components.forEach((component) => component.init(this)) } Entity.prototype.dispose = function () { // detach from the hierarchy this.transform.set({ parent: null }) } Entity.prototype.getComponent = function (type) { return this.components.find((component) => component.type === type) } module.exports = function createEntity (components, parent, tags) { return new Entity(components, parent, tags) }
const createTransform = require('./transform') let entityId = 0 function Entity (components, parent, tags) { this.id = entityId++ this.tags = tags || [] this.components = components ? components.slice(0) : [] this.transform = this.getComponent('Transform') if (!this.transform) { this.transform = createTransform({ parent: parent ? parent.transform : null }) this.components.unshift(this.transform) } this.transform.set({ parent: parent ? parent.transform : null }) this.components.forEach((component) => component.init(this)) } Entity.prototype.dispose = function () { // detach from the hierarchy this.transform.set({ parent: null }) } Entity.prototype.addComponent = function (component) { this.components.push(component) component.init(this) } Entity.prototype.getComponent = function (type) { return this.components.find((component) => component.type === type) } module.exports = function createEntity (components, parent, tags) { return new Entity(components, parent, tags) }
Add addComponent method to Entity
Add addComponent method to Entity
JavaScript
mit
pex-gl/pex-renderer,pex-gl/pex-renderer
3053a37c25fa000223642db9c0eb0dc8b0c265ae
migrations/20170401114125_initial.js
migrations/20170401114125_initial.js
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTableIfNotExists('user', (table) => { table.integer('telegram_id') .primary(); table.string('piikki_username') .unique(); table.string('default_group'); table.text('json_state'); }), ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('user'), ]);
exports.up = (knex, Promise) => Promise.all([ knex.schema.createTableIfNotExists('user', (table) => { table.integer('telegram_id') .primary(); table.string('piikki_username'); table.string('default_group'); table.text('json_state'); }), ]); exports.down = (knex, Promise) => Promise.all([ knex.schema.dropTable('user'), ]);
Allow multiple nulls in username
Allow multiple nulls in username
JavaScript
mit
majori/piikki-client-tg
8e75817344c4743a95f93efbb6a7124220183f60
src/components/MdContent/styles.js
src/components/MdContent/styles.js
import theme from '../../theme' export default { mdContent: {}, content: { position: 'relative', }, markdown: { display: 'block', }, actions: { float: 'right', display: 'flex', alignItems: 'center', position: 'relative', zIndex: 5 }, action: { display: 'flex', height: 30, borderRight: [1, 'solid', theme.borderColor], paddingRight: 20, marginLeft: 20, '&:last-child': { isolate: false, borderRight: 0, paddingRight: 0 }, '&:first-child': { marginLeft: 0 } }, // Removes inlining with title. [theme.media.md]: { actions: { float: 'none', justifyContent: 'flex-end', marginBottom: 20, } }, [theme.media.sm]: { actions: { justifyContent: 'center' } } }
import theme from '../../theme' export default { mdContent: {}, content: { position: 'relative', }, markdown: { display: 'block', }, actions: { float: 'right', display: 'flex', alignItems: 'center', position: 'relative', zIndex: 5, marginLeft: 20 }, action: { display: 'flex', height: 30, borderRight: [1, 'solid', theme.borderColor], paddingRight: 20, marginLeft: 20, '&:last-child': { isolate: false, borderRight: 0, paddingRight: 0 }, '&:first-child': { marginLeft: 0 } }, // Removes inlining with title. [theme.media.md]: { actions: { float: 'none', justifyContent: 'flex-end', marginBottom: 20, } }, [theme.media.sm]: { actions: { justifyContent: 'center' } } }
Fix space between title and version select
Fix space between title and version select
JavaScript
mit
cssinjs/cssinjs
c08fa30117cf593cd91a1325b86a4199b0fd08f6
config/webpack/webpack.config.test.js
config/webpack/webpack.config.test.js
"use strict"; /** * Webpack frontend test configuration. */ var path = require("path"); var prodCfg = require("./webpack.config"); // Replace with `__dirname` if using in project root. var ROOT = process.cwd(); var _ = require("lodash"); // devDependency module.exports = { cache: true, context: path.join(ROOT, "test/client"), entry: "./main", output: { filename: "main.js", publicPath: "/assets/" }, resolve: _.merge({}, prodCfg.resolve, { alias: { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 sinon: "node_modules/sinon/pkg/sinon.js", // Allow root import of `src/FOO` from ROOT/src. src: path.join(ROOT, "src") } }), // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 externals: { "cheerio": "window", "react/lib/ExecutionEnvironment": true, "react/lib/ReactContext": true }, module: _.assign({}, prodCfg.module, { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 noParse: [ /\/sinon\.js/ ] }), devtool: "source-map" };
"use strict"; /** * Webpack frontend test configuration. */ var path = require("path"); var prodCfg = require("./webpack.config"); // Replace with `__dirname` if using in project root. var ROOT = process.cwd(); var _ = require("lodash"); // devDependency module.exports = { cache: true, context: path.join(ROOT, "test/client"), entry: "./main", output: { filename: "main.js", publicPath: "/assets/" }, resolve: _.merge({}, prodCfg.resolve, { alias: { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 sinon: "node_modules/sinon/pkg/sinon.js", // Allow root import of `src/FOO` from ROOT/src. src: path.join(ROOT, "src") } }), // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 externals: { "cheerio": "window", "react/lib/ExecutionEnvironment": true, "react/lib/ReactContext": true, "react/addons": true }, module: _.assign({}, prodCfg.module, { // enzyme webpack issue https://github.com/airbnb/enzyme/issues/47 noParse: [ /\/sinon\.js/ ] }), devtool: "source-map" };
Fix for enzyme and react 15
Fix for enzyme and react 15
JavaScript
mit
FormidableLabs/builder-radium-component,FormidableLabs/builder-radium-component
59fd6e6d26ddb98957dcdcdb415efddad1080be3
content/bootloader.js
content/bootloader.js
// Render the environment & partner menus renderEnvironmentMenuItems(); renderPartnerMenuItems(); renderGaugeRowItems(); // Events binding window.onhashchange = _handlerRefreshMenuAndPage; // Update the menu and render the content _handlerRefreshMenuAndPage();
// Render the environment & partner menus renderEnvironmentMenuItems(); renderPartnerMenuItems(); renderGaugeRowItems(); // Events binding window.onhashchange = _handlerRefreshMenuAndPage; // Update the menu and render the content _handlerRefreshMenuAndPage(); (function myLoop (i) { setTimeout(function () { renderGaugeRowItems(); if (--i) { myLoop(i); } }, 3000) })(1000);
Add simple code for time triggering of gauge
Add simple code for time triggering of gauge
JavaScript
mit
vejuhust/yet-another-monitoring-dashboard,vejuhust/yet-another-monitoring-dashboard
8ccc4d34fe92889c75a06d01bcdbd9df226aa965
inject.js
inject.js
function receiveMessage(event) { var commentPath, frameURL; // get url of comment commentPath = event.data.commentURL; frameURL = "https://news.ycombinator.com/" + commentPath; showComments( frameURL ) } var showComments = function( URL ) { var commentFrame; } var drawIframe = function() { var frameset, pageURL, pageFrame, commentFrame, html, body; html = document.querySelector( "html" ); body = document.querySelector( "body" ); frameset = document.createElement( "frameset" ); pageFrame = document.createElement( "frame" ); commentFrame = document.createElement( "frame" ); pageFrame.setAttribute( "id", "page-frame" ); commentFrame.setAttribute( "id", "comment-frame" ); pageURL = document.URL; if ( body ) body.parentNode.removeChild( body ); frameset.appendChild( pageFrame ); frameset.appendChild( commentFrame ); html.appendChild( frameset ); pageFrame.setAttribute( "src", pageURL ); } drawIframe(); window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) { var commentPath, frameURL; // get url of comment commentPath = event.data.commentURL; frameURL = "https://news.ycombinator.com/" + commentPath; showComments( frameURL ) } var showComments = function( URL ) { var commentFrame; commentFrame = document.querySelector( "#frameID" ); commentFrame.setAttribute( "src", URL ); } var drawIframe = function() { var frameset, pageURL, pageFrame, commentFrame, html, body; html = document.querySelector( "html" ); body = document.querySelector( "body" ); frameset = document.createElement( "frameset" ); pageFrame = document.createElement( "frame" ); commentFrame = document.createElement( "frame" ); pageFrame.setAttribute( "id", "page-frame" ); commentFrame.setAttribute( "id", "comment-frame" ); pageURL = document.URL; if ( body ) body.parentNode.removeChild( body ); frameset.appendChild( pageFrame ); frameset.appendChild( commentFrame ); html.appendChild( frameset ); pageFrame.setAttribute( "src", pageURL ); } drawIframe(); window.addEventListener("message", receiveMessage, false);
Set attribute of comment frame.
Set attribute of comment frame.
JavaScript
mit
tonyonodi/reddit-comments,tonyonodi/reddit-comments,tonyonodi/back-to-the-comments,tonyonodi/back-to-the-comments
62dee18342aa659ad1f124be9de70b11d3a0c0d1
src/jar/lang/Object/Object-info.js
src/jar/lang/Object/Object-info.js
JAR.register({ MID: 'jar.lang.Object.Object-info', deps: ['..', '.!reduce|derive', '..Array!reduce'] }, function(lang, Obj, Arr) { 'use strict'; var reduce = Obj.reduce; lang.extendNativeType('Object', { keys: function() { return reduce(this, pushKey, []); }, pairs: function() { return reduce(this, pushKeyValue, []); }, prop: function(key) { var propList = key.split('.'); return Arr.reduce(propList, extractProperty, this); }, size: function() { return reduce(this, countProperties, 0); }, values: function() { return reduce(this, pushValue, []); } }); function extractProperty(obj, key) { return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined; } function countProperties(size) { return ++size; } function pushKey(array, value, key) { array[array.length] = key; return array; } function pushValue(array, value) { array[array.length] = value; return array; } function pushKeyValue(array, value, key) { array[array.length] = [key, value]; return array; } return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']); });
JAR.register({ MID: 'jar.lang.Object.Object-info', deps: ['..', '.!reduce|derive', '..Array!reduce'] }, function(lang, Obj, Arr) { 'use strict'; var reduce = Obj.reduce; lang.extendNativeType('Object', { keys: function() { return reduce(this, pushKey, Arr()); }, pairs: function() { return reduce(this, pushKeyValue, Arr()); }, prop: function(key) { var propList = key.split('.'); return Arr.reduce(propList, extractProperty, this); }, size: function() { return reduce(this, countProperties, 0); }, values: function() { return reduce(this, pushValue, Arr()); } }); function extractProperty(obj, key) { return (obj && Obj.hasOwn(obj, key)) ? obj[key] : undefined; } function countProperties(size) { return ++size; } function pushKey(array, value, key) { array[array.length] = key; return array; } function pushValue(array, value) { array[array.length] = value; return array; } function pushKeyValue(array, value, key) { array[array.length] = Arr(key, value); return array; } return Obj.extract(Obj, ['keys', 'pairs', 'prop', 'size', 'values']); });
Use jar.lang.Array instead of native as returnvalue
Use jar.lang.Array instead of native as returnvalue
JavaScript
mit
HROH/JAR
9cd54ca34eee54d3cbe357147f2f81c6021bc606
controllers/widget.js
controllers/widget.js
var args = _.extend({ duration: 2000, animationDuration: 250, message: '', title: Ti.App.name, elasticity: 0.5, pushForce: 30, usePhysicsEngine: true }, arguments[0] || {}); var That = null; exports.show = function(opt) { if (_.isObject(opt)) _.extend(args, opt); if (_.isString(opt)) _.extend(args, { message: opt }); if (OS_ANDROID && args.view == null) { Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification."); That = Ti.UI.createNotification({ message: args.message, duration: args.duration }); That.show(); } else { That = Widget.createController('window', args); } }; exports.hide = function() { if (That != null) { That.hide(); } };
var args = _.extend({ duration: 2000, animationDuration: 250, message: '', title: Ti.App.name, elasticity: 0.5, pushForce: 30, usePhysicsEngine: true }, arguments[0] || {}); var That = null; exports.show = function(opt) { if (_.isObject(opt)) _.extend(args, opt); if (_.isString(opt)) _.extend(args, { message: opt }); if (OS_ANDROID && args.view == null) { Ti.API.error("In Android you have to set a view that contain the sliding view. Fallbacking to Ti.UI.Notification."); That = Ti.UI.createNotification({ message: args.message, duration: args.duration }); That.show(); } else { That = Widget.createController('window', args); } }; exports.update = function(message) { That.update(message); }; exports.hide = function() { if (That != null) { That.hide(); } };
Allow update of notification text.
Allow update of notification text. Allows you to update the message in the notification. I wanted this feature to allow me to show loading percentage in the notification when downloading or uploading data.
JavaScript
mit
titanium-forks/CaffeinaLab.com.caffeinalab.titanium.notifications,CaffeinaLab/Ti.Notifications,DouglasHennrich/Ti.Notifications
460569d2ccd067dea0fcebca62a266e4f43c4ac8
src/express/middleware/createContext.js
src/express/middleware/createContext.js
// ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- var data = require('../../data'), notifications = require('../../notifications'), attachOperators = require('../../query/attachOperators'), logger = require('../../logger'); module.exports = function (configuration) { var dataProvider = data(configuration), notificationsClient = notifications(configuration.notifications).getClient(); return function (req, res, next) { req.azureMobile = { req: req, res: res, data: dataProvider, push: notificationsClient, configuration: configuration, logger: logger, tables: function (name) { return attachOperators(name, dataProvider(configuration.tables[name])); } }; next(); }; };
// ---------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // ---------------------------------------------------------------------------- var data = require('../../data'), notifications = require('../../notifications'), attachOperators = require('../../query/attachOperators'), logger = require('../../logger'); module.exports = function (configuration) { var dataProvider = data(configuration), notificationsClient = notifications(configuration.notifications).getClient(); return function (req, res, next) { req.azureMobile = { req: req, res: res, data: dataProvider, push: notificationsClient, configuration: configuration, logger: logger, tables: function (name) { if(!configuration.tables[name]) throw new Error("The table '" + name + "' does not exist.") return attachOperators(name, dataProvider(configuration.tables[name])); } }; next(); }; };
Throw meaningful exception if table does not exist
Throw meaningful exception if table does not exist
JavaScript
mit
mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,mamaso/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node,shrishrirang/azure-mobile-apps-node
7512a4e4e4588c16883ebc5499804a05286d1b64
web/src/js/views/location-chooser.js
web/src/js/views/location-chooser.js
import locations from '../core/locations'; import View from '../base/view'; import {trigger} from '../utils/browser'; import template from '../../templates/location-chooser.ejs'; export default class LocationChooser extends View { constructor({app, location, route}) { super({app}); this.location = location; this.route = route; } getHTML() { const currentLocation = this.location; const targetRoute = this.getTargetRoute(); return this.app.renderTemplate(template, { locations, targetRoute, currentLocation}); } mount() { this.events.bind('change', 'onChange'); } getTargetRoute() { if (this.route.name == 'place-list') { return {name: 'place-list', args: this.route.args}; } else if (this.route.name == 'event-list') { return {name: 'event-list', args: this.route.args}; } else { return {name: 'event-list', args: {}}; } } onChange(event) { trigger(window, 'navigate', this.element.value); } }
import locations from '../core/locations'; import View from '../base/view'; import {trigger} from '../utils/browser'; import template from '../../templates/location-chooser.ejs'; export default class LocationChooser extends View { constructor({app, location, route}) { super({app}); this.location = location; this.route = route; } getHTML() { const currentLocation = this.location; const targetRoute = this.getTargetRoute(); return this.app.renderTemplate(template, { locations, targetRoute, currentLocation}); } mount() { this.events.bind('change', 'onChange'); } getTargetRoute() { if (['place-list', 'event-list'].includes(this.route.name)) { return this.route; } else { return {name: 'event-list', args: {}}; } } onChange(event) { trigger(window, 'navigate', this.element.value); } }
Simplify location chooser target route logic
Simplify location chooser target route logic
JavaScript
mit
despawnerer/theatrics,despawnerer/theatrics,despawnerer/theatrics
c69e67b560fd1fa97674f254e88e5637d177d1d9
js/app.js
js/app.js
"use strict"; (function() { var filters = { age: function() { this .saturation(20) .gamma(1.4) .vintage() .contrast(5) .exposure(15) .vignette(300, 60) .render() }, lomo: function() { this .brightness(15) .exposure(15) .curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]) .saturation(-20) .gamma(1.8) .vignette("50%", 60) .brightness(5) .render() }, oldtv: function() { this .saturation(-60) .contrast(30) .noise(20) .vignette("50%", 70) .render() } }; $('#filters button').click(function(e) { e.preventDefault(); Caman("#canvas").revert(); Caman("#canvas", filters[$(this).data('filter')]); $('#filters button').removeClass('active'); $(this).addClass('active'); }); })()
"use strict"; (function() { var filters = { age: function() { this .saturation(20) .gamma(1.4) .vintage() .contrast(5) .exposure(15) .vignette(300, 60) .render() }, blackAndWhite: function() { this .gamma(100) .contrast(30) .saturation(-100) .render() }, lomo: function() { this .brightness(15) .exposure(15) .curves('rgb', [0, 0], [200, 0], [155, 255], [255, 255]) .saturation(-20) .gamma(1.8) .vignette("50%", 60) .brightness(5) .render() }, oldtv: function() { this .saturation(-60) .contrast(30) .noise(20) .vignette("50%", 70) .render() } }; $('#filters button').click(function(e) { e.preventDefault(); Caman("#canvas").revert(); Caman("#canvas", filters[$(this).data('filter')]); $('#filters button').removeClass('active'); $(this).addClass('active'); }); })()
Add black and white filter
Add black and white filter
JavaScript
bsd-2-clause
fwenzel/hipstergram
b304daf4802a5fa1a870ac65ab9f3674eb83b4c1
app/js/store.js
app/js/store.js
'use strict'; import { createStore, applyMiddleware, compose } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducers'; const createStoreWithMiddleware = compose( applyMiddleware(thunk), window.devToolsExtension ? window.devToolsExtension() : f => f )(createStore); export default createStoreWithMiddleware(reducer);
'use strict'; import { createStore, applyMiddleware } from 'redux'; import thunk from 'redux-thunk'; import reducer from './reducers'; const createStoreWithMiddleware = applyMiddleware( thunk )(createStore); export default createStoreWithMiddleware(reducer);
Revert "Add dev tools stuff"
Revert "Add dev tools stuff" This reverts commit 46ebaea0030bdb0b81aa5b6ac343f70a968910b9.
JavaScript
mit
rit-sse/officers,rit-sse/officers
ed2d17a60d5d560f3c22722221603d846457ae9c
lib/router.js
lib/router.js
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); }, fastRender: true });
var subscriptions = new SubsManager(); Router.configure({ layoutTemplate: 'layout', loadingTemplate: 'loading', notFoundTemplate: 'notFound' }); Router.route('/', { name: 'home', waitOn: function() { return subscriptions.subscribe('allOwnedMangas', Meteor.userId()); }, fastRender: true }); Router.route('/missingMangas', { name: 'missingMangas', waitOn: function() { return subscriptions.subscribe('allMissingMangas', Meteor.userId()); }, fastRender: true });
Add route for missing mangas
Add route for missing mangas
JavaScript
mit
dexterneo/mangas,dexterneo/mangas,dexterneo/mangatek,dexterneo/mangatek
3eba8d104dea9a21650e0dcb52ec8d00d42fe4b0
plugin.js
plugin.js
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ constructor() { super(); // Will be injected by core this.app = null; this.plugins = null; this.server = null; this.players = null; this.maps = null; /** * Will hold the defined models for this plugin! * * @type {{}} */ this.models = {}; } /** * Inject Core App interface into the plugin. * * @param {App} app */ inject(app) { this.app = app; this.server = app.server; // Expand app into separate parts. // TODO: Fill in plugins, server, players, maps. } }
'use strict'; // Make our own plugin main interface an event emitter. // This can be used to communicate and subscribe to others plugins events. import { EventEmitter } from 'events'; /** * Plugin Interface * @class Plugin */ export default class extends EventEmitter { /** * Construct the plugin. */ constructor() { super(); // Will be injected by core this.app = null; this.plugins = null; this.server = null; this.players = null; this.maps = null; /** * Will hold the defined models for this plugin! * * @type {{}} */ this.models = {}; } /** * Inject Core App interface into the plugin. * * @param {App} app */ inject(app) { this.app = app; this.server = app.server; // Expand app into separate parts. this.players = app.players; this.maps = app.maps; } }
Prepare for players and maps update of core.
Prepare for players and maps update of core.
JavaScript
isc
ManiaJS/plugins,ManiaJS/plugins,ManiaJS/plugins
3692239249bb4d9efd4e84a2c1ea81d31b28f736
spec/global-spec.js
spec/global-spec.js
var proxyquire = require("proxyquire"); // Returns an ajax instance that has the underlying XMLHttpRequest stubbed. function getStubbedAjax(stub) { proxyquire("../index.js", { xmlhttprequest: { "XMLHttpRequest": function () { this.open = function () {}; this.send = function () {}; this.setRequestHeader = function () { this.readyState = 4; this.status = 200; this.onreadystatechange(); }; if (stub != null) { for (var method in stub) { this[method] = stub[method]; } } } } }); return require("../index.js"); } describe("The get method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.get("http://www.example.com") .then(function () { done(); }, function () { fail(); }) }); });
var proxyquire = require("proxyquire"); // Returns an ajax instance that has the underlying XMLHttpRequest stubbed. function getStubbedAjax(stub) { proxyquire("../index.js", { xmlhttprequest: { "XMLHttpRequest": function () { this.open = function () {}; this.send = function () {}; this.setRequestHeader = function () { this.readyState = 4; this.status = 200; this.onreadystatechange(); }; if (stub != null) { for (var method in stub) { this[method] = stub[method]; } } } } }); return require("../index.js"); } describe("The get method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.get("http://www.example.com") .then(done, fail); }); }); describe("The post method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.post("http://www.example.com") .then(done, fail); }); }); describe("The put method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.put("http://www.example.com") .then(done, fail); }); }); describe("The del method", function () { it("works", function (done) { var ajax = getStubbedAjax(); ajax.del("http://www.example.com") .then(done, fail); }); });
Add basic tests for post/put/del
Add basic tests for post/put/del
JavaScript
mit
levibotelho/dead-simple-ajax
da1cd5e7b6cfe09fb21599dd590b49aada010e3d
koans/AboutExpects.js
koans/AboutExpects.js
describe("About Expects", function() { /We shall contemplate truth by testing reality, via spec expectations. it("should expect true", function() { expect(true).toBeTruthy(); //This should be true }); //To understand reality, we must compare our expectations against reality. it("should expect equality", function () { var expectedValue = FILL_ME_IN; var actualValue = 1 + 1; expect(actualValue === expectedValue).toBeTruthy(); }); //Some ways of asserting equality are better than others. it("should assert equality a better way", function () { var expectedValue = FILL_ME_IN; var actualValue = 1 + 1; // toEqual() compares using common sense equality. expect(actualValue).toEqual(expectedValue); }); //Sometimes you need to be really exact about what you "type". it("should assert equality with ===", function () { var expectedValue = FILL_ME_IN; var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. expect(actualValue).toBe(expectedValue); }); //Sometimes we will ask you to fill in the values. it("should have filled in values", function () { expect(1 + 1).toEqual(FILL_ME_IN); }); });
describe("About Expects", function() { /We shall contemplate truth by testing reality, via spec expectations. it("should expect true", function() { expect(true).toBeTruthy(); //This should be true }); //To understand reality, we must compare our expectations against reality. it("should expect equality", function () { var expectedValue = 2; var actualValue = 1 + 1; expect(actualValue === expectedValue).toBeTruthy(); }); //Some ways of asserting equality are better than others. it("should assert equality a better way", function () { var expectedValue = 2; var actualValue = 1 + 1; // toEqual() compares using common sense equality. expect(actualValue).toEqual(expectedValue); }); //Sometimes you need to be really exact about what you "type". it("should assert equality with ===", function () { var expectedValue = "2"; var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. expect(actualValue).toBe(expectedValue); }); //Sometimes we will ask you to fill in the values. it("should have filled in values", function () { expect(1 + 1).toEqual(2); }); });
Change FILL_ME_IN to respective types
Change FILL_ME_IN to respective types
JavaScript
mit
Imti/javascript-koans,Imti/javascript-koans
260c02133464f51f80d117fdb67893247f55551a
testem.js
testem.js
var Reporter = require('ember-test-utils/reporter') module.exports = { disable_watching: true, framework: 'mocha', launch_in_ci: [ 'Chrome', 'Firefox' ], launch_in_dev: [ 'Chrome' ], reporter: new Reporter(), test_page: 'tests/index.html?hidepassed' }
var Reporter = require('ember-test-utils/reporter') module.exports = { disable_watching: true, framework: 'mocha', launch_in_ci: [ 'Firefox', 'Chrome' ], launch_in_dev: [ 'Chrome' ], reporter: new Reporter(), test_page: 'tests/index.html?hidepassed' }
Test firefox first, so Chrome coverage is used
Test firefox first, so Chrome coverage is used
JavaScript
mit
dafortin/ember-frost-core,EWhite613/ember-frost-core,helrac/ember-frost-core,rox163/ember-frost-core,EWhite613/ember-frost-core,dafortin/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,rox163/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core,dafortin/ember-frost-core,EWhite613/ember-frost-core,ciena-frost/ember-frost-core,helrac/ember-frost-core
5594dd12afca6f57965eeac6fd1e5609c89d78b9
lib/linter.js
lib/linter.js
'use strict'; var gonzales = require('gonzales-pe'); var linters = [ require('./linters/space_before_brace') ]; exports.lint = function (data, path, config) { var ast = this.parseAST(data); var errors = []; ast.map(function (node) { var i; for (i = 0; i < linters.length; i++) { errors.push(linters[i].call(null, { config: config, node: node, path: path })); } }); // Remove empty errors return errors.filter(function (error) { return error !== null && error !== true; }); }; exports.parseAST = function (input) { return gonzales.parse(input, { syntax: 'less' }); };
'use strict'; var gonzales = require('gonzales-pe'); var linters = [ require('./linters/space_before_brace') ]; exports.lint = function (input, path, config) { var ast = this.parseAST(input); var errors = []; ast.map(function (node) { var i; for (i = 0; i < linters.length; i++) { errors.push(linters[i].call(null, { config: config, node: node, path: path })); } }); // Remove empty errors return errors.filter(function (error) { return error !== null && error !== true; }); }; exports.parseAST = function (input) { return gonzales.parse(input, { syntax: 'less' }); };
Use 'input' instead of 'data'
Use 'input' instead of 'data'
JavaScript
mit
JoshuaKGoldberg/lesshint,lesshint/lesshint,runarberg/lesshint,gilt/lesshint
3988262c70babec9b3d877077d1327f995247568
problems/filtered_ls/setup.js
problems/filtered_ls/setup.js
const fs = require('fs') , path = require('path') , os = require('os') , onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync , files = [ 'learnyounode.dat' , 'learnyounode.txt' , 'learnyounode.sql' , 'api.html' , 'README.md' , 'data.json' , 'data.dat' , 'words.dat' , 'w00t.dat' , 'w00t.txt' , 'wrrrrongdat' ] module.exports = function () { var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid) , trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json') fs.mkdirSync(dir) files.forEach(function (f) { fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8') }) return { args : [ dir, 'dat' ] , stdin : null , modUseTrack : { trackFile : trackFile , modules : [ 'fs' ] } , verify : onlyAsync.bind(null, trackFile) } }
const fs = require('fs') , path = require('path') , os = require('os') , onlyAsync = require('workshopper/verify-calls').verifyOnlyAsync , files = [ 'learnyounode.dat' , 'learnyounode.txt' , 'learnyounode.sql' , 'api.html' , 'README.md' , 'data.json' , 'data.dat' , 'words.dat' , 'w00t.dat' , 'w00t.txt' , 'wrrrrongdat' , 'dat' ] module.exports = function () { var dir = path.join(os.tmpDir(), 'learnyounode_' + process.pid) , trackFile = path.join(os.tmpDir(), 'learnyounode_' + process.pid + '.json') fs.mkdirSync(dir) files.forEach(function (f) { fs.writeFileSync(path.join(dir, f), 'nothing to see here', 'utf8') }) return { args : [ dir, 'dat' ] , stdin : null , modUseTrack : { trackFile : trackFile , modules : [ 'fs' ] } , verify : onlyAsync.bind(null, trackFile) } }
Add test case from make_it_modular to filtered_ls
Add test case from make_it_modular to filtered_ls This test case was present in the next, "same as the previous" challenge, thus preventing some solutions to filtered_ls to work for make_it_modular for an unclear reason.
JavaScript
mit
amandasilveira/learnyounode,soujiro27/learnyounode,sergiorgiraldo/learnyounode,AydinHassan/learnyounode,thenaughtychild/learnyounode,jqk6/learnyounode,Yas3r/learnyounode,kmckee/learnyounode,zpxiaomi/learnyounode,keshwans/learnyounode,jojo1311/learnyounode,5harf/learnyounode,hsidar/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,kmckee/learnyounode,PibeDx/learnyounode,PibeDx/learnyounode,RoseTHERESA/learnyounode-1,Gtskk/learnyoupython,maksimgm/learnyounode,sergiorgiraldo/learnyounode,yous/learnyounode,AydinHassan/learnyounode,hsidar/learnyounode,JonnyCheng/learnyounode,noikiy/learnyounode,chechiachang/learnyounode,amandasilveira/learnyounode,chechiachang/learnyounode,zpxiaomi/learnyounode,walhs/learnyounode,runithome/learnyounode,andrewtdinh/learnyounode,marocchino/learnyounode,pushnoy100500/learnyounode,soujiro27/learnyounode,JonnyCheng/learnyounode,yous/learnyounode,michaelgrilo/learnyounode,piccoloaiutante/learnyounode,AustenLR/learnyounode,jqk6/learnyounode,maksimgm/learnyounode,ElTomatos/learnyounode,thenaughtychild/learnyounode,lesterhm/learnyounode,marocchino/learnyounode,Yas3r/learnyounode,ericdouglas/learnyounode,kishorsharma/learnyounode,ralphtheninja/learnyounode,ralphtheninja/learnyounode,ElTomatos/learnyounode,CNBorn/learnyounode,noikiy/learnyounode,esmitley/learnyounode,pushnoy100500/learnyounode,akashnimare/learnyounode,runithome/learnyounode,Gtskk/learnyoupython,andrewtdinh/learnyounode,zhushuanglong/learnyounode,5harf/learnyounode,esmitley/learnyounode,walhs/learnyounode,lesterhm/learnyounode,michaelgrilo/learnyounode,jojo1311/learnyounode,akashnimare/learnyounode,RoseTHERESA/learnyounode-1,keshwans/learnyounode,CNBorn/learnyounode,aijiekj/learnyounode,aijiekj/learnyounode,Gtskk/learnyoupython,metakata/learnyounode,metakata/learnyounode,kishorsharma/learnyounode,zhushuanglong/learnyounode
e62497abb96c1a8753a786e55be75b5e3bb3f90b
src/tasks/check-file-names/__tests__/index-test.js
src/tasks/check-file-names/__tests__/index-test.js
'use strict'; import { runCommand } from '../../../utils/helper-tests'; import { join } from 'path'; describe('Check file names task', () => { pit('should pass with valid file & folder names', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'valid-project') }]) ); pit('should fail if invalid file name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-file-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should fail if invalid folder name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-folder-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use global configuration if parameters are not defined', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'global-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use default configuration without specific parameters', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'default-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); });
'use strict'; import { extendJasmineTimeout, runCommand } from '../../../utils/helper-tests'; import { join } from 'path'; describe('Check file names task', () => { extendJasmineTimeout(jasmine, beforeEach, afterEach); pit('should pass with valid file & folder names', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'valid-project') }]) ); pit('should fail if invalid file name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-file-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should fail if invalid folder name found', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'invalid-folder-name'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use global configuration if parameters are not defined', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'global-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); pit('should use default configuration without specific parameters', () => runCommand(['gulp check-file-names', { cwd: join(__dirname, 'default-configuration'), expectToFail: true, expectToContain: 'Invalid file name at' }]) ); });
Fix checkFileNames tests (extend timeout)
Fix checkFileNames tests (extend timeout)
JavaScript
mit
urbanjs/tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/tools,urbanjs/urbanjs-tools,urbanjs/urbanjs-tools
67336759eedbcbd662d500336364ba5745ca306a
src/Schema/Address.js
src/Schema/Address.js
const mongoose = require("mongoose"); const shortid = require("shortid"); const ProcessorItem = require("./ProcessorItem"); const originals = require("mongoose-originals"); const Address = new mongoose.Schema({ _id: { type: String, default: shortid.generate, }, processor: { type: ProcessorItem, default: ProcessorItem, }, phone: String, company: String, name: String, country: String, locality: String, streetAddress: String, extendedAddress: String, postalCode: String, createdAt: Date, updatedAt: Date, }); Address.plugin(originals, { fields: [ "phone", "company", "name", "country", "locality", "streetAddress", "extendedAddress", "postalCode", ], }); module.exports = Address;
const mongoose = require("mongoose"); const shortid = require("shortid"); const ProcessorItem = require("./ProcessorItem"); const originals = require("mongoose-originals"); const Address = new mongoose.Schema({ _id: { type: String, default: shortid.generate, }, processor: { type: ProcessorItem, default: ProcessorItem, }, name: String, country: String, postalCode: String, createdAt: Date, updatedAt: Date, }); Address.plugin(originals, { fields: [ "phone", "company", "name", "country", "locality", "streetAddress", "extendedAddress", "postalCode", ], }); module.exports = Address;
Remove not needed fields from schema
Remove not needed fields from schema
JavaScript
mit
enhancv/mongoose-subscriptions
f78e46607cf15a7273ac780086a071f4cea092df
packages/meteor/server_environment.js
packages/meteor/server_environment.js
Meteor = { isClient: false, isServer: true }; try { if (process.env.METEOR_SETTINGS) Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS); } catch (e) { throw new Error("Settings are not valid JSON"); }
Meteor = { isClient: false, isServer: true }; try { Meteor.settings = {}; if (process.env.METEOR_SETTINGS) Meteor.settings = JSON.parse(process.env.METEOR_SETTINGS); } catch (e) { throw new Error("Settings are not valid JSON"); }
Make the default for Meteor.settings be the empty object
Make the default for Meteor.settings be the empty object
JavaScript
mit
TribeMedia/meteor,henrypan/meteor,l0rd0fwar/meteor,esteedqueen/meteor,jg3526/meteor,D1no/meteor,colinligertwood/meteor,Profab/meteor,skarekrow/meteor,dfischer/meteor,shadedprofit/meteor,servel333/meteor,shadedprofit/meteor,baiyunping333/meteor,skarekrow/meteor,GrimDerp/meteor,michielvanoeffelen/meteor,jeblister/meteor,bhargav175/meteor,shmiko/meteor,modulexcite/meteor,yinhe007/meteor,luohuazju/meteor,yiliaofan/meteor,yyx990803/meteor,eluck/meteor,benjamn/meteor,mirstan/meteor,Urigo/meteor,jeblister/meteor,steedos/meteor,ljack/meteor,yyx990803/meteor,paul-barry-kenzan/meteor,sdeveloper/meteor,joannekoong/meteor,pjump/meteor,codedogfish/meteor,meonkeys/meteor,IveWong/meteor,GrimDerp/meteor,somallg/meteor,DCKT/meteor,michielvanoeffelen/meteor,dandv/meteor,jagi/meteor,Jonekee/meteor,LWHTarena/meteor,jrudio/meteor,shmiko/meteor,wmkcc/meteor,jeblister/meteor,cherbst/meteor,daslicht/meteor,joannekoong/meteor,cherbst/meteor,chinasb/meteor,somallg/meteor,sunny-g/meteor,baiyunping333/meteor,elkingtonmcb/meteor,saisai/meteor,yonas/meteor-freebsd,karlito40/meteor,yanisIk/meteor,PatrickMcGuinness/meteor,Quicksteve/meteor,rabbyalone/meteor,AnjirHossain/meteor,joannekoong/meteor,cog-64/meteor,meteor-velocity/meteor,jirengu/meteor,alexbeletsky/meteor,brettle/meteor,bhargav175/meteor,lawrenceAIO/meteor,eluck/meteor,dandv/meteor,daslicht/meteor,mirstan/meteor,ashwathgovind/meteor,4commerce-technologies-AG/meteor,servel333/meteor,ericterpstra/meteor,benjamn/meteor,benstoltz/meteor,williambr/meteor,udhayam/meteor,shmiko/meteor,oceanzou123/meteor,brettle/meteor,calvintychan/meteor,AnthonyAstige/meteor,yinhe007/meteor,sclausen/meteor,luohuazju/meteor,whip112/meteor,Puena/meteor,jdivy/meteor,codingang/meteor,chiefninew/meteor,ashwathgovind/meteor,Hansoft/meteor,modulexcite/meteor,benstoltz/meteor,DAB0mB/meteor,wmkcc/meteor,luohuazju/meteor,Prithvi-A/meteor,evilemon/meteor,baysao/meteor,ndarilek/meteor,jrudio/meteor,jrudio/meteor,neotim/meteor,kengchau/meteor,lieuwex/meteor,qscripter/meteor,wmkcc/meteor,nuvipannu/meteor,ashwathgovind/meteor,TribeMedia/meteor,rozzzly/meteor,arunoda/meteor,vacjaliu/meteor,nuvipannu/meteor,shmiko/meteor,vjau/meteor,katopz/meteor,youprofit/meteor,Prithvi-A/meteor,chmac/meteor,skarekrow/meteor,Ken-Liu/meteor,Puena/meteor,stevenliuit/meteor,lieuwex/meteor,tdamsma/meteor,lieuwex/meteor,chasertech/meteor,daltonrenaldo/meteor,Hansoft/meteor,h200863057/meteor,ndarilek/meteor,DCKT/meteor,AnthonyAstige/meteor,namho102/meteor,baiyunping333/meteor,mubassirhayat/meteor,mjmasn/meteor,evilemon/meteor,l0rd0fwar/meteor,sunny-g/meteor,allanalexandre/meteor,papimomi/meteor,l0rd0fwar/meteor,guazipi/meteor,zdd910/meteor,PatrickMcGuinness/meteor,TechplexEngineer/meteor,mauricionr/meteor,qscripter/meteor,Quicksteve/meteor,qscripter/meteor,DAB0mB/meteor,ashwathgovind/meteor,baysao/meteor,EduShareOntario/meteor,wmkcc/meteor,fashionsun/meteor,lpinto93/meteor,Theviajerock/meteor,yalexx/meteor,jenalgit/meteor,shadedprofit/meteor,michielvanoeffelen/meteor,lieuwex/meteor,pjump/meteor,AlexR1712/meteor,Hansoft/meteor,HugoRLopes/meteor,mauricionr/meteor,PatrickMcGuinness/meteor,AlexR1712/meteor,guazipi/meteor,oceanzou123/meteor,tdamsma/meteor,evilemon/meteor,namho102/meteor,arunoda/meteor,evilemon/meteor,youprofit/meteor,akintoey/meteor,benstoltz/meteor,alexbeletsky/meteor,jg3526/meteor,yiliaofan/meteor,nuvipannu/meteor,chmac/meteor,jagi/meteor,tdamsma/meteor,vacjaliu/meteor,rozzzly/meteor,newswim/meteor,michielvanoeffelen/meteor,IveWong/meteor,chasertech/meteor,rozzzly/meteor,codingang/meteor,servel333/meteor,bhargav175/meteor,judsonbsilva/meteor,EduShareOntario/meteor,lpinto93/meteor,colinligertwood/meteor,cherbst/meteor,Hansoft/meteor,mirstan/meteor,dboyliao/meteor,jg3526/meteor,chiefninew/meteor,katopz/meteor,ashwathgovind/meteor,Eynaliyev/meteor,fashionsun/meteor,sitexa/meteor,yanisIk/meteor,DAB0mB/meteor,mirstan/meteor,l0rd0fwar/meteor,paul-barry-kenzan/meteor,kencheung/meteor,baiyunping333/meteor,steedos/meteor,GrimDerp/meteor,karlito40/meteor,LWHTarena/meteor,AnthonyAstige/meteor,modulexcite/meteor,Profab/meteor,devgrok/meteor,dfischer/meteor,ericterpstra/meteor,dandv/meteor,justintung/meteor,Ken-Liu/meteor,ndarilek/meteor,arunoda/meteor,jg3526/meteor,fashionsun/meteor,Ken-Liu/meteor,Prithvi-A/meteor,chinasb/meteor,justintung/meteor,jg3526/meteor,AnjirHossain/meteor,rozzzly/meteor,brdtrpp/meteor,HugoRLopes/meteor,chiefninew/meteor,yyx990803/meteor,zdd910/meteor,sdeveloper/meteor,planet-training/meteor,TechplexEngineer/meteor,alphanso/meteor,neotim/meteor,vjau/meteor,cog-64/meteor,Urigo/meteor,ndarilek/meteor,justintung/meteor,lorensr/meteor,cbonami/meteor,tdamsma/meteor,johnthepink/meteor,vjau/meteor,bhargav175/meteor,deanius/meteor,elkingtonmcb/meteor,codedogfish/meteor,meteor-velocity/meteor,dfischer/meteor,bhargav175/meteor,shrop/meteor,DAB0mB/meteor,Puena/meteor,yalexx/meteor,judsonbsilva/meteor,elkingtonmcb/meteor,lorensr/meteor,benstoltz/meteor,SeanOceanHu/meteor,williambr/meteor,arunoda/meteor,daltonrenaldo/meteor,cherbst/meteor,meonkeys/meteor,ndarilek/meteor,katopz/meteor,alphanso/meteor,cog-64/meteor,modulexcite/meteor,udhayam/meteor,yyx990803/meteor,SeanOceanHu/meteor,saisai/meteor,allanalexandre/meteor,somallg/meteor,elkingtonmcb/meteor,yalexx/meteor,codingang/meteor,namho102/meteor,hristaki/meteor,h200863057/meteor,cbonami/meteor,yanisIk/meteor,sitexa/meteor,sclausen/meteor,Profab/meteor,jg3526/meteor,Hansoft/meteor,brdtrpp/meteor,vjau/meteor,alphanso/meteor,Hansoft/meteor,ericterpstra/meteor,rabbyalone/meteor,whip112/meteor,servel333/meteor,nuvipannu/meteor,mjmasn/meteor,fashionsun/meteor,LWHTarena/meteor,Jonekee/meteor,Hansoft/meteor,lieuwex/meteor,dfischer/meteor,yinhe007/meteor,vacjaliu/meteor,TribeMedia/meteor,SeanOceanHu/meteor,codedogfish/meteor,pandeysoni/meteor,williambr/meteor,evilemon/meteor,skarekrow/meteor,somallg/meteor,D1no/meteor,katopz/meteor,benjamn/meteor,h200863057/meteor,chmac/meteor,h200863057/meteor,youprofit/meteor,yalexx/meteor,dfischer/meteor,modulexcite/meteor,hristaki/meteor,yalexx/meteor,brdtrpp/meteor,henrypan/meteor,judsonbsilva/meteor,planet-training/meteor,wmkcc/meteor,planet-training/meteor,Puena/meteor,jagi/meteor,imanmafi/meteor,steedos/meteor,lassombra/meteor,rabbyalone/meteor,lassombra/meteor,meteor-velocity/meteor,sdeveloper/meteor,daslicht/meteor,stevenliuit/meteor,Jonekee/meteor,lawrenceAIO/meteor,Eynaliyev/meteor,chiefninew/meteor,servel333/meteor,Ken-Liu/meteor,aramk/meteor,arunoda/meteor,chasertech/meteor,yiliaofan/meteor,dboyliao/meteor,lpinto93/meteor,alexbeletsky/meteor,GrimDerp/meteor,devgrok/meteor,ljack/meteor,henrypan/meteor,chmac/meteor,paul-barry-kenzan/meteor,aleclarson/meteor,aldeed/meteor,iman-mafi/meteor,youprofit/meteor,sdeveloper/meteor,codedogfish/meteor,kidaa/meteor,somallg/meteor,meteor-velocity/meteor,Paulyoufu/meteor-1,esteedqueen/meteor,pandeysoni/meteor,IveWong/meteor,devgrok/meteor,jrudio/meteor,JesseQin/meteor,papimomi/meteor,aramk/meteor,pandeysoni/meteor,brdtrpp/meteor,oceanzou123/meteor,chinasb/meteor,cog-64/meteor,newswim/meteor,Urigo/meteor,brettle/meteor,HugoRLopes/meteor,tdamsma/meteor,chinasb/meteor,DAB0mB/meteor,newswim/meteor,imanmafi/meteor,codedogfish/meteor,whip112/meteor,vacjaliu/meteor,Eynaliyev/meteor,GrimDerp/meteor,jenalgit/meteor,dboyliao/meteor,deanius/meteor,msavin/meteor,jirengu/meteor,emmerge/meteor,luohuazju/meteor,Eynaliyev/meteor,framewr/meteor,emmerge/meteor,neotim/meteor,hristaki/meteor,codingang/meteor,yyx990803/meteor,elkingtonmcb/meteor,johnthepink/meteor,jirengu/meteor,sunny-g/meteor,HugoRLopes/meteor,papimomi/meteor,Jeremy017/meteor,JesseQin/meteor,D1no/meteor,yonas/meteor-freebsd,sitexa/meteor,deanius/meteor,yinhe007/meteor,oceanzou123/meteor,yiliaofan/meteor,servel333/meteor,benjamn/meteor,katopz/meteor,zdd910/meteor,h200863057/meteor,JesseQin/meteor,TechplexEngineer/meteor,daltonrenaldo/meteor,shadedprofit/meteor,shadedprofit/meteor,jeblister/meteor,johnthepink/meteor,calvintychan/meteor,Jeremy017/meteor,stevenliuit/meteor,baysao/meteor,AnjirHossain/meteor,ericterpstra/meteor,msavin/meteor,nuvipannu/meteor,neotim/meteor,TechplexEngineer/meteor,ericterpstra/meteor,GrimDerp/meteor,imanmafi/meteor,juansgaitan/meteor,planet-training/meteor,tdamsma/meteor,meteor-velocity/meteor,dboyliao/meteor,pjump/meteor,daltonrenaldo/meteor,yiliaofan/meteor,steedos/meteor,justintung/meteor,benstoltz/meteor,AnthonyAstige/meteor,kencheung/meteor,elkingtonmcb/meteor,aramk/meteor,williambr/meteor,meonkeys/meteor,brettle/meteor,yonas/meteor-freebsd,ljack/meteor,Quicksteve/meteor,guazipi/meteor,evilemon/meteor,justintung/meteor,TechplexEngineer/meteor,kengchau/meteor,kidaa/meteor,joannekoong/meteor,daltonrenaldo/meteor,ljack/meteor,mirstan/meteor,calvintychan/meteor,judsonbsilva/meteor,deanius/meteor,Theviajerock/meteor,servel333/meteor,johnthepink/meteor,lawrenceAIO/meteor,karlito40/meteor,pandeysoni/meteor,TechplexEngineer/meteor,alphanso/meteor,iman-mafi/meteor,aramk/meteor,queso/meteor,newswim/meteor,tdamsma/meteor,juansgaitan/meteor,esteedqueen/meteor,johnthepink/meteor,papimomi/meteor,benjamn/meteor,deanius/meteor,eluck/meteor,udhayam/meteor,framewr/meteor,baiyunping333/meteor,sclausen/meteor,lassombra/meteor,juansgaitan/meteor,JesseQin/meteor,alexbeletsky/meteor,yonas/meteor-freebsd,katopz/meteor,luohuazju/meteor,daltonrenaldo/meteor,sitexa/meteor,AnjirHossain/meteor,brdtrpp/meteor,SeanOceanHu/meteor,Jonekee/meteor,TribeMedia/meteor,jdivy/meteor,namho102/meteor,baiyunping333/meteor,daltonrenaldo/meteor,yonglehou/meteor,mubassirhayat/meteor,dev-bobsong/meteor,udhayam/meteor,jirengu/meteor,queso/meteor,dev-bobsong/meteor,mubassirhayat/meteor,pandeysoni/meteor,shmiko/meteor,kengchau/meteor,jg3526/meteor,ndarilek/meteor,planet-training/meteor,devgrok/meteor,lorensr/meteor,TribeMedia/meteor,SeanOceanHu/meteor,judsonbsilva/meteor,mirstan/meteor,yanisIk/meteor,AlexR1712/meteor,katopz/meteor,cbonami/meteor,zdd910/meteor,alphanso/meteor,aramk/meteor,h200863057/meteor,paul-barry-kenzan/meteor,yiliaofan/meteor,JesseQin/meteor,chiefninew/meteor,sitexa/meteor,HugoRLopes/meteor,papimomi/meteor,udhayam/meteor,meteor-velocity/meteor,ljack/meteor,jenalgit/meteor,DCKT/meteor,lpinto93/meteor,queso/meteor,yonglehou/meteor,kidaa/meteor,newswim/meteor,emmerge/meteor,Jeremy017/meteor,hristaki/meteor,AnthonyAstige/meteor,PatrickMcGuinness/meteor,sclausen/meteor,jdivy/meteor,hristaki/meteor,williambr/meteor,henrypan/meteor,Profab/meteor,Theviajerock/meteor,Theviajerock/meteor,Quicksteve/meteor,yonglehou/meteor,karlito40/meteor,sunny-g/meteor,esteedqueen/meteor,codedogfish/meteor,joannekoong/meteor,sunny-g/meteor,newswim/meteor,ljack/meteor,yanisIk/meteor,ashwathgovind/meteor,guazipi/meteor,chmac/meteor,fashionsun/meteor,yonglehou/meteor,vjau/meteor,IveWong/meteor,EduShareOntario/meteor,henrypan/meteor,sclausen/meteor,shadedprofit/meteor,meonkeys/meteor,juansgaitan/meteor,DCKT/meteor,lpinto93/meteor,sdeveloper/meteor,karlito40/meteor,sunny-g/meteor,AnthonyAstige/meteor,aldeed/meteor,judsonbsilva/meteor,alphanso/meteor,cog-64/meteor,lassombra/meteor,shadedprofit/meteor,rabbyalone/meteor,jeblister/meteor,cbonami/meteor,Ken-Liu/meteor,l0rd0fwar/meteor,yonas/meteor-freebsd,4commerce-technologies-AG/meteor,lpinto93/meteor,whip112/meteor,JesseQin/meteor,rozzzly/meteor,AlexR1712/meteor,allanalexandre/meteor,allanalexandre/meteor,papimomi/meteor,oceanzou123/meteor,lieuwex/meteor,alexbeletsky/meteor,allanalexandre/meteor,HugoRLopes/meteor,jeblister/meteor,baysao/meteor,saisai/meteor,evilemon/meteor,brettle/meteor,dandv/meteor,baysao/meteor,bhargav175/meteor,Jeremy017/meteor,youprofit/meteor,steedos/meteor,guazipi/meteor,vjau/meteor,kengchau/meteor,Prithvi-A/meteor,fashionsun/meteor,4commerce-technologies-AG/meteor,chinasb/meteor,udhayam/meteor,msavin/meteor,bhargav175/meteor,Eynaliyev/meteor,qscripter/meteor,tdamsma/meteor,shmiko/meteor,jdivy/meteor,colinligertwood/meteor,daslicht/meteor,AnthonyAstige/meteor,yinhe007/meteor,4commerce-technologies-AG/meteor,sdeveloper/meteor,mubassirhayat/meteor,colinligertwood/meteor,SeanOceanHu/meteor,LWHTarena/meteor,whip112/meteor,DCKT/meteor,sdeveloper/meteor,saisai/meteor,dandv/meteor,akintoey/meteor,cbonami/meteor,arunoda/meteor,vacjaliu/meteor,benjamn/meteor,sunny-g/meteor,paul-barry-kenzan/meteor,rozzzly/meteor,calvintychan/meteor,newswim/meteor,planet-training/meteor,brettle/meteor,elkingtonmcb/meteor,planet-training/meteor,chasertech/meteor,Quicksteve/meteor,kencheung/meteor,henrypan/meteor,ljack/meteor,TechplexEngineer/meteor,eluck/meteor,wmkcc/meteor,GrimDerp/meteor,daslicht/meteor,chengxiaole/meteor,shrop/meteor,Jonekee/meteor,chengxiaole/meteor,TribeMedia/meteor,chengxiaole/meteor,vacjaliu/meteor,benjamn/meteor,whip112/meteor,aldeed/meteor,chasertech/meteor,ashwathgovind/meteor,JesseQin/meteor,D1no/meteor,namho102/meteor,msavin/meteor,Theviajerock/meteor,youprofit/meteor,queso/meteor,yyx990803/meteor,dandv/meteor,jagi/meteor,jagi/meteor,DCKT/meteor,nuvipannu/meteor,shrop/meteor,DAB0mB/meteor,karlito40/meteor,pjump/meteor,jagi/meteor,PatrickMcGuinness/meteor,chasertech/meteor,devgrok/meteor,iman-mafi/meteor,sitexa/meteor,chiefninew/meteor,arunoda/meteor,aleclarson/meteor,rabbyalone/meteor,mubassirhayat/meteor,Jeremy017/meteor,chiefninew/meteor,sclausen/meteor,l0rd0fwar/meteor,4commerce-technologies-AG/meteor,yyx990803/meteor,esteedqueen/meteor,AlexR1712/meteor,justintung/meteor,neotim/meteor,cbonami/meteor,Eynaliyev/meteor,modulexcite/meteor,namho102/meteor,alexbeletsky/meteor,whip112/meteor,brdtrpp/meteor,yonas/meteor-freebsd,vjau/meteor,jirengu/meteor,judsonbsilva/meteor,saisai/meteor,eluck/meteor,stevenliuit/meteor,ndarilek/meteor,eluck/meteor,queso/meteor,skarekrow/meteor,HugoRLopes/meteor,EduShareOntario/meteor,emmerge/meteor,yinhe007/meteor,dev-bobsong/meteor,dandv/meteor,papimomi/meteor,skarekrow/meteor,imanmafi/meteor,dfischer/meteor,rozzzly/meteor,lawrenceAIO/meteor,kengchau/meteor,allanalexandre/meteor,yanisIk/meteor,sitexa/meteor,SeanOceanHu/meteor,Quicksteve/meteor,rabbyalone/meteor,Eynaliyev/meteor,michielvanoeffelen/meteor,D1no/meteor,zdd910/meteor,codingang/meteor,yalexx/meteor,lieuwex/meteor,chengxiaole/meteor,mauricionr/meteor,youprofit/meteor,Urigo/meteor,luohuazju/meteor,lorensr/meteor,saisai/meteor,devgrok/meteor,servel333/meteor,jenalgit/meteor,yiliaofan/meteor,mjmasn/meteor,msavin/meteor,chmac/meteor,jdivy/meteor,PatrickMcGuinness/meteor,alexbeletsky/meteor,ndarilek/meteor,yonglehou/meteor,DCKT/meteor,h200863057/meteor,Paulyoufu/meteor-1,chengxiaole/meteor,codingang/meteor,AnthonyAstige/meteor,Urigo/meteor,colinligertwood/meteor,lorensr/meteor,meteor-velocity/meteor,dboyliao/meteor,kidaa/meteor,4commerce-technologies-AG/meteor,Prithvi-A/meteor,cog-64/meteor,brdtrpp/meteor,yinhe007/meteor,akintoey/meteor,LWHTarena/meteor,calvintychan/meteor,framewr/meteor,imanmafi/meteor,yalexx/meteor,Puena/meteor,aramk/meteor,shrop/meteor,kencheung/meteor,jeblister/meteor,lassombra/meteor,daslicht/meteor,Jeremy017/meteor,mauricionr/meteor,Theviajerock/meteor,kidaa/meteor,cherbst/meteor,stevenliuit/meteor,yanisIk/meteor,somallg/meteor,mauricionr/meteor,meonkeys/meteor,colinligertwood/meteor,esteedqueen/meteor,qscripter/meteor,qscripter/meteor,SeanOceanHu/meteor,eluck/meteor,iman-mafi/meteor,Prithvi-A/meteor,Paulyoufu/meteor-1,msavin/meteor,IveWong/meteor,shrop/meteor,qscripter/meteor,emmerge/meteor,chasertech/meteor,LWHTarena/meteor,kencheung/meteor,emmerge/meteor,queso/meteor,Paulyoufu/meteor-1,akintoey/meteor,calvintychan/meteor,guazipi/meteor,ljack/meteor,framewr/meteor,Puena/meteor,justintung/meteor,deanius/meteor,jirengu/meteor,Jonekee/meteor,udhayam/meteor,benstoltz/meteor,pjump/meteor,Ken-Liu/meteor,AnjirHossain/meteor,dev-bobsong/meteor,jenalgit/meteor,dboyliao/meteor,framewr/meteor,somallg/meteor,yanisIk/meteor,williambr/meteor,calvintychan/meteor,mubassirhayat/meteor,Paulyoufu/meteor-1,dev-bobsong/meteor,IveWong/meteor,neotim/meteor,EduShareOntario/meteor,chengxiaole/meteor,luohuazju/meteor,jenalgit/meteor,dboyliao/meteor,allanalexandre/meteor,mjmasn/meteor,Profab/meteor,Theviajerock/meteor,meonkeys/meteor,jirengu/meteor,chmac/meteor,henrypan/meteor,dfischer/meteor,johnthepink/meteor,Ken-Liu/meteor,Jeremy017/meteor,dboyliao/meteor,Eynaliyev/meteor,fashionsun/meteor,shmiko/meteor,aleclarson/meteor,cbonami/meteor,cherbst/meteor,jdivy/meteor,jenalgit/meteor,hristaki/meteor,Paulyoufu/meteor-1,Quicksteve/meteor,framewr/meteor,rabbyalone/meteor,mirstan/meteor,lawrenceAIO/meteor,joannekoong/meteor,mjmasn/meteor,akintoey/meteor,shrop/meteor,meonkeys/meteor,aldeed/meteor,nuvipannu/meteor,codingang/meteor,chinasb/meteor,mauricionr/meteor,karlito40/meteor,aldeed/meteor,colinligertwood/meteor,michielvanoeffelen/meteor,kencheung/meteor,namho102/meteor,joannekoong/meteor,mauricionr/meteor,DAB0mB/meteor,chengxiaole/meteor,mubassirhayat/meteor,pandeysoni/meteor,iman-mafi/meteor,jagi/meteor,imanmafi/meteor,zdd910/meteor,Urigo/meteor,planet-training/meteor,paul-barry-kenzan/meteor,sclausen/meteor,D1no/meteor,4commerce-technologies-AG/meteor,dev-bobsong/meteor,Paulyoufu/meteor-1,neotim/meteor,modulexcite/meteor,johnthepink/meteor,msavin/meteor,devgrok/meteor,kengchau/meteor,iman-mafi/meteor,aldeed/meteor,D1no/meteor,D1no/meteor,vacjaliu/meteor,yonglehou/meteor,esteedqueen/meteor,oceanzou123/meteor,TribeMedia/meteor,kencheung/meteor,lorensr/meteor,sunny-g/meteor,yonglehou/meteor,steedos/meteor,alexbeletsky/meteor,baysao/meteor,paul-barry-kenzan/meteor,aldeed/meteor,aramk/meteor,codedogfish/meteor,hristaki/meteor,lorensr/meteor,stevenliuit/meteor,pandeysoni/meteor,skarekrow/meteor,Prithvi-A/meteor,Profab/meteor,stevenliuit/meteor,AlexR1712/meteor,akintoey/meteor,benstoltz/meteor,iman-mafi/meteor,daslicht/meteor,Jonekee/meteor,imanmafi/meteor,chiefninew/meteor,HugoRLopes/meteor,AnjirHossain/meteor,PatrickMcGuinness/meteor,steedos/meteor,lassombra/meteor,kengchau/meteor,Puena/meteor,emmerge/meteor,baiyunping333/meteor,framewr/meteor,mubassirhayat/meteor,ericterpstra/meteor,lawrenceAIO/meteor,EduShareOntario/meteor,juansgaitan/meteor,jdivy/meteor,oceanzou123/meteor,zdd910/meteor,Profab/meteor,Urigo/meteor,queso/meteor,alphanso/meteor,akintoey/meteor,AnjirHossain/meteor,guazipi/meteor,EduShareOntario/meteor,AlexR1712/meteor,baysao/meteor,pjump/meteor,brdtrpp/meteor,brettle/meteor,dev-bobsong/meteor,wmkcc/meteor,juansgaitan/meteor,l0rd0fwar/meteor,juansgaitan/meteor,daltonrenaldo/meteor,allanalexandre/meteor,mjmasn/meteor,somallg/meteor,kidaa/meteor,jrudio/meteor,mjmasn/meteor,lawrenceAIO/meteor,cog-64/meteor,lpinto93/meteor,yonas/meteor-freebsd,shrop/meteor,jrudio/meteor,deanius/meteor,chinasb/meteor,lassombra/meteor,karlito40/meteor,eluck/meteor,IveWong/meteor,cherbst/meteor,williambr/meteor,saisai/meteor,kidaa/meteor,ericterpstra/meteor,michielvanoeffelen/meteor,LWHTarena/meteor,pjump/meteor
876bd105dc905630f9d01d787c1d60f70113a72a
pages/authPassword/authPassword.js
pages/authPassword/authPassword.js
//var ERR = require('async-stacktrace'); var express = require('express'); var router = express.Router(); var csrf = require('../../lib/csrf'); var config = require('../../lib/config'); router.get('/', function(req, res) { res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies; res.render(__filename.replace(/\.js$/, '.ejs'), res.locals); }); router.post('/', function(req, res) { if (req.body.__action == 'assessmentPassword') { var pl_pw_origUrl = req.cookies.pl_pw_origUrl; var pwCookie = csrf.generateToken({password: req.body.password}, config.secretKey); res.cookie('pl_assessmentpw', pwCookie); res.clearCookie('pl_pw_origUrl'); return res.redirect(pl_pw_origUrl); } }); module.exports = router;
//var ERR = require('async-stacktrace'); var express = require('express'); var router = express.Router(); var csrf = require('../../lib/csrf'); var config = require('../../lib/config'); router.get('/', function(req, res) { res.locals.passwordInvalid = 'pl_assessmentpw' in req.cookies; res.render(__filename.replace(/\.js$/, '.ejs'), res.locals); }); router.post('/', function(req, res) { if (req.body.__action == 'assessmentPassword') { var pl_pw_origUrl = req.cookies.pl_pw_origUrl; var maxAge = 1000 * 60 * 60 * 12; // 12 hours var pwCookie = csrf.generateToken({password: req.body.password, maxAge: maxAge}, config.secretKey); res.cookie('pl_assessmentpw', pwCookie, {maxAge: maxAge}); res.clearCookie('pl_pw_origUrl'); return res.redirect(pl_pw_origUrl); } }); module.exports = router;
Add timeouts to CSRF and cookie
Add timeouts to CSRF and cookie
JavaScript
agpl-3.0
parasgithub/PrairieLearn,parasgithub/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,parasgithub/PrairieLearn,rbessick5/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,parasgithub/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn,mwest1066/PrairieLearn,rbessick5/PrairieLearn
c0f10b0f04d691ad7ad2e2bcc5a28effc0f20414
src/index.js
src/index.js
import React from 'react'; import Logo from './components/logo' import SocialButtons from './components/social-buttons' import Navigation from './components/navigation' import Home from './components/home' import Footer from './components/footer' class Page { render() { return ( <div id="wrapper" className="pure-g"> <header className="pure-u-2-3"> <Logo/> <SocialButtons/> <Navigation /> </header> <Home/> <Footer /> </div> ) } } React.render(<Page/>, document.getElementById('app'));
import React from 'react'; import Logo from './components/logo' import SocialButtons from './components/social-buttons' import Navigation from './components/navigation' import Home from './components/home'; import Footer from './components/footer'; import AppUrl from './appurl' class Page { render() { let appUrl = new AppUrl(); const siteComponent = this.props.siteComponent; return ( <div id="wrapper" className="pure-g"> <header className="pure-u-2-3"> <Logo/> <SocialButtons/> <Navigation appUrl={appUrl} /> </header> {siteComponent} <Footer /> </div> ) } } const rerender = (siteComponent = <Home />) => { React.render(<Page siteComponent={siteComponent} />, document.getElementById('app')); }; import {parse as parseUrl} from 'url'; import Chronicle from './lexicon/chronicle' window.addEventListener('hashchange', ({newURL: newUrl}) => { const parsedUrl = parseUrl(newUrl); processUrl(parsedUrl); }); function processUrl(parsedUrl) { if (parsedUrl && parsedUrl.hash && parsedUrl.hash.startsWith('#/')) { if (parsedUrl.hash.match(/^#\/chronicle/)) { Chronicle.componentWithData((chronicleComponent) => { rerender(chronicleComponent); }); } } else { rerender(<Home />); } } processUrl();
Load the page according to the current url, using hashes.
Load the page according to the current url, using hashes.
JavaScript
mit
cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki,cosmowiki/cosmowiki
969aa542268675b9edfeae9a8139d229712f1000
server.js
server.js
var util = require('util'), connect = require('connect'), serveStatic = require('serve-static'), port = 80, app = connect(); app.use(serveStatic(__dirname)).listen(port); util.puts('Listening on ' + port + '...'); util.puts('Press Ctrl + C to stop.');
var util = require('util'), connect = require('connect'), serveStatic = require('serve-static'), port = process.env.PORT || 3000, app = connect(); app.use(serveStatic(__dirname)).listen(port); util.puts('Listening on ' + port + '...'); util.puts('Press Ctrl + C to stop.');
Update so PORT environment variable is used
Update so PORT environment variable is used
JavaScript
mit
maael/design-patterns-presentation
a6bb5eedb0f26bcdb5b837a5cffd86122db42cf8
src/index.js
src/index.js
// @flow import { elementNames } from './config' import create from './helper' export { apply } from './helper' export function tag(head: string, ...tail: any[]): Function { return create(head)(...tail) } export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } { const helpers = {} names.forEach(name => { helpers[name] = create(name) }) return helpers } export default createHelpers(elementNames)
// @flow import { elementNames } from './config' import create from './helper' export { apply } from './helper' function tag(head: string, ...tail: any[]): Function { return create(head)(...tail) } export function createHelpers(names: string[]): { [key: string]: (...args: any[]) => Function } { const helpers = {} names.forEach(name => { helpers[name] = create(name) }) helpers.tag = tag return helpers } export default createHelpers(elementNames)
Move `tag` helper in default export
Move `tag` helper in default export
JavaScript
mit
ktsn/vue-vnode-helper,ktsn/vue-vnode-helper
373fdd2d21739f38464fb502a75c063f07c8d1cf
src/index.js
src/index.js
var Alexa = require('alexa-sdk'); var APP_ID = 'amzn1.ask.skill.933585d3-ba4a-49f9-baed-86e109c589ed'; var SKILL_NAME = 'Snack Overflow'; var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ]; exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context, callback); alexa.registerHandlers(getRecipieHandlers); alexa.execute(); }; var getRecipieHandlers = { 'whatShouldIMakeIntent': function() { var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length); this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]); } };
var Alexa = require('alexa-sdk'); var APP_ID = 'amzn1.ask.skill.85ae7ea2-b727-4d2a-9765-5c563a5ec379'; var SKILL_NAME = 'Snack Overflow'; var POSSIBLE_RECIPIES = [ 'Chicken Parmesan', 'Spaghetti', 'Turkey Sandwich' ]; exports.handler = function(event, context, callback) { var alexa = Alexa.handler(event, context, callback); alexa.registerHandlers(getRecipieHandlers); alexa.execute(); }; var getRecipieHandlers = { 'whatShouldIMakeIntent': function() { var recipieNum = Math.floor(Math.random() * POSSIBLE_RECIPIES.length); this.emit(':tell', POSSIBLE_RECIPIES[recipieNum]); } };
Update APP_ID to correct app id
Update APP_ID to correct app id
JavaScript
mit
cwboden/amazon-hackathon-alexa
0825b7031e33edfd6d684118046bced28b0a2fd2
src/index.js
src/index.js
import isFunction from 'lodash/isFunction'; import isObject from 'lodash/isObject'; import assign from 'lodash/assign'; import pick from 'lodash/pick'; import flatten from 'lodash/flatten'; import pickBy from 'lodash/pickBy'; import assignWith from 'lodash/assignWith'; import compose from './compose'; export const isDescriptor = isObject; export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose); export const isComposable = obj => isDescriptor(obj) || isStamp(obj); export const init = (...functions) => compose({ initializers: flatten(functions) }); export const overrides = (...keys) => { const flattenKeys = flatten(keys); return compose({ initializers: [function (opt) { assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys)); }] }); }; export const namespaced = (keyStampMap) => { const keyStampMapClone = pickBy(keyStampMap, isStamp); return compose({ initializers: [function (opt) { const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]); assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt)); assign(this, optClone); }] }); };
import { isFunction, isObject, assign, assignWith, pick, pickBy, flatten } from 'lodash'; import compose from './compose'; export const isDescriptor = isObject; export const isStamp = obj => isFunction(obj) && isFunction(obj.compose) && isDescriptor(obj.compose); export const isComposable = obj => isDescriptor(obj) || isStamp(obj); export const init = (...functions) => compose({ initializers: flatten(functions) }); export const overrides = (...keys) => { const flattenKeys = flatten(keys); return compose({ initializers: [function (opt) { assign(this, flattenKeys.length === 0 ? opt : pick(opt, flattenKeys)); }] }); }; export const namespaced = (keyStampMap) => { const keyStampMapClone = pickBy(keyStampMap, isStamp); return compose({ initializers: [function (opt) { const optClone = pickBy(opt, (value, key) => keyStampMapClone[key]); assignWith(optClone, keyStampMapClone, (innerOpt, stamp) => stamp(innerOpt)); assign(this, optClone); }] }); };
Use single import of lodash
Use single import of lodash
JavaScript
mit
stampit-org/stamp-utils
d715a4bbc039e4959caabcb3e92ccc8a7626d555
public/javascripts/application.js
public/javascripts/application.js
$(document).ready(function() { var divs = "#flash_success, #flash_notice, #flash_error"; $(divs).each(function() { humanMsg.displayMsg($(this).text()); return false; }); if (window.location.href.search(/query=/) == -1) { $('#query').one('click', function() { $(this).val(''); }); } $(document).bind('keyup', function(event) { if ($(event.target).is(':input')) { return; } if (event.which == 83) { $('#query').focus(); } }); if ($('.count').length > 0) { setInterval(function() { $.getJSON("/api/v1/downloads.json", function(data) { $(".count strong").text(number_with_delimiter(data['total']) + " downloads"); }); }, 5000); } }); // http://kevinvaldek.com/number-with-delimiter-in-javascript function number_with_delimiter(number, delimiter) { number = number + '', delimiter = delimiter || ','; var split = number.split('.'); split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter); return split.join('.'); };
$(document).ready(function() { $('#flash_success, #flash_notice, #flash_error').each(function() { humanMsg.displayMsg($(this).text()); }); if (window.location.href.search(/query=/) == -1) { $('#query').one('click, focus', function() { $(this).val(''); }); } $(document).bind('keyup', function(event) { if ($(event.target).is(':input')) { return; } if (event.which == 83) { $('#query').focus(); } }); if ($('.count').length > 0) { setInterval(function() { $.getJSON('/api/v1/downloads.json', function(data) { $('.count strong') .text(number_with_delimiter(data['total']) + ' downloads'); }); }, 5000); } }); // http://kevinvaldek.com/number-with-delimiter-in-javascript function number_with_delimiter(number, delimiter) { number = number + '', delimiter = delimiter || ','; var split = number.split('.'); split[0] = split[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1' + delimiter); return split.join('.'); };
Clear the search query on focus as well and some minor JS clean up.
Clear the search query on focus as well and some minor JS clean up.
JavaScript
mit
bpm/getbpm.org,bpm/getbpm.org,alloy/gemcutter,dstrctrng/private_event,square/rubygems.org,alloy/gemcutter,dstrctrng/private_event,rubygems/rubygems.org-backup,rubygems/rubygems.org-backup,square/rubygems.org,1337807/rubygems.org,1337807/rubygems.org,square/rubygems.org,1337807/rubygems.org,rubygems/rubygems.org-backup
56a95bd9065a4299a0195b6408ade51b47640ee2
services/bovada.js
services/bovada.js
const axios = require('axios'); const BovadaParser = require('../services/BovadaParser'); axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football'; axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36'; module.exports.getLines = async () => { const [regSeasonResp, playoffResp] = await Promise.all([ axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'), ]); return BovadaParser.call(regSeasonResp.data) .concat(BovadaParser.call(playoffResp.data)); };
const axios = require('axios'); const BovadaParser = require('../services/BovadaParser'); axios.defaults.baseURL = 'https://www.bovada.lv/services/sports/event/v2/events/A/description/football'; axios.defaults.headers.common['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.96 Safari/537.36'; module.exports.getLines = async () => { const [regSeasonResp, playoffResp, superBowlResp] = await Promise.all([ axios.get('/nfl?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/nfl-playoffs?marketFilterId=def&preMatchOnly=true&lang=en'), axios.get('/super-bowl?marketFilterId=def&preMatchOnly=true&lang=en'), ]); return BovadaParser.call(regSeasonResp.data) .concat(BovadaParser.call(playoffResp.data)) .concat(BovadaParser.call(superBowlResp.data)); };
Add Bovada endpoint for super bowl lines
Add Bovada endpoint for super bowl lines
JavaScript
mit
lentz/buddyduel,lentz/buddyduel,lentz/buddyduel
eeee14f6c0d0ae83cce051024739940960474147
plugin.js
plugin.js
/** * @file insert Non-Breaking SPace for CKEditor * Copyright (C) 2014 Alfonso Martnez de Lizarrondo * Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor * */ CKEDITOR.plugins.add( 'nbsp', { init : function( editor ) { // Insert &nbsp; if Ctrl+Space is pressed: editor.addCommand( 'insertNbsp', { exec: function( editor ) { editor.insertHtml( '&nbsp;' ); } }); editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' ); } } );
/** * @file insert Non-Breaking Space for CKEditor * Copyright (C) 2014 Alfonso Martínez de Lizarrondo * Create a command and enable the Ctrl+Space shortcut to insert a non-breaking space in CKEditor * */ CKEDITOR.plugins.add( 'nbsp', { init : function( editor ) { // Insert &nbsp; if Ctrl+Space is pressed: editor.addCommand( 'insertNbsp', { exec: function( editor ) { editor.insertHtml( '&nbsp;', 'text' ); } }); editor.setKeystroke( CKEDITOR.CTRL + 32 /* space */, 'insertNbsp' ); } } );
Fix inline tag splitting and comment formatting
Fix inline tag splitting and comment formatting
JavaScript
mpl-2.0
AlfonsoML/nbsp
0e3042f89fb16fe3c130d1044b8e9c7f599f8e72
server.js
server.js
var app = require('express')(); var parser = require('./src/scrip').parse; app.get('/', function (req, res) { var scrip = req.query.scrip; var result = parser(scrip); res.send(result); }); app.listen('8000');
var app = require('express')(); var parser = require('./src/scrip').parse; app.get('/', function (req, res) { var scrip = req.query.scrip; if (scrip) { var result = parser(scrip); res.status(200).json(result); } else { res.status(422).json({'error': 'Invalid data'}); } }); app.listen('8000'); module.exports = app;
Return 422 for invalid parameters
Return 422 for invalid parameters
JavaScript
mit
pranavrc/scrip
64de8750546e31361e85a1ebe2917afe2c7c30df
mspace.js
mspace.js
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*jslint browser: true*/ "use strict"; (function () { window.addEventListener("load", function () { // Insert mathml.css if the <mspace> element is not supported. var box, div, link; div = document.createElement("div"); div.innerHTML = "<math><mspace height='23px' width='77px'/></math>"; document.body.appendChild(div); box = div.firstChild.firstChild.getBoundingClientRect(); document.body.removeChild(div); if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) { link = document.createElement("link"); link.href = "http://fred-wang.github.io/mathml.css/mathml.css"; link.rel = "stylesheet"; document.head.appendChild(link); } }); }());
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /*jslint browser: true*/ "use strict"; (function () { window.addEventListener("load", function () { // Insert mathml.css if the <mspace> element is not supported. var box, div, link; div = document.createElement("div"); div.innerHTML = "<math xmlns='http://www.w3.org/1998/Math/MathML'><mspace height='23px' width='77px'/></math>"; document.body.appendChild(div); box = div.firstChild.firstChild.getBoundingClientRect(); document.body.removeChild(div); if (Math.abs(box.height - 23) > 1 || Math.abs(box.width - 77) > 1) { link = document.createElement("link"); link.href = "http://fred-wang.github.io/mathml.css/mathml.css"; link.rel = "stylesheet"; document.head.appendChild(link); } }); }());
Add a MathML namespace so that the detection works in XML too.
Add a MathML namespace so that the detection works in XML too.
JavaScript
mpl-2.0
fred-wang/mathml.css,josephlewis42/mathml.css,fred-wang/mathml.css,josephlewis42/mathml.css
47b5d6c7a2e90dec04f1b7e751abed54347488a2
public/js/views/DashboardMainGraph.js
public/js/views/DashboardMainGraph.js
define([], function() { 'use strict'; return Backbone.View.extend({ jqplotId: null, initialize: function(options) { this.render(); var view = this; diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) { view.options.dashArgs.interval = interval; view.render(); }); }, render: function() { // Use convention-based IDs so markup can just hold positional containers. this.jqplotId = this.el.id + '-canvas'; var url = this.buildUrl('/job/count_all_graph?', { interval: this.options.dashArgs.interval }, false); var view = this; $.ajax( url, { success: function(data) { view.$el.empty(); view.$el.append($('<div>').attr('id', view.jqplotId)); var graphData = []; _.each(data, function(result, time) { graphData.push([time, result.count]); }); var defaults = { xaxis: { renderer: $.jqplot.DateAxisRenderer } }; var axes = diana.helpers.Graph.adjustAxes(graphData, defaults); try { $.jqplot( view.jqplotId, [graphData], { title: 'Events', axes: axes, series:[{lineWidth:2}] } ); } catch (e) { if (e.message != 'No data to plot.') { console.log(e); } } } }); } }); });
define([], function() { 'use strict'; return Backbone.View.extend({ jqplotId: null, initialize: function(options) { this.render(); var view = this; diana.helpers.Event.on('DashboardTimeIntervalChange', function(interval) { view.options.dashArgs.interval = interval; view.navigate('dashboard', view.options.dashArgs, {trigger: false}); view.render(); }); }, render: function() { // Use convention-based IDs so markup can just hold positional containers. this.jqplotId = this.el.id + '-canvas'; var url = this.buildUrl('/job/count_all_graph?', { interval: this.options.dashArgs.interval }, false); var view = this; $.ajax( url, { success: function(data) { view.$el.empty(); view.$el.append($('<div>').attr('id', view.jqplotId)); var graphData = []; _.each(data, function(result, time) { graphData.push([time, result.count]); }); var defaults = { xaxis: { renderer: $.jqplot.DateAxisRenderer } }; var axes = diana.helpers.Graph.adjustAxes(graphData, defaults); try { $.jqplot( view.jqplotId, [graphData], { title: 'Events', axes: axes, series:[{lineWidth:2}] } ); } catch (e) { if (e.message != 'No data to plot.') { console.log(e); } } } }); } }); });
Update route on interval drop-down changes.
Update route on interval drop-down changes.
JavaScript
mit
codeactual/mainevent
9b5395ab11d8b28bc996f42e266a11a591057551
online.js
online.js
#!/usr/bin/env node 'use strict'; let [,, onLineSrc, onCloseSrc ] = process.argv; let onLine = eval(onLineSrc) || (line => line); let onClose = eval(onCloseSrc) || (() => undefined); let env = new Set(); require('readline') .createInterface({ input: process.stdin }) .on('line', line => { let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || []; let value = onLine(line, columns, env); if (value != null) { console.log(value); } }) .on('close', () => { onClose(env); });
#!/usr/bin/env node 'use strict'; let [,, onLineSrc, onCloseSrc ] = process.argv; let onLine = eval(onLineSrc) || (line => line); let onClose = eval(onCloseSrc) || (() => undefined); let env = new Set(); require('readline') .createInterface({ input: process.stdin }) .on('line', line => { let columns = line.match(/('(\\'|[^'])*'|"(\\"|[^"])*"|\/(\\\/|[^\/])*\/|(\\ |[^ ])+|[\w-]+)/g) || []; let value = onLine(line, columns, env); if (value != null) { console.log(value); } }) .on('close', () => { let value = onClose(env); if (value != null) { console.log(value); } });
Print the return value of onClose if it's not null
Print the return value of onClose if it's not null
JavaScript
mit
bsdelf/scripts
e558d635be3c497a4766900400ad8b2acb26282f
gulpfile.js
gulpfile.js
var gulp = require('gulp') var connect = require('gulp-connect') var inlinesource = require('gulp-inline-source') gulp.task('connect', () => { connect.server({ root: 'dist', livereload: true }) }) gulp.task('html', () => { gulp.src('./src/index.html') .pipe(inlinesource()) .pipe(gulp.dest('./dist/')) .pipe(connect.reload()) }) gulp.task('watch', () => { gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']) }) gulp.task('default', ['connect', 'watch', 'html'])
var gulp = require('gulp'); var connect = require('gulp-connect'); var inlinesource = require('gulp-inline-source'); gulp.task('connect', () => { connect.server({ root: 'dist', livereload: true }) }) gulp.task('html', () => { gulp.src('./src/index.html') .pipe(inlinesource()) .pipe(gulp.dest('./dist/')) .pipe(connect.reload()); }) gulp.task('watch', () => { gulp.watch(['./src/*.html', './src/styles/*.css', './src/scripts/*.js'], ['html']); }) gulp.task('default', ['connect', 'watch', 'html']); gulp.task('test', ['html']);
Add test task for Gulp
Add test task for Gulp
JavaScript
mit
jeerbl/beat.pm,jeerbl/beat.pm
ead960958b97975c73851633e4c530ada3f374b8
gulpfile.js
gulpfile.js
'use strict'; const gulp = require('gulp'), fs = require('fs'), plumber = require('gulp-plumber'); const options = { source: 'templates', dist: 'dist', workingDir: 'tmp', src: function plumbedSrc() { return gulp.src.apply(gulp, arguments).pipe(plumber()); } }; /** * Load tasks from the '/tasks' directory. */ const build = require('./tasks/build')(options); const checkDeps = require('./tasks/check-deps')(options); const dupe = require('./tasks/dupe')(options); const less = require('./tasks/less')(options); const lint = require('./tasks/lint')(options); const postcss = require('./tasks/postcss')(options); const sass = require('./tasks/sass')(options); /* By default templates will be built into '/dist' */ gulp.task( 'default', gulp.series( ('dupe', 'less', 'sass', 'postcss', 'lint', 'build'), () => { /* gulp will watch for changes in '/templates'. */ gulp.watch( [ options.source + '/**/*.html', options.source + '/**/*.css', options.source + '/**/*.scss', options.source + '/**/*.less', options.source + '/**/conf.json' ], { delay: 500 }, gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build') ) } ) );
'use strict'; const gulp = require('gulp'), fs = require('fs'), plumber = require('gulp-plumber'); const options = { source: 'templates', dist: 'dist', workingDir: 'tmp', src: function plumbedSrc() { return gulp.src.apply(gulp, arguments).pipe(plumber()); } }; /** * Load tasks from the '/tasks' directory. */ const build = require('./tasks/build')(options); const checkDeps = require('./tasks/check-deps')(options); const dupe = require('./tasks/dupe')(options); const less = require('./tasks/less')(options); const lint = require('./tasks/lint')(options); const postcss = require('./tasks/postcss')(options); const sass = require('./tasks/sass')(options); /* Runs the entire pipeline once. */ gulp.task('run-pipeline', gulp.series('dupe', 'less', 'sass', 'postcss', 'lint', 'build')); /* By default templates will be built into '/dist'. */ gulp.task( 'default', gulp.series( 'run-pipeline', () => { /* gulp will watch for changes in '/templates'. */ gulp.watch( [ options.source + '/**/*.html', options.source + '/**/*.css', options.source + '/**/*.scss', options.source + '/**/*.less', options.source + '/**/conf.json' ], { delay: 500 }, gulp.series('run-pipeline') ) } ) );
Create a gulp task to run pipeline once
Create a gulp task to run pipeline once
JavaScript
mit
fadeit/responsive-html-email-signature,fadeit/responsive-html-email-signature
d5d5e4f18a4a3fb467bac398a0a28d5c9a1701f4
server/routes/dashboard/dashboard.route.js
server/routes/dashboard/dashboard.route.js
const express = require('express') const router = express.Router() module.exports = router
const express = require('express') const queryHelper = require('../../utilities/query') const router = express.Router() router.get('/number-of-student', (req, res) => { queryHelper.queryAndResponse({ sql: `select substr(student_id, 1, 2) as academic_year, count(*) as student_count from students group by substr(student_id, 1, 2)`, req: req, res: res }) }) router.get('/average-gpax', (req, res) => { queryHelper.queryAndResponse({ sql: `SELECT SUBSTRING(student_id, 1, 2) as academic_year, count(*) as student_count FROM students group by SUBSTRING(student_id, 1, 2)`, req: req, res: res }) }) module.exports = router
Add some service to dashboard
Add some service to dashboard
JavaScript
mit
JThanat/student-management-system,JThanat/student-management-system
2ce08f2ca4392a0a5753106e2f582a3310914596
gulpfile.js
gulpfile.js
var gulp = require('gulp'), // this is an arbitrary object that loads all gulp plugins in package.json. coffee = require('coffee-script/register'), $ = require("gulp-load-plugins")(), express = require('express'), path = require('path'), tinylr = require('tiny-lr'), assets = require('connect-assets'), app = express(), server = tinylr(); gulp.task('express', function() { // app.use(express.static(path.resolve('./dist'))); app.set('views', 'src/views'); app.set('view engine', 'jade'); require('./routes')(app); app.use(assets({ paths: ['src/scripts', 'src/images', 'src/stylesheets', 'src/views'] })); app.listen(1337); $.util.log('Listening on port: 1337'); }); // Default Task gulp.task('default', ['express']);
var gulp = require('gulp'), // this is an arbitrary object that loads all gulp plugins in package.json. coffee = require('coffee-script/register'), $ = require("gulp-load-plugins")(), express = require('express'), path = require('path'), tinylr = require('tiny-lr'), assets = require('connect-assets'), app = express(), server = tinylr(); gulp.task('express', function() { // app.use(express.static(path.resolve('./dist'))); app.set('views', 'src/views'); app.set('view engine', 'jade'); require('./routes')(app); app.use(assets({ paths: [ 'src/scripts', 'src/images', 'src/stylesheets', 'src/views', 'bower_components' ] })); app.listen(1337); $.util.log('Listening on port: 1337'); }); // Default Task gulp.task('default', ['express']);
Include bower components as assets
Include bower components as assets
JavaScript
mit
GeoSensorWebLab/Arctic-Scholar-Portal,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/asw-workbench,GeoSensorWebLab/Arctic-Scholar-Portal
4ab099864a19bc91b50122853b6dc1808466d443
gulpfile.js
gulpfile.js
var bower = require('bower'), eventStream = require('event-stream'), gulp = require('gulp'), chmod = require('gulp-chmod'), zip = require('gulp-zip'), tar = require('gulp-tar'), gzip = require('gulp-gzip'); // Installs bower dependencies gulp.task('bower', function(callback) { bower.commands.install([], {}, {}) .on('error', function(error) { callback(error); }) .on('end', function() { callback(); }); }); // Builds and packs plugins sources gulp.task('default', ['bower'], function() { var version = require('./package.json').version; return eventStream.merge( getSources() .pipe(zip('emoji-plugin-' + version + '.zip')), getSources() .pipe(tar('emoji-plugin-' + version + '.tar')) .pipe(gzip()) ) .pipe(chmod(0644)) .pipe(gulp.dest('release')); }); /** * Returns files stream with the plugin sources. * * @returns {Object} Stream with VinylFS files. */ var getSources = function() { return gulp.src([ 'Plugin.php', 'README.md', 'LICENSE', 'js/*', 'css/*', 'components/emoji-images/emoji-images.js', 'components/emoji-images/readme.md', 'components/emoji-images/pngs/*' ], {base: './'} ); }
var bower = require('bower'), eventStream = require('event-stream'), gulp = require('gulp'), chmod = require('gulp-chmod'), zip = require('gulp-zip'), tar = require('gulp-tar'), gzip = require('gulp-gzip'); // Installs bower dependencies gulp.task('bower', function(callback) { bower.commands.install([], {}, {}) .on('error', function(error) { callback(error); }) .on('end', function() { callback(); }); }); gulp.task('prepare-release', ['bower'], function() { var version = require('./package.json').version; return eventStream.merge( getSources() .pipe(zip('emoji-plugin-' + version + '.zip')), getSources() .pipe(tar('emoji-plugin-' + version + '.tar')) .pipe(gzip()) ) .pipe(chmod(0644)) .pipe(gulp.dest('release')); }); // Builds and packs plugins sources gulp.task('default', ['prepare-release'], function() { // The "default" task is just an alias for "prepare-release" task. }); /** * Returns files stream with the plugin sources. * * @returns {Object} Stream with VinylFS files. */ var getSources = function() { return gulp.src([ 'Plugin.php', 'README.md', 'LICENSE', 'js/*', 'css/*', 'components/emoji-images/emoji-images.js', 'components/emoji-images/readme.md', 'components/emoji-images/pngs/*' ], {base: './'} ); }
Add prepare-release task for consistency
Add prepare-release task for consistency
JavaScript
apache-2.0
Mibew/emoji-plugin,Mibew/emoji-plugin
a91c6b4ca951b8cf5d1076d4f7b35746ddbf034f
shared/chat/conversation/messages/retry.js
shared/chat/conversation/messages/retry.js
// @flow import React from 'react' import {globalColors} from '../../../styles' import {Box, Text} from '../../../common-adapters' const Retry = ({onRetry}: {onRetry: () => void}) => ( <Box> <Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text> <Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text> <Text type='BodySmall' style={{color: globalColors.red, textDecoration: 'underline'}} onClick={onRetry}>Retry</Text> </Box> ) export default Retry
// @flow import React from 'react' import {globalColors, globalStyles} from '../../../styles' import {Text} from '../../../common-adapters' const Retry = ({onRetry}: {onRetry: () => void}) => ( <Text type='BodySmall'> <Text type='BodySmall' style={{fontSize: 9, color: globalColors.red}}>{'┏(>_<)┓'}</Text> <Text type='BodySmall' style={{color: globalColors.red}}> Failed to send. </Text> <Text type='BodySmall' style={{color: globalColors.red, ...globalStyles.textDecoration('underline')}} onClick={onRetry}>Retry</Text> </Text> ) export default Retry
Fix styling of Retry component on mobile
Fix styling of Retry component on mobile
JavaScript
bsd-3-clause
keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client,keybase/client
7b3bdf9c919d38bf18b8825d75deb0f6018c0e37
httpmock.js
httpmock.js
var argv = require('optimist') .usage("Usage: $0 --config [config] --port [port]") .demand(['config']) .default('port', 5000) .argv; var mock = require('./src/mock.js').mock; mock(argv.port, process.cwd + "/" + argv.config);
var argv = require('optimist') .usage("Usage: $0 --config [config] --port [port]") .demand(['config']) .default('port', 5000) .argv; var mock = require('./src/mock.js').mock; mock(argv.port, argv.config);
Revert "Look for mock.js in the current directory"
Revert "Look for mock.js in the current directory" This reverts commit c7f1aa03479a7fd2dedc5d172fbdc0dc692bcf85. Conflicts: httpmock.js
JavaScript
mit
tildedave/httpmock.js
3c4b2a07c509c7031e7e914729982fc3431872d9
server.js
server.js
'use strict'; const express = require('express'); const app = express(); const path = require('path'); const twilio = require('twilio'); const bodyparser = require('body-parser'); const onConnect = require('./lib/socket').onConnect; const twilioRoute = require('./lib/twilio'); app.use(express.static(path.join(__dirname, 'public'))); app.use(bodyparser.json()); app.post('/twilio/response', twilio.webhook({ validate: false }), twilioRoute.response); const server = require('http').createServer(app); const io = require('socket.io')(server); server.listen(process.env.port || 3000); io.on('connection', onConnect);
'use strict'; const express = require('express'); const app = express(); const path = require('path'); const twilio = require('twilio'); const bodyparser = require('body-parser'); const onConnect = require('./lib/socket').onConnect; const twilioRoute = require('./lib/twilio'); app.use(express.static(path.join(__dirname, 'public'))); app.use(bodyparser.urlencoded({ extended: false })); app.post('/twilio/response', twilio.webhook({ validate: false }), twilioRoute.response); const server = require('http').createServer(app); const io = require('socket.io')(server); server.listen(process.env.port || 3000); io.on('connection', onConnect);
Switch json for url parser
Switch json for url parser
JavaScript
apache-2.0
peterjuras/askeighty,peterjuras/askeighty
ecd6064267b8bbdd126dbda09e74f85cdabc729f
src/reducers/visibilityFilter.js
src/reducers/visibilityFilter.js
const visibilityFilter = (state = 'SHOW_ALL', action) => { switch(action.type) { case 'SET_VISIBILITY_FILTER': return action.filter; default: return state; } }; export default visibilityFilter;
const visibilityFilter = (state = 'SHOW_ALL', action) => { switch(action.type) { case 'ADD_ITEM': return 'SHOW_ALL'; case 'SET_VISIBILITY_FILTER': return action.filter; default: return state; } }; export default visibilityFilter;
Set viz-filter to SHOW_ALL when adding a new item
Set viz-filter to SHOW_ALL when adding a new item
JavaScript
mit
blaqbern/lists,blaqbern/lists
b2f2591150c2bcc640fd706eef8cd2ae1cc740ad
src/actions/headerNav.js
src/actions/headerNav.js
import { HEADER_NAV_MOUSE_ENTER, HEADER_NAV_MOUSE_LEAVE, SET_HEADER_NAV } from '../constants/headerNav'; import { setCurrentAsset } from '../actions/assets'; import keyBy from 'lodash/keyBy'; export const setCurrentHeaderNav = headerNavID => dispatch => { dispatch({ type: SET_HEADER_NAV, payload: headerNavID }); }; export const headevNavMouseEnter = headerNavID => dispatch => { dispatch({ type: HEADER_NAV_MOUSE_ENTER, payload: headerNavID }); }; export const headevNavMouseLeave = () => dispatch => { dispatch({ type: HEADER_NAV_MOUSE_LEAVE }); }; export const headerNavClick = headerNavID => (dispatch, getState) => { const mapping = keyBy(getState().assetsToHeaderNavMapping, 'headerNavID')[headerNavID]; mapping && dispatch(setCurrentAsset(mapping.assetID)); dispatch(setCurrentHeaderNav(headerNavID)); };
import { HEADER_NAV_MOUSE_ENTER, HEADER_NAV_MOUSE_LEAVE, SET_HEADER_NAV } from '../constants/headerNav'; import { setCurrentAsset } from '../actions/assets'; import keyBy from 'lodash/keyBy'; export const setCurrentHeaderNav = headerNavID => dispatch => { dispatch({ type: SET_HEADER_NAV, payload: headerNavID }); }; export const headevNavMouseEnter = headerNavID => dispatch => { dispatch({ type: HEADER_NAV_MOUSE_ENTER, payload: headerNavID }); }; export const headevNavMouseLeave = () => dispatch => { dispatch({ type: HEADER_NAV_MOUSE_LEAVE }); }; export const headerNavClick = headerNavID => (dispatch, getState) => { const mapping = keyBy(getState().assetsToHeaderNavMapping, 'headerNavID')[headerNavID]; mapping && dispatch(setCurrentAsset(mapping.assetID)); dispatch(setCurrentHeaderNav(headerNavID)); dispatch(headevNavMouseLeave()); };
Hide submenu on click sub menu item
Hide submenu on click sub menu item
JavaScript
mit
g8extended/Character-Generator,g8extended/Character-Generator
b487ddf16e2a8c396b927fb580919716a951f0a3
bin/imp.js
bin/imp.js
#! /usr/bin/env node var program = require("commander"); program .version("0.0.1") .command("devices [options]", "Lists devices, or adds/removes devices from project") .command("deploy [options]", "Deploys the project") .command("init", "Creates a new imp project") .command("log [options]", "Logs messages from specified device") .command("login [options]", "Sets your global API-Key") .command("models [options]", "Lists models, or sets the project's model") .command("pull [options]", "Fetches the most recent code from the imp server") .command("migrate [options]", "Migrates model from development imp server to production imp server") program.parse(process.argv);
#! /usr/bin/env node var program = require("commander"); program .version("0.0.1") .command("devices [options]", "Lists devices, or adds/removes devices from project") .command("deploy [options]", "Deploys the project") .command("init", "Creates a new imp project") .command("log [options]", "Logs messages from specified device") .command("login [options]", "Sets your global API-Key") .command("models [options]", "Lists models, or sets the project's model") .command("pull [options]", "Fetches the most recent code from the imp server") .command("migrate [options]", "Migrates model from one imp account to another (useful for commercial customers with dev accounts and limited access production accounts)") program.parse(process.argv);
Update migrate help text so that its purpose was more clear
Update migrate help text so that its purpose was more clear
JavaScript
mit
deldrid1/imp-cli,matt-haines/imp-cli,cat-haines/imp-cli
9e1f44dd5609ae683e9bb147f7c84955b3b7bdaa
bleep.com-dance-all-night.user.js
bleep.com-dance-all-night.user.js
// ==UserScript== // @name bleep.com dance all night // @namespace rob@middlerob.com // @include https://bleep.com/* // @version 1 // @description Disable the 60 second pause on bleep.com // @license MIT // @oujs:author middlerob // @grant none // ==/UserScript== eval(durationChanged.toString().replace('durationChanged', 'fixedDurationChanged').replace(60, 1000000)) $('#jplayer') .unbind($.jPlayer.event.timeupdate) .bind($.jPlayer.event.timeupdate, fixedDurationChanged)
// ==UserScript== // @name bleep.com dance all night // @namespace rob@middlerob.com // @include https://bleep.com/* // @version 2 // @description Disable the 60 second pause on bleep.com // @license MIT // @oujs:author middlerob // @grant none // ==/UserScript== setInterval(function() { window.playableTime = 1000000 }, 2000)
Fix script to work with latest website updates
Fix script to work with latest website updates
JavaScript
mit
Rob-ot/bleep.com-dance-all-night
8f05bb23c68bf3ded65cbf9b145f1f299b44205c
src/defaults.js
src/defaults.js
const defaults = { /** * Label */ label: 'Dialog', /** * Description - ID of HTMLElement to use as aria-describedby */ description: '', /** * Focus - HTMLElement to focus on open */ focus: '', /** * Alert - Is the dialog an alert? */ alert: false, openClass: 'is-open', /** * Auto initiate on instantiation */ autoInit: true, }; export default defaults;
/** * Default configuration. * * @property {string} label - ID of HTMLElement to use as label or a string. * @property {string} description - ID of HTMLElement to use as aria-describedby. * @property {boolean} alert - Set dialog role to alertdialog. * @property {string} openClass - The class applied to elements.dialog when open. */ const defaults = { label: 'Dialog', description: '', alert: false, openClass: 'is-open', }; export default defaults;
Add docblock to default configuration object
Add docblock to default configuration object
JavaScript
mit
rynpsc/dialog,rynpsc/dialog
3561e1abd475ac6b1d3a48076b9f5d8a5ebaf3f1
src/components/Facets/FacetsGroup.js
src/components/Facets/FacetsGroup.js
import React, { Component } from 'react' import Facet from './Facet' import { isActive } from '../../helpers/manageFilters' const styles = { type: { textTransform: 'capitalize', fontSize: '1em', fontWeight: 400, marginBottom: '1em', }, group: { marginBottom: '1em', } } class FacetsGroup extends Component { render() { const { type, facets, filters, addFilter } = this.props return ( <div style={styles.group}> <h4 style={styles.type}>{type}</h4> {facets.map((facet, idx) => <Facet key={idx} name={type} value={facet.value} count={facet.count} isActive={isActive(filters, {name: type, value: facet.value})} addFilter={addFilter} />)} </div> ) } } export default FacetsGroup
import React, { Component } from 'react' import Facet from './Facet' import { isActive } from '../../helpers/manageFilters' const styles = { type: { textTransform: 'capitalize', fontSize: '1em', fontWeight: 400, marginBottom: '1em', }, group: { marginBottom: '1em', } } class FacetsGroup extends Component { render() { const { type, facets, filters, addFilter } = this.props const activeMap = facets.map(facet => isActive(filters, {name: type, value: facet.value})) if (activeMap.indexOf(false) === -1) { return null; } return ( <div style={styles.group}> <h4 style={styles.type}>{type}</h4> {facets.map((facet, idx) => <Facet key={idx} name={type} value={facet.value} count={facet.count} isActive={activeMap[idx]} addFilter={addFilter} />)} </div> ) } } export default FacetsGroup
Hide facet if no filters are still inactive inside
Hide facet if no filters are still inactive inside
JavaScript
mit
sgmap/inspire,sgmap/inspire
bf33de8661a8d2ff1dfa415929c86679eb7c8cc0
src/css-clean-src/sortCss/sortCss.js
src/css-clean-src/sortCss/sortCss.js
function sortCss(settings, cssObject) { function sortDeep(array) { sortCss.scope(settings, array, { displace : [ 'sass function', 'sass import', 'sass include', 'sass include arguments', 'sass mixin', 'sass include block', 'sass extend', 'property group', ] }); for (var i = 0, n = array.length; i < n; i++) { if (Array.isArray(array[i].content) && array[i].content.length) { sortDeep(array[i].content); } } } sortCss.scope(settings, cssObject, { displace : [ 'sass import', 'sass include', 'sass variable assignment', 'font face', 'sass function', 'sass mixin', 'sass include block', 'sass placeholder', ] }); if (settings.sortBlockScope) { for (var i = 0, n = cssObject.length; i < n; i++) { if (Array.isArray(cssObject[i].content) && cssObject[i].content.length) { sortDeep(cssObject[i].content); } } } } sortCss.list = {}; sortCss.each = {};
function sortCss(settings, cssObject) { var displaceDeep = [ 'sass function', 'sass import', 'sass include', 'sass include arguments', 'sass mixin', 'sass include block', 'sass extend', 'property group', ]; var displaceZeroDepth = [ 'sass import', 'sass include', 'sass variable assignment', 'font face', 'sass function', 'sass mixin', 'sass include block', 'sass placeholder', ]; function sortDeep(array) { sortCss.scope(settings, array, { displace : displaceDeep }); for (var i = 0, n = array.length; i < n; i++) { if (Array.isArray(array[i].content) && array[i].content.length) { sortDeep(array[i].content); } } } sortCss.scope(settings, cssObject, { displace : displaceZeroDepth }); if (settings.sortBlockScope) { for (var i = 0, n = cssObject.length; i < n; i++) { if (Array.isArray(cssObject[i].content) && cssObject[i].content.length) { sortDeep(cssObject[i].content); } } } } sortCss.list = {}; sortCss.each = {};
Declare 'displace' arrays at the top of the function
Declare 'displace' arrays at the top of the function
JavaScript
mit
SeanJM/atom-css-clean
3eb178c27d595833fe1ea7ebeb846c37ffd094e4
js/board.js
js/board.js
import settings from 'settings'; import { bind } from 'util/dom'; var worker; var messageCount; var callbacks; function post (command, data, callback) { callbacks[messageCount] = callback; worker.postMessage({ id: messageCount, command: command, data: JSON.parse(JSON.stringify(data)), }); messageCount++; } function messageHandler (event) { var message = event.data; if (callbacks[message.id]) { callbacks[message.id](message.data); delete callbacks[message.id]; } } export function getJewel (x, y, callback) { post('getJewel', { x: x, y: y, }, callback); } export function getBoard (callback) { post('getBoard', null, callback); } export function print () { post('print', null, function (jewels) { console.log(jewels); }); } export function swap (x1, y1, x2, y2, callback) { post('swap', { x1: x1, y1: y1, x2: x2, y2: y2 }, callback); } export function initialize (callback) { messageCount = 0; callbacks = []; worker = new Worker('/scripts/workers/board.js'); bind(worker, 'message', messageHandler); post('initialize', settings, callback); }
import settings from 'settings'; import { bind } from 'util/dom'; var worker; var messageCount; var callbacks; function post (command, data, callback) { callbacks[messageCount] = callback; worker.postMessage({ id: messageCount, command: command, data: JSON.parse(JSON.stringify(data)), }); messageCount++; } function messageHandler (event) { var message = event.data; if (callbacks[message.id]) { callbacks[message.id](message.data); delete callbacks[message.id]; } } export function getJewel (x, y, callback) { post('getJewel', { x: x, y: y, }, callback); } export function getBoard (callback) { post('getBoard', null, callback); } export function print () { post('print', null, function (jewels) { console.log(jewels); }); } export function swap (x1, y1, x2, y2, callback) { post('swap', { x1: x1, y1: y1, x2: x2, y2: y2 }, callback); } export function initialize (callback) { messageCount = 0; callbacks = []; worker = new Worker('/scripts/workers/board.js'); bind(worker, 'message', messageHandler); bind(worker, 'error', function (err) { console.log('worker error:', err); }); post('initialize', settings, callback); }
Add error handler to Web Worker
Add error handler to Web Worker
JavaScript
mit
darvelo/match-three
4d84f4549135fce864890b00deedfb81eed3ad23
js/count.js
js/count.js
document.addEventListener("DOMContentLoaded", function (event) { // redirect to 7777 port // ping golang counter httpGetAsync("http://www.aracki.me:7777/count", function (res) { alert(res); }) }); function httpGetAsync(theUrl, callback) { var xmlHttp = new XMLHttpRequest(); xmlHttp.onreadystatechange = function () { if (xmlHttp.readyState === 4 && xmlHttp.status === 200) callback(xmlHttp.responseText); }; xmlHttp.open("GET", theUrl, true); // true for asynchronous xmlHttp.setRequestHeader("Access-Control-Allow-Origin", '*'); xmlHttp.setRequestHeader("Access-Control-Allow-Methods", 'GET, POST, PATCH, PUT, DELETE, OPTIONS'); xmlHttp.setRequestHeader("Access-Control-Allow-Headers", 'Origin, Content-Type, X-Auth-Token'); xmlHttp.send("ivan"); }
document.addEventListener("DOMContentLoaded", function (event) { // redirect to 7777 port // ping golang counter getRequest("localhost:7777/count", function (request) { var response = request.currentTarget.response || request.target.responseText; console.log(response); }) }); function getRequest(url, success) { var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.onload = success; xhr.send(); return xhr; }
Add getRequest() to golang app
Add getRequest() to golang app
JavaScript
mit
Aracki/aracki.me,Aracki/aracki.me
f4035de99216e3c4d587a53e5f728316acab1f22
server.js
server.js
const express = require('express') const path = require('path') const fs = require('fs') const formidable = require('formidable') const app = express() const PORT = process.env.PORT || 9000 const UPLOAD_DIR = path.join(__dirname, 'uploads/') if (!fs.existsSync(UPLOAD_DIR)) { console.warn('Creating uploads folder...') fs.mkdirSync(UPLOAD_DIR) } console.info(`Uploads will be saved in ${UPLOAD_DIR}`) app.use(express.static(path.join(__dirname, 'build'))) app.get('/*', function (req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')) }) app.post('/uploads', function (req, res) { var form = new formidable.IncomingForm() form.parse(req) form.on('fileBegin', function (name, file) { file.path = `${UPLOAD_DIR}${file.name}` }) form.on('file', function (name, file) { console.log('Uploaded ' + file.name) }) res.header('Access-Control-Allow-Origin', '*') res.header( 'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept' ) res.status(200).json({ success: true, status: 'Form successfully submitted' }) }) app.listen(PORT, _ => console.info(`Server listening on PORT ${PORT}...`))
const express = require('express') const path = require('path') const fs = require('fs') const formidable = require('formidable') const app = express() const PORT = process.env.PORT || 9000 const UPLOAD_DIR = path.join(__dirname, 'uploads/') const CORS = process.env.NODE_ENV === 'production' ? process.env.HOST : '*' if (!fs.existsSync(UPLOAD_DIR)) { console.warn('Creating uploads folder...') fs.mkdirSync(UPLOAD_DIR) } console.info(`Uploads will be saved in ${UPLOAD_DIR}`) app.use(express.static(path.join(__dirname, 'build'))) app.get('/*', function (req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')) }) app.post('/uploads', function (req, res) { var form = new formidable.IncomingForm() form.parse(req) form.on('fileBegin', function (name, file) { file.path = `${UPLOAD_DIR}${file.name}` }) form.on('file', function (name, file) { console.log('Uploaded ' + file.name) }) res.header('Access-Control-Allow-Origin', CORS) res.header( 'Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept' ) res.status(200).json({ success: true, status: 'Form successfully submitted' }) }) app.listen(PORT, _ => console.info(`Server listening on PORT ${PORT}...`))
Change CORS to be set by environment
Change CORS to be set by environment
JavaScript
mit
planigan/resource-center,planigan/resource-center,fus-marcom/resource-center,fus-marcom/resource-center
647e62ffa45e6cd91bf2232c7dfbe78055705599
knexfile.js
knexfile.js
/** * This file is automatically loaded when knex runs migrations */ require('babel-register')(); const config = require('./server/config').default; module.exports = { client: 'mssql', connection: { server: config.db.server, user: config.db.user, password: config.db.password, database: config.db.name, options: { encrypt: true, }, }, };
/** * This file is automatically loaded when knex runs migrations */ require('babel-register')(); const config = require('./server/config').default; module.exports = { client: 'mssql', connection: { server: config.db.server, user: config.db.user, password: config.db.password, database: config.db.name, options: { encrypt: true, }, }, acquireConnectionTimeout: 5000, };
Use a more sensible connection timeout for knex
Use a more sensible connection timeout for knex
JavaScript
mit
noms-digital-studio/csra-app,noms-digital-studio/csra-app,noms-digital-studio/csra-app
5df0f46b25b9d97e5a20a9488de3ee01fc9baa71
app/assets/javascripts/deck.js
app/assets/javascripts/deck.js
var Deck = function(cards = []) { this.cards = cards; }; Deck.prototype.addCard = function(card) { this.cards.push(card); }; Deck.prototype.nextCard = function(card) { return this.cards.pop(); }; Deck.prototype.fetchCards = function() { var request = $.ajax({ method: 'POST', url: '/decks/new', data: $("input").serialize() }) .done(function(resp) { deckCallBack(resp); }) }; Deck.prototype.updateHistory = function(card, state) { // Send back the result of the card json_card = { card_id: card["id"], card_name: card["name"], card_state: state } $.ajax({ method: 'PUT', url: '/decks/' + card["id"] + '/update', data: json_card }) };
var Deck = function() { this.cards = []; }; Deck.prototype.addCard = function(card) { this.cards.push(card); }; Deck.prototype.nextCard = function(card) { return this.cards.pop(); }; Deck.prototype.fetchCards = function() { var request = $.ajax({ method: 'POST', url: '/decks/new', data: $("input").serialize() }) .done(function(resp) { deckCallBack(resp); }) }; Deck.prototype.updateHistory = function(card, state) { // Send back the result of the card json_card = { card_id: card["id"], card_name: card["name"], card_state: state } $.ajax({ method: 'PUT', url: '/decks/' + card["id"] + '/update', data: json_card }) };
Remove cards == [] from Deck()
Remove cards == [] from Deck()
JavaScript
mit
zjuanz/tendr,zjuanz/tendr,zjuanz/tendr
0ee588e3e67535829d31b06b5da91ffb3d1910a8
src/apis/GifAPI.js
src/apis/GifAPI.js
import * as _ from 'lodash' import UUID from 'node-uuid'; const KEY = 'GIFS'; export const loadData = () => { let data = JSON.parse(localStorage.getItem(KEY)); if (_.isEmpty(data)) { return {}; } else { return data; } }; export const update = (update) => { localStorage.setItem(KEY, JSON.stringify(update)); }; export const mock = (max = 10) => { localStorage.clear(); let data = []; for(let i = 0; i < max; i++) { data.push({ id: UUID.v4(), name: 'Test ' + i, url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif' }); } localStorage.setItem(KEY, JSON.stringify(data)) };
import * as _ from 'lodash' import UUID from 'node-uuid'; const KEY = 'GIFS'; export const loadData = () => { let data = JSON.parse(localStorage.getItem(KEY)); if (_.isEmpty(data)) { return {}; } else { return data; } }; export const update = (update) => { localStorage.setItem(KEY, JSON.stringify(update)); }; export const mock = (max = 10) => { localStorage.clear(); let data = []; for(let i = 0; i < max; i++) { data.push({ id: UUID.v4(), name: 'Test ' + i, url: 'http://media2.giphy.com/media/geozuBY5Y6cXm/giphy.gif', still_url: 'https://media2.giphy.com/media/geozuBY5Y6cXm/giphy_s.gif' }); } localStorage.setItem(KEY, JSON.stringify(data)) };
Add stil url in mock
Add stil url in mock
JavaScript
mit
macpie/Gif-Chrome-Extension,macpie/Gif-Chrome-Extension
f60385580b7db9ef8a0a8a137d95e08abccb854e
lib/util.js
lib/util.js
/** * Download tool for Unicode CLDR JSON data * * Copyright 2013 Rafael Xavier de Souza * Released under the MIT license * https://github.com/rxaviers/cldr-data-downloader/blob/master/LICENSE-MIT */ "use strict"; var assert = require("assert"); var fs = require("fs"); var url = require("url"); module.exports = { deepEqual: function(a, b) { try { assert.deepEqual(a, b); } catch (error) { if (error.name === "AssertionError") { return false; } throw error; } return true; }, isUrl: function(urlOrPath) { urlOrPath = url.parse(urlOrPath); return urlOrPath.hostname ? true : false; }, readJSON: function(filepath) { return JSON.parse(fs.readFileSync(filepath)); } };
/** * Download tool for Unicode CLDR JSON data * * Copyright 2013 Rafael Xavier de Souza * Released under the MIT license * https://github.com/rxaviers/cldr-data-downloader/blob/master/LICENSE-MIT */ "use strict"; var assert = require("assert"); var fs = require("fs"); var url = require("url"); module.exports = { deepEqual: function(a, b) { try { assert.deepEqual(a, b); } catch (error) { if (error instanceof assert.AssertionError) { return false; } throw error; } return true; }, isUrl: function(urlOrPath) { urlOrPath = url.parse(urlOrPath); return urlOrPath.hostname ? true : false; }, readJSON: function(filepath) { return JSON.parse(fs.readFileSync(filepath)); } };
Check error with instance of
Check error with instance of Closes #22 Signed-off-by: Dominic Bartl <a9662aa7a7b7ac6326ee7732d0f7f2070642dd85@gmail.com>
JavaScript
mit
rxaviers/cldr-data-downloader
9163379bf273fde65b13d8a6b989c9c3b09a079e
app/webpacker/packs/vue_app.js
app/webpacker/packs/vue_app.js
import Vue from 'vue/dist/vue.esm'; import store from '../store/index.js.erb'; import '../config/axios'; import '../directives/selectionchange'; import TheAnnotator from '../components/TheAnnotator.vue.erb'; import AnnotationHandle from "../components/AnnotationHandle"; document.addEventListener('DOMContentLoaded', () => { const app = new Vue({ el: '#app', store, components: { TheAnnotator, AnnotationHandle } }); window.app = app; });
import 'polyfills'; import Vue from 'vue/dist/vue.esm'; import store from '../store/index.js.erb'; import '../config/axios'; import '../directives/selectionchange'; import TheAnnotator from '../components/TheAnnotator.vue.erb'; import AnnotationHandle from "../components/AnnotationHandle"; document.addEventListener('DOMContentLoaded', () => { const app = new Vue({ el: '#app', store, components: { TheAnnotator, AnnotationHandle } }); window.app = app; });
Include polyfills for vue app js
Include polyfills for vue app js
JavaScript
agpl-3.0
harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o,harvard-lil/h2o
5712884c7ddbe7edafdf2c3e03f456d031d96e84
app/js/controllers/main_controller.js
app/js/controllers/main_controller.js
annotationApp.controller('MainController', function($scope) { $scope.tokens = [ { 'string' : 'Marcus', 'id' : '1' }, { 'string' : 'rosam', 'id' : '2' }, { 'string' : 'videt', 'id' : '3' }, { 'string' : '.', 'id' : '4' } ]; $scope.selectedToken = { id: '1' }; $scope.currentToken = function() { return $scope.tokens[$scope.selectedToken.id - 1] }; });
annotationApp.controller('MainController', function($scope) { $scope.tokens = [ { 'string' : 'Marcus', 'id' : '1' }, { 'string' : 'rosam', 'id' : '2' }, { 'string' : 'videt', 'id' : '3' }, { 'string' : '.', 'id' : '4' } ]; $scope.selectedToken = { id: '1' }; $scope.currentToken = function() { return $scope.tokens[$scope.selectedToken.id - 1] }; $scope.selectToken = function(id) { $scope.selectedToken.id = id } });
Add function to select a token
Add function to select a token
JavaScript
mit
fbaumgardt/arethusa,alpheios-project/arethusa,latin-language-toolkit/arethusa,latin-language-toolkit/arethusa,alpheios-project/arethusa,fbaumgardt/arethusa,alpheios-project/arethusa,PonteIneptique/arethusa,PonteIneptique/arethusa,Masoumeh/arethusa,fbaumgardt/arethusa,Masoumeh/arethusa
4c36269339935f0ccb44dc600d4c1dcd5d2725ec
config/webpack.dev.js
config/webpack.dev.js
const path = require("path"); const merge = require("webpack-merge"); const webpack = require("webpack"); const common = require("./webpack.common.js"); const postCSSPlugins = [ require("postcss-easy-import")({ prefix: "_" }), require("postcss-mixins"), require("postcss-simple-vars"), require("postcss-nested"), require("postcss-color-function"), require("postcss-hexrgba"), require("autoprefixer") ]; module.exports = merge(common, { entry: [ "webpack-dev-server/client?http://localhost:3000/", "webpack/hot/only-dev-server" ], mode: "development", devtool: "eval-cheap-module-source-map", watch: true, devServer: { headers: { "Access-Control-Allow-Origin": "*" }, hot: true, port: 3000, disableHostCheck: true, overlay: true, contentBase: path.join(__dirname, "../src") }, plugins: [new webpack.HotModuleReplacementPlugin()], module: { rules: [ { test: /\.css$/, use: [ "style-loader", { loader: "css-loader", options: { url: false } }, { loader: "postcss-loader", options: { plugins: postCSSPlugins } } ] } ] } });
const path = require("path"); const merge = require("webpack-merge"); const webpack = require("webpack"); const common = require("./webpack.common.js"); const postCSSPlugins = [ require("postcss-easy-import")({ prefix: "_" }), require("postcss-mixins"), require("postcss-simple-vars"), require("postcss-nested"), require("postcss-color-function"), require("postcss-hexrgba"), require("autoprefixer") ]; module.exports = merge(common, { entry: [ "webpack-dev-server/client?http://localhost:3000/", "webpack/hot/only-dev-server" ], mode: "development", devtool: "eval-source-map", watch: true, devServer: { headers: { "Access-Control-Allow-Origin": "*" }, hot: true, port: 3000, disableHostCheck: true, overlay: true, contentBase: path.join(__dirname, "../src") }, plugins: [new webpack.HotModuleReplacementPlugin()], module: { rules: [ { test: /\.css$/, use: [ "style-loader", { loader: "css-loader", options: { url: false } }, { loader: "postcss-loader", options: { plugins: postCSSPlugins } } ] } ] } });
Use more reliable JS source mapping technique
Use more reliable JS source mapping technique
JavaScript
mit
trendyminds/pura,trendyminds/pura
091842d279f0456ca9f8f2f062a7d207c4e1466e
spec/client.spec.js
spec/client.spec.js
const Client = require('../lib/client'); const options = { baseUrl: 'some value', username: 'some value', password: 'some value' }; describe('Client', () => { it('should be constructor and factory function', () => { expect(Client).toBeFunction(); expect(new Client(options)).toBeObject(); expect(Client(options)).toBeObject(); }); it('should have properties with api', () => { const client = new Client(options); const apiKeys = Object.keys(client); expect(apiKeys.length).toEqual(1); expect(client['branchPermissions']).toBeObject(); }); it('should have validation for options', () => { expect(() => new Client()).toThrow(); expect(() => new Client(123)).toThrow(); expect(() => new Client({})).toThrow(); expect(() => new Client({ baseUrl: null, username: null, password: null })).toThrow(); expect(() => new Client({ baseUrl: '123' })).toThrow(); expect(() => new Client({ username: '123', password: '123' })).toThrow(); expect(() => new Client({ username: '123', password: '123', baseUrl: '123' })).not.toThrow(); }); });
const Client = require('../lib/client'); const options = { baseUrl: 'some value', username: 'some value', password: 'some value' }; describe('Client', () => { it('should be constructor and factory function', () => { expect(Client).toBeFunction(); expect(new Client(options)).toBeObject(); expect(Client(options)).toBeObject(); }); it('should have properties with api', () => { const client = new Client(options); const apiKeys = Object.keys(client); expect(apiKeys.length).toEqual(1); expect(client['branchPermissions']).toBeObject(); }); it('should have validation for options', () => { expect(() => new Client()).toThrow(); expect(() => new Client(123)).toThrow(); expect(() => new Client({})).toThrow(); expect(() => new Client({ baseUrl: null, username: null, password: null })).toThrow(); expect(() => new Client({ baseUrl: '123' })).toThrow(); expect(() => new Client({ username: '123', password: '123' })).toThrow(); expect(() => new Client({ username: '123', baseUrl: '123' })).toThrow(); expect(() => new Client({ username: '123', password: '123', baseUrl: '123' })).not.toThrow(); }); });
Cover one more branch in unit tests
tests: Cover one more branch in unit tests
JavaScript
mit
bponomarenko/stash-web-api
188f10af537bfdfb3e0c24c676b129efca9117f5
server.js
server.js
var http = require('http'); var fs = require('fs'); var path = require('path'); var mime = require('mime'); var cache = {}; function send404(response) { response.writeHead(404, {'Content-Type': 'text/plain'}); response.write('Error 404: resource not found.'); response.end(); } function sendFile(response, filePath, fileContents) { response.writeHead( 200, {'Content-Type': mime.lookup(path.basename(filePath))} ); response.end(fileContents); }
var http = require('http'); var fs = require('fs'); var path = require('path'); var mime = require('mime'); var cache = {}; function send404(response) { response.writeHead(404, {'Content-Type': 'text/plain'}); response.write('Error 404: resource not found.'); response.end(); } function sendFile(response, filePath, fileContents) { response.writeHead( 200, {'Content-Type': mime.lookup(path.basename(filePath))} ); response.end(fileContents); } function serveStatic(response, cache, absPath) { if (cache[absPath]) { sendFile(response, absPath, cache[absPath]); } else { fs.exists(absPath, function(exists) { if (exists) { fs.readFile(absPath, function(err, data) { if (err) { send404(response); } else { cache[absPath] = data; sendFile(response, absPath, data); } }); } else { send404(response); } }); } }
Add helper function for serving static files
Add helper function for serving static files
JavaScript
mit
sebsonic2o/chatrooms,sebsonic2o/chatrooms
4b14769af554c0a28817f049e75b783dc2c18f36
server.js
server.js
var koa = require('koa'); var http = require('http'); var route = require('koa-route'); var serve = require('koa-static'); var bodyParser = require('koa-bodyparser'); // Koa middleware var error = require('./api/lib/middleware/error'); // Create koa app var app = koa(); // Koa middleware app.use(error()); app.use(bodyParser()); app.use(serve('./frontend/dist')); // API routes app.use(route.post('/generate', require('./api/routes/generate'))); // Define configurable port var port = process.env.PORT || 4000; // Listen for connections app.listen(port); // Log port console.log('Server listening on http://localhost:' + port);
var koa = require('koa'); var http = require('http'); var route = require('koa-route'); var serve = require('koa-static'); var bodyParser = require('koa-bodyparser'); // Koa middleware var error = require('./api/lib/middleware/error'); // Create koa app var app = koa(); // Koa middleware app.use(error()); app.use(bodyParser()); app.use(serve('./frontend/dist')); // API routes app.use(route.post('/generate', require('./api/routes/generate'))); // Define configurable port var port = process.env.PORT || 4000; // Listen for connections app.listen(port); // Log port console.log('Server listening on port ' + port);
Improve port log message syntax
Improve port log message syntax
JavaScript
apache-2.0
eladnava/applicationize,eladnava/applicationize
0736453287987b2221129475d5c2fedfb160d8a2
gulp-tasks/link-js.js
gulp-tasks/link-js.js
'use strict'; (() => { module.exports = (gulp, plugins, config) => { return () => { return plugins.vinylFs.src([config.patternsPath + '/**/*.js', config.patternsPath + '/**/*.json', '!' + config.patternsPath + '/**/rocketbelt.slipsum-cache.json']) .pipe(plugins.plumber({ errorHandler: plugins.notify.onError('Error: <%= error.message %>') })) .pipe(plugins.vinylFs.symlink(config.templatesPath, { relative: true })); }; }; })();
'use strict'; (() => { module.exports = (gulp, plugins, config) => { return () => { return plugins.vinylFs.src([`${config.patternsPath}/**/*.js`, `${config.patternsPath}/**/*.json`, `!${config.patternsPath}/**/rocketbelt.slipsum-cache.json`, `!${config.patternsPath}/tools/**/*`]) .pipe(plugins.plumber({ errorHandler: plugins.notify.onError('Error: <%= error.message %>') })) .pipe(plugins.vinylFs.symlink(config.templatesPath, { relative: true })); }; }; })();
Exclude JS files in tools directory from symlinking.
fix(Build): Exclude JS files in tools directory from symlinking.
JavaScript
mit
Pier1/rocketbelt,Pier1/rocketbelt
8de650bcecb75087610aed4352e0a426290f690c
src/modules/common/components/App.js
src/modules/common/components/App.js
import React from 'react'; import {Provider} from 'react-redux'; import {Router, Route, IndexRoute} from 'react-router'; import HomeContainer from '../../home/components/HomeContainer'; import TranslationProvider from './translation/TranslationProvider'; import {routerPaths} from '../constants'; const routes = ( <Route path="/"> <IndexRoute component={HomeContainer}/> <Route path={routerPaths.singleUnit} component={HomeContainer}/> </Route> ); const App = ({store, history}) => ( <TranslationProvider> <Provider store={store}> <Router history={history} routes={routes} key={Math.random()}/> </Provider> </TranslationProvider> ); export default App;
import React from 'react'; import {Provider} from 'react-redux'; import {Router, Route, IndexRoute} from 'react-router'; import HomeContainer from '../../home/components/HomeContainer'; import TranslationProvider from './translation/TranslationProvider'; import {routerPaths} from '../constants'; const routes = ( <Route path="/"> <IndexRoute component={HomeContainer}/> <Route path={routerPaths.singleUnit} component={HomeContainer}/> </Route> ); const App = ({store, history}) => ( <Provider store={store}> <TranslationProvider> <Router history={history} routes={routes} key={Math.random()}/> </TranslationProvider> </Provider> ); export default App;
Change order of translation provider and store provider to allow translation provider access the storage
Change order of translation provider and store provider to allow translation provider access the storage
JavaScript
mit
nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map,nordsoftware/outdoors-sports-map
826d3b49a409fc658991a25f2226f67a0a00722e
src/gates/Joke_NeGate.js
src/gates/Joke_NeGate.js
import {GateBuilder} from "src/circuit/Gate.js" import {Matrix} from "src/math/Matrix.js" import {GatePainting} from "src/draw/GatePainting.js" const NeGate = new GateBuilder(). setSerializedId("NeGate"). setSymbol("-I"). setTitle("Ne-Gate"). setBlurb("Negates all amplitudes."). setDrawer(args => { GatePainting.paintLocationIndependentFrame(args); let {x, y} = args.rect.center(); args.painter.print( "-I", x, y, 'center', 'middle', 'black', '16px monospace', args.rect.w, args.rect.h); }). setKnownEffectToMatrix(Matrix.square(-1, 0, 0, -1)). gate; export {NeGate}
import {GateBuilder} from "src/circuit/Gate.js" import {Matrix} from "src/math/Matrix.js" import {Point} from "src/math/Point.js" import {GatePainting} from "src/draw/GatePainting.js" const NeGate = new GateBuilder(). setSerializedId("NeGate"). setTitle("Ne-Gate"). setBlurb("Negates all amplitudes."). setDrawer(args => { GatePainting.paintLocationIndependentFrame(args); let {x, y} = args.rect.center(); args.painter.strokeLine(new Point(x - 6, y), new Point(x + 6, y), 'black', 2); }). setKnownEffectToMatrix(Matrix.square(-1, 0, 0, -1)). gate; export {NeGate}
Update negate gate symbol to be a single thick line
Update negate gate symbol to be a single thick line
JavaScript
apache-2.0
Strilanc/Quantum-Circuit-Inspector,Strilanc/Quirk,Strilanc/Quirk,Strilanc/Quantum-Circuit-Inspector
4d49374a63ede67e58ead2fd34dc484c67efa606
assignments/javascript/anagram/anagram_test.spec.js
assignments/javascript/anagram/anagram_test.spec.js
var Anagram = require('./anagram'); describe('Anagram', function() { it("no matches",function() { var detector = new Anagram("diaper"); var matches = detector.match([ "hello", "world", "zombies", "pants"]); expect(matches).toEqual([]); }); xit("detects simple anagram",function() { var detector = new Anagram("ba"); var matches = detector.match(['ab', 'abc', 'bac']); expect(matches).toEqual(['ab']); }); xit("detects multiple anagrams",function() { var detector = new Anagram("abc"); var matches = detector.match(['ab', 'abc', 'bac']); expect(matches).toEqual(['abc', 'bac']); }); xit("detects anagram",function() { var detector = new Anagram("listen"); var matches = detector.match(['enlists', 'google', 'inlets', 'banana']); expect(matches).toEqual(['inlets']); }); xit("detects multiple anagrams",function() { var detector = new Anagram("allergy"); var matches = detector.match(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']); expect(matches).toEqual(['gallery', 'regally', 'largely']); }); });
var Anagram = require('./anagram'); describe('Anagram', function() { it("no matches",function() { var detector = new Anagram("diaper"); var matches = detector.match([ "hello", "world", "zombies", "pants"]); expect(matches).toEqual([]); }); xit("detects simple anagram",function() { var detector = new Anagram("ba"); var matches = detector.match(['ab', 'abc', 'bac']); expect(matches).toEqual(['ab']); }); xit("does not detect false positives",function() { var detector = new Anagram("bba"); var matches = detector.match(["aab"]); expect(matches).toEqual([]); }); xit("detects multiple anagrams",function() { var detector = new Anagram("abc"); var matches = detector.match(['ab', 'abc', 'bac']); expect(matches).toEqual(['abc', 'bac']); }); xit("detects anagram",function() { var detector = new Anagram("listen"); var matches = detector.match(['enlists', 'google', 'inlets', 'banana']); expect(matches).toEqual(['inlets']); }); xit("detects multiple anagrams",function() { var detector = new Anagram("allergy"); var matches = detector.match(['gallery', 'ballerina', 'regally', 'clergy', 'largely', 'leading']); expect(matches).toEqual(['gallery', 'regally', 'largely']); }); });
Add test for same length, same letters, different letter instance counts
Add test for same length, same letters, different letter instance counts One possible solution to detecting an anagram might be to check to see if the words are the same length and that each letter from the first word is contained in the second word. This additional test would guard against that solution appearing to work. I wasn't sure in what position in the test sequence it ought to go, or what the exact test description should be. Feel free to suggest changes.
JavaScript
mit
wobh/xjavascript,marcCanipel/xjavascript,marcCanipel/xjavascript,nicgallardo/xjavascript,a25patel/xjavascript,cloudleo/xjavascript,schorsch3000/xjavascript,wobh/xjavascript,JenanMannette/xjavascript,Vontei/Xjavascript-Solutions,eloquence/xjavascript,exercism/xjavascript,nicgallardo/xjavascript,exercism/xjavascript,a25patel/excercismExcercises,cloudleo/xjavascript,Vontei/xjavascript,eloquence/xjavascript,schorsch3000/xjavascript,Vontei/xjavascript,a25patel/excercismExcercises,Vontei/Xjavascript-Solutions,ZacharyRSmith/xjavascript,JenanMannette/xjavascript,a25patel/xjavascript,ZacharyRSmith/xjavascript
214861a2176e4beb47802ef192927a286301fefe
packages/core/lib/commands/console.js
packages/core/lib/commands/console.js
const command = { command: "console", description: "Run a console with contract abstractions and commands available", builder: {}, help: { usage: "truffle console [--network <name>] [--verbose-rpc]", options: [ { option: "--network <name>", description: "Specify the network to use. Network name must exist in the configuration." }, { option: "--verbose-rpc", description: "Log communication between Truffle and the Ethereum client." } ] }, run: async function (options) { const { promisify } = require("util"); const Config = require("@truffle/config"); const Console = require("../console"); const { Environment } = require("@truffle/environment"); const config = Config.detect(options); // This require a smell? const commands = require("./index"); const excluded = new Set(["console", "init", "watch", "develop"]); const consoleCommands = Object.keys(commands).reduce((acc, name) => { return !excluded.has(name) ? Object.assign(acc, {[name]: commands[name]}) : acc; }, {}); await Environment.detect(config); const c = new Console(consoleCommands, config.with({noAliases: true})); return await promisify(c.start)(); } }; module.exports = command;
const { promisify } = require("util"); const command = { command: "console", description: "Run a console with contract abstractions and commands available", builder: {}, help: { usage: "truffle console [--network <name>] [--verbose-rpc]", options: [ { option: "--network <name>", description: "Specify the network to use. Network name must exist in the configuration." }, { option: "--verbose-rpc", description: "Log communication between Truffle and the Ethereum client." } ] }, run: async function (options) { const Config = require("@truffle/config"); const Console = require("../console"); const { Environment } = require("@truffle/environment"); const config = Config.detect(options); // This require a smell? const commands = require("./index"); const excluded = new Set(["console", "init", "watch", "develop"]); const consoleCommands = Object.keys(commands).reduce((acc, name) => { return !excluded.has(name) ? Object.assign(acc, {[name]: commands[name]}) : acc; }, {}); await Environment.detect(config); const c = new Console(consoleCommands, config.with({noAliases: true})); return await promisify(c.start)(); } }; module.exports = command;
Move promisify require to top of file
Move promisify require to top of file
JavaScript
mit
ConsenSys/truffle
f2ed67e33ec475506a9d5c5dfcfbd985a274b5f7
Presentation.Web/protractor.conf.js
Presentation.Web/protractor.conf.js
var paths = require('../paths.config.js'); exports.config = { // Path to the selenium server jar. Update version number accordingly! seleniumServerJar: paths.seleniumServerJar, // select all end to end tests specs: paths.e2eFiles, resultJsonOutputFile: paths.e2eReport };
var paths = require('../paths.config.js'); exports.config = { // Path to the selenium server jar. Update version number accordingly! seleniumServerJar: paths.seleniumServerJar, // select all end to end tests specs: paths.e2eFiles, resultJsonOutputFile: paths.e2eReport, // Increase timeout to allow AppVeyor to rebuild database on first instantiation. allScriptsTimeout: 30000 };
Increase protractor timeout limit to enable AppVeyor to build database on first instantiation.
Increase protractor timeout limit to enable AppVeyor to build database on first instantiation.
JavaScript
mpl-2.0
os2kitos/kitos,os2kitos/kitos,miracle-as/kitos,os2kitos/kitos,miracle-as/kitos,miracle-as/kitos,miracle-as/kitos,os2kitos/kitos
159689207deab42fbc4626d8f8b38d3e94c880ea
src/angular-ladda-lw.js
src/angular-ladda-lw.js
angular.module('ladda-lw', ['ngAnimate']).directive('ladda', function laddaDirective() { return { restrict: 'A', scope: { ladda: '=', }, compile: (element, attrs) => { const lLoading = attrs.ladda; element.addClass('ladda-lw'); const textWrap = angular.element(` <div class="ladda-lw__text" ng-class="{\'ladda-lw__text--up\': ' + lLoading + '}"> </div> `); textWrap.append(element.contents()); element.append(textWrap); const loadingWrap = angular.element('<div class="ladda-lw__loading-wrap"></div>'); const loading = angular.element('<div class="ladda-lw__loading" ng-class="{\'ladda-lw__loading--up\': ' + lLoading + '}"></div>'); loadingWrap.append(loading); element.append(loadingWrap); return function link(scope, iElement) { scope.$watch('ladda', function laddaWatch(l) { iElement.attr('disabled', l ? 'disabled' : false); }); }; }, }; });
angular.module('ladda-lw', ['ngAnimate']).directive('ladda', function laddaDirective() { return { restrict: 'A', scope: { ladda: '=', }, compile: (element, attrs) => { const lLoading = attrs.ladda; element.addClass('ladda-lw'); const textWrap = angular.element(` <div class="ladda-lw__text" ng-class="{'ladda-lw__text--up': ${lLoading}}"> </div> `); textWrap.append(element.contents()); element.append(textWrap); const loadingWrap = angular.element(`<div class="ladda-lw__loading-wrap"></div>`); const loading = angular.element(` <div class="ladda-lw__loading" ng-class="{'ladda-lw__loading--up': ${lLoading}}"> </div> `); loadingWrap.append(loading); element.append(loadingWrap); return function link(scope, iElement) { scope.$watch('ladda', function laddaWatch(l) { iElement.attr('disabled', l ? 'disabled' : false); }); }; }, }; });
Fix for templates in es6
Fix for templates in es6
JavaScript
mit
aeharding/angular-ladda-lw,aeharding/angular-ladda-lw
1600a066ccdb6cbb1b55ecfc0eb526f1854350e0
Public/Resources/Javascript/global-config.js
Public/Resources/Javascript/global-config.js
/* We have to setup the global variables which will be used for web application. As now everything comes from webframework globally so I put it here temprarily. When we completely moved back ferite webframework then we setup it to main.js file */ var scriptSrcPath = "/Cention.app/Resources/ReactSrc/"; var imageSrcPath = "/Cention.app/Resources/Images/"; var webRoot = "/web/"; var controllerPath = "/Cention/";
/* We have to setup the global variables which will be used for web application. As now everything comes from webframework globally so I put it here temprarily. When we completely moved back ferite webframework then we setup it to main.js file */ var scriptSrcPath = "/Cention.app/Resources/ReactSrc/"; var imageSrcPath = "/Cention.app/Resources/Images/"; var webRoot = "/Cention/web/"; var controllerPath = "/";
Change controllerPath and webRoot for customer server installation
Change controllerPath and webRoot for customer server installation
JavaScript
bsd-3-clause
cention/ferite-module-webframework,cention/ferite-module-webframework,cention/ferite-module-webframework
62ce6e6f8111497d5bee0cc3bd44c4a1902eb317
src/lib/control/typeahead/normalizer/TypeaheadNormalizer.js
src/lib/control/typeahead/normalizer/TypeaheadNormalizer.js
/** * @requires javelin-install * @provides javelin-typeahead-normalizer * @javelin */ /** * @group control */ JX.install('TypeaheadNormalizer', { statics : { normalize : function(str) { return ('' + str) .toLowerCase() .replace(/[^a-z0-9 ]/g, '') .replace(/ +/g, ' ') .replace(/^\s*|\s*$/g, ''); } } });
/** * @requires javelin-install * @provides javelin-typeahead-normalizer * @javelin */ /** * @group control */ JX.install('TypeaheadNormalizer', { statics : { /** * Normalizes a string by lowercasing it and stripping out extra spaces * and punctuation. * * @param string * @return string Normalized string. */ normalize : function(str) { return ('' + str) .toLocaleLowerCase() .replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g, '') .replace(/ +/g, ' ') .replace(/^\s*|\s*$/g, ''); } } });
Use Punctuation Blacklist for Typeahead Normalizer
Use Punctuation Blacklist for Typeahead Normalizer Summary: This changes the Typeahead normalizer to use a punctuation blacklist instead of stripping all non-alphanumeric characters. As the normalizer stands now, any international characters (e.g. Japanese characters) are stripped. Reviewers: epriestley, jg Test Plan: > JX.TypeaheadNormalizer.normalize('Get rid of the periods...') "get rid of the periods" > JX.TypeaheadNormalizer.normalize('ラジオ') "ラジオ" Differential Revision: 924
JavaScript
bsd-3-clause
phacility/javelin,phacility/javelin,phacility/javelin,phacility/javelin,phacility/javelin
23e1f61e01d8f6d8fb3760bcd01bc50b17cdeaf7
dashboard/app/scripts/collections/user-request-collection.js
dashboard/app/scripts/collections/user-request-collection.js
/*jshint -W106*/ /*global define*/ define(['underscore', 'backbone', 'models/user-request-model'], function(_, Backbone, UserRequestModel) { 'use strict'; var UserRequestCollection = Backbone.Collection.extend({ url: function() { return '/api/v2/cluster/' + this.cluster + '/request'; }, model: UserRequestModel, initialize: function(models, options) { if (options && options.cluster) { this.cluster = options.cluster; } } }); return UserRequestCollection; });
/*jshint -W106*/ /*global define*/ define(['underscore', 'backbone', 'models/user-request-model'], function(_, Backbone, UserRequestModel) { 'use strict'; var UserRequestCollection = Backbone.Collection.extend({ url: function() { return '/api/v2/cluster/' + this.cluster + '/request' + this.params; }, parse: function(resp) { return resp.results; }, model: UserRequestModel, params: '?page_size=32', initialize: function(models, options) { if (options && options.cluster) { this.cluster = options.cluster; } }, // Only grab requests with state submitted getSubmitted: function(options) { this.params = '?state=submitted&page_size=32'; var self = this; return this.fetch(options).always(function() { self.params = '?page_size=32'; }); } }); return UserRequestCollection; });
Set page_size and state on collection requests
Set page_size and state on collection requests
JavaScript
mit
SUSE/calamari-clients,ceph/calamari-clients,ceph/calamari-clients,ceph/romana,SUSE/romana,GregMeno/test,SUSE/calamari-clients,SUSE/romana,ceph/romana,SUSE/calamari-clients,SUSE/romana,GregMeno/test,ceph/romana,ceph/calamari-clients,SUSE/calamari-clients,SUSE/romana,SUSE/calamari-clients,ceph/romana,ceph/romana,ceph/calamari-clients,GregMeno/test,ceph/calamari-clients,GregMeno/test,SUSE/romana,GregMeno/test
9067165f7c34b397f227f76c042bbac248b55b52
app/models/experiment-schema.server.model.js
app/models/experiment-schema.server.model.js
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema, MediaSchema = require('./media.server.model').schema, _ = require('lodash'); /** * ExperimentSchema Schema */ var ExperimentSchemaSchema = new Schema({ trialCount: { type: Number, required: true }, mediaPool: [{ type: Schema.Types.ObjectId, ref: 'Media' }] }); // Validator that requires the value is an array and contains at least one entry function requiredArrayValidator(value) { return Object.prototype.toString.call(value) === '[object Array]' && value.length > 0; } // Use the above validator for `mediaPool` ExperimentSchemaSchema.path('mediaPool').validate(requiredArrayValidator); ExperimentSchemaSchema.methods.buildExperiment = function(callback) { // Populate mediaPool this.populate('mediaPool'); var selectedMedia = _.sample(this.mediaPool, this.trialCount); if (typeof callback === 'function') { return callback(null, {media: selectedMedia}); } else { return {media: selectedMedia}; } }; // Register schema for `ExperimentSchema` model mongoose.model('ExperimentSchema', ExperimentSchemaSchema);
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema, MediaSchema = require('./media.server.model').schema, _ = require('lodash'); /** * ExperimentSchema Schema */ var ExperimentSchemaSchema = new Schema({ structure: {}, sensors: [String], trialCount: { type: Number, required: true }, mediaPool: [{ type: Schema.Types.ObjectId, ref: 'Media' }] }); // Validator that requires the value is an array and contains at least one entry function requiredArrayValidator(value) { return Object.prototype.toString.call(value) === '[object Array]' && value.length > 0; } // Use the above validator for `mediaPool` ExperimentSchemaSchema.path('mediaPool').validate(requiredArrayValidator); ExperimentSchemaSchema.methods.buildExperiment = function(callback) { // Populate mediaPool this.populate('mediaPool'); var selectedMedia = _.sample(this.mediaPool, this.trialCount); var schemaSubset = { _id: this._id, structure: this.structure, sensors: this.sensors, media: selectedMedia, }; if (typeof callback === 'function') { return callback(null, schemaSubset); } else { return schemaSubset; } }; // Register schema for `ExperimentSchema` model mongoose.model('ExperimentSchema', ExperimentSchemaSchema);
Return structure and sensors with ExperimentSchema
Return structure and sensors with ExperimentSchema
JavaScript
mit
brennon/eim,brennon/eim,brennon/eim,brennon/eim
23223ca4b00a8cab8c2afe164fa86d45e8bc5bcf
src/common/components/GroupItem.js
src/common/components/GroupItem.js
import { List } from 'material-ui/List'; import React from 'react'; import { Link } from 'react-router'; import MemberItem from './MemberItem'; export default class GroupItem extends React.Component { static propTypes = { id: React.PropTypes.string, isAdmin: React.PropTypes.bool, isMember: React.PropTypes.bool, name: React.PropTypes.string, members: React.PropTypes.array, } renderHeader() { if (this.props.isAdmin) { return <h2><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></h2>; } return <h2>{this.props.name}</h2>; } render() { const members = this.props.members.filter(member => member.user); if (!members.length) { return null; } return ( <List> {this.renderHeader()} {members.sort((a, b) => a.user.name > b.user.name).map(member => <MemberItem key={member.id} isMember={this.props.isMember} {...member} />)} </List> ); } }
import { List } from 'material-ui/List'; import Subheader from 'material-ui/Subheader'; import React from 'react'; import { Link } from 'react-router'; import MemberItem from './MemberItem'; export default class GroupItem extends React.Component { static propTypes = { id: React.PropTypes.string, isAdmin: React.PropTypes.bool, isMember: React.PropTypes.bool, name: React.PropTypes.string, members: React.PropTypes.array, } renderHeader() { if (this.props.isAdmin) { return <Subheader style={{ textTransform: 'uppercase' }}><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></Subheader>; } return <Subheader style={{ textTransform: 'uppercase' }}>{this.props.name}</Subheader>; } render() { const members = this.props.members.filter(member => member.user); if (!members.length) { return null; } return ( <List> {this.renderHeader()} {members.sort((a, b) => a.user.name > b.user.name).map(member => <MemberItem key={member.id} isMember={this.props.isMember} {...member} />)} </List> ); } }
Use subheaders in member list
Use subheaders in member list
JavaScript
agpl-3.0
strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs
976953f7392ac8d42105fc43a98be05dbd29d37d
src/components/MainHeader/index.js
src/components/MainHeader/index.js
import MainHeader from './MainHeader' import Logo from './Logo' import LogoText from './LogoText' import Navbar from './Navbar' import NavbarMenu from './NavbarMenu' import SidebarToggle from './SidebarToggle' import ControlSidebarToggle from './ControlSidebarToggle' import Messages from './Messages' import MessageItem from './MessageItem' import Notifications from './Notifications' import NotificationItem from './NotificationItem' import Tasks from './Tasks' import TaskItem from './TaskItem' import User from './User' import UserHeader from './UserHeader' import UserBody from './UserBody' import UserBodyItem from './UserBodyItem' import UserFooter from './UserFooter' import UserFooterItem from './UserFooterItem' export default { MainHeader, Logo, LogoText, Navbar, NavbarMenu, SidebarToggle, ControlSidebarToggle, Messages, MessageItem, Notifications, NotificationItem, Tasks, TaskItem, User, UserHeader, UserBody, UserBodyItem, UserFooter, UserFooterItem }
import MainHeader from './MainHeader' import Logo from './Logo' import LogoText from './LogoText' import Navbar from './Navbar' import NavbarMenu from './NavbarMenu' import SidebarToggle from './SidebarToggle' import ControlSidebarToggle from './ControlSidebarToggle' import Messages from './Messages' import MessageItem from './MessageItem' import Notifications from './Notifications' import NotificationItem from './NotificationItem' import Tasks from './Tasks' import TaskItem from './TaskItem' import User from './User' import UserHeader from './UserHeader' import UserBody from './UserBody' import UserBodyItem from './UserBodyItem' import UserFooter from './UserFooter' import UserFooterItem from './UserFooterItem' MainHeader.MainHeader = MainHeader MainHeader.Logo = Logo MainHeader.LogoText = LogoText MainHeader.Navbar = Navbar MainHeader.NavbarMenu = NavbarMenu MainHeader.SidebarToggle = SidebarToggle MainHeader.ControlSidebarToggle = ControlSidebarToggle MainHeader.Messages = Messages MainHeader.MessageItem = MessageItem MainHeader.Notifications = Notifications MainHeader.NotificationItem = NotificationItem MainHeader.Tasks = Tasks MainHeader.TaskItem = TaskItem MainHeader.User = User MainHeader.UserHeader = UserHeader MainHeader.UserBody = UserBody MainHeader.UserBodyItem = UserBodyItem MainHeader.UserFooter = UserFooter MainHeader.UserFooterItem = UserFooterItem export default MainHeader
Change way of exports MainHeader Components
Change way of exports MainHeader Components For: https://github.com/falmar/react-adm-lte/issues/2
JavaScript
mit
falmar/react-adm-lte
79e420facbf85e450abe75e73ab50966d3a0d8fd
app/assets/javascripts/whitehall.js
app/assets/javascripts/whitehall.js
jQuery(document).ready(function($) { $(".flash.notice, .flash.alert").flashNotice(); // This is useful for toggling CSS helpers // whilst developing.. cmd+G var cmdDown = false; $('body').keydown(function(event) { if (event.keyCode == '91') { cmdDown = true; } if (cmdDown && event.keyCode == '71') { event.preventDefault(); $(this).toggleClass('dev'); } }).keyup(function(event) { if (event.keyCode == '91') { cmdDown = false; } }); $(".chzn-select").chosen(); $("#completed_fact_check_requests").markLinkedAnchor(); $('fieldset.sortable legend').each(function () { $(this).append(' (drag up and down to re-order)'); }) });
jQuery(document).ready(function($) { $(".flash.notice, .flash.alert").flashNotice(); // This is useful for toggling CSS helpers // whilst developing.. cmd+G var cmdDown = false; $('body').keydown(function(event) { if (event.keyCode == '91') { cmdDown = true; } if (cmdDown && event.keyCode == '71') { event.preventDefault(); $(this).toggleClass('dev'); } }).keyup(function(event) { if (event.keyCode == '91') { cmdDown = false; } }); $(".chzn-select").chosen({allow_single_deselect: true}); $("#completed_fact_check_requests").markLinkedAnchor(); $('fieldset.sortable legend').each(function () { $(this).append(' (drag up and down to re-order)'); }) });
Allow de-select on single selects with a blank option.
Allow de-select on single selects with a blank option.
JavaScript
mit
ggoral/whitehall,YOTOV-LIMITED/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,robinwhittleton/whitehall,alphagov/whitehall,alphagov/whitehall,askl56/whitehall,ggoral/whitehall,ggoral/whitehall,askl56/whitehall,hotvulcan/whitehall,robinwhittleton/whitehall,robinwhittleton/whitehall,alphagov/whitehall,alphagov/whitehall,hotvulcan/whitehall,YOTOV-LIMITED/whitehall,ggoral/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,hotvulcan/whitehall,hotvulcan/whitehall,robinwhittleton/whitehall
1de53839f2cd6677b4851328727c79268ebaa278
app/feeds/new/add-operator/route.js
app/feeds/new/add-operator/route.js
import Ember from 'ember'; export default Ember.Route.extend({ createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'), beforeModel: function(transition) { var controller = this; var feedModel = this.get('createFeedFromGtfsService').feedModel; var url = feedModel.get('url'); var adapter = this.get('store').adapterFor('feeds'); var fetch_info_url = adapter.urlPrefix()+'/feeds/fetch_info'; var promise = adapter.ajax(fetch_info_url, 'post', {data:{url:url}}); promise.then(function(response) { if (response.status == 'complete') { feedModel.set('id', response.feed.onestop_id); feedModel.set('operators_in_feed', response.feed.operators_in_feed); response.operators.map(function(operator){feedModel.addOperator(operator)}); return feedModel; } else if (response.status == 'processing') { transition.abort(); return Ember.run.later(controller, function(){ transition.retry(); }, 1000); } }).catch(function(error) { error.errors.forEach(function(error){ feedModel.get('errors').add('url', error.message); }); }); return promise; }, model: function() { return this.get('createFeedFromGtfsService').feedModel; }, actions: { error: function(error, transition) { return this.transitionTo('feeds.new'); } } });
import Ember from 'ember'; export default Ember.Route.extend({ createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'), beforeModel: function(transition) { var controller = this; var feedModel = this.get('createFeedFromGtfsService').feedModel; var url = feedModel.get('url'); var adapter = this.get('store').adapterFor('feeds'); var fetch_info_url = adapter.urlPrefix()+'/feeds/fetch_info'; var promise = adapter.ajax(fetch_info_url, 'post', {data:{url:url}}); promise.then(function(response) { if (response.status == 'complete') { feedModel.set('id', response.feed.onestop_id); feedModel.set('operators_in_feed', response.feed.operators_in_feed); response.operators.map(function(operator){feedModel.addOperator(operator)}); return feedModel; } else { transition.abort(); return Ember.run.later(controller, function(){ transition.retry(); }, 1000); } }).catch(function(error) { error.errors.forEach(function(error){ feedModel.get('errors').add('url', error.message); }); }); return promise; }, model: function() { return this.get('createFeedFromGtfsService').feedModel; }, actions: { error: function(error, transition) { return this.transitionTo('feeds.new'); } } });
Allow additional response states (queued, downloading, processing)
Allow additional response states (queued, downloading, processing)
JavaScript
mit
transitland/feed-registry,transitland/feed-registry