commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
d8ff30d3d76302e3730d44d5ed8ce500214a4ef8 | resources/loader.js | resources/loader.js | (function () {
var loadingElement = document.getElementsByClassName("loading")[0];
loadingElement.textContent = "Loading...";
function start() {
var scriptElement = document.createElement("script");
scriptElement.src = "game.js";
document.body.appendChild(scriptElement);
}
if (applicationCache) {
function onProgress(event) {
loadingElement.textContent = "Loading... " + event.loaded.toString() + "/" + event.total.toString();
}
function onUpdateReady() {
window.location.reload();
}
applicationCache.addEventListener("progress", onProgress, true);
applicationCache.addEventListener("noupdate", start, true);
applicationCache.addEventListener("cached", start, true);
applicationCache.addEventListener("updateready", onUpdateReady, true);
applicationCache.addEventListener("obsolete", start, true);
applicationCache.addEventListener("error", start, true);
} else {
start();
}
}()); | (function () {
var loadingElement = document.getElementsByClassName("loading")[0];
loadingElement.textContent = "Loading...";
function start() {
var scriptElement = document.createElement("script");
scriptElement.src = "game.js";
document.body.appendChild(scriptElement);
}
if (window.applicationCache) {
function onProgress(event) {
loadingElement.textContent = "Loading... " + event.loaded.toString() + "/" + event.total.toString();
}
function onUpdateReady() {
window.location.reload();
}
applicationCache.addEventListener("progress", onProgress, true);
applicationCache.addEventListener("noupdate", start, true);
applicationCache.addEventListener("cached", start, true);
applicationCache.addEventListener("updateready", onUpdateReady, true);
applicationCache.addEventListener("obsolete", start, true);
applicationCache.addEventListener("error", start, true);
} else {
start();
}
}()); | Fix for browsers that don't support application cache. | Fix for browsers that don't support application cache.
| JavaScript | mit | djcsdy/words-that-rhyme-with-purple | ---
+++
@@ -9,7 +9,7 @@
document.body.appendChild(scriptElement);
}
- if (applicationCache) {
+ if (window.applicationCache) {
function onProgress(event) {
loadingElement.textContent = "Loading... " + event.loaded.toString() + "/" + event.total.toString();
} |
02c641a353b694c4554ca68a239827fde3e044dc | defaults/index.js | defaults/index.js | module.exports = {
// output config
dist: {
min: '~/square.{type}.{ext}'
, dev: '~/square.{type}.{ext}'
}
// plugin configuration
, plugin: {}
// hinting and linting
, jshint: require('./jshint')
, csslint: require('./csshint')
};
| var path = require('path')
, file = path.join(process.env.PWD, 'package.json')
, pkg;
try { pkg = require(file); }
catch (e) { pkg = {}; }
module.exports = {
// output config
dist: {
min: '~/square.{type}.{ext}'
, dev: '~/square.{type}.{ext}'
}
// plugin configuration
, plugin: {}
// hinting and linting
, jshint: require('./jshint')
, csslint: require('./csshint')
// add package.json if it exists
, vars: pkg
};
| Add package.json data as vars if it exists | Add package.json data as vars if it exists
| JavaScript | mit | observing/square | ---
+++
@@ -1,3 +1,10 @@
+var path = require('path')
+ , file = path.join(process.env.PWD, 'package.json')
+ , pkg;
+
+try { pkg = require(file); }
+catch (e) { pkg = {}; }
+
module.exports = {
// output config
dist: {
@@ -11,4 +18,7 @@
// hinting and linting
, jshint: require('./jshint')
, csslint: require('./csshint')
+
+ // add package.json if it exists
+ , vars: pkg
}; |
edb2dda19668b256bcdf9198a5771aca2516eecb | app/assets/javascripts/application.js | app/assets/javascripts/application.js | //= require_self
//= require components
//= require turbolinks
//= require react_ujs
// Setup React in global scope
var React = window.React = global.React = require('react/addons');
var $ = window.JQuery = require('jquery-browserify'); | //= require_self
//= require components
//= require react_ujs
// Setup React in global scope
var React = window.React = global.React = require('react/addons');
window.$ = window.jQuery = require('jquery')
require('jquery-ujs')
//= jquery_ujs | Add jquery and jquery_ujs -global | Add jquery and jquery_ujs -global
| JavaScript | artistic-2.0 | gauravtiwari/hireables,gauravtiwari/techhire,Hireables/hireables,gauravtiwari/techhire,gauravtiwari/techhire,Hireables/hireables,gauravtiwari/hireables,gauravtiwari/hireables,Hireables/hireables | ---
+++
@@ -1,8 +1,9 @@
//= require_self
//= require components
-//= require turbolinks
//= require react_ujs
// Setup React in global scope
var React = window.React = global.React = require('react/addons');
-var $ = window.JQuery = require('jquery-browserify');
+window.$ = window.jQuery = require('jquery')
+require('jquery-ujs')
+//= jquery_ujs |
bef2ac16c67434bed013fdcd069b2b7973b3fd5f | www/src/pages/Html.js | www/src/pages/Html.js | import React, { PropTypes } from 'react'
export default class Html extends React.Component {
render () {
return (
<html>
<head>
<title>
{this.props.title}
</title>
<link type='text/css' rel='stylesheet' href='/static/pure.min.css' />
<link type='text/css' rel='stylesheet' href='/static/app.bundle.css' />
</head>
<body>
<div id='root' dangerouslySetInnerHTML={{ __html: this.props.children }} />
<script src='/static/init.bundle.js' onLoad='console.log("hovno")' />
<script async src='/static/react.bundle.js' />
<script async src='/static/app.bundle.js' />
</body>
</html>
)
}
}
Html.propTypes = {
children: PropTypes.node.isRequired,
title: PropTypes.string.isRequired
}
| import React, { PropTypes } from 'react'
export default class Html extends React.Component {
render () {
return (
<html>
<head>
<title>
{this.props.title}
</title>
<meta name='viewport' content='width=device-width, initial-scale=1' />
<link type='text/css' rel='stylesheet' href='/static/pure.min.css' />
<link type='text/css' rel='stylesheet' href='/static/app.bundle.css' />
</head>
<body>
<div id='root' dangerouslySetInnerHTML={{ __html: this.props.children }} />
<script src='/static/init.bundle.js' />
<script async src='/static/react.bundle.js' />
<script async src='/static/app.bundle.js' />
</body>
</html>
)
}
}
Html.propTypes = {
children: PropTypes.node.isRequired,
title: PropTypes.string.isRequired
}
| Add viewport meta tag for mobile sites | WWW: Add viewport meta tag for mobile sites
| JavaScript | mit | svagi/httptest | ---
+++
@@ -8,12 +8,13 @@
<title>
{this.props.title}
</title>
+ <meta name='viewport' content='width=device-width, initial-scale=1' />
<link type='text/css' rel='stylesheet' href='/static/pure.min.css' />
<link type='text/css' rel='stylesheet' href='/static/app.bundle.css' />
</head>
<body>
<div id='root' dangerouslySetInnerHTML={{ __html: this.props.children }} />
- <script src='/static/init.bundle.js' onLoad='console.log("hovno")' />
+ <script src='/static/init.bundle.js' />
<script async src='/static/react.bundle.js' />
<script async src='/static/app.bundle.js' />
</body> |
ada5c08ebdccb0fedbd5cee4758c8c4ea20c0c79 | api/js/schema.js | api/js/schema.js | const mongoose = require('mongoose')
const shortId = require('shortid')
const Schema = mongoose.Schema
const assetSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
tagId: { type: String, text: true },
assignedTo: { type: String, text: true }
})
const specSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
key: { type: String, text: true },
value: { type: String, text: true }
})
const categorySchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
name: String,
label: String,
description: String,
config: {
faIcon: String,
color: String,
api: String,
fallbackImage: String
},
models: [ { type: Schema.Types.ObjectId, ref: 'Model' } ]
})
const modelSchema = Schema({
_parent: {type: String, ref: 'Category'},
_shortId: {type: String, unique: true, default: shortId.generate},
category: { type: String, text: true },
vendor: { type: String, text: true },
name: { type: String, text: true },
version: { type: String, text: true },
image: String,
description: { type: String, text: true },
active: Boolean,
specs: [ specSchema ],
assets: [ assetSchema ]
})
modelSchema.index({
vendor: 'text',
name: 'text',
version: 'text',
description: 'text'
})
module.exports = { assetSchema, modelSchema, categorySchema }
| const mongoose = require('mongoose')
const shortId = require('shortid')
const Schema = mongoose.Schema
const assetSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
tagId: String,
assignedTo: String
})
const specSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
key: String,
value: String
})
const categorySchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
name: String,
label: String,
description: String,
config: {
faIcon: String,
color: String,
api: String,
fallbackImage: String
},
models: [ { type: Schema.Types.ObjectId, ref: 'Model' } ]
})
const modelSchema = Schema({
_parent: {type: String, ref: 'Category'},
_shortId: {type: String, unique: true, default: shortId.generate},
category: String,
vendor: String,
name: String,
version: String,
image: String,
description: String,
active: Boolean,
specs: [ specSchema ],
assets: [ assetSchema ]
})
modelSchema.index({
vendor: 'text',
name: 'text',
version: 'text',
description: 'text'
})
module.exports = { assetSchema, modelSchema, categorySchema }
| Complete search functionality for models | Complete search functionality for models
* Add button functionality to search bar
| JavaScript | mit | timramsier/asset-manager,timramsier/asset-manager,timramsier/asset-manager | ---
+++
@@ -4,14 +4,14 @@
const assetSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
- tagId: { type: String, text: true },
- assignedTo: { type: String, text: true }
+ tagId: String,
+ assignedTo: String
})
const specSchema = Schema({
_shortId: {type: String, unique: true, default: shortId.generate},
- key: { type: String, text: true },
- value: { type: String, text: true }
+ key: String,
+ value: String
})
const categorySchema = Schema({
@@ -31,12 +31,12 @@
const modelSchema = Schema({
_parent: {type: String, ref: 'Category'},
_shortId: {type: String, unique: true, default: shortId.generate},
- category: { type: String, text: true },
- vendor: { type: String, text: true },
- name: { type: String, text: true },
- version: { type: String, text: true },
+ category: String,
+ vendor: String,
+ name: String,
+ version: String,
image: String,
- description: { type: String, text: true },
+ description: String,
active: Boolean,
specs: [ specSchema ],
assets: [ assetSchema ] |
9fb13ddc4ee61d1776ca311cdc94311e0e8ecaef | app/password/handlers/authenticate.js | app/password/handlers/authenticate.js | exports = module.exports = function(parse, csrfProtection, loadState, authenticate, proceed) {
// TODO: Move this file to "password/handlers/authenticate"
return [
parse('application/x-www-form-urlencoded'),
csrfProtection(),
loadState('login'),
authenticate('local'),
proceed
];
};
exports['@require'] = [
'http://i.bixbyjs.org/http/middleware/parse',
'http://i.bixbyjs.org/http/middleware/csrfProtection',
'http://i.bixbyjs.org/http/middleware/loadState',
'http://i.bixbyjs.org/http/middleware/authenticate',
'../../workflow/login/resume'
];
| exports = module.exports = function(parse, flow, csrfProtection, authenticate) {
return [
parse('application/x-www-form-urlencoded'),
flow('authenticate-password',
csrfProtection(),
authenticate([ 'local' ]),
{ through: 'login' })
];
};
exports['@require'] = [
'http://i.bixbyjs.org/http/middleware/parse',
'http://i.bixbyjs.org/http/middleware/state/flow',
'http://i.bixbyjs.org/http/middleware/csrfProtection',
'http://i.bixbyjs.org/http/middleware/authenticate'
];
| Switch to DSL for password authentication. | Switch to DSL for password authentication.
| JavaScript | mit | authnomicon/nodex-aaa-login | ---
+++
@@ -1,20 +1,17 @@
-exports = module.exports = function(parse, csrfProtection, loadState, authenticate, proceed) {
-
- // TODO: Move this file to "password/handlers/authenticate"
+exports = module.exports = function(parse, flow, csrfProtection, authenticate) {
return [
parse('application/x-www-form-urlencoded'),
- csrfProtection(),
- loadState('login'),
- authenticate('local'),
- proceed
+ flow('authenticate-password',
+ csrfProtection(),
+ authenticate([ 'local' ]),
+ { through: 'login' })
];
};
exports['@require'] = [
'http://i.bixbyjs.org/http/middleware/parse',
+ 'http://i.bixbyjs.org/http/middleware/state/flow',
'http://i.bixbyjs.org/http/middleware/csrfProtection',
- 'http://i.bixbyjs.org/http/middleware/loadState',
- 'http://i.bixbyjs.org/http/middleware/authenticate',
- '../../workflow/login/resume'
+ 'http://i.bixbyjs.org/http/middleware/authenticate'
]; |
4142a09bbaf3fe3ec38e26421f5417eed512ac47 | app/src/controllers/filter/reducer.js | app/src/controllers/filter/reducer.js | import { combineReducers } from 'redux';
import { fetchReducer } from 'controllers/fetch';
import { paginationReducer } from 'controllers/pagination';
import { loadingReducer } from 'controllers/loading';
import {
NAMESPACE,
FETCH_USER_FILTERS_SUCCESS,
UPDATE_FILTER_CONDITIONS,
ADD_FILTER,
UPDATE_FILTER_SUCCESS,
REMOVE_FILTER,
} from './constants';
import { updateFilter } from './utils';
const updateFilterConditions = (filters, filterId, conditions) => {
const filter = filters.find((item) => item.id === filterId);
return updateFilter(filters, { ...filter, conditions });
};
export const launchesFiltersReducer = (state = [], { type, payload, meta: { oldId } = {} }) => {
switch (type) {
case FETCH_USER_FILTERS_SUCCESS:
return [...state, ...payload];
case UPDATE_FILTER_CONDITIONS:
return updateFilterConditions(state, payload.filterId, payload.conditions);
case UPDATE_FILTER_SUCCESS:
return updateFilter(state, payload, oldId);
case ADD_FILTER:
return [...state, payload];
case REMOVE_FILTER:
return state.filter((filter) => filter.id !== payload);
default:
return state;
}
};
export const filterReducer = combineReducers({
filters: fetchReducer(NAMESPACE, { contentPath: 'content' }),
pagination: paginationReducer(NAMESPACE),
loading: loadingReducer(NAMESPACE),
launchesFilters: launchesFiltersReducer,
});
| import { combineReducers } from 'redux';
import { fetchReducer } from 'controllers/fetch';
import { paginationReducer } from 'controllers/pagination';
import { loadingReducer } from 'controllers/loading';
import {
NAMESPACE,
FETCH_USER_FILTERS_SUCCESS,
UPDATE_FILTER_CONDITIONS,
ADD_FILTER,
UPDATE_FILTER_SUCCESS,
REMOVE_FILTER,
} from './constants';
import { updateFilter } from './utils';
const updateFilterConditions = (filters, filterId, conditions) => {
const filter = filters.find((item) => item.id === filterId);
return updateFilter(filters, { ...filter, conditions });
};
export const launchesFiltersReducer = (state = [], { type, payload, meta: { oldId } = {} }) => {
switch (type) {
case FETCH_USER_FILTERS_SUCCESS:
return payload;
case UPDATE_FILTER_CONDITIONS:
return updateFilterConditions(state, payload.filterId, payload.conditions);
case UPDATE_FILTER_SUCCESS:
return updateFilter(state, payload, oldId);
case ADD_FILTER:
return [...state, payload];
case REMOVE_FILTER:
return state.filter((filter) => filter.id !== payload);
default:
return state;
}
};
export const filterReducer = combineReducers({
filters: fetchReducer(NAMESPACE, { contentPath: 'content' }),
pagination: paginationReducer(NAMESPACE),
loading: loadingReducer(NAMESPACE),
launchesFilters: launchesFiltersReducer,
});
| Replace fetched user filters when switching project | EPMRPP-38336: Replace fetched user filters when switching project
| JavaScript | apache-2.0 | reportportal/service-ui,reportportal/service-ui,reportportal/service-ui | ---
+++
@@ -20,7 +20,7 @@
export const launchesFiltersReducer = (state = [], { type, payload, meta: { oldId } = {} }) => {
switch (type) {
case FETCH_USER_FILTERS_SUCCESS:
- return [...state, ...payload];
+ return payload;
case UPDATE_FILTER_CONDITIONS:
return updateFilterConditions(state, payload.filterId, payload.conditions);
case UPDATE_FILTER_SUCCESS: |
1d7a55ea211f543c1b70a64b78e2fc7acadf2f61 | views/page-retry.js | views/page-retry.js | import React from "react-native";
import Page from "./page";
const {
StyleSheet,
View,
Text,
Image,
TouchableOpacity
} = React;
const styles = StyleSheet.create({
failed: {
fontSize: 18
},
button: {
flexDirection: "row",
alignItems: "center",
padding: 16
},
label: {
paddingHorizontal: 8,
marginLeft: 8
},
icon: {
height: 24,
width: 24,
opacity: 0.5
}
});
export default class PageRetry extends React.Component {
render() {
return (
<Page {...this.props}>
<Text style={styles.failed}>Failed to load data</Text>
{this.props.onRetry ?
<TouchableOpacity onPress={this.props.onRetry}>
<View style={styles.button}>
<Image style={styles.icon} source={require("image!ic_refresh_black")} />
<Text style={styles.label}>Retry</Text>
</View>
</TouchableOpacity> :
null
}
</Page>
);
}
}
PageRetry.propTypes = {
onRetry: React.PropTypes.func
};
| import React from "react-native";
import Page from "./page";
const {
StyleSheet,
View,
Text,
Image,
TouchableOpacity
} = React;
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center"
},
failed: {
fontSize: 18
},
button: {
flexDirection: "row",
alignItems: "center",
padding: 16
},
label: {
paddingHorizontal: 8,
marginHorizontal: 8
},
icon: {
height: 24,
width: 24,
opacity: 0.5
}
});
export default class PageRetry extends React.Component {
render() {
return (
<Page {...this.props}>
<TouchableOpacity onPress={this.props.onRetry} style={styles.container}>
<Text style={styles.failed}>Failed to load data</Text>
{this.props.onRetry ?
<View style={styles.button}>
<Image style={styles.icon} source={require("image!ic_refresh_black")} />
<Text style={styles.label}>Retry</Text>
</View> :
null
}
</TouchableOpacity>
</Page>
);
}
}
PageRetry.propTypes = {
onRetry: React.PropTypes.func
};
| Make the whole retry page tappable | Make the whole retry page tappable
| JavaScript | unknown | wesley1001/io.scrollback.neighborhoods,wesley1001/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods,scrollback/io.scrollback.neighborhoods | ---
+++
@@ -10,6 +10,11 @@
} = React;
const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ alignItems: "center",
+ justifyContent: "center"
+ },
failed: {
fontSize: 18
},
@@ -20,7 +25,7 @@
},
label: {
paddingHorizontal: 8,
- marginLeft: 8
+ marginHorizontal: 8
},
icon: {
height: 24,
@@ -33,16 +38,16 @@
render() {
return (
<Page {...this.props}>
- <Text style={styles.failed}>Failed to load data</Text>
- {this.props.onRetry ?
- <TouchableOpacity onPress={this.props.onRetry}>
- <View style={styles.button}>
- <Image style={styles.icon} source={require("image!ic_refresh_black")} />
- <Text style={styles.label}>Retry</Text>
- </View>
- </TouchableOpacity> :
+ <TouchableOpacity onPress={this.props.onRetry} style={styles.container}>
+ <Text style={styles.failed}>Failed to load data</Text>
+ {this.props.onRetry ?
+ <View style={styles.button}>
+ <Image style={styles.icon} source={require("image!ic_refresh_black")} />
+ <Text style={styles.label}>Retry</Text>
+ </View> :
null
}
+ </TouchableOpacity>
</Page>
);
} |
c7c1c94635bc499b8c33fc4c9b65033ef2c24c89 | source/popup/containers/EntriesPage.js | source/popup/containers/EntriesPage.js | import { connect } from "react-redux";
import EntriesPage from "../components/EntriesPage.js";
import { clearSearchResults } from "../library/messaging.js";
import { searchEntriesForTerm } from "../../shared/library/messaging.js";
export default connect(
(state, ownProps) => ({}),
{
onPrepare: () => () => {
clearSearchResults();
},
onSearchTermChange: searchTerm => () => {
if (searchTerm.trim().length > 0) {
searchEntriesForTerm(searchTerm);
} else {
clearSearchResults();
}
}
}
)(EntriesPage);
| import { connect } from "react-redux";
import EntriesPage from "../components/EntriesPage.js";
import { clearSearchResults } from "../library/messaging.js";
import { searchEntriesForTerm } from "../../shared/library/messaging.js";
export default connect(
(state, ownProps) => ({}),
{
onPrepare: () => () => {},
onSearchTermChange: searchTerm => () => {
if (searchTerm.trim().length > 0) {
searchEntriesForTerm(searchTerm);
} else {
clearSearchResults();
}
}
}
)(EntriesPage);
| Stop clearing search results on popup init | Stop clearing search results on popup init
| JavaScript | mit | buttercup-pw/buttercup-browser-extension,perry-mitchell/buttercup-chrome,buttercup-pw/buttercup-browser-extension,perry-mitchell/buttercup-chrome | ---
+++
@@ -6,9 +6,7 @@
export default connect(
(state, ownProps) => ({}),
{
- onPrepare: () => () => {
- clearSearchResults();
- },
+ onPrepare: () => () => {},
onSearchTermChange: searchTerm => () => {
if (searchTerm.trim().length > 0) {
searchEntriesForTerm(searchTerm); |
4a7170574f65b7f1eb12827b30aca892f32c7dfa | frontend/src/signup/sagas.js | frontend/src/signup/sagas.js | import { put, call, fork } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { getBranches, register } from './resources';
import {
BRANCH_LIST_REQUESTED, branchListUpdated,
registerStart,
REGISTER_REQUESTED, registerSuccess,
clearPageError, pageError,
} from './actions';
export function* fetchBranchList() {
try {
yield put(clearPageError());
const { branches } = yield call(getBranches);
yield put(branchListUpdated(branches));
yield put(registerStart());
} catch (error) {
yield put(pageError('There was an error loading the page content'));
}
}
export function* registerMember({ payload }) {
const { member, onSuccess, onFailure } = payload;
try {
yield put(clearPageError());
yield call(register, member);
yield put(registerSuccess());
yield call(onSuccess);
} catch (error) {
console.log('ERROR', error);
yield put(pageError('There was an error saving your changes'));
yield call(onFailure);
}
}
export function* watchBranchListRequest() {
yield* takeLatest(BRANCH_LIST_REQUESTED, fetchBranchList);
}
export function* watchRegisterRequest() {
yield* takeLatest(REGISTER_REQUESTED, registerMember);
}
export default function* rootSaga() {
yield [
fork(watchBranchListRequest),
fork(watchRegisterRequest),
];
}
| import { put, call, fork } from 'redux-saga/effects';
import { takeLatest } from 'redux-saga';
import { getBranches, register } from './resources';
import {
BRANCH_LIST_REQUESTED, branchListUpdated,
registerStart,
REGISTER_REQUESTED, registerSuccess,
clearPageError, pageError,
} from './actions';
export function* fetchBranchList() {
try {
yield put(clearPageError());
const { branches } = yield call(getBranches);
yield put(branchListUpdated(branches));
yield put(registerStart());
} catch (error) {
yield put(pageError('There was an error loading the page content'));
}
}
export function* registerMember({ payload }) {
const { member, onSuccess, onFailure } = payload;
try {
yield put(clearPageError());
yield call(register, member);
yield put(registerSuccess());
yield call(onSuccess);
} catch (error) {
yield put(pageError('There was an error saving your changes'));
yield call(onFailure);
}
}
export function* watchBranchListRequest() {
yield* takeLatest(BRANCH_LIST_REQUESTED, fetchBranchList);
}
export function* watchRegisterRequest() {
yield* takeLatest(REGISTER_REQUESTED, registerMember);
}
export default function* rootSaga() {
yield [
fork(watchBranchListRequest),
fork(watchRegisterRequest),
];
}
| Remove some debug logging from the frontend | Remove some debug logging from the frontend
| JavaScript | agpl-3.0 | rabblerouser/core,rabblerouser/core,rabblerouser/core | ---
+++
@@ -28,7 +28,6 @@
yield put(registerSuccess());
yield call(onSuccess);
} catch (error) {
- console.log('ERROR', error);
yield put(pageError('There was an error saving your changes'));
yield call(onFailure);
} |
c56eb8e8c3ea46bd777cf2cd7675c5eb675df161 | configuration.js | configuration.js | var nconf = require('nconf');
var scheConf = new nconf.Provider();
var mainConf = new nconf.Provider();
var optConf = new nconf.Provider();
var name2Conf = {"sche" : scheConf, "main": mainConf, "opt": optConf};
scheConf.file({file: './app/schedules.json'});
mainConf.file({file: './app/schools.json'});
optConf.file({file: './app/options.json'});
function saveSettings(settingKey, settingValue, file) {
var conf = name2Conf[file];
conf.set(settingKey, settingValue);
conf.save();
}
function readSettings(settingKey, file) {
var conf = name2Conf[file];
conf.load();
return conf.get(settingKey);
}
function getSettings(file) {
var conf = name2Conf[file];
conf.load();
return conf.get();
}
function clearSetting(key, file) {
var conf = name2Conf[file];
conf.load();
conf.clear(key);
conf.save();
}
module.exports = {
saveSettings: saveSettings,
readSettings: readSettings,
getSettings: getSettings,
clearSetting: clearSetting
};
| var nconf = require('nconf');
var scheConf = new nconf.Provider();
var mainConf = new nconf.Provider();
var optConf = new nconf.Provider();
var name2Conf = {"sche" : scheConf, "main": mainConf, "opt": optConf};
scheConf.file({file: __dirname + '/app/schedules.json'});
mainConf.file({file: __dirname + '/app/schools.json'});
optConf.file({file: __dirname + '/app/options.json'});
function saveSettings(settingKey, settingValue, file) {
var conf = name2Conf[file];
conf.set(settingKey, settingValue);
conf.save();
}
function readSettings(settingKey, file) {
var conf = name2Conf[file];
conf.load();
return conf.get(settingKey);
}
function getSettings(file) {
var conf = name2Conf[file];
conf.load();
return conf.get();
}
function clearSetting(key, file) {
var conf = name2Conf[file];
conf.load();
conf.clear(key);
conf.save();
}
module.exports = {
saveSettings: saveSettings,
readSettings: readSettings,
getSettings: getSettings,
clearSetting: clearSetting
};
| Make .json config paths relative | Make .json config paths relative
| JavaScript | mit | jdkato/scheduler,jdkato/scheduler | ---
+++
@@ -5,9 +5,10 @@
var optConf = new nconf.Provider();
var name2Conf = {"sche" : scheConf, "main": mainConf, "opt": optConf};
-scheConf.file({file: './app/schedules.json'});
-mainConf.file({file: './app/schools.json'});
-optConf.file({file: './app/options.json'});
+
+scheConf.file({file: __dirname + '/app/schedules.json'});
+mainConf.file({file: __dirname + '/app/schools.json'});
+optConf.file({file: __dirname + '/app/options.json'});
function saveSettings(settingKey, settingValue, file) {
var conf = name2Conf[file]; |
3cd5a7649adbb7a227f849c4cf73ec2ef553ae6d | app/scripts/services/MockFetchService.js | app/scripts/services/MockFetchService.js | "use strict";
angular.module("angular-mobile-docs")
.factory("MockFetchService", function ($http, $q) {
var config = {
url: "http://localhost:8080/assets/code.angularjs.org/"
};
var getVersionList = function (version) {
return $http.get(config.url+"versions.json");
}
var getFileList = function (version) {
return $http.get(
config.url
+ version
+ "/docs/partials/api/filelist.json");
}
var getPartial = function (version, name) {
return $http.get(
config.url
+ version
+ "/docs/partials/api/" + name);
}
var getAllPartials = function (version) {
var promises = [];
var fileNameList = getFileList(version);
angular.forEach(fileNameList, function (fileName) {
promises.push(getPartial(fileName, version));
})
return $q.all(promises);
}
return {
getVersionList: function () {
return getVersionList();
},
getFileList : function (version) {
return getFileList(version);
},
getPartial : function (version, name) {
return getPartial(version, name);
},
getAllPartials: function (version) {
return getAllPartials(version);
}
};
}); | "use strict";
angular.module("angular-mobile-docs")
.factory("MockFetchService", function ($http, $q) {
var config = {
url: "http://apidocs.angularjs.de/code.angularjs.org/"
};
var getVersionList = function (version) {
return $http.get(config.url+"versions.json");
}
var getFileList = function (version) {
return $http.get(
config.url
+ version
+ "/docs/partials/api/filelist.json");
}
var getPartial = function (version, name) {
return $http.get(
config.url
+ version
+ "/docs/partials/api/" + name);
}
var getAllPartials = function (version) {
var promises = [];
var fileNameList = getFileList(version);
angular.forEach(fileNameList, function (fileName) {
promises.push(getPartial(fileName, version));
})
return $q.all(promises);
}
return {
getVersionList: function () {
return getVersionList();
},
getFileList : function (version) {
return getFileList(version);
},
getPartial : function (version, name) {
return getPartial(version, name);
},
getAllPartials: function (version) {
return getAllPartials(version);
}
};
}); | Change URL to our online apidocs server | Change URL to our online apidocs server
| JavaScript | apache-2.0 | robinboehm/angular-mobile-docs,robinboehm/angular-mobile-docs,robinboehm/angular-mobile-docs,robinboehm/angular-mobile-docs | ---
+++
@@ -4,7 +4,7 @@
.factory("MockFetchService", function ($http, $q) {
var config = {
- url: "http://localhost:8080/assets/code.angularjs.org/"
+ url: "http://apidocs.angularjs.de/code.angularjs.org/"
};
var getVersionList = function (version) { |
2e2348be48f999682bfc420852121adfc6a627e9 | css.js | css.js | var importcss = require('rework-npm')
, rework = require('rework')
, vars = require('rework-vars')
, path = require('path')
, read = require('fs').readFileSync
module.exports = function (opts, cb) {
opts = opts || {}
var css = rework(read(opts.entry, 'utf8'))
css.use(importcss(path.dirname(opts.entry)))
// even if variables were not provided
// use rework-vars to process default values
css.use(vars(opts.variables))
// utilize any custom rework plugins provided
if (opts.plugins) {
opts.plugins.forEach(function (plugin) {
css.use(plugin)
})
}
cb(null, css.toString())
}
| var importcss = require('rework-npm')
, rework = require('rework')
, vars = require('rework-vars')
, path = require('path')
, read = require('fs').readFileSync
module.exports = function (opts, cb) {
opts = opts || {}
var css = rework(read(opts.entry, 'utf8'))
css.use(importcss(path.dirname(opts.entry)))
// even if variables were not provided
// use rework-vars to process default values
css.use(vars(opts.variables))
// utilize any custom rework plugins provided
if (opts.plugins) {
opts.plugins.forEach(function (plugin) {
if (typeof plugin === 'string') plugin = require(plugin)
css.use(plugin)
})
}
cb(null, css.toString())
}
| Add support for passing plugin names as strings | Add support for passing plugin names as strings | JavaScript | mit | atomify/atomify-css | ---
+++
@@ -17,6 +17,7 @@
// utilize any custom rework plugins provided
if (opts.plugins) {
opts.plugins.forEach(function (plugin) {
+ if (typeof plugin === 'string') plugin = require(plugin)
css.use(plugin)
})
} |
b056642ff76757bcb3b9481670c2f5e3b34397f7 | src/driver/websocket.js | src/driver/websocket.js | import buffer from '../buffer';
function websocket({ url, bufferTime = 0 }, { feed }) {
const buf = buffer(feed, bufferTime);
let socket;
return {
start: () => {
socket = new WebSocket(url);
socket.binaryType = 'arraybuffer';
socket.onmessage = event => {
if (typeof event.data === 'string') {
buf.pushEvent(JSON.parse(event.data));
} else {
buf.pushText(String.fromCharCode.apply(null, new Uint8Array(event.data)));
}
}
},
stop: () => {
socket.close();
}
}
}
export { websocket };
| import buffer from '../buffer';
function websocket({ url, bufferTime = 0 }, { feed }) {
const buf = buffer(feed, bufferTime);
let socket;
let reconnectDelay = 250;
function connect() {
socket = new WebSocket(url);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
reconnectDelay = 250;
}
socket.onmessage = event => {
if (typeof event.data === 'string') {
buf.pushEvent(JSON.parse(event.data));
} else {
buf.pushText(String.fromCharCode.apply(null, new Uint8Array(event.data)));
}
}
socket.onclose = event => {
if (!event.wasClean) {
console.debug(`reconnecting in ${reconnectDelay}...`);
setTimeout(connect, reconnectDelay);
reconnectDelay = Math.min(reconnectDelay * 2, 5000);
}
}
}
return {
start: () => {
connect();
},
stop: () => {
if (socket !== undefined) {
socket.close();
}
}
}
}
export { websocket };
| Implement reconnection with backoff for WebSocket driver | Implement reconnection with backoff for WebSocket driver
| JavaScript | apache-2.0 | asciinema/asciinema-player,asciinema/asciinema-player | ---
+++
@@ -3,23 +3,42 @@
function websocket({ url, bufferTime = 0 }, { feed }) {
const buf = buffer(feed, bufferTime);
let socket;
+ let reconnectDelay = 250;
+
+ function connect() {
+ socket = new WebSocket(url);
+ socket.binaryType = 'arraybuffer';
+
+ socket.onopen = () => {
+ reconnectDelay = 250;
+ }
+
+ socket.onmessage = event => {
+ if (typeof event.data === 'string') {
+ buf.pushEvent(JSON.parse(event.data));
+ } else {
+ buf.pushText(String.fromCharCode.apply(null, new Uint8Array(event.data)));
+ }
+ }
+
+ socket.onclose = event => {
+ if (!event.wasClean) {
+ console.debug(`reconnecting in ${reconnectDelay}...`);
+ setTimeout(connect, reconnectDelay);
+ reconnectDelay = Math.min(reconnectDelay * 2, 5000);
+ }
+ }
+ }
return {
start: () => {
- socket = new WebSocket(url);
- socket.binaryType = 'arraybuffer';
-
- socket.onmessage = event => {
- if (typeof event.data === 'string') {
- buf.pushEvent(JSON.parse(event.data));
- } else {
- buf.pushText(String.fromCharCode.apply(null, new Uint8Array(event.data)));
- }
- }
+ connect();
},
stop: () => {
- socket.close();
+ if (socket !== undefined) {
+ socket.close();
+ }
}
}
} |
ff4795dc9788e4d580d75741c235b48d0e4a43f9 | __test__/pickpocket.integration.test.js | __test__/pickpocket.integration.test.js | /* eslint-disable import/no-extraneous-dependencies */
require('dotenv').config();
const test = require('ava').test;
const pickpocket = require('../pickpocket');
const p = pickpocket({
consumerKey: process.env.CONSUMER_KEY
});
test('output of getAuthorizationURL with valid request token',
async t => p.obtainRequestToken().then((token) => {
const url = p.getAuthorizationURL({ requestToken: token });
t.truthy(url.startsWith('http'),
'valid call to getAuthorizationURL returns a url');
})
);
| /* eslint-disable import/no-extraneous-dependencies */
require('dotenv').config();
const test = require('ava').test;
const pickpocket = require('../pickpocket');
const p = pickpocket({
consumerKey: process.env.CONSUMER_KEY
});
test('output of getAuthorizationURL with valid request token',
async t => p.obtainRequestToken().then((token) => {
const url = p.getAuthorizationURL({ requestToken: token });
t.truthy(url.startsWith('http'),
'valid call to getAuthorizationURL returns a url');
})
);
test('output of obtainAccessToken with unauthorized request token',
async t => t.throws(
p.obtainAccessToken({ requestToken: 'unauthorized_token' }),
Error,
'obtainAccessToken should throw a SyntaxError when called with an invalid request token'
)
);
| Test for invalid request token call | Test for invalid request token call
| JavaScript | mit | janis-kra/Pickpocket | ---
+++
@@ -14,3 +14,11 @@
'valid call to getAuthorizationURL returns a url');
})
);
+
+test('output of obtainAccessToken with unauthorized request token',
+ async t => t.throws(
+ p.obtainAccessToken({ requestToken: 'unauthorized_token' }),
+ Error,
+ 'obtainAccessToken should throw a SyntaxError when called with an invalid request token'
+ )
+); |
74520011c07a05c357e0679ae7832d456008c5df | hamming/hamming_test.spec.js | hamming/hamming_test.spec.js | var compute = require('./hamming').compute;
describe('Hamming', function () {
it('no difference between identical strands', function () {
expect(compute('A', 'A')).toEqual(0);
});
xit('complete hamming distance for single nucleotide strand', function () {
expect(compute('A','G')).toEqual(1);
});
xit('complete hamming distance for small strand', function () {
expect(compute('AG','CT')).toEqual(2);
});
xit('small hamming distance', function () {
expect(compute('AT','CT')).toEqual(1);
});
xit('small hamming distance in longer strand', function () {
expect(compute('GGACG', 'GGTCG')).toEqual(1);
});
xit('ignores extra length on first strand when longer', function () {
expect(compute('AAAG', 'AAA')).toEqual(0);
});
xit('ignores extra length on other strand when longer', function () {
expect(compute('AAA', 'AAAG')).toEqual(0);
});
xit('large hamming distance', function () {
expect(compute('GATACA', 'GCATAA')).toEqual(4);
});
xit('hamming distance in very long strand', function () {
expect(compute('GGACGGATTCTG', 'AGGACGGATTCT')).toEqual(9);
});
});
| var compute = require('./hamming').compute;
describe('Hamming', function () {
it('no difference between identical strands', function () {
expect(compute('A', 'A')).toEqual(0);
});
xit('complete hamming distance for single nucleotide strand', function () {
expect(compute('A','G')).toEqual(1);
});
xit('complete hamming distance for small strand', function () {
expect(compute('AG','CT')).toEqual(2);
});
xit('small hamming distance', function () {
expect(compute('AT','CT')).toEqual(1);
});
xit('small hamming distance in longer strand', function () {
expect(compute('GGACG', 'GGTCG')).toEqual(1);
});
xit('no defined hamming distance for unequal string (first way)', function () {
expect(compute('AAAG', 'AAA')).toBeUndefined();
});
xit('no defined hamming distance for unequal string (second way)', function () {
expect(compute('AAA', 'AAAG')).toBeUndefined();
});
xit('large hamming distance', function () {
expect(compute('GATACA', 'GCATAA')).toEqual(4);
});
xit('hamming distance in very long strand', function () {
expect(compute('GGACGGATTCTG', 'AGGACGGATTCT')).toEqual(9);
});
});
| Fix tests with different length strings to look for undefined result, rather than zero. | Fix tests with different length strings to look for undefined result, rather than zero.
| JavaScript | mit | nicgallardo/xjavascript,a25patel/xjavascript,JenanMannette/xjavascript,ZacharyRSmith/xjavascript,JenanMannette/xjavascript,cloudleo/xjavascript,cloudleo/xjavascript,a25patel/excercismExcercises,a25patel/xjavascript,a25patel/excercismExcercises,exercism/xjavascript,schorsch3000/xjavascript,Vontei/xjavascript,wobh/xjavascript,nicgallardo/xjavascript,ZacharyRSmith/xjavascript,schorsch3000/xjavascript,marcCanipel/xjavascript,Vontei/xjavascript,eloquence/xjavascript,Vontei/Xjavascript-Solutions,wobh/xjavascript,eloquence/xjavascript,Vontei/Xjavascript-Solutions,exercism/xjavascript,marcCanipel/xjavascript | ---
+++
@@ -22,12 +22,12 @@
expect(compute('GGACG', 'GGTCG')).toEqual(1);
});
- xit('ignores extra length on first strand when longer', function () {
- expect(compute('AAAG', 'AAA')).toEqual(0);
+ xit('no defined hamming distance for unequal string (first way)', function () {
+ expect(compute('AAAG', 'AAA')).toBeUndefined();
});
- xit('ignores extra length on other strand when longer', function () {
- expect(compute('AAA', 'AAAG')).toEqual(0);
+ xit('no defined hamming distance for unequal string (second way)', function () {
+ expect(compute('AAA', 'AAAG')).toBeUndefined();
});
xit('large hamming distance', function () { |
23766ec217eb39a9318bb51271a8021db136de29 | assets/js/app/controllers/Issues/Show.js | assets/js/app/controllers/Issues/Show.js | redmineApp.controller('IssueShowController', function($scope, $rootScope, $window, $routeParams, $location, ProjectService, IssueService, Restangular) {
$scope.issue = {};
ProjectService.get($routeParams.project_id).then(function (project) {
$rootScope.project = project;
});
IssueService.get($routeParams.id, 'attachments,changesets,children,journals,relations,watchers').then(function (issue) {
originalIssue = Restangular.copy(issue);
$scope.issue = issue;
});
$scope.deleteIssue = function (issue) {
if ($window.confirm('Are you sure you wish to delete the issue?')) {
IssueService.delete(issue.id).then(function () {
$location.path('/projects/' + issue.project.identifier);
});
}
};
}); | redmineApp.controller('IssueShowController', function($scope, $rootScope, $window, $routeParams, $location, ProjectService, IssueService, Restangular) {
$scope.issue = {};
ProjectService.get($routeParams.project_id).then(function (project) {
$rootScope.project = project;
});
IssueService.get($routeParams.id, 'attachments,changesets,children,journals,relations,watchers').then(function (issue) {
originalIssue = Restangular.copy(issue);
$scope.issue = issue;
});
$scope.deleteIssue = function (issue) {
if ($window.confirm('Are you sure you wish to delete the issue?')) {
IssueService.delete(issue.id).then(function () {
$location.path('/projects/' + $rootScope.project.identifier + '/issues');
});
}
};
}); | Fix deleting an issue redirecting to an undefined project. | Fix deleting an issue redirecting to an undefined project.
| JavaScript | mit | tomzx/redmine.js,tomzx/redmine.js | ---
+++
@@ -13,7 +13,7 @@
$scope.deleteIssue = function (issue) {
if ($window.confirm('Are you sure you wish to delete the issue?')) {
IssueService.delete(issue.id).then(function () {
- $location.path('/projects/' + issue.project.identifier);
+ $location.path('/projects/' + $rootScope.project.identifier + '/issues');
});
}
}; |
8e085d9184c4883be92f74e18417cdebd972cc7f | src/server/index.js | src/server/index.js | import deviceMiddleware from 'express-device';
import express from 'express';
import bodyParser from 'body-parser';
import winston from 'winston';
import routerRender from './middleware/routerRender';
import errorRender from './middleware/errorRender';
import staticMiddleware from './middleware/static';
const defaultConfig = {
logLevel: process.env.NODE_LOGLEVEL || 'info',
port: process.env.NODE_PORT || 3000,
};
export default function server(userConfig = {}) {
const app = express();
const config = { ...defaultConfig, ...userConfig };
winston.level = config.logLevel;
app.use('/static', staticMiddleware);
if (process.env.NODE_ENV === 'production') {
app.use('/assets', express.static('dist/frontend'));
}
app.use(deviceMiddleware.capture());
app.use(bodyParser.json());
app.use(bodyParser.json({ type: 'application/json' }));
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// eslint-disable-next-line global-require
app.use(require('./middleware/dev').default);
}
app.use(routerRender);
app.use(errorRender);
app.ready = new Promise((resolve) => {
app.server = app.listen(config.port, () => {
winston.log('info', `Started server on port ${config.port}`);
resolve();
});
});
return app;
}
| import deviceMiddleware from 'express-device';
import express from 'express';
import bodyParser from 'body-parser';
import winston from 'winston';
import routerRender from './middleware/routerRender';
import errorRender from './middleware/errorRender';
import staticMiddleware from './middleware/static';
const defaultConfig = {
logLevel: process.env.NODE_LOG_LEVEL || 'info',
port: process.env.NODE_PORT || 3000,
};
export default function server(userConfig = {}) {
const app = express();
const config = { ...defaultConfig, ...userConfig };
winston.level = config.logLevel;
app.use('/static', staticMiddleware);
if (process.env.NODE_ENV === 'production') {
app.use('/assets', express.static('dist/frontend'));
}
app.use(deviceMiddleware.capture());
app.use(bodyParser.json());
app.use(bodyParser.json({ type: 'application/json' }));
if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// eslint-disable-next-line global-require
app.use(require('./middleware/dev').default);
}
app.use(routerRender);
app.use(errorRender);
app.ready = new Promise((resolve) => {
app.server = app.listen(config.port, () => {
winston.log('info', `Started server on port ${config.port}`);
resolve();
});
});
return app;
}
| Use nicer name for log level env variable | Use nicer name for log level env variable
| JavaScript | mit | just-paja/improtresk-web,just-paja/improtresk-web | ---
+++
@@ -8,7 +8,7 @@
import staticMiddleware from './middleware/static';
const defaultConfig = {
- logLevel: process.env.NODE_LOGLEVEL || 'info',
+ logLevel: process.env.NODE_LOG_LEVEL || 'info',
port: process.env.NODE_PORT || 3000,
};
|
fc711737c81d53b06b40740afc4b3c0005ca7e80 | github-cleandiff.js | github-cleandiff.js | var lines = document.querySelectorAll('.diff-line-code');
for (var i = 0; i < lines.length; i++) {
var line = lines[i],
lineContent = line.innerText,
firstChar = lineContent[0],
restContent = lineContent.slice(1);
var first = document.createElement('span');
first.classList.add('clean-diff-sheker');
first.setAttribute('data-char', firstChar);
var rest = document.createElement('span');
rest.innerText = restContent;
line.innerText = '';
line.appendChild(first);
line.appendChild(rest);
}
| var lines = document.querySelectorAll('.diff-line-code');
for (var i = 0; i < lines.length; i++) {
var line = lines[i],
commentButton = line.firstChild,
lineContent = line.innerText,
firstChar = lineContent[0],
restContent = lineContent.slice(1);
var first = document.createElement('span');
first.classList.add('clean-diff-sheker');
first.setAttribute('data-char', firstChar);
var rest = document.createElement('span');
rest.innerText = restContent;
line.innerText = '';
line.appendChild(commentButton);
line.appendChild(first);
line.appendChild(rest);
}
| Fix comment button being removed | Fix comment button being removed
| JavaScript | mit | rot-13/github-cleandiff,rot-13/github-cleandiff,iic-ninjas/github-cleandiff,iic-ninjas/github-cleandiff | ---
+++
@@ -2,6 +2,7 @@
for (var i = 0; i < lines.length; i++) {
var line = lines[i],
+ commentButton = line.firstChild,
lineContent = line.innerText,
firstChar = lineContent[0],
restContent = lineContent.slice(1);
@@ -14,6 +15,7 @@
rest.innerText = restContent;
line.innerText = '';
+ line.appendChild(commentButton);
line.appendChild(first);
line.appendChild(rest);
} |
6c1318e8ec6e7a59e01263a5922521d848fde233 | src/touch-action.js | src/touch-action.js | (function() {
function selector(v) {
return '[touch-action="' + v + '"]';
}
function rule(v) {
return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + '; }';
}
var attrib2css = [
'none',
'auto',
'pan-x',
'pan-y',
{
rule: 'pan-x pan-y',
selectors: [
'pan-x pan-y',
'pan-y pan-x'
]
}
];
var styles = '';
attrib2css.forEach(function(r) {
if (String(r) === r) {
styles += selector(r) + rule(r);
} else {
styles += r.selectors.map(selector) + rule(r.rule);
}
});
var el = document.createElement('style');
el.textContent = styles;
// Use querySelector instead of document.head to ensure that in
// ShadowDOM Polyfill that we have a wrapped head to append to.
var h = document.querySelector('head');
// document.write + document.head.appendChild = crazytown
// use insertBefore instead for correctness in ShadowDOM Polyfill
h.insertBefore(el, h.firstChild);
})();
| (function() {
function selector(v) {
return '[touch-action="' + v + '"]';
}
function rule(v) {
return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + '; }';
}
var attrib2css = [
'none',
'auto',
'pan-x',
'pan-y',
{
rule: 'pan-x pan-y',
selectors: [
'pan-x pan-y',
'pan-y pan-x'
]
}
];
var styles = '';
attrib2css.forEach(function(r) {
if (String(r) === r) {
styles += selector(r) + rule(r);
} else {
styles += r.selectors.map(selector) + rule(r.rule);
}
});
var el = document.createElement('style');
el.textContent = styles;
document.head.appendChild(el);
})();
| Remove nasty querySelector / head / appendChild hack for ShadowDOM Polyfill | Remove nasty querySelector / head / appendChild hack for ShadowDOM Polyfill
- Requires fix from Polymer/ShadowDOM#228
| JavaScript | bsd-3-clause | roblarsen/pointer-events.js | ---
+++
@@ -28,10 +28,5 @@
});
var el = document.createElement('style');
el.textContent = styles;
- // Use querySelector instead of document.head to ensure that in
- // ShadowDOM Polyfill that we have a wrapped head to append to.
- var h = document.querySelector('head');
- // document.write + document.head.appendChild = crazytown
- // use insertBefore instead for correctness in ShadowDOM Polyfill
- h.insertBefore(el, h.firstChild);
+ document.head.appendChild(el);
})(); |
ab7cef683322c39bf42e78f5387236ae8d6476e9 | src/objects/axis/methods/_parseDate.js | src/objects/axis/methods/_parseDate.js | // Copyright: 2013 PMSI-AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/axis/methods/_parseDate.js
this._parseDate = function (inDate) {
// A javascript date object
var outDate;
if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
// If nothing has been explicity defined you are in the hands of the browser gods
// may they smile upon you...
outDate = Date.parse(inDate);
} else {
outDate = d3.time.format(this.dateParseFormat).parse(inDate);
}
// Return the date
return outDate;
};
| // Copyright: 2013 PMSI-AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/axis/methods/_parseDate.js
this._parseDate = function (inDate) {
// A javascript date object
var outDate;
if (!isNaN(inDate)) {
// If inDate is a number, assume it's epoch time
outDate = new Date(inDate);
} else if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
// If nothing has been explicity defined you are in the hands of the browser gods
// may they smile upon you...
outDate = Date.parse(inDate);
} else {
outDate = d3.time.format(this.dateParseFormat).parse(inDate);
}
// Return the date
return outDate;
};
| Support time series data represented in epoch time | Support time series data represented in epoch time
| JavaScript | mit | mlzummo/dimple,rebaselabs/dimple,timothymartin76/dimple,danucalovj/dimple,ganeshchand/dimple,rpaskowitz/dimple,PMSI-AlignAlytics/dimple,dbirchak/dimple,upsight/dimple,bbirand/dimple,sajith/dimple,boneyao/dimple,gdseller/dimple,zhangweiabc/dimple,rebaselabs/dimple,mlzummo/dimple,sajith/dimple,PMSI-AlignAlytics/dimple,upsight/dimple,zhangweiabc/dimple,sjtg/dimple,gdseller/dimple,boneyao/dimple,rpaskowitz/dimple,ganeshchand/dimple,danucalovj/dimple,sjtg/dimple,dbirchak/dimple,confile/dimple,confile/dimple,bbirand/dimple,timothymartin76/dimple | ---
+++
@@ -4,7 +4,10 @@
this._parseDate = function (inDate) {
// A javascript date object
var outDate;
- if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
+ if (!isNaN(inDate)) {
+ // If inDate is a number, assume it's epoch time
+ outDate = new Date(inDate);
+ } else if (this.dateParseFormat === null || this.dateParseFormat === undefined) {
// If nothing has been explicity defined you are in the hands of the browser gods
// may they smile upon you...
outDate = Date.parse(inDate); |
9c1fbeeb7037b1f0e04ea09d021380b2623516d3 | addon/components/bs4/bs-collapse.js | addon/components/bs4/bs-collapse.js | import Collapse from 'ember-bootstrap/components/base/bs-collapse';
export default Collapse.extend({
classNameBindings: ['collapse', 'showContent:show', 'collapsing']
});
| import Collapse from 'ember-bootstrap/components/base/bs-collapse';
export default Collapse.extend({
classNameBindings: ['showContent:show']
});
| Remove redundant class name bindings in BS4. | Remove redundant class name bindings in BS4.
| JavaScript | mit | jelhan/ember-bootstrap,kaliber5/ember-bootstrap,kaliber5/ember-bootstrap,jelhan/ember-bootstrap | ---
+++
@@ -1,5 +1,5 @@
import Collapse from 'ember-bootstrap/components/base/bs-collapse';
export default Collapse.extend({
- classNameBindings: ['collapse', 'showContent:show', 'collapsing']
+ classNameBindings: ['showContent:show']
}); |
cedab8e26fd8342b6e9903f09bf5ba08f88138db | app/assets/javascripts/caboose/admin.js | app/assets/javascripts/caboose/admin.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require colorbox-rails
//= require caboose/modal_integration
//= require caboose/placeholder
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require colorbox-rails
//= require caboose/jquery.placeholder
//= require caboose/modal_integration
| Fix manifest file wrong include name | Fix manifest file wrong include name
| JavaScript | mit | williambarry007/caboose-cms,williambarry007/caboose-cms,williambarry007/caboose-cms | ---
+++
@@ -14,5 +14,5 @@
//= require jquery_ujs
//= require jquery.ui.all
//= require colorbox-rails
+//= require caboose/jquery.placeholder
//= require caboose/modal_integration
-//= require caboose/placeholder |
2569ca89d308a23be218ba6e7a890e11de201b1b | app/assets/javascripts/messaging.js | app/assets/javascripts/messaging.js | ;(function(){
var app = angular.module('Communicant', []);
app.controller('ListOfMessagesController', ['$scope', '$http', function($scope, $http){
$http.get("/messages.json")
.then(function(response){
$scope.messages = response.data;
})
}]); // END ListOfMessagesController
app.controller('SendMessageController', ['$scope', '$http', function($scope, $http){
// console.log("Hello?");
$scope.newMessage = { };
$scope.submit = function(){
$http.post("/messages.json", $scope.newMessage);
};
$http.get("/messages.json")
.then(function(response){
$scope.messages = response.data;
})
}]); // END SendMessageController
})(); // END IIFE
| ;(function(){
var app = angular.module('Communicant', []);
app.controller('ListOfMessagesController', ['$scope', '$http', function($scope, $http){
$http.get("/messages.json")
.then(function(response){
$scope.messages = response.data;
})
}]); // END ListOfMessagesController
app.controller('SendMessageController', ['$scope', '$http', function($scope, $http){
// console.log("Hello?");
$scope.newMessage = { };
$scope.submit = function(){
$http.post("/messages.json", $scope.newMessage);
};
$http.get("/messages.json")
.then(function(response){
$scope.messages = response.data;
})
}]); // END SendMessageController
// $timeout([fn], [2000], [invokeApply], [Pass]);
})(); // END IIFE
| Add code commented note about setTimeout | Add code commented note about setTimeout
| JavaScript | mit | Communicant/app,Communicant/app,Communicant/app | ---
+++
@@ -15,12 +15,13 @@
$scope.submit = function(){
$http.post("/messages.json", $scope.newMessage);
};
+
$http.get("/messages.json")
.then(function(response){
$scope.messages = response.data;
})
}]); // END SendMessageController
-
+// $timeout([fn], [2000], [invokeApply], [Pass]);
})(); // END IIFE |
ef48a4d4ff9a880d3d2be436ece22f5b86e0afaf | includes/js/main.js | includes/js/main.js | $(function() {
$(".add").button();
$(".edit").button();
$(".delete").button().click(function() {
var res = confirm("Are you sure you want to delete this item?");
if (res)
window.location.href=$(this).attr('href');
else
return false;
});
$(".view").button();
$(".submit").button();
$("#ingredients_table table").tablesorter();
}); | $(function() {
$(".add").button();
$(".edit").button();
$(".delete").button().click(function() {
var res = confirm("Are you sure you want to delete this item?");
if (res)
window.location.href=$(this).attr('href');
else
return false;
});
$(".view").button();
$(".submit").button();
$("#ingredients_table table").tablesorter();
$("#effects_table table").tablesorter();
}); | Add tablesorter to effects table | Add tablesorter to effects table
| JavaScript | mit | claw68/alchemy,claw68/alchemy,claw68/alchemy,claw68/alchemy | ---
+++
@@ -12,4 +12,5 @@
$(".submit").button();
$("#ingredients_table table").tablesorter();
+ $("#effects_table table").tablesorter();
}); |
280c691c77f3644e79030ea9d06c12d66963c85a | testing/templates/karma.conf.js | testing/templates/karma.conf.js | module.exports = function( config ) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
frameworks: ['mocha','requirejs'],
// list of files / patterns to load in the browser
files: [
{pattern: 'test/lib/*.js', included: false},
{pattern: 'app/bower_components/**/*.js', included: false},
{pattern: 'app/scripts/**/*.js', included: false},
{pattern: 'test/unit/**/*.test.js', included: false},
// test main require module last
'test/test-main.js'
],
preprocessors: {
'app/scripts/**/*.js': 'coverage'
},
autoWatch: true,
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['progress','coverage'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
| module.exports = function( config ) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
frameworks: ['mocha','requirejs'],
// list of files / patterns to load in the browser
files: [
{pattern: 'test/lib/*.js', included: false},
{pattern: 'app/bower_components/**/*.js', included: false},
{pattern: 'app/scripts/**/*.js', included: false},
{pattern: 'test/unit/**/*.test.js', included: false},
// test main require module last
'test/test-main.js'
],
preprocessors: {
'app/scripts/**/*.js': 'coverage'
},
autoWatch: true,
// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['progress','coverage'],
// web server port
port: 9876,
// cli runner port
runnerPort: 9100,
// enable / disable colors in the output (reporters and logs)
colors: true,
// Start these browsers, currently available:
// - Chrome
// - PhantomJS
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
| Update available browsers as this has changed by default in 0.10.2 | Update available browsers as this has changed by default in 0.10.2 | JavaScript | mit | kaldor/generator-pugpig,kaldor/generator-pugpig | ---
+++
@@ -36,12 +36,7 @@
// Start these browsers, currently available:
// - Chrome
- // - ChromeCanary
- // - Firefox
- // - Opera
- // - Safari (only Mac)
// - PhantomJS
- // - IE (only Windows)
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it |
0e84fae622294e398c6d91207a59c34373c20c80 | lib/constants.js | lib/constants.js | module.exports = {
CONFIG_FILE_NAME: 'ssh-seed.yml',
PASS_FILE_NAME: 'ssh-seed.pass.yml',
DEFAULT_CONFIG: {
passphrase: {
length: 12,
options: '',
},
ssh_add: {
'default': false,
options: '',
},
ssh_keygen: {
options: '',
},
keys: [],
},
};
| module.exports = {
CONFIG_FILE_NAME: 'ssh-seed.yml',
PASS_FILE_NAME: 'ssh-seed.pass.yml',
DEFAULT_CONFIG: {
passphrase: {},
ssh_add: {
'default': false,
options: '',
},
ssh_keygen: {
options: '',
},
keys: [],
},
};
| Change the default passphrase generation options | refactor: Change the default passphrase generation options
| JavaScript | mit | suzuki-shunsuke/ssh-seed,suzuki-shunsuke/ssh-seed | ---
+++
@@ -2,10 +2,7 @@
CONFIG_FILE_NAME: 'ssh-seed.yml',
PASS_FILE_NAME: 'ssh-seed.pass.yml',
DEFAULT_CONFIG: {
- passphrase: {
- length: 12,
- options: '',
- },
+ passphrase: {},
ssh_add: {
'default': false,
options: '', |
8d077e561dd8ac38c6fab90cabb2c7d5df15992e | script/dist-info.js | script/dist-info.js | 'use strict'
const path = require('path')
const projectRoot = path.join(__dirname, '..')
const appPackage = require(path.join(projectRoot, 'package.json'))
function getDistPath () {
return path.join(projectRoot, 'dist', `${appPackage.productName}-${process.platform}-x64`)
}
function getProductName () {
return appPackage.productName
}
function getCompanyName () {
return appPackage.companyName
}
function getVersion () {
return appPackage.version
}
function getOSXZipPath () {
const productName = getProductName()
return path.join(getDistPath(), '..', `${productName}.zip`)
}
function getWindowsInstallerPath () {
const productName = getProductName()
return path.join(getDistPath(), '..', 'installer', `${productName}.msi`)
}
module.exports = {getDistPath, getProductName, getCompanyName, getVersion, getOSXZipPath, getWindowsInstallerPath}
| 'use strict'
const path = require('path')
const projectRoot = path.join(__dirname, '..')
const appPackage = require(path.join(projectRoot, 'package.json'))
function getDistPath () {
return path.join(projectRoot, 'dist', `${appPackage.productName}-${process.platform}-x64`)
}
function getProductName () {
return appPackage.productName
}
function getCompanyName () {
return appPackage.companyName
}
function getVersion () {
return appPackage.version
}
function getOSXZipPath () {
const productName = getProductName()
return path.join(getDistPath(), '..', `${productName}.zip`)
}
function getWindowsInstallerPath () {
const productName = getProductName()
return path.join(getDistPath(), '..', 'installer', `${productName}Setup.msi`)
}
module.exports = {getDistPath, getProductName, getCompanyName, getVersion, getOSXZipPath, getWindowsInstallerPath}
| Set Up The Bomb here too | Set Up The Bomb here too
| JavaScript | mit | artivilla/desktop,shiftkey/desktop,j-f1/forked-desktop,desktop/desktop,artivilla/desktop,j-f1/forked-desktop,kactus-io/kactus,hjobrien/desktop,hjobrien/desktop,artivilla/desktop,kactus-io/kactus,gengjiawen/desktop,j-f1/forked-desktop,shiftkey/desktop,desktop/desktop,desktop/desktop,BugTesterTest/desktops,desktop/desktop,artivilla/desktop,say25/desktop,say25/desktop,gengjiawen/desktop,BugTesterTest/desktops,hjobrien/desktop,BugTesterTest/desktops,shiftkey/desktop,gengjiawen/desktop,hjobrien/desktop,kactus-io/kactus,j-f1/forked-desktop,gengjiawen/desktop,kactus-io/kactus,BugTesterTest/desktops,shiftkey/desktop,say25/desktop,say25/desktop | ---
+++
@@ -28,7 +28,7 @@
function getWindowsInstallerPath () {
const productName = getProductName()
- return path.join(getDistPath(), '..', 'installer', `${productName}.msi`)
+ return path.join(getDistPath(), '..', 'installer', `${productName}Setup.msi`)
}
module.exports = {getDistPath, getProductName, getCompanyName, getVersion, getOSXZipPath, getWindowsInstallerPath} |
63a2622f531d99fa0056709f90c996290dcab047 | server/devServer.js | server/devServer.js | const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: {
colors: true,
},
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
| const WebpackDevServer = require('webpack-dev-server');
const webpack = require('webpack');
const config = require('../webpack/webpack.config.dev');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
stats: 'errors-only',
historyApiFallback: {
index: 'src/html/index.dev.html',
},
}).listen(8080, '0.0.0.0', (err) => {
if (err) {
// eslint-disable-next-line no-console
return console.log(err);
}
// eslint-disable-next-line no-console
return console.log('Listening at http://localhost:8080/');
});
| Hide extra webpack stats on development. | Hide extra webpack stats on development.
| JavaScript | mit | hannupekka/react-pack,hannupekka/react-pack | ---
+++
@@ -5,9 +5,7 @@
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
- stats: {
- colors: true,
- },
+ stats: 'errors-only',
historyApiFallback: {
index: 'src/html/index.dev.html',
}, |
d63082734a20580eb29a8b2419ed36a386d46234 | spec/loggeSpec.js | spec/loggeSpec.js | describe('logge', function() {
var $console, log;
beforeEach(module('logge'));
beforeEach(function() {
var logMethod = function(msg) { log += (msg + ';'); };
log = '';
$console = {
'debug': logMethod,
'log': logMethod,
'info': logMethod,
'warn': logMethod,
'error': logMethod
};
});
describe('when console is present', function() {
beforeEach(module(function($provide) {
$provide.value('$window', {console: $console});
}));
it('logs messages', inject(function($logge) {
$logge.debug('debug');
$logge.log('log');
$logge.info('info');
$logge.warn('warn');
$logge.error('error');
expect(log).toEqual('debug;log;info;warn;error;');
}));
});
describe('when console is not present', function() {
beforeEach(module(function($provide) {
$provide.value('$window', {});
}));
it('calls noop', inject(function($logge) {
$logge.debug('debug;');
$logge.log('log');
$logge.info('info;');
$logge.warn('warn;');
$logge.error('error;');
expect(log).toEqual('');
}));
});
});
| describe('logge', function() {
var $console, log;
beforeEach(module('logge'));
beforeEach(function() {
var logMethod = function(msg) { log += (msg + ';'); };
log = '';
$console = {
'debug': logMethod,
'log': logMethod,
'info': logMethod,
'warn': logMethod,
'error': logMethod
};
});
describe('when console is present', function() {
beforeEach(module(function($provide) {
$provide.value('$window', {console: $console});
}));
it('logs messages', inject(function($logge) {
$logge.debug('debug');
$logge.log('log');
$logge.info('info');
$logge.warn('warn');
$logge.error('error');
expect(log).toEqual('debug;log;info;warn;error;');
}));
});
describe('when console is not present', function() {
beforeEach(module(function($provide) {
$provide.value('$window', {});
}));
it('calls noop', inject(function($logge) {
$logge.debug('debug;');
$logge.log('log');
$logge.info('info;');
$logge.warn('warn;');
$logge.error('error;');
expect(log).toEqual('');
}));
});
describe('when level is set', function() {
beforeEach(module(function($provide, $loggeProvider) {
$provide.value('$window', {console: $console});
$loggeProvider.level('error');
}));
it('calls noop of equal or greater level', inject(function($logge) {
$logge.info('info');
$logge.error('error');
expect(log).toEqual('error;');
}));
});
});
| Add log level configuration specs | Add log level configuration specs
| JavaScript | mit | nysa/logge | ---
+++
@@ -44,5 +44,18 @@
expect(log).toEqual('');
}));
});
+
+ describe('when level is set', function() {
+ beforeEach(module(function($provide, $loggeProvider) {
+ $provide.value('$window', {console: $console});
+ $loggeProvider.level('error');
+ }));
+
+ it('calls noop of equal or greater level', inject(function($logge) {
+ $logge.info('info');
+ $logge.error('error');
+ expect(log).toEqual('error;');
+ }));
+ });
});
|
f7059099105835e8f658dd39815c91d0286385d4 | styles/test/test.js | styles/test/test.js | const path = require('path');
const sassTrue = require('sass-true')
const globImporter = require('node-sass-glob-importer')
const alreadyImported = []
const importOnce = (url, prev, done) => {
const asAbsolute = path.isAbsolute(url) ? url : path.join(path.dirname(prev), url)
const asAbsoluteDirname = path.dirname(asAbsolute)
const asAbsoluteBaseStrip = path.basename(asAbsolute).replace(/^_/, '').replace(/.s[ca]ss$/, '')
const isSameFile = (otherPath) => {
const isSameDir = path.dirname(otherPath) === asAbsoluteDirname
const otherPathBaseStrip = path.basename(otherPath).replace(/^_/, '').replace(/.s[ca]ss$/, '')
const isCompatibleBase = otherPathBaseStrip === asAbsoluteBaseStrip
return (isSameDir && isCompatibleBase)
}
if (alreadyImported.some(isSameFile)) {
return {};
} else {
alreadyImported.push(asAbsolute)
return null;
}
}
const frameworkIncludesPath = path.join(__dirname, '../framework')
const sassFile = path.join(__dirname, 'test-framework.scss')
sassTrue.runSass({
file: sassFile,
importer: [globImporter(), importOnce],
includePaths: [frameworkIncludesPath],
}, describe, it)
| const path = require('path');
const sassTrue = require('sass-true')
const globImporter = require('node-sass-glob-importer')
const alreadyImported = []
const importOnce = (url, prev, done) => {
const asAbsolute = path.isAbsolute(url) ? url : path.join(path.dirname(prev), url)
const asAbsoluteDirname = path.dirname(asAbsolute)
const asAbsoluteBaseStrip = path.basename(asAbsolute).replace(/^_/, '').replace(/.s[ca]ss$/, '')
const isSameFile = (otherPath) => {
const isSameDir = path.dirname(otherPath) === asAbsoluteDirname
const otherPathBaseStrip = path.basename(otherPath).replace(/^_/, '').replace(/.s[ca]ss$/, '')
const isCompatibleBase = otherPathBaseStrip === asAbsoluteBaseStrip
return (isSameDir && isCompatibleBase)
}
if (alreadyImported.some(isSameFile)) {
// console.log(`Not imported: ${asAbsolute}`)
return {};
} else {
alreadyImported.push(asAbsolute)
return null;
}
}
const frameworkIncludesPath = path.join(__dirname, '../framework')
const sassFile = path.join(__dirname, 'test-framework.scss')
sassTrue.runSass({
file: sassFile,
importer: [globImporter(), importOnce],
includePaths: [frameworkIncludesPath],
}, describe, it)
| Add debug message for import once | Add debug message for import once
| JavaScript | lgpl-2.1 | Connexions/cnx-rulesets,Connexions/cnx-rulesets,Connexions/cte,Connexions/cnx-recipes,Connexions/cte,Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cnx-recipes,Connexions/cnx-rulesets,Connexions/cnx-recipes,Connexions/cnx-recipes | ---
+++
@@ -14,6 +14,7 @@
return (isSameDir && isCompatibleBase)
}
if (alreadyImported.some(isSameFile)) {
+ // console.log(`Not imported: ${asAbsolute}`)
return {};
} else {
alreadyImported.push(asAbsolute) |
9098a803b471d858e98b8e03b5c83a09c9fdf13d | workers/social/index.js | workers/social/index.js | require('coffee-script');
require('newrelic');
module.exports = require('./lib/social/main.coffee');
| require('coffee-script');
module.exports = require('./lib/social/main.coffee'); | Revert "add newrelic to social worker" | Revert "add newrelic to social worker"
This reverts commit e27600b036531be98593688f50a4d8da22b79356.
| JavaScript | agpl-3.0 | gokmen/koding,andrewjcasal/koding,alex-ionochkin/koding,alex-ionochkin/koding,cihangir/koding,rjeczalik/koding,mertaytore/koding,mertaytore/koding,rjeczalik/koding,andrewjcasal/koding,alex-ionochkin/koding,rjeczalik/koding,koding/koding,usirin/koding,kwagdy/koding-1,sinan/koding,mertaytore/koding,gokmen/koding,mertaytore/koding,kwagdy/koding-1,sinan/koding,koding/koding,andrewjcasal/koding,jack89129/koding,drewsetski/koding,cihangir/koding,koding/koding,szkl/koding,kwagdy/koding-1,usirin/koding,sinan/koding,acbodine/koding,gokmen/koding,koding/koding,sinan/koding,andrewjcasal/koding,kwagdy/koding-1,kwagdy/koding-1,cihangir/koding,jack89129/koding,alex-ionochkin/koding,drewsetski/koding,jack89129/koding,szkl/koding,sinan/koding,acbodine/koding,gokmen/koding,koding/koding,koding/koding,andrewjcasal/koding,koding/koding,szkl/koding,usirin/koding,acbodine/koding,usirin/koding,acbodine/koding,usirin/koding,alex-ionochkin/koding,jack89129/koding,szkl/koding,rjeczalik/koding,drewsetski/koding,sinan/koding,alex-ionochkin/koding,szkl/koding,jack89129/koding,koding/koding,andrewjcasal/koding,mertaytore/koding,gokmen/koding,alex-ionochkin/koding,rjeczalik/koding,sinan/koding,mertaytore/koding,drewsetski/koding,acbodine/koding,szkl/koding,rjeczalik/koding,drewsetski/koding,sinan/koding,cihangir/koding,gokmen/koding,kwagdy/koding-1,andrewjcasal/koding,jack89129/koding,jack89129/koding,cihangir/koding,mertaytore/koding,drewsetski/koding,kwagdy/koding-1,acbodine/koding,gokmen/koding,szkl/koding,acbodine/koding,mertaytore/koding,cihangir/koding,cihangir/koding,andrewjcasal/koding,alex-ionochkin/koding,drewsetski/koding,jack89129/koding,gokmen/koding,kwagdy/koding-1,acbodine/koding,szkl/koding,rjeczalik/koding,usirin/koding,cihangir/koding,usirin/koding,usirin/koding,rjeczalik/koding,drewsetski/koding | ---
+++
@@ -1,3 +1,2 @@
require('coffee-script');
-require('newrelic');
module.exports = require('./lib/social/main.coffee'); |
1c74bbc69ba577f32a8411b1075796869dd4c549 | NoteWrangler/public/js/services/note.js | NoteWrangler/public/js/services/note.js | // js/services/note.js
(function() {
"use strict";
angular.module("NoteWrangler")
.factory("Note", NoteFactory);
NoteFactory.$inject = ["$http"];
function NoteFactory($http) {
function getAllNotes() {
return $http({
method: "GET",
url: "/api/notes"
});
}
function createNote(noteData) {
return $http({
method: "POST",
url: "/api/notes",
data: noteData
})
}
return {
getAllNotes,
createNote
}
}
})();
| // js/services/note.js
(function() {
"use strict";
angular.module("NoteWrangler")
.factory("Note", NoteFactory);
NoteFactory.$inject = ["$http", "$routeParams"];
function NoteFactory($http, $routeParams) {
function getAllNotes() {
return $http({
method: "GET",
url: "/api/notes"
});
}
function getNoteById() {
return $http({
method: "GET",
url: "/api/notes/" + $routeParams.id
})
}
function createNote(noteData) {
return $http({
method: "POST",
url: "/api/notes",
data: noteData
})
}
return {
getAllNotes,
createNote,
getNoteById
}
}
})();
| Add getNoteById method. Add to | Add getNoteById method. Add to
| JavaScript | mit | var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training,var-bin/angularjs-training | ---
+++
@@ -6,14 +6,21 @@
angular.module("NoteWrangler")
.factory("Note", NoteFactory);
- NoteFactory.$inject = ["$http"];
+ NoteFactory.$inject = ["$http", "$routeParams"];
- function NoteFactory($http) {
+ function NoteFactory($http, $routeParams) {
function getAllNotes() {
return $http({
method: "GET",
url: "/api/notes"
});
+ }
+
+ function getNoteById() {
+ return $http({
+ method: "GET",
+ url: "/api/notes/" + $routeParams.id
+ })
}
function createNote(noteData) {
@@ -26,7 +33,8 @@
return {
getAllNotes,
- createNote
+ createNote,
+ getNoteById
}
}
})(); |
ac7c650445d9188823deda1be39dd16c74d3a9c9 | src/module_pre.js | src/module_pre.js | (function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory();
} else if (typeof define === 'function' && define.amd) {
// AMD
define([], function () {
return (root.returnExportsGlobal = factory());
});
} else {
// Global Variables
var snabbtjs = factory();
root.snabbtjs = snabbtjs;
root.snabbt = snabbtjs.snabbt;
//root.returnExportsGlobal = factory();
}
}(this, function () {
| (function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
module.exports = factory().snabbt;
} else if (typeof define === 'function' && define.amd) {
// AMD
define([], function () {
return (root.returnExportsGlobal = factory().snabbt);
});
} else {
// Global Variables
root.snabbt = factory().snabbt;
}
}(this, function () {
| Improve UMD boilerplate to export snabbt-function directly | Improve UMD boilerplate to export snabbt-function directly
| JavaScript | mit | wangyue-ramy/snabbt.js,CreaturePhil/snabbt.js,elwebdeveloper/snabbt.js,lowyjoe/snabbt.js,output/snabbt.js,RubyLouvre/snabbt.js,daniel-lundin/snabbt.js,mubassirhayat/snabbt.js | ---
+++
@@ -1,19 +1,16 @@
(function (root, factory) {
if (typeof exports === 'object') {
// CommonJS
- module.exports = factory();
+ module.exports = factory().snabbt;
} else if (typeof define === 'function' && define.amd) {
// AMD
define([], function () {
- return (root.returnExportsGlobal = factory());
+ return (root.returnExportsGlobal = factory().snabbt);
});
} else {
// Global Variables
- var snabbtjs = factory();
- root.snabbtjs = snabbtjs;
- root.snabbt = snabbtjs.snabbt;
- //root.returnExportsGlobal = factory();
+ root.snabbt = factory().snabbt;
}
}(this, function () {
|
a8e06d5f2050f7e059d6c32079cbc8b5f127a0da | lib/core/src/server/utils/load-custom-addons-file.js | lib/core/src/server/utils/load-custom-addons-file.js | import path from 'path';
import { logger } from '@storybook/node-logger';
import { getInterpretedFile } from './interpret-files';
function loadCustomAddons({ configDir }) {
const storybookCustomAddonsPath = getInterpretedFile(path.resolve(configDir, 'addons'));
if (storybookCustomAddonsPath) {
logger.info('=> Loading custom addons config.');
return [storybookCustomAddonsPath];
}
return [];
}
export default loadCustomAddons;
| import path from 'path';
import { logger } from '@storybook/node-logger';
import { getInterpretedFile } from './interpret-files';
function loadCustomAddons({ configDir }) {
const storybookCustomAddonsPath = getInterpretedFile(path.resolve(configDir, 'addons'));
const storybookCustomManagerPath = getInterpretedFile(path.resolve(configDir, 'manager'));
if (storybookCustomAddonsPath || storybookCustomManagerPath) {
logger.info('=> Loading custom addons config.');
}
return [].concat(storybookCustomAddonsPath || []).concat(storybookCustomManagerPath || []);
}
export default loadCustomAddons;
| ADD support for manager.js as a replacement for addons.js | ADD support for manager.js as a replacement for addons.js
| JavaScript | mit | storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook | ---
+++
@@ -5,13 +5,13 @@
function loadCustomAddons({ configDir }) {
const storybookCustomAddonsPath = getInterpretedFile(path.resolve(configDir, 'addons'));
+ const storybookCustomManagerPath = getInterpretedFile(path.resolve(configDir, 'manager'));
- if (storybookCustomAddonsPath) {
+ if (storybookCustomAddonsPath || storybookCustomManagerPath) {
logger.info('=> Loading custom addons config.');
- return [storybookCustomAddonsPath];
}
- return [];
+ return [].concat(storybookCustomAddonsPath || []).concat(storybookCustomManagerPath || []);
}
export default loadCustomAddons; |
ad464785cb18d845ef4a7bacc261b9226dc02551 | Specs/DynamicScene/KmlDataSourceSpec.js | Specs/DynamicScene/KmlDataSourceSpec.js | /*global defineSuite*/
defineSuite(['DynamicScene/KmlDataSource',
'DynamicScene/DynamicObjectCollection',
'Core/Event'
], function(
KmlDataSource,
DynamicObjectCollection,
Event) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('default constructor has expected values', function() {
var dataSource = new KmlDataSource();
expect(dataSource.getChangedEvent()).toBeInstanceOf(Event);
expect(dataSource.getErrorEvent()).toBeInstanceOf(Event);
expect(dataSource.getClock()).toBeUndefined();
expect(dataSource.getDynamicObjectCollection()).toBeInstanceOf(DynamicObjectCollection);
expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(0);
expect(dataSource.getIsTimeVarying()).toEqual(false);
});
it('A new empty test', function() {
});
}); | /*global defineSuite*/
defineSuite(['DynamicScene/KmlDataSource',
'DynamicScene/DynamicObjectCollection',
'Core/loadXML',
'Core/Event'
], function(
KmlDataSource,
loadXML,
DynamicObjectCollection,
Event) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('default constructor has expected values', function() {
var dataSource = new KmlDataSource();
expect(dataSource.getChangedEvent()).toBeInstanceOf(Event);
expect(dataSource.getErrorEvent()).toBeInstanceOf(Event);
expect(dataSource.getClock()).toBeUndefined();
expect(dataSource.getDynamicObjectCollection()).toBeInstanceOf(DynamicObjectCollection);
expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(0);
expect(dataSource.getIsTimeVarying()).toEqual(false);
});
it('Just want to see placemark data type in the debugger', function() {
var dataSource = new KmlDataSource();
var url = 'http://localhost:8080/Apps/CesiumViewer/Gallery/KML_Samples.kml';
dataSource.loadUrl(url);
});
}); | Add new test to allow me to visualize Placemark list in the debugger | Add new test to allow me to visualize Placemark list in the debugger
| JavaScript | apache-2.0 | AnimatedRNG/cesium,jason-crow/cesium,progsung/cesium,CesiumGS/cesium,geoscan/cesium,NaderCHASER/cesium,YonatanKra/cesium,kiselev-dv/cesium,CesiumGS/cesium,josh-bernstein/cesium,jason-crow/cesium,esraerik/cesium,wallw-bits/cesium,oterral/cesium,soceur/cesium,wallw-bits/cesium,AnalyticalGraphicsInc/cesium,esraerik/cesium,kiselev-dv/cesium,aelatgt/cesium,esraerik/cesium,wallw-bits/cesium,josh-bernstein/cesium,denverpierce/cesium,jasonbeverage/cesium,omh1280/cesium,hodbauer/cesium,likangning93/cesium,jason-crow/cesium,kaktus40/cesium,hodbauer/cesium,aelatgt/cesium,YonatanKra/cesium,AnalyticalGraphicsInc/cesium,YonatanKra/cesium,omh1280/cesium,emackey/cesium,AnimatedRNG/cesium,kiselev-dv/cesium,likangning93/cesium,NaderCHASER/cesium,wallw-bits/cesium,omh1280/cesium,oterral/cesium,emackey/cesium,ggetz/cesium,likangning93/cesium,ggetz/cesium,likangning93/cesium,denverpierce/cesium,oterral/cesium,hodbauer/cesium,kaktus40/cesium,aelatgt/cesium,soceur/cesium,soceur/cesium,likangning93/cesium,NaderCHASER/cesium,kiselev-dv/cesium,emackey/cesium,ggetz/cesium,emackey/cesium,AnimatedRNG/cesium,denverpierce/cesium,denverpierce/cesium,jasonbeverage/cesium,aelatgt/cesium,CesiumGS/cesium,ggetz/cesium,AnimatedRNG/cesium,YonatanKra/cesium,jason-crow/cesium,esraerik/cesium,CesiumGS/cesium,CesiumGS/cesium,progsung/cesium,omh1280/cesium,geoscan/cesium | ---
+++
@@ -1,9 +1,11 @@
/*global defineSuite*/
defineSuite(['DynamicScene/KmlDataSource',
'DynamicScene/DynamicObjectCollection',
+ 'Core/loadXML',
'Core/Event'
], function(
KmlDataSource,
+ loadXML,
DynamicObjectCollection,
Event) {
"use strict";
@@ -19,6 +21,10 @@
expect(dataSource.getIsTimeVarying()).toEqual(false);
});
- it('A new empty test', function() {
+ it('Just want to see placemark data type in the debugger', function() {
+ var dataSource = new KmlDataSource();
+ var url = 'http://localhost:8080/Apps/CesiumViewer/Gallery/KML_Samples.kml';
+
+ dataSource.loadUrl(url);
});
}); |
8f498053041a216f04373380822016c90efc309b | _TEMPLATE/applications/-Application-.js | _TEMPLATE/applications/-Application-.js | var controller;
$(function(){
var appName = "[ENTER YOUR APP NAME HERE]",
app = $.ku4webApp.app();
controller = $.ku4webApp.controllers[appName](app)
$.ku4webApp.views[appName](app);
/*======================================================*/
//[Other desired views or initialization scripting HERE]
/*======================================================*/
}); | var controller;
$(function(){
var appName = "[ENTER YOUR APP NAME HERE]",
app = $.ku4webApp.app().throwErrors();
controller = $.ku4webApp.controllers[appName](app)
$.ku4webApp.views[appName](app);
/*======================================================*/
//[Other desired views or initialization scripting HERE]
/*======================================================*/
}); | Set app to throwErrors on by default | Set app to throwErrors on by default
| JavaScript | mit | kodmunki/ku4js-webApp,kodmunki/ku4js-webApp,kodmunki/ku4js-webApp,kodmunki/ku4js-webApp,kodmunki/ku4js-webApp | ---
+++
@@ -1,7 +1,7 @@
var controller;
$(function(){
var appName = "[ENTER YOUR APP NAME HERE]",
- app = $.ku4webApp.app();
+ app = $.ku4webApp.app().throwErrors();
controller = $.ku4webApp.controllers[appName](app)
$.ku4webApp.views[appName](app);
|
f8ce69f9a48eecf7ebc838ac830807ffeab43609 | api/models/Equation.js | api/models/Equation.js | /**
* Equation.js
*
* @description :: An equation with input type, equation in source format,
* and generated components.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
mathType: {
type: 'string',
required: true,
enum: ['AsciiMath', 'MathML', 'LaTeX']
},
math: {
type: 'string',
required: true
},
equationName: 'string',
qualityScore: 'integer',
submittedBy: {
model: 'user'
},
components: {
collection: 'component',
via: 'equation'
},
feedback: {
collection: 'feedback',
via: 'equation'
}
}
};
| /**
* Equation.js
*
* @description :: An equation with input type, equation in source format,
* and generated components.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
mathType: {
type: 'string',
required: true,
enum: ['AsciiMath', 'MathML', 'TeX']
},
math: {
type: 'string',
required: true
},
equationName: 'string',
qualityScore: 'integer',
submittedBy: {
model: 'user'
},
components: {
collection: 'component',
via: 'equation'
},
feedback: {
collection: 'feedback',
via: 'equation'
}
}
};
| Fix mathtype enum for latex | Fix mathtype enum for latex
| JavaScript | bsd-3-clause | jbrugge/mmlc-api,meghanlarson/mmlc-api,jbrugge/mmlc-api,meghanlarson/mmlc-api,meghanlarson/mmlc-api | ---
+++
@@ -12,7 +12,7 @@
mathType: {
type: 'string',
required: true,
- enum: ['AsciiMath', 'MathML', 'LaTeX']
+ enum: ['AsciiMath', 'MathML', 'TeX']
},
math: {
type: 'string', |
2758368bf5ddf0d29806ea2331daa7f1210089f6 | test/browserSpec.js | test/browserSpec.js | describe("Dom Tests", function() {
var substrata = {};
beforeEach(function(){
substrata = new Substrata();
});
it("has a function called testRun which returns true", function() {
expect(true).to.be.true;
});
it("has a function called setupWindow which returns an integer", function() {
expect(true).to.be.true;
})
}); | describe("Dom Tests", function() {
var substrata = {};
beforeEach(function(){
substrata = new Substrata();
});
it("has a function called testRun which returns true", function() {
expect(substrata.testRun()).to.be.true;
});
it("has a function called setupWindow which returns an integer", function() {
expect(substrata.setupWindow()).to.be.a('number');
})
}); | Use the object to test | Use the object to test
| JavaScript | apache-2.0 | shaunchurch/Substrata | ---
+++
@@ -7,11 +7,11 @@
});
it("has a function called testRun which returns true", function() {
- expect(true).to.be.true;
+ expect(substrata.testRun()).to.be.true;
});
it("has a function called setupWindow which returns an integer", function() {
- expect(true).to.be.true;
+ expect(substrata.setupWindow()).to.be.a('number');
})
}); |
bbca13237edb02a32d38cd8166fb1ee097b27416 | wdio/hooks/index.js | wdio/hooks/index.js | 'use strict'
/* global browser */
const cmds = require('wdio-screen-commands')
module.exports = {
before: () => {
global.should = require('chai').should()
browser.addCommand('saveScreenshotByName', cmds.saveScreenshotByName)
browser.addCommand('saveAndDiffScreenshot', cmds.saveAndDiffScreenshot)
if (browser.config.maximizeWindow) browser.maximizeWindow()
},
beforeTest: test => {
cmds.startScreenRecording(test)
},
afterTest: async test => {
await cmds.stopScreenRecording(test)
cmds.saveScreenshotByTest(test)
}
}
| 'use strict'
/* global browser, Promise */
const cmds = require('wdio-screen-commands')
/* eslint-disable jsdoc/valid-types */
/** @type WebdriverIO.Config */
const config = {
before: async () => {
global.Should = require('chai').should()
browser.addCommand('saveScreenshotByName', cmds.saveScreenshotByName)
browser.addCommand('saveAndDiffScreenshot', cmds.saveAndDiffScreenshot)
if (browser.config.maximizeWindow) await browser.maximizeWindow()
},
beforeTest: async test => {
await cmds.startScreenRecording(test)
},
afterTest: async test => {
await Promise.all([
cmds.stopScreenRecording(test),
cmds.saveScreenshotByTest(test)
])
}
}
module.exports = config
| Update hooks for latest wdio-screen-commands. | Update hooks for latest wdio-screen-commands.
| JavaScript | mit | blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload,blueimp/jQuery-File-Upload | ---
+++
@@ -1,21 +1,27 @@
'use strict'
-/* global browser */
+/* global browser, Promise */
const cmds = require('wdio-screen-commands')
-module.exports = {
- before: () => {
- global.should = require('chai').should()
+/* eslint-disable jsdoc/valid-types */
+/** @type WebdriverIO.Config */
+const config = {
+ before: async () => {
+ global.Should = require('chai').should()
browser.addCommand('saveScreenshotByName', cmds.saveScreenshotByName)
browser.addCommand('saveAndDiffScreenshot', cmds.saveAndDiffScreenshot)
- if (browser.config.maximizeWindow) browser.maximizeWindow()
+ if (browser.config.maximizeWindow) await browser.maximizeWindow()
},
- beforeTest: test => {
- cmds.startScreenRecording(test)
+ beforeTest: async test => {
+ await cmds.startScreenRecording(test)
},
afterTest: async test => {
- await cmds.stopScreenRecording(test)
- cmds.saveScreenshotByTest(test)
+ await Promise.all([
+ cmds.stopScreenRecording(test),
+ cmds.saveScreenshotByTest(test)
+ ])
}
}
+
+module.exports = config |
7bcc74486d0a8245614f2a3ca5559c2b1f87748d | src/meta_data.js | src/meta_data.js | class MetaData {
constructor(data, extra_key) {
this.data = data;
this.extra_key = extra_key;
}
get(keys) {
if (!this.data)
return [];
if (this.extra_key)
return this.slice_with_extra_key(keys);
else
return this.slice_without_extra_key(keys);
}
slice_with_extra_key(keys) {
const data = [];
keys.forEach((k) => {
if (this.data[k] && this.data[k][this.extra_key])
data.push({class: k, value: this.data[k][this.extra_key]});
});
return data;
}
slice_without_extra_key(keys) {
const data = [];
keys.forEach((k) => {
if (this.data[k])
data.push({class: k, value: this.data[k]});
});
return data;
}
}
module.exports = MetaData;
| class MetaData {
constructor(data, extra_key) {
this.data = data;
this.extra_key = extra_key;
}
get(keys) {
return this.slice(keys).filter((k, i) => typeof k.value === 'string');
}
slice(keys) {
if (!this.data)
return [];
if (this.extra_key)
return this.slice_with_extra_key(keys);
else
return this.slice_without_extra_key(keys);
}
slice_with_extra_key(keys) {
const data = [];
keys.forEach((k) => {
if (this.data[k] && this.data[k][this.extra_key])
data.push({class: k, value: this.data[k][this.extra_key]});
});
return data;
}
slice_without_extra_key(keys) {
const data = [];
keys.forEach((k) => {
if (this.data[k])
data.push({class: k, value: this.data[k]});
});
return data;
}
}
module.exports = MetaData;
| Return metadata which are in {"class": string, "value": string} format only | Return metadata which are in {"class": string, "value": string} format only
| JavaScript | mit | codeout/inet-henge,codeout/inet-henge,codeout/inet-henge | ---
+++
@@ -5,6 +5,10 @@
}
get(keys) {
+ return this.slice(keys).filter((k, i) => typeof k.value === 'string');
+ }
+
+ slice(keys) {
if (!this.data)
return [];
|
076cf40cdb69f838dc8468bdbacce7df605c3892 | app/containers/home.js | app/containers/home.js | import React, { Component } from 'react';
import { connect } from 'react-redux';
class Home extends Component {
render () {
return (
<div>
Wellcome to auction-app! ;)
</div>
);
}
}
export default connect(() => {
return { };
})(Home);
| import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import Buyer from '../components/buyer';
class Home extends Component {
static propTypes = {
history: PropTypes.object.isRequired,
};
handleBuyerClick (id) {
this.props.history.push(`/auctions/${id}`);
}
render () {
const buyersList = [
{ id: 1, name: 'Buyer 1' },
{ id: 2, name: 'Buyer 2' },
];
const buyers = buyersList
.map((buyer) => {
return (
<Buyer
key={buyer.id}
buyer={buyer}
onClick={::this.handleBuyerClick}
/>
);
});
return (
<div>
Choose your Buyer:
{buyers}
</div>
);
}
}
export default connect(() => {
return { };
})(Home);
| Add buyers to Home container | Add buyers to Home container
| JavaScript | mit | mersocarlin/auction-app,mersocarlin/auction-app | ---
+++
@@ -1,12 +1,39 @@
-import React, { Component } from 'react';
+import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
+
+import Buyer from '../components/buyer';
class Home extends Component {
+ static propTypes = {
+ history: PropTypes.object.isRequired,
+ };
+
+ handleBuyerClick (id) {
+ this.props.history.push(`/auctions/${id}`);
+ }
+
render () {
+ const buyersList = [
+ { id: 1, name: 'Buyer 1' },
+ { id: 2, name: 'Buyer 2' },
+ ];
+
+ const buyers = buyersList
+ .map((buyer) => {
+ return (
+ <Buyer
+ key={buyer.id}
+ buyer={buyer}
+ onClick={::this.handleBuyerClick}
+ />
+ );
+ });
+
return (
<div>
- Wellcome to auction-app! ;)
+ Choose your Buyer:
+ {buyers}
</div>
);
} |
957af4e6d108bf6d4ca6a583aff3cbf98af72784 | app/middleware/relations/resolveUser.js | app/middleware/relations/resolveUser.js | 'use strict';
import models from '../../models';
import { GENERIC } from '../../utils/errorTypes.js';
let User = models.User;
export default function resolveUser(req, res, next) {
let jwtUserId = req.user.id;
User.findById(jwtUserId)
.then(function (loggedInUser) {
if (!loggedInUser) {
res.err(404, 'User not found!')
} else {
req.user = loggedInUser;
return next();
}
})
.catch(function (err) {
res.err(500)
})
};
| 'use strict';
import models from '../../models';
import { GENERIC } from '../../utils/errorTypes.js';
let User = models.User;
export default function resolveUser(req, res, next) {
let jwtUserId = req.user.id;
User.findById(jwtUserId)
.then(function (loggedInUser) {
if (!loggedInUser) {
res.err(404, 'User not found!')
} else {
req.user = loggedInUser;
next();
return null;
}
})
.catch(function (err) {
res.err(500)
})
};
| Return null from resolveuser since it seems to confuse bluebird | Return null from resolveuser since it seems to confuse bluebird
| JavaScript | mit | learning-layers/sardroid-server,learning-layers/sardroid-server | ---
+++
@@ -14,7 +14,8 @@
res.err(404, 'User not found!')
} else {
req.user = loggedInUser;
- return next();
+ next();
+ return null;
}
})
.catch(function (err) { |
fe9bfb669f003cee44dadda08d84f13a9c1fd826 | src/query/day.js | src/query/day.js |
'use strict';
const graphql = require('graphql');
const MoistureType = new graphql.GraphQLObjectType({
name: 'Moisture',
fields: {
date: { type: graphql.GraphQLString },
moisture: { type: graphql.GraphQLFloat },
}
});
module.exports = function(dayService) {
return {
name: 'DayQuery',
description: 'Retrieve moisture levels per day',
type: new graphql.GraphQLList(MoistureType),
args: {
hours: {
type: graphql.GraphQLInt,
defaultValue: 1
},
},
resolve: (_, args, ast) => {
const hours = args.hours > 0 ? args.hours : 1;
return dayService.getLastHours('garden-aid-client-test-js', hours);
}
}
}
|
'use strict';
const graphql = require('graphql');
const MoistureType = new graphql.GraphQLObjectType({
name: 'Moisture',
fields: {
date: { type: graphql.GraphQLString },
moisture: { type: graphql.GraphQLFloat },
}
});
module.exports = function(dayService) {
return {
name: 'DayQuery',
description: 'Retrieve moisture levels per day',
type: new graphql.GraphQLList(MoistureType),
args: {
hours: {
type: graphql.GraphQLInt,
defaultValue: 1
},
},
resolve: (_, args, ast) => {
const hours = args.hours > 0 ? args.hours : 1;
// TODO remove clientid
return dayService.getLastHours('garden-aid-client-test-js', hours);
}
}
}
| Add comment about client id | Add comment about client id
| JavaScript | mit | garden-aid/web-bff,garden-aid/web-bff | ---
+++
@@ -24,6 +24,7 @@
},
resolve: (_, args, ast) => {
const hours = args.hours > 0 ? args.hours : 1;
+ // TODO remove clientid
return dayService.getLastHours('garden-aid-client-test-js', hours);
}
} |
0701cb31e3a580327b19ae5c5bf9ee97e578242d | src/gt1000/index.js | src/gt1000/index.js | import { split } from './int-util.js'
import { name, clear, singularize, addConjunction, addComma, write } from './parts-util.js'
/**
* Escrever números maiores que mil.
*
* @param {string} int Um número inteiro maior que mil.
* @returns {number} Retorna o valor por extenso.
*/
const gt1000 = (int) => {
let number = write(addComma(addConjunction(singularize(clear(name(split(int)))), int)))
return number.join(' ')
}
export default gt1000
| import { split } from './int-util'
import { name, clear, singularize, addConjunction, addComma, write } from './parts-util'
/**
* Escrever números maiores que mil.
*
* @param {string} int Um número inteiro maior que mil.
* @returns {number} Retorna o valor por extenso.
*/
const gt1000 = (int) => {
let number = write(addComma(addConjunction(singularize(clear(name(split(int)))), int)))
return number.join(' ')
}
export default gt1000
| Remove extensão .js de alguns imports | Remove extensão .js de alguns imports
| JavaScript | mit | theuves/extenso | ---
+++
@@ -1,5 +1,5 @@
-import { split } from './int-util.js'
-import { name, clear, singularize, addConjunction, addComma, write } from './parts-util.js'
+import { split } from './int-util'
+import { name, clear, singularize, addConjunction, addComma, write } from './parts-util'
/**
* Escrever números maiores que mil. |
18959857d9e576dc641ddf884676d955d1312854 | library/Admin/library/Admin/Form/Song.js | library/Admin/library/Admin/Form/Song.js | /**
* @class Admin_Form_Song
* @extends CM_Form_Abstract
*/
var Admin_Form_Song = CM_Form_Abstract.extend({
_class: 'Admin_Form_Song'
});
| /**
* @class Admin_Form_Song
* @extends CM_Form_Abstract
*/
var Admin_Form_Song = CM_Form_Abstract.extend({
_class: 'Admin_Form_Song',
childrenEvents: {
'Denkmal_FormField_FileSong uploadComplete': function(field, files) {
this._setLabelFromFilename(files[0].name);
}
},
/**
* @param {String} filename
*/
_setLabelFromFilename: function(filename) {
filename = filename.replace(/\.[^\.]+$/, '');
this.getField('label').setValue(filename);
}
});
| Set default label on song upload from filename | Set default label on song upload from filename
| JavaScript | mit | njam/denkmal.org,njam/denkmal.org,njam/denkmal.org,fvovan/denkmal.org,njam/denkmal.org,denkmal/denkmal.org,denkmal/denkmal.org,denkmal/denkmal.org,fvovan/denkmal.org,denkmal/denkmal.org,fvovan/denkmal.org,njam/denkmal.org,fvovan/denkmal.org,fvovan/denkmal.org,denkmal/denkmal.org | ---
+++
@@ -3,5 +3,19 @@
* @extends CM_Form_Abstract
*/
var Admin_Form_Song = CM_Form_Abstract.extend({
- _class: 'Admin_Form_Song'
+ _class: 'Admin_Form_Song',
+
+ childrenEvents: {
+ 'Denkmal_FormField_FileSong uploadComplete': function(field, files) {
+ this._setLabelFromFilename(files[0].name);
+ }
+ },
+
+ /**
+ * @param {String} filename
+ */
+ _setLabelFromFilename: function(filename) {
+ filename = filename.replace(/\.[^\.]+$/, '');
+ this.getField('label').setValue(filename);
+ }
}); |
bc2e4d8ebd609461c4abc63db480ae1aa5558ff7 | ghost/admin/controllers/editor/new.js | ghost/admin/controllers/editor/new.js | import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
actions: {
/**
* Redirect to editor after the first save
*/
save: function () {
var self = this;
this._super().then(function (model) {
if (model.get('id')) {
self.transitionTo('editor.edit', model);
}
return model;
});
}
}
});
export default EditorNewController;
| import EditorControllerMixin from 'ghost/mixins/editor-base-controller';
var EditorNewController = Ember.ObjectController.extend(EditorControllerMixin, {
actions: {
/**
* Redirect to editor after the first save
*/
save: function () {
var self = this;
this._super().then(function (model) {
if (model.get('id')) {
self.transitionToRoute('editor.edit', model);
}
return model;
});
}
}
});
export default EditorNewController;
| Fix warning about transitionTo being deprecated | Fix warning about transitionTo being deprecated
| JavaScript | mit | TryGhost/Ghost,TryGhost/Ghost,TryGhost/Ghost | ---
+++
@@ -9,7 +9,7 @@
var self = this;
this._super().then(function (model) {
if (model.get('id')) {
- self.transitionTo('editor.edit', model);
+ self.transitionToRoute('editor.edit', model);
}
return model;
}); |
21bd7f3970f461895a3ba64496378d510a45b3e7 | app/modules/boilerplate/router.js | app/modules/boilerplate/router.js | define([
'backbone',
'modules/boilerplate/module',
'modules/boilerplate/views/home',
], function (Backbone, BoilerplateModule, HomeView) {
var Router = Backbone.SubRoute.extend({
routes: {
"": "home",
},
home: function() {
// var homeView = new HomeView();
// var renderedView = homeView.render();
// renderedView.$el.appendTo("body");
}
});
return Router;
});
| define([
'backbone',
'modules/boilerplate/module',
'modules/boilerplate/views/home',
], function (Backbone, BoilerplateModule, HomeView) {
var Router = Backbone.SubRoute.extend({
routes: {
"": "home",
"*404": "404" // catch-all route
},
home: function() {
// var homeView = new HomeView();
// var renderedView = homeView.render();
// renderedView.$el.appendTo("body");
},
"404": function() {
console.error("Route 404");
}
});
return Router;
});
| Add 404 catch all route to boilerplate module code | Add 404 catch all route to boilerplate module code
| JavaScript | mit | jesstelford/longdistance | ---
+++
@@ -8,12 +8,17 @@
routes: {
"": "home",
+ "*404": "404" // catch-all route
},
home: function() {
// var homeView = new HomeView();
// var renderedView = homeView.render();
// renderedView.$el.appendTo("body");
+ },
+
+ "404": function() {
+ console.error("Route 404");
}
}); |
3c5395db6bf159d53f9b701f5f48c21c54d6ece5 | src/util-lang.js | src/util-lang.js | /**
* util-lang.js - The minimal language enhancement
*/
function isType(type) {
return function(obj) {
return Object.prototype.toString.call(obj) === "[object " + type + "]"
}
}
var isObject = isType("Object")
var isString = isType("String")
var isArray = Array.isArray || isType("Array")
var isFunction = isType("Function")
var _cid = 0
function cid() {
return _cid++
}
| /**
* util-lang.js - The minimal language enhancement
*/
function isType(type) {
return function(obj) {
return {}.toString.call(obj) == "[object " + type + "]"
}
}
var isObject = isType("Object")
var isString = isType("String")
var isArray = Array.isArray || isType("Array")
var isFunction = isType("Function")
var _cid = 0
function cid() {
return _cid++
}
| Improve isType function for reducing gzip size | Improve isType function for reducing gzip size
| JavaScript | mit | LzhElite/seajs,kuier/seajs,longze/seajs,ysxlinux/seajs,miusuncle/seajs,treejames/seajs,moccen/seajs,chinakids/seajs,wenber/seajs,Gatsbyy/seajs,zwh6611/seajs,Lyfme/seajs,JeffLi1993/seajs,AlvinWei1024/seajs,hbdrawn/seajs,lovelykobe/seajs,kaijiemo/seajs,miusuncle/seajs,uestcNaldo/seajs,lianggaolin/seajs,Lyfme/seajs,MrZhengliang/seajs,tonny-zhang/seajs,judastree/seajs,Lyfme/seajs,LzhElite/seajs,evilemon/seajs,judastree/seajs,sheldonzf/seajs,uestcNaldo/seajs,jishichang/seajs,seajs/seajs,twoubt/seajs,kuier/seajs,liupeng110112/seajs,zaoli/seajs,zwh6611/seajs,judastree/seajs,twoubt/seajs,moccen/seajs,lee-my/seajs,FrankElean/SeaJS,seajs/seajs,FrankElean/SeaJS,JeffLi1993/seajs,kuier/seajs,eleanors/SeaJS,angelLYK/seajs,yuhualingfeng/seajs,baiduoduo/seajs,MrZhengliang/seajs,sheldonzf/seajs,imcys/seajs,miusuncle/seajs,uestcNaldo/seajs,eleanors/SeaJS,kaijiemo/seajs,baiduoduo/seajs,121595113/seajs,evilemon/seajs,yuhualingfeng/seajs,kaijiemo/seajs,baiduoduo/seajs,coolyhx/seajs,lovelykobe/seajs,wenber/seajs,ysxlinux/seajs,wenber/seajs,longze/seajs,chinakids/seajs,imcys/seajs,zaoli/seajs,zaoli/seajs,Gatsbyy/seajs,lovelykobe/seajs,yern/seajs,tonny-zhang/seajs,13693100472/seajs,FrankElean/SeaJS,13693100472/seajs,LzhElite/seajs,jishichang/seajs,mosoft521/seajs,tonny-zhang/seajs,lianggaolin/seajs,angelLYK/seajs,twoubt/seajs,JeffLi1993/seajs,evilemon/seajs,lee-my/seajs,moccen/seajs,AlvinWei1024/seajs,zwh6611/seajs,yuhualingfeng/seajs,lianggaolin/seajs,angelLYK/seajs,yern/seajs,PUSEN/seajs,lee-my/seajs,PUSEN/seajs,coolyhx/seajs,eleanors/SeaJS,Gatsbyy/seajs,imcys/seajs,coolyhx/seajs,liupeng110112/seajs,ysxlinux/seajs,mosoft521/seajs,treejames/seajs,AlvinWei1024/seajs,treejames/seajs,sheldonzf/seajs,mosoft521/seajs,hbdrawn/seajs,longze/seajs,PUSEN/seajs,121595113/seajs,MrZhengliang/seajs,liupeng110112/seajs,jishichang/seajs,seajs/seajs,yern/seajs | ---
+++
@@ -4,7 +4,7 @@
function isType(type) {
return function(obj) {
- return Object.prototype.toString.call(obj) === "[object " + type + "]"
+ return {}.toString.call(obj) == "[object " + type + "]"
}
}
|
92e08232403d7afbf0d7f1e2672d02e72bfb5958 | blueprints/ember-cli-qunit/index.js | blueprints/ember-cli-qunit/index.js | module.exports = {
normalizeEntityName: function() {
// this prevents an error when the entityName is
// not specified (since that doesn't actually matter
// to us
},
afterInstall: function() {
return this.addBowerPackagesToProject([
{ name: 'qunit', target: '~1.17.1' },
{ name: 'ember-cli/ember-cli-test-loader', target: '0.1.3' },
{ name: 'ember-qunit-notifications', target: '0.0.7' },
{ name: 'ember-qunit', target: '0.4.9' }
]);
}
};
| module.exports = {
normalizeEntityName: function() {
// this prevents an error when the entityName is
// not specified (since that doesn't actually matter
// to us
},
afterInstall: function() {
return this.addBowerPackagesToProject([
{ name: 'qunit', target: '~1.18.0' },
{ name: 'ember-cli/ember-cli-test-loader', target: '0.1.3' },
{ name: 'ember-qunit-notifications', target: '0.0.7' },
{ name: 'ember-qunit', target: '0.4.9' }
]);
}
};
| Update QUnit version to 1.18.0. | Update QUnit version to 1.18.0.
[Changelog](https://github.com/jquery/qunit/blob/1.18.0/History.md):
* Assert: throws uses push method only
* Assert: Fix missing test on exported throws
* Assert: Implements notOk to assert falsy values
* Core: More graceful handling of AMD
* Core: Simplify stack trace methods
* Core: Expose Dump maxDepth property
* Core: Expose QUnit version as QUnit.version property
* Core: Handle multiple testId parameters
* Dump: Fix .name/.property doublettes
* HTML Reporter: New diff using Google's Diff-Patch-Match Library
* HTML Reporter: Make it more obvious why diff is suppressed.
* HTML Reporter: Change display text for bad tests
* HTML Reporter: Fix checkbox and select handling in IE <9
* HTML Reporter: Fix test filter without any module
* HTML Reporter: Retain failed tests numbers
* Test: lowercase the valid test filter before using it
| JavaScript | mit | nathanhammond/ember-cli-qunit,zenefits/ember-cli-qunit,blimmer/ember-cli-qunit,ember-cli/ember-cli-qunit,zenefits/ember-cli-qunit,nathanhammond/ember-cli-qunit,ember-cli/ember-cli-qunit,blimmer/ember-cli-qunit | ---
+++
@@ -7,7 +7,7 @@
afterInstall: function() {
return this.addBowerPackagesToProject([
- { name: 'qunit', target: '~1.17.1' },
+ { name: 'qunit', target: '~1.18.0' },
{ name: 'ember-cli/ember-cli-test-loader', target: '0.1.3' },
{ name: 'ember-qunit-notifications', target: '0.0.7' },
{ name: 'ember-qunit', target: '0.4.9' } |
12c8b42e97da478109aec131992601b559daa00d | webpack.config.js | webpack.config.js | process.traceDeprecation = true;
const path = require("path");
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config");
const svelte_config = require("@patternslib/pat-content-browser/webpack.svelte");
module.exports = async (env, argv, build_dirname = __dirname) => {
let config = {
entry: {
"bundle.min": path.resolve(__dirname, "src/index.js"),
},
};
config = svelte_config(env, argv, patternslib_config(env, argv, config, ["mockup"]));
config.output.path = path.resolve(__dirname, "dist/");
if (process.env.NODE_ENV === "development") {
// Note: ``publicPath`` is set to "auto" in Patternslib,
// so for the devServer the public path set to "/".
config.devServer.port = "8000";
config.devServer.static.directory = path.resolve(__dirname, "./docs/_site/");
}
if (env && env.DEPLOYMENT === "plone") {
config.output.path = path.resolve(
build_dirname,
"../plone.staticresources/src/plone/staticresources/static/bundle-plone/"
);
}
return config;
};
| process.traceDeprecation = true;
const path = require("path");
const patternslib_config = require("@patternslib/patternslib/webpack/webpack.config");
const svelte_config = require("@patternslib/pat-content-browser/webpack.svelte");
module.exports = async (env, argv, build_dirname = __dirname) => {
let config = {
entry: {
"bundle.min": path.resolve(__dirname, "src/index.js"),
},
externals: {
window: "window",
$: 'jquery',
jquery: 'jQuery',
"window.jquery": 'jQuery',
},
};
config = svelte_config(env, argv, patternslib_config(env, argv, config, ["mockup"]));
config.output.path = path.resolve(__dirname, "dist/");
if (process.env.NODE_ENV === "development") {
// Note: ``publicPath`` is set to "auto" in Patternslib,
// so for the devServer the public path set to "/".
config.devServer.port = "8000";
config.devServer.static.directory = path.resolve(__dirname, "./docs/_site/");
}
if (env && env.DEPLOYMENT === "plone") {
config.output.path = path.resolve(
build_dirname,
"../plone.staticresources/src/plone/staticresources/static/bundle-plone/"
);
}
return config;
};
| Add jquery as an external | Add jquery as an external
| JavaScript | bsd-3-clause | plone/mockup,plone/mockup,plone/mockup | ---
+++
@@ -7,6 +7,12 @@
let config = {
entry: {
"bundle.min": path.resolve(__dirname, "src/index.js"),
+ },
+ externals: {
+ window: "window",
+ $: 'jquery',
+ jquery: 'jQuery',
+ "window.jquery": 'jQuery',
},
};
|
104ec66104936860ee36ad8d3cbb0bd496c0f8cb | src/scripts/app/play/sentences/results.controller.js | src/scripts/app/play/sentences/results.controller.js | 'use strict';
/*@ngInject*/
module.exports = function($state) {
if ($state.params.student) {
}
console.log(Porthole);
};
| /*global Porthole*/
'use strict';
/*@ngInject*/
module.exports = function($state) {
var windowProxy = new Porthole.WindowProxy();
var postObj = {
action: 'activity_complete',
};
if ($state.params.student) {
postObj.id = $state.params.student;
}
windowProxy.post(postObj);
};
| Send a message through porthole | Send a message through porthole
| JavaScript | agpl-3.0 | empirical-org/Quill-Grammar,empirical-org/Quill-Grammar,ddmck/Quill-Grammar,ddmck/Quill-Grammar,empirical-org/Quill-Grammar,ddmck/Quill-Grammar | ---
+++
@@ -1,8 +1,18 @@
+/*global Porthole*/
'use strict';
/*@ngInject*/
module.exports = function($state) {
+ var windowProxy = new Porthole.WindowProxy();
+ var postObj = {
+ action: 'activity_complete',
+ };
+
if ($state.params.student) {
+ postObj.id = $state.params.student;
}
- console.log(Porthole);
+
+ windowProxy.post(postObj);
+
+
}; |
039dbe18bd1e4429f688c7549722ab72a3a85d21 | lib/contrib/connectMiddleware.js | lib/contrib/connectMiddleware.js | var React = require('react');
var urllite = require('urllite');
var renderDocumentString = require('../utils/renderDocumentString');
var connectMiddleware = function(router) {
return function(req, res, next) {
// Get the part of the URL we care about.
// TODO: Allow this to be mounted at a different base and strip that from pathname
var parsed = urllite(req.url);
var url = parsed.pathname + parsed.search + parsed.hash;
var rres = router.dispatch(url, {initialOnly: true});
rres.request
.on('error', function(err) {
// The React router doesn't want to handle it. That's okay, let
// something else.
if (err.name === 'Unhandled') return next();
// Uh oh. A real error.
return next(err);
})
.on('end', function() {
var contentType = rres.contentType(); // Guess from contentType if not present
res.statusCode = rres._notFound ? 404 : 200;
res.setHeader('Content-Type', contentType);
res.end(renderDocumentString(rres));
});
};
};
module.exports = connectMiddleware;
| var React = require('react');
var urllite = require('urllite');
var renderDocumentString = require('../utils/renderDocumentString');
var connectMiddleware = function(router) {
return function(req, res, next) {
// Get the part of the URL we care about.
// TODO: Allow this to be mounted at a different base and strip that from pathname
var parsed = urllite(req.url);
var url = parsed.pathname + parsed.search + parsed.hash;
router.dispatch(url, {initialOnly: true}, function(err, rres) {
if (err) {
// The React router doesn't want to handle it. That's okay, let
// something else.
if (err.name === 'Unhandled') return next();
// Uh oh. A real error.
return next(err);
}
var contentType = rres.contentType(); // Guess from contentType if not present
res.statusCode = rres._notFound ? 404 : 200;
res.setHeader('Content-Type', contentType);
res.end(renderDocumentString(rres));
});
};
};
module.exports = connectMiddleware;
| Use dispatch callback in connect middleware | Use dispatch callback in connect middleware
| JavaScript | mit | matthewwithanm/monorouter | ---
+++
@@ -10,23 +10,22 @@
var parsed = urllite(req.url);
var url = parsed.pathname + parsed.search + parsed.hash;
- var rres = router.dispatch(url, {initialOnly: true});
- rres.request
- .on('error', function(err) {
+ router.dispatch(url, {initialOnly: true}, function(err, rres) {
+ if (err) {
// The React router doesn't want to handle it. That's okay, let
// something else.
if (err.name === 'Unhandled') return next();
// Uh oh. A real error.
return next(err);
- })
- .on('end', function() {
- var contentType = rres.contentType(); // Guess from contentType if not present
+ }
- res.statusCode = rres._notFound ? 404 : 200;
- res.setHeader('Content-Type', contentType);
- res.end(renderDocumentString(rres));
- });
+ var contentType = rres.contentType(); // Guess from contentType if not present
+
+ res.statusCode = rres._notFound ? 404 : 200;
+ res.setHeader('Content-Type', contentType);
+ res.end(renderDocumentString(rres));
+ });
};
};
|
96a95e118eb86e06b6e37d2085d12306fed720ec | tonic-example.js | tonic-example.js | var jss = require('jss');
var extend = require('jss-extend');
var nested = require('jss-nested');
var camelCase = require('jss-camel-case');
var defaultUnit = require('jss-default-unit');
var perdido = require('perdido');
jss.use(extend());
jss.use(nested());
jss.use(camelCase());
jss.use(defaultUnit());
var testGrid = {
article: {
extend: perdido.flexContainer('row'),
'& div': {
extend: perdido.column('1/3'),
},
},
};
var styleSheet = jss.createStyleSheet(testGrid, {named: false});
styleSheet.toString();
perdido = perdido.create('30px', true);
perdido.flex = true;
var testGrid2 = {
article: {
extend: perdido.flexContainer('row'),
'& div': {
extend: perdido.column('1/3'),
},
},
};
var styleSheet2 = jss.createStyleSheet(testGrid2, {named: false});
styleSheet2.toString();
| var jss = require('jss');
var extend = require('jss-extend');
var nested = require('jss-nested');
var camelCase = require('jss-camel-case');
var defaultUnit = require('jss-default-unit');
var perdido = require('perdido');
jss.use(extend());
jss.use(nested());
jss.use(camelCase());
jss.use(defaultUnit());
var testGrid = {
article: {
extend: perdido.flexContainer('row'),
'& div': {
extend: perdido.column('1/3'),
},
},
};
var styleSheet = jss.createStyleSheet(testGrid, {named: false});
styleSheet.toString();
var perdidoFlex = perdido.create('30px', {flex: true});
perdido.flex = true;
var testGrid2 = {
article: {
extend: perdidoFlex.flexContainer('row'),
'& div': {
extend: perdidoFlex.column('1/3'),
},
},
};
var styleSheet2 = jss.createStyleSheet(testGrid2, {named: false});
styleSheet2.toString();
| Update tonic example for new API | Update tonic example for new API
| JavaScript | mit | wldcordeiro/perdido,wldcordeiro/perdido | ---
+++
@@ -25,14 +25,14 @@
styleSheet.toString();
-perdido = perdido.create('30px', true);
+var perdidoFlex = perdido.create('30px', {flex: true});
perdido.flex = true;
var testGrid2 = {
article: {
- extend: perdido.flexContainer('row'),
+ extend: perdidoFlex.flexContainer('row'),
'& div': {
- extend: perdido.column('1/3'),
+ extend: perdidoFlex.column('1/3'),
},
},
}; |
c1fa8f164c452d83915f6d63c2fe61f67861061d | src/vgl-geometry.js | src/vgl-geometry.js | import { Geometry } from './three.js';
import { validatePropString } from './utils.js';
import { geometries } from './object-stores.js';
export default {
inject: ['vglGeometries'],
props: {
name: validatePropString,
},
computed: {
inst: () => new Geometry(),
},
watch: {
inst: {
handler(inst, oldInst) {
if (oldInst) delete geometries[oldInst.uuid];
geometries[inst.uuid] = inst;
this.$set(this.vglGeometries.forSet, this.name, inst.uuid);
},
immediate: true,
},
name(name, oldName) {
if (this.vglGeometries.forGet[oldName] === this.inst.uuid) this.$delete(this.vglGeometries.forSet, oldName);
this.$set(this.vglGeometries.forSet, name, this.inst.uuid);
},
},
beforeDestroy() {
delete geometries[this.inst.uuid];
if (this.vglGeometries.forGet[this.name] === this.inst.uuid) this.$delete(this.vglGeometries.forSet, this.name);
},
render(h) {
return this.$slots.default ? h('div', this.$slots.default) : undefined;
}
};
| import { BufferGeometry } from './three.js';
import { validatePropString } from './utils.js';
import { geometries } from './object-stores.js';
export default {
inject: ['vglGeometries'],
props: {
name: validatePropString,
},
computed: {
inst: () => new BufferGeometry(),
},
watch: {
inst: {
handler(inst, oldInst) {
if (oldInst) delete geometries[oldInst.uuid];
geometries[inst.uuid] = inst;
this.$set(this.vglGeometries.forSet, this.name, inst.uuid);
},
immediate: true,
},
name(name, oldName) {
if (this.vglGeometries.forGet[oldName] === this.inst.uuid) {
this.$delete(this.vglGeometries.forSet, oldName);
}
this.$set(this.vglGeometries.forSet, name, this.inst.uuid);
},
},
beforeDestroy() {
delete geometries[this.inst.uuid];
if (this.vglGeometries.forGet[this.name] === this.inst.uuid) {
this.$delete(this.vglGeometries.forSet, this.name);
}
},
render(h) {
return this.$slots.default ? h('div', this.$slots.default) : undefined;
},
};
| Use the BufferGeometry class instead of the Geometry. | refactor: Use the BufferGeometry class instead of the Geometry.
| JavaScript | mit | vue-gl/vue-gl | ---
+++
@@ -1,4 +1,4 @@
-import { Geometry } from './three.js';
+import { BufferGeometry } from './three.js';
import { validatePropString } from './utils.js';
import { geometries } from './object-stores.js';
@@ -8,7 +8,7 @@
name: validatePropString,
},
computed: {
- inst: () => new Geometry(),
+ inst: () => new BufferGeometry(),
},
watch: {
inst: {
@@ -20,15 +20,19 @@
immediate: true,
},
name(name, oldName) {
- if (this.vglGeometries.forGet[oldName] === this.inst.uuid) this.$delete(this.vglGeometries.forSet, oldName);
+ if (this.vglGeometries.forGet[oldName] === this.inst.uuid) {
+ this.$delete(this.vglGeometries.forSet, oldName);
+ }
this.$set(this.vglGeometries.forSet, name, this.inst.uuid);
},
},
beforeDestroy() {
delete geometries[this.inst.uuid];
- if (this.vglGeometries.forGet[this.name] === this.inst.uuid) this.$delete(this.vglGeometries.forSet, this.name);
+ if (this.vglGeometries.forGet[this.name] === this.inst.uuid) {
+ this.$delete(this.vglGeometries.forSet, this.name);
+ }
},
render(h) {
return this.$slots.default ? h('div', this.$slots.default) : undefined;
- }
+ },
}; |
e563cd39f8eacfcc7aa1e5571cc654b7e032afe1 | packages/ember-validations/lib/errors.js | packages/ember-validations/lib/errors.js | Ember.Validations.Errors = Ember.Object.extend({
add: function(property, value) {
this.set(property, (this.get(property) || []).concat(value));
},
clear: function() {
var keys = Object.keys(this);
for(var i = 0; i < keys.length; i++) {
delete this[keys[i]];
}
}
});
| Ember.Validations.Errors = Ember.Object.extend({
add: function(property, value) {
this.set(property, (this.get(property) || []).concat(value));
},
clear: function() {
var keys = Object.keys(this);
for(var i = 0; i < keys.length; i++) {
this.set(keys[i], undefined);
delete this[keys[i]];
}
}
});
| Set to undefined when clearing | Set to undefined when clearing
| JavaScript | mit | davewasmer/ember-validations,Patsy-issa/ember-validations,aaronmcouture/ember-validations,aaronmcouture/ember-validations,spruce/ember-validations,indirect/ember-validations,irma-abh/ember-validations,xymbol/ember-validations,dockyard/ember-validations,Patsy-issa/ember-validations,yonjah/ember-validations,atsjj/ember-validations,Hanastaroth/ember-validations,irma-abh/ember-validations,dollarshaveclub/ember-validations,InboxHealth/ember-validations,meszike123/ember-validations,indirect/ember-validations,jeffreybiles/ember-validations,dockyard/ember-validations,yonjah/ember-validations,SeyZ/ember-validations,spruce/ember-validations,jcope2013/ember-validations,xymbol/ember-validations,nibynic/ember-validations,jeffreybiles/ember-validations,dollarshaveclub/ember-validations,csantero/ember-validations,jcope2013/ember-validations,clairton/ember-validations,davewasmer/ember-validations,meszike123/ember-validations,atsjj/ember-validations,nibynic/ember-validations,clairton/ember-validations,SeyZ/ember-validations,InboxHealth/ember-validations,Hanastaroth/ember-validations | ---
+++
@@ -5,6 +5,7 @@
clear: function() {
var keys = Object.keys(this);
for(var i = 0; i < keys.length; i++) {
+ this.set(keys[i], undefined);
delete this[keys[i]];
}
} |
e9b2ffd94cbcd7b5f7ddd497707a3f02032d4520 | config/build.conf.js | config/build.conf.js | ({
mainConfigFile: './require.conf.js',
dir: '../dist',
modules: [
{
name: 'app',
exclude: [
/*
* https://groups.google.com/forum/#!msg/requirejs/jiaDogbA1EQ/jKrHL0gs21UJ
* text plugin is evaluated by r.js
* required for building but useless into build
*/
'text'
]
}
],
optimize: 'none',
useStrict: true,
paths: {
'angular': 'empty:'
}
/*
* DO NOT USE STUBMODULES OPTION EXCEPTED FOR APPCACHE BUILDS.
* stubModules: ['text']
*/
})
| ({
mainConfigFile: './require.conf.js',
out: '../dist/app.js',
exclude: [
/*
* https://groups.google.com/forum/#!msg/requirejs/jiaDogbA1EQ/jKrHL0gs21UJ
* text plugin is evaluated by r.js
* required for building but useless into build
*/
'text'
],
optimize: 'none',
useStrict: true,
paths: {
'angular': 'empty:'
}
/*
* DO NOT USE STUBMODULES OPTION EXCEPTED FOR APPCACHE BUILDS.
* stubModules: ['text']
*/
})
| Build into single file rather than by module | Build into single file rather than by module
| JavaScript | mit | glepretre/angular-requirejs-ready,glepretre/angular-requirejs-ready | ---
+++
@@ -1,18 +1,13 @@
({
mainConfigFile: './require.conf.js',
- dir: '../dist',
- modules: [
- {
- name: 'app',
- exclude: [
- /*
- * https://groups.google.com/forum/#!msg/requirejs/jiaDogbA1EQ/jKrHL0gs21UJ
- * text plugin is evaluated by r.js
- * required for building but useless into build
- */
- 'text'
- ]
- }
+ out: '../dist/app.js',
+ exclude: [
+ /*
+ * https://groups.google.com/forum/#!msg/requirejs/jiaDogbA1EQ/jKrHL0gs21UJ
+ * text plugin is evaluated by r.js
+ * required for building but useless into build
+ */
+ 'text'
],
optimize: 'none',
useStrict: true, |
635e58b6ccae199cb519ecce90fb9fd2af81213d | packages/munar-plugin-serve/src/index.js | packages/munar-plugin-serve/src/index.js | import { createServer } from 'http'
import { Plugin } from 'munar-core'
import micro, { createError } from 'micro'
export default class Serve extends Plugin {
static defaultOptions = {
port: 3000
}
enable () {
this.server = micro(this.onRequest)
this.server.listen(this.options.port)
}
disable () {
this.server.close()
}
onRequest = async (req, res) => {
const pluginName = req.url.split('/')[1]
const plugin = await this.bot.getPlugin(pluginName)
if (!plugin || typeof plugin.serve !== 'function') {
throw createError(404, 'That plugin does not exist or does not expose a web interface.')
}
return plugin.serve(req, res, {
send: micro.send,
sendError: micro.sendError,
createError: micro.createError,
json: micro.json
})
}
}
| import { createServer } from 'http'
import { Plugin } from 'munar-core'
import micro, { createError } from 'micro'
export default class Serve extends Plugin {
static defaultOptions = {
port: 3000
}
enable () {
this.server = micro(this.onRequest)
this.server.listen(this.options.port)
}
disable () {
this.server.close()
}
onRequest = async (req, res) => {
const pluginName = req.url.split('/')[1]
const plugin = await this.bot.getPlugin(pluginName)
if (!plugin || typeof plugin.serve !== 'function') {
throw createError(404, 'That plugin does not exist or does not expose a web interface.')
}
// Remove plugin name from the URL.
const parts = req.url.split('/')
parts.splice(1, 1)
req.url = parts.join('/')
return plugin.serve(req, res, {
send: micro.send,
sendError: micro.sendError,
createError: micro.createError,
json: micro.json
})
}
}
| Remove plugin name from URL before passing it to the plugin. | serve: Remove plugin name from URL before passing it to the plugin.
| JavaScript | isc | welovekpop/munar | ---
+++
@@ -25,6 +25,11 @@
throw createError(404, 'That plugin does not exist or does not expose a web interface.')
}
+ // Remove plugin name from the URL.
+ const parts = req.url.split('/')
+ parts.splice(1, 1)
+ req.url = parts.join('/')
+
return plugin.serve(req, res, {
send: micro.send,
sendError: micro.sendError, |
14989d5c0dd5f173900c37c36e04b24540824b97 | js/components/pages/ReadmePage.react.js | js/components/pages/ReadmePage.react.js | /*
* ReadmePage
*
* This is the page users see when they click the "Setup" button on the HomePage
*/
import React, { Component} from 'react';
import { Link } from 'react-router';
export default class AboutPage extends Component {
render() {
return (
<div>
<h2>Further Setup</h2>
<p>Assuming you have already cloned the repo and ran all the commands from the README (otherwise you would not be here), these are the further steps:</p>
<ol>
<li>Replace my name and the package name in the package.json file</li>
<li>Replace the two components with your first component</li>
<li>Replace the default actions with your first action</li>
<li>Delete css/components/_home.css and add the styling for your component</li>
<li>And finally, update the unit tests</li>
</ol>
<Link className="btn" to="/">Home</Link>
</div>
);
}
}
| /*
* ReadmePage
*
* This is the page users see when they click the "Setup" button on the HomePage
*/
import React, { Component } from 'react';
import { Link } from 'react-router';
export default class AboutPage extends Component {
render() {
return (
<div>
<h2>Further Setup</h2>
<p>Assuming you have already cloned the repo and ran all the commands from the README (otherwise you would not be here), these are the further steps:</p>
<ol>
<li>Replace my name and the package name in the package.json file</li>
<li>Replace the two components with your first component</li>
<li>Replace the default actions with your first action</li>
<li>Delete css/components/_home.css and add the styling for your component</li>
<li>And finally, update the unit tests</li>
</ol>
<Link className="btn" to="/">Home</Link>
</div>
);
}
}
| Fix spacing on import in ReadmePage. | Fix spacing on import in ReadmePage. | JavaScript | mit | chexee/karaoke-night,w01fgang/react-boilerplate,w01fgang/react-boilerplate,chexee/karaoke-night | ---
+++
@@ -4,7 +4,7 @@
* This is the page users see when they click the "Setup" button on the HomePage
*/
-import React, { Component} from 'react';
+import React, { Component } from 'react';
import { Link } from 'react-router';
export default class AboutPage extends Component { |
48f34ddfcfaf52c7b526ceb54637af97de19752d | server/discovery.js | server/discovery.js |
var async = require('async')
var rb = require('./rubygems')
exports.run = (root, step, done) => {
var gems = {}
var error = false
getGem({name: root}, (err) => {
if (err) {
done(err)
return
}
done(null, gems)
})
function getGem (gem, done) {
if (error) {
done(error)
return
}
// skip
if (gems[gem.name]) {
done(error)
return
}
gems[gem.name] = true
// get
rb.get('gems/' + gem.name, (err, res) => {
if (err) {
done(err)
return
}
gems[gem.name] = res.body
if (step) {
error = step(res.body)
}
// client has disconnected
if (error) {
done(error)
return
}
// deps
if (res.body.dependencies.runtime.length) {
deps(res.body.dependencies.runtime, done)
}
// bottom
else {
done()
}
})
}
function deps (dependencies, done) {
async.each(dependencies, getGem, done)
}
}
|
var https = require('https')
var async = require('async')
var rb = require('./rubygems')
exports.run = (root, step, done) => {
var gems = {}
var error = false
var agent = new https.Agent({keepAlive: true, maxSockets: 3})
getGem({name: root}, (err) => {
agent.destroy()
if (err) {
done(err)
return
}
done(null, gems)
})
function getGem (gem, done) {
if (error) {
done(error)
return
}
// skip
if (gems[gem.name]) {
done(error)
return
}
gems[gem.name] = true
// get
rb.get('gems/' + gem.name, {agent}, (err, res) => {
if (err) {
done(err)
return
}
gems[gem.name] = res.body
if (step) {
error = step(res.body)
}
// client has disconnected
if (error) {
done(error)
return
}
// deps
if (res.body.dependencies.runtime.length) {
deps(res.body.dependencies.runtime, done)
}
// bottom
else {
done()
}
})
}
function deps (dependencies, done) {
async.each(dependencies, getGem, done)
}
}
| Use 3 persistent tcp connections while discovering the deps graph | Use 3 persistent tcp connections while discovering the deps graph
| JavaScript | mit | simov/rubinho,simov/rubinho | ---
+++
@@ -1,4 +1,5 @@
+var https = require('https')
var async = require('async')
var rb = require('./rubygems')
@@ -6,8 +7,10 @@
exports.run = (root, step, done) => {
var gems = {}
var error = false
+ var agent = new https.Agent({keepAlive: true, maxSockets: 3})
getGem({name: root}, (err) => {
+ agent.destroy()
if (err) {
done(err)
return
@@ -30,7 +33,7 @@
gems[gem.name] = true
// get
- rb.get('gems/' + gem.name, (err, res) => {
+ rb.get('gems/' + gem.name, {agent}, (err, res) => {
if (err) {
done(err)
return |
88ec6dc5bfa4c6c6e66f0034b4860fda021cb391 | demo/graphics/frame.js | demo/graphics/frame.js | 'use strict';
var PIXI = window.PIXI,
Point = require('../data/point'),
Rect = require('../data/rect');
function Frame(position, url, options) {
this.pos = position;
this.dir = options.direction || new Point(1, 1);
this.offset = options.offset || new Point(0, 0);
var base = PIXI.BaseTexture.fromImage(url, false, PIXI.scaleModes.NEAREST),
slice = options.crop || new Rect(0, 0, base.width, base.height),
tex = new PIXI.Texture(base, slice);
this.sprite = new PIXI.Sprite(tex);
this.render();
}
Frame.prototype.render = function() {
var gPos = this.sprite.position,
gScale = this.sprite.scale;
gPos.x = Math.round(this.pos.x + this.offset.x);
gPos.y = Math.round(this.pos.y + this.offset.y);
gScale.x = this.dir.x;
gScale.y = this.dir.y;
/*
* Flipping will result in the sprite appearing to jump (flips on the 0,
* rather than mid-sprite), so subtract the sprite's size from its position
* if it's flipped.
*/
if(gScale.x < 0) gPos.x -= this.sprite.width;
if(gScale.y < 0) gPos.y -= this.sprite.height;
};
module.exports = Frame;
| 'use strict';
var PIXI = window.PIXI,
Point = require('../data/point'),
Rect = require('../data/rect');
function Frame(position, url, options) {
this.pos = position;
this.dir = options.direction || new Point(1, 1);
this.offset = options.offset || new Point(0, 0);
var base = PIXI.BaseTexture.fromImage(url, false, PIXI.scaleModes.NEAREST),
slice = options.crop || new Rect(0, 0, base.width, base.height),
tex = new PIXI.Texture(base, slice);
this.sprite = new PIXI.Sprite(tex);
this.render();
}
Frame.prototype.render = function() {
var gPos = this.sprite.position,
gScale = this.sprite.scale;
gPos.x = this.pos.x + this.offset.x;
gPos.y = this.pos.y + this.offset.y;
gScale.x = this.dir.x;
gScale.y = this.dir.y;
/*
* Flipping will result in the sprite appearing to jump (flips on the 0,
* rather than mid-sprite), so subtract the sprite's size from its position
* if it's flipped.
*/
if(gScale.x < 0) gPos.x -= this.sprite.width;
if(gScale.y < 0) gPos.y -= this.sprite.height;
};
module.exports = Frame;
| Remove deoptimized calls based on profiling | Remove deoptimized calls based on profiling
| JavaScript | mit | reissbaker/gamekernel,reissbaker/gamekernel | ---
+++
@@ -22,8 +22,8 @@
var gPos = this.sprite.position,
gScale = this.sprite.scale;
- gPos.x = Math.round(this.pos.x + this.offset.x);
- gPos.y = Math.round(this.pos.y + this.offset.y);
+ gPos.x = this.pos.x + this.offset.x;
+ gPos.y = this.pos.y + this.offset.y;
gScale.x = this.dir.x;
gScale.y = this.dir.y; |
0cdcc779bfe4d2aedf15de26b14e1ff940202334 | resources/assets/js/bootstrap.js | resources/assets/js/bootstrap.js |
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');
/**
* Vue is a modern JavaScript library for building interactive web interfaces
* using reactive data binding and reusable components. Vue's API is clean
* and simple, leaving you to focus on building your next great project.
*/
window.Vue = require('vue');
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common = {
'X-Requested-With': 'XMLHttpRequest'
};
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from "laravel-echo"
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// });
|
window._ = require('lodash');
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
window.$ = window.jQuery = require('jquery');
require('bootstrap-sass');
/**
* Vue is a modern JavaScript library for building interactive web interfaces
* using reactive data binding and reusable components. Vue's API is clean
* and simple, leaving you to focus on building your next great project.
*/
window.Vue = require('vue');
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common = {
'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest'
};
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from "laravel-echo"
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: 'your-pusher-key'
// });
| Make axios automatically send the `X-CSRF-TOKEN` | Make axios automatically send the `X-CSRF-TOKEN`
| JavaScript | apache-2.0 | zhiyicx/thinksns-plus,remxcode/laravel-base,zeropingheroes/lanyard,hackel/laravel,cbnuke/FilesCollection,remxcode/laravel-base,beautifultable/phpwind,slimkit/thinksns-plus,hackel/laravel,zeropingheroes/lanyard,cbnuke/FilesCollection,orckid-lab/dashboard,orckid-lab/dashboard,slimkit/thinksns-plus,hackel/laravel,zhiyicx/thinksns-plus,tinywitch/laravel,beautifultable/phpwind,zeropingheroes/lanyard | ---
+++
@@ -28,6 +28,7 @@
window.axios = require('axios');
window.axios.defaults.headers.common = {
+ 'X-CSRF-TOKEN': window.Laravel.csrfToken,
'X-Requested-With': 'XMLHttpRequest'
};
|
66e23fb4a54084ef13cfb1964134d9d009d6363b | blueprints/ember-i18next/index.js | blueprints/ember-i18next/index.js | module.exports = {
description: 'Adds i18next dependency to the app.',
normalizeEntityName: function () {},
afterInstall: function(options) {
return this.addBowerPackageToProject('i18next');
}
};
| module.exports = {
description: 'Adds i18next dependency to the app.',
normalizeEntityName: function () {},
afterInstall: function(options) {
return this.addBowerPackageToProject('i18next', '^1.7.0');
}
};
| Add version to addBowerPackageToProject call | Add version to addBowerPackageToProject call
Specify a version string for i18next in the `afterInstall` hook's
call to `addBowerPackageToProject` so that i18next < 2.0 is used.
Fixes #25.
| JavaScript | mit | OCTRI/ember-i18next,OCTRI/ember-i18next | ---
+++
@@ -4,6 +4,6 @@
normalizeEntityName: function () {},
afterInstall: function(options) {
- return this.addBowerPackageToProject('i18next');
+ return this.addBowerPackageToProject('i18next', '^1.7.0');
}
}; |
c9b3876e1707c702da98ed68695353c30548af43 | src/engine/index.js | src/engine/index.js | // import polyfills. Done as an export to make sure polyfills are imported first
export * from './polyfill';
// export core
export * from './core';
// export libs
import * as accessibility from './accessibility';
import * as extract from './extract';
import * as filters from './filters';
import * as interaction from './interaction';
import * as loaders from './loaders';
import * as prepare from './prepare';
import * as audio from './audio';
import Signal from './Signal';
// handle mixins now, after all code has been added
import { utils } from './core';
utils.mixins.perform_mixins();
/**
* Alias for {@link V.loaders.shared}.
* @name loader
* @memberof V
* @type {V.loader.Loader}
*/
const loader = loaders.shared || null;
const sound = audio.SoundLibrary.init(loaders);
export {
accessibility,
extract,
filters,
interaction,
loaders,
prepare,
loader,
audio,
sound,
Signal,
};
import SceneTree from './SceneTree';
export * from './SceneTree';
export const scene_tree = new SceneTree();
| // import polyfills. Done as an export to make sure polyfills are imported first
export * from './polyfill';
// export core
import * as core from './core';
export * from './core';
// export libs
import * as accessibility from './accessibility';
import * as extract from './extract';
import * as filters from './filters';
import * as interaction from './interaction';
import * as loaders from './loaders';
import * as prepare from './prepare';
import * as audio from './audio';
import Signal from './Signal';
// handle mixins now, after all code has been added
import { utils } from './core';
utils.mixins.perform_mixins();
/**
* Alias for {@link V.loaders.shared}.
* @name loader
* @memberof V
* @type {V.loader.Loader}
*/
const loader = loaders.shared || null;
const sound = audio.SoundLibrary.init(loaders);
export {
accessibility,
extract,
filters,
interaction,
loaders,
prepare,
loader,
audio,
sound,
Signal,
};
import SceneTree from './SceneTree';
export * from './SceneTree';
export const scene_tree = new SceneTree();
function assemble_node(node, children) {
if (!children || children.length === 0) {
return;
}
let i, data, inst;
for (i = 0; i < children.length; i++) {
data = children[i];
inst = new (core[data.type])();
inst._load_data(data);
assemble_node(inst, data.children);
node.add_child(inst);
}
}
export function assemble_scene(scn, data) {
if (data.name) {
scn.name = name;
}
if (data.children) {
for (let i = 0; i < data.children.length; i++) {
assemble_node(scn, data.children);
}
}
return scn;
}
| Add function to assemble node from data | Add function to assemble node from data
| JavaScript | mit | pixelpicosean/voltar,pixelpicosean/voltar | ---
+++
@@ -2,6 +2,7 @@
export * from './polyfill';
// export core
+import * as core from './core';
export * from './core';
// export libs
@@ -45,3 +46,33 @@
export * from './SceneTree';
export const scene_tree = new SceneTree();
+
+
+function assemble_node(node, children) {
+ if (!children || children.length === 0) {
+ return;
+ }
+
+ let i, data, inst;
+ for (i = 0; i < children.length; i++) {
+ data = children[i];
+
+ inst = new (core[data.type])();
+ inst._load_data(data);
+
+ assemble_node(inst, data.children);
+
+ node.add_child(inst);
+ }
+}
+export function assemble_scene(scn, data) {
+ if (data.name) {
+ scn.name = name;
+ }
+ if (data.children) {
+ for (let i = 0; i < data.children.length; i++) {
+ assemble_node(scn, data.children);
+ }
+ }
+ return scn;
+} |
47caddefce106e70cf24163f597cf5f4f40ec436 | lib/modifier.js | lib/modifier.js | var util = require('util'),
Pipeline = require('pipeline'),
SerializationPlugin = require('./plugins/serialization');
//Modifier
var Modifier = module.exports = function (availablePlugins) {
Pipeline.call(this);
this.plugins.push(SerializationPlugin);
var modifier = this;
availablePlugins.forEach(function (plugin) {
modifier[plugin.name] = function (replacer) {
this._enablePlugin(plugin, replacer);
return this;
};
});
};
util.inherits(Modifier, Pipeline);
//Internals
Modifier.prototype._enablePlugin = function (plugin, replacer) {
if (!this._isPluginEnabled(plugin)) {
var serializationPluginIdx = this.plugins.indexOf(SerializationPlugin);
//NOTE: SerializationPlugin should be the last in the chain
this.plugins.splice(serializationPluginIdx, 0, plugin);
this.pluginResetArgs[plugin] = replacer;
}
};
Modifier.prototype._aggregatePluginResults = SerializationPlugin.getHtml;
| var util = require('util'),
Pipeline = require('pipeline'),
SerializationPlugin = require('./plugins/serialization');
//Modifier
var Modifier = module.exports = function (availablePlugins) {
Pipeline.call(this);
this.plugins.push(SerializationPlugin);
var modifier = this;
availablePlugins.forEach(function (plugin) {
modifier[plugin.name] = function (replacer) {
this._enablePlugin(plugin, replacer);
return this;
};
});
};
util.inherits(Modifier, Pipeline);
//Internals
Modifier.prototype._aggregatePluginResults = SerializationPlugin.getHtml;
Modifier.prototype._enablePlugin = function (plugin, replacer) {
if (!this._isPluginEnabled(plugin)) {
var serializationPluginIdx = this.plugins.indexOf(SerializationPlugin);
//NOTE: SerializationPlugin should be the last in the chain
this.plugins.splice(serializationPluginIdx, 0, plugin);
this.pluginResetArgs[plugin] = replacer;
}
};
| Swap code lines FTW =) | Swap code lines FTW =)
| JavaScript | mit | inikulin/ineed,inikulin/ineed | ---
+++
@@ -24,6 +24,8 @@
//Internals
+Modifier.prototype._aggregatePluginResults = SerializationPlugin.getHtml;
+
Modifier.prototype._enablePlugin = function (plugin, replacer) {
if (!this._isPluginEnabled(plugin)) {
var serializationPluginIdx = this.plugins.indexOf(SerializationPlugin);
@@ -34,7 +36,6 @@
}
};
-Modifier.prototype._aggregatePluginResults = SerializationPlugin.getHtml;
|
19cd561f5a82561d1df560bf7201c414fffa49c2 | src/header/index.js | src/header/index.js | import React from 'react'
import {iconify} from '../lib/str'
import styles from './styles'
export const Link = ({name, href, title}) => (
<a className={styles.link} href={href} title={title} target={'_blank'}>
<span className={styles[iconify(name)]} />
</a>
)
export const Header = () => (
<header className={styles.header}>
<h1 className={styles.title}>Langri-Sha</h1>
<nav className={styles.nav}>
{[
[
'Stack Overflow', 'https://stackoverflow.com/users/44041/filip-dupanovi%C4%87?tab=profile',
'StackOverflow profile #SOreadytohelp 💓'
],
[
'Keybase', 'https://keybase.io/langrisha',
'Identity details on Keybase.io'
],
[
'GitHub', 'https://github.com/langri-sha',
'GitHub profile'
]
].map(([name, href, title]) => (
<Link key={name} name={name} href={href} title={title} />
))}
</nav>
</header>
)
| import React from 'react'
import {iconify} from '../lib/str'
import styles from './styles'
export const Link = ({name, href, title}) => (
<a className={styles.link} href={href} title={title} target={'_blank'}>
<span className={styles[iconify(name)]} />
</a>
)
export const Header = () => (
<header className={styles.header}>
<h1 className={styles.title}>Langri-Sha</h1>
<nav className={styles.nav}>
{[
[
'Stack Overflow', 'https://stackoverflow.com/users/44041/filip-dupanovi%C4%87?tab=profile',
'StackOverflow profile #SOreadytohelp 💓'
],
[
'Keybase', 'https://keybase.io/langrisha',
'Identity details on Keybase.io'
],
[
'GitHub', 'https://github.com/langri-sha',
'GitHub profile'
],
[
'Docker', 'https://hub.docker.com/u/langrisha/',
'Docker Hub profile'
]
].map(([name, href, title]) => (
<Link key={name} name={name} href={href} title={title} />
))}
</nav>
</header>
)
| Add link to Docker Hub :rocket: | feat(header): Add link to Docker Hub :rocket:
| JavaScript | mit | langri-sha/langri-sha.github.io,langri-sha/langri-sha.github.io | ---
+++
@@ -25,6 +25,10 @@
[
'GitHub', 'https://github.com/langri-sha',
'GitHub profile'
+ ],
+ [
+ 'Docker', 'https://hub.docker.com/u/langrisha/',
+ 'Docker Hub profile'
]
].map(([name, href, title]) => (
<Link key={name} name={name} href={href} title={title} /> |
d176026894f7d190fd58cec08c9d23688e52006f | lib/prettier.js | lib/prettier.js | module.exports = {
tabWidth: 4,
printWidth: 100,
singleQuote: true,
arrowParens: "always",
trailingComma: "all",
overrides: [
{
files: ["*.json"],
options: {
parser: "json",
tabWidth: 2,
singleQuote: false,
},
},
{
files: ["*.yml"],
options: {
parser: "yml",
tabWidth: 2,
singleQuote: false,
},
},
],
};
| module.exports = {
tabWidth: 4,
printWidth: 100,
singleQuote: true,
arrowParens: "always",
trailingComma: "all",
overrides: [
{
files: ["*.json"],
options: {
parser: "json",
tabWidth: 2,
singleQuote: false,
},
},
{
files: ["*.yml"],
options: {
parser: "yml",
tabWidth: 2,
singleQuote: false,
},
},
{
files: ["*.css"],
options: {
parser: "css",
singleQuote: false,
},
},
{
files: ["*.scss"],
options: {
parser: "scss",
singleQuote: false,
},
},
],
};
| Add stylesheets rules for Prettier | Add stylesheets rules for Prettier
| JavaScript | mit | prezly/code-style,prezly/code-style | ---
+++
@@ -22,5 +22,19 @@
singleQuote: false,
},
},
+ {
+ files: ["*.css"],
+ options: {
+ parser: "css",
+ singleQuote: false,
+ },
+ },
+ {
+ files: ["*.scss"],
+ options: {
+ parser: "scss",
+ singleQuote: false,
+ },
+ },
],
}; |
74ff9b6416a1225f2051ff7dde7f6e5b16b5f847 | app/js/services.js | app/js/services.js | 'use strict';
/* Services */
// Demonstrate how to register services
// In this case it is a simple value service.
angular.module('myApp.services', []).
value('version', '0.1')
.factory("moviesService", function($http){
var _movies = [];
var _getMovies = function(){
$http.get("js/data/movies.json")
.then(function(results){
//Success
angular.copy(results.data, _movies); //this is the preferred; instead of $scope.movies = result.data
}, function(results){
//Error
})
}
var _addNewMovie = function(movie){
_movies.splice(0, 0, movie);
}
var _removeMovie = function(idx){
var person_to_delete = _movies[idx.id];
_movies.splice(idx.id, 1);
/*
angular.forEach(_movies, function(value, key){
if(value.id == movie.id){
_movies.splice(idx, 1);
}
});
*/
}
return{
movies: _movies,
getMovies: _getMovies,
addNewMovie: _addNewMovie,
removeMovie:_removeMovie
};
});
| 'use strict';
/* Services */
// Demonstrate how to register services
// In this case it is a simple value service.
angular.module('myApp.services', []).
value('version', '0.1')
.factory("moviesService", function($http){
var _movies = [];
var _getMovies = function(){
$http.get("js/data/movies.json")
.then(function(results){
//Success
angular.copy(results.data, _movies); //this is the preferred; instead of $scope.movies = result.data
}, function(results){
//Error
})
}
var _addNewMovie = function(movie){
_movies.splice(0, 0, movie);
}
var _removeMovie = function(idx){
var person_to_delete = _movies[idx.id];
_movies.splice(idx.id, 1);
/*
angular.forEach(_movies, function(value, key){
if(value.id == movie.id){
_movies.splice(idx, 1);
}
});
*/
}
return{
movies: _movies, // revealing module pattern applied here
getMovies: _getMovies,
addNewMovie: _addNewMovie,
removeMovie:_removeMovie
};
});
| Comment for revealing module pattern | Comment for revealing module pattern
| JavaScript | mit | compufreakjosh/add-delete-routing,compufreakjosh/add-delete-routing,compufreakjosh/add-delete-routing,compufreakjosh/add-delete-routing | ---
+++
@@ -36,7 +36,7 @@
}
return{
- movies: _movies,
+ movies: _movies, // revealing module pattern applied here
getMovies: _getMovies,
addNewMovie: _addNewMovie,
removeMovie:_removeMovie |
35588441a2bd55e285510f956ed85ed8fbf10165 | src/js/directives/participate.js | src/js/directives/participate.js | 'use strict';
angular.module('Teem')
.directive('participate', function() {
return {
controller: [
'$scope', '$element', '$attrs', 'SessionSvc', '$timeout', 'CommunitiesSvc',
function($scope, $element, $attrs, SessionSvc, $timeout, CommunitiesSvc) {
$scope.participateCopyOn = $attrs.participateCopyOn;
$scope.participateCopyOff = $attrs.participateCopyOff;
$element.on('click', function($event) {
SessionSvc.loginRequired($scope, function() {
if ($scope.community.toggleParticipant) {
$timeout(function() {
$scope.community.toggleParticipant();
});
} else {
CommunitiesSvc.find($scope.community.id).then(function(community) {
$timeout(function() {
community.toggleParticipant();
});
});
}
});
$event.stopPropagation();
});
}],
templateUrl: 'participate.html'
};
});
| 'use strict';
angular.module('Teem')
.directive('participate', function() {
return {
controller: [
'$scope', '$element', '$attrs', 'SessionSvc', '$timeout', 'CommunitiesSvc',
function($scope, $element, $attrs, SessionSvc, $timeout, CommunitiesSvc) {
$scope.participateCopyOn = $attrs.participateCopyOn;
$scope.participateCopyOff = $attrs.participateCopyOff;
$element.on('click', function($event) {
SessionSvc.loginRequired($scope, function() {
if ($scope.community.toggleParticipant) {
$timeout(function() {
$scope.community.toggleParticipant();
});
} else {
CommunitiesSvc.find($scope.community.id).then(function(community) {
$timeout(function() {
community.toggleParticipant();
});
});
}
});
});
}],
templateUrl: 'participate.html'
};
});
| Stop propatation here not longer needed | Stop propatation here not longer needed
It was preventing the community menu to close
Not needed since the join button has been removed in 3c51857
| JavaScript | agpl-3.0 | P2Pvalue/teem,Grasia/teem,P2Pvalue/teem,P2Pvalue/teem,Grasia/teem,Grasia/teem,P2Pvalue/pear2pear,P2Pvalue/pear2pear | ---
+++
@@ -23,7 +23,6 @@
});
}
});
- $event.stopPropagation();
});
}],
templateUrl: 'participate.html' |
ca50925fb48d9bb01b80a3ec6bb2d726abf919ae | api/src/models/Ballot.js | api/src/models/Ballot.js | var config = require('/opt/cocorico/api-web/config.json');
var keystone = require('keystone');
var transform = require('model-transform');
var bcrypt = require('bcrypt');
var Types = keystone.Field.Types;
var Ballot = new keystone.List('Ballot', {
defaultSort: '-updatedAt',
track: { createdAt: true, updatedAt: true },
nodelete: config.env !== 'development',
nocreate: true,
noedit: true,
});
Ballot.add({
status: {
type: Types.Select,
options: [
'signing',
'queued',
'pending',
'initialized',
'registered',
'complete',
'error',
],
default: 'queued',
required: true,
initial: true,
},
hash: { type: String, required: true, initial: true },
error: { type: String },
});
transform.toJSON(Ballot);
Ballot.defaultColumns = 'status, hash, createdAt, updatedAt';
Ballot.register();
| var config = require('/opt/cocorico/api-web/config.json');
var keystone = require('keystone');
var transform = require('model-transform');
var Types = keystone.Field.Types;
var Ballot = new keystone.List('Ballot', {
defaultSort: '-updatedAt',
track: { createdAt: true, updatedAt: true },
nodelete: config.env !== 'development',
nocreate: true,
noedit: true,
});
Ballot.add({
status: {
type: Types.Select,
options: [
'signing',
'queued',
'pending',
'initialized',
'registered',
'complete',
'error',
],
default: 'queued',
required: true,
initial: true,
},
hash: { type: String, required: true, initial: true },
error: { type: String },
});
transform.toJSON(Ballot);
Ballot.defaultColumns = 'status, hash, createdAt, updatedAt';
Ballot.register();
| Fix unused required of the 'bcrypt' module. | Fix unused required of the 'bcrypt' module.
| JavaScript | mit | promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico,promethe42/cocorico | ---
+++
@@ -2,7 +2,6 @@
var keystone = require('keystone');
var transform = require('model-transform');
-var bcrypt = require('bcrypt');
var Types = keystone.Field.Types;
|
63b013ea4549750faa1835cd21df1a8602bbc201 | app/adapters/proposal.js | app/adapters/proposal.js | import ApplicationAdapter from 'ember-jsonapi-resources/adapters/application';
export default ApplicationAdapter.extend({
type: 'proposal',
url: /*config.APP.API_PATH + */ '/proposals',
/*fetchUrl: function(url) {
const proxy = config.APP.API_HOST_PROXY;
const host = config.APP.API_HOST;
if (proxy && host) {
url = url.replace(proxy, host);
}
return url;
}*/
});
| import ApplicationAdapter from 'ember-jsonapi-resources/adapters/application';
import config from '../config/environment';
export default ApplicationAdapter.extend({
type: 'proposal',
url: config.APP.API_HOST + '/proposals',
// FIXME: This is a hack to make ember-jsonapi-resources work with ember-simple-auth.
// It overrides fetch() options to include the bearer token in the session.
// I'll post an issue on ember-jsonapi-resources and see if there's a better way.
fetchOptions(options) {
let isUpdate;
options.headers = options.headers || { 'Content-Type': 'application/vnd.api+json' };
// const authHeader = window.localStorage.getItem('AuthorizationHeader');
const simpleAuthSession = JSON.parse(window.localStorage.getItem('ember_simple_auth:session'));
const accessToken = simpleAuthSession.secure.access_token;
const authHeader = 'Bearer ' + accessToken;
if (authHeader) {
options.headers['Authorization'] = authHeader;
}
if (typeof options.update === 'boolean') {
isUpdate = options.update;
delete options.update;
}
return isUpdate;
}
});
| Make ember-jsonapi-resources work with ember-simple-auth, by overriding fetch() options to include the bearer token in the session. | Make ember-jsonapi-resources work with ember-simple-auth, by overriding fetch() options to include the bearer token in the session.
| JavaScript | mit | pixelhandler/participate,pixelhandler/participate | ---
+++
@@ -1,16 +1,29 @@
import ApplicationAdapter from 'ember-jsonapi-resources/adapters/application';
+import config from '../config/environment';
export default ApplicationAdapter.extend({
type: 'proposal',
- url: /*config.APP.API_PATH + */ '/proposals',
+ url: config.APP.API_HOST + '/proposals',
- /*fetchUrl: function(url) {
- const proxy = config.APP.API_HOST_PROXY;
- const host = config.APP.API_HOST;
- if (proxy && host) {
- url = url.replace(proxy, host);
+ // FIXME: This is a hack to make ember-jsonapi-resources work with ember-simple-auth.
+ // It overrides fetch() options to include the bearer token in the session.
+ // I'll post an issue on ember-jsonapi-resources and see if there's a better way.
+ fetchOptions(options) {
+ let isUpdate;
+ options.headers = options.headers || { 'Content-Type': 'application/vnd.api+json' };
+ // const authHeader = window.localStorage.getItem('AuthorizationHeader');
+ const simpleAuthSession = JSON.parse(window.localStorage.getItem('ember_simple_auth:session'));
+ const accessToken = simpleAuthSession.secure.access_token;
+ const authHeader = 'Bearer ' + accessToken;
+
+ if (authHeader) {
+ options.headers['Authorization'] = authHeader;
}
- return url;
- }*/
+ if (typeof options.update === 'boolean') {
+ isUpdate = options.update;
+ delete options.update;
+ }
+ return isUpdate;
+ }
}); |
99390623b0c13313965c7fcb718c98397c4312c7 | conpigurator.jquery.js | conpigurator.jquery.js | ;var conpigurator = {
active:false,
handleChange:function(event){
if($(event.target).hasClass('conpiguratorInput')){
if(event.target.value && event.target.value !== '' && typeof event.target.value === 'string'){
if(event.target.dataset){
var pigment = event.target.value;
if(pigment.substring(0,1) !== '#') pigment = '#'+pigment;
pigment = (pigment.length > 7)? pigment.substring(0,7) : pigment;
conpigurator.conpigurateElements(event.target.dataset.conpigbg,'backgroundColor',pigment);
conpigurator.conpigurateElements(event.target.dataset.conpigborder,'borderColor',pigment);
conpigurator.conpigurateElements(event.target.dataset.conpigtext,'color',pigment);
}
}
}
},
conpigurateElements:function(selector,colorProperty,pigment){
if(selector){
colorProperty = colorProperty || 'backgroundColor';
$(selector).css(colorProperty,pigment);
}
},
init:function(){
if(!conpigurator.active){
$(body).on('change',function(event){conpigurator.handleChange(event);});
conpigurator.active = true;
}
}
};
| ;var conpigurator = {
active:false,
handleChange:function(event){
if($(event.target).hasClass('conpiguratorInput')){
if(event.target.value && event.target.value !== '' && typeof event.target.value === 'string'){
if(event.target.dataset){
var pigment = event.target.value;
if(pigment.substring(0,1) !== '#') pigment = '#'+pigment;
pigment = (pigment.length > 7)? pigment.substring(0,7) : pigment;
conpigurator.conpigurateElements(event.target.dataset.conpigbg,'backgroundColor',pigment);
conpigurator.conpigurateElements(event.target.dataset.conpigborder,'borderColor',pigment);
conpigurator.conpigurateElements(event.target.dataset.conpigtext,'color',pigment);
}
}
}
},
conpigurateElements:function(selector,colorProperty,pigment){
if(selector){
colorProperty = colorProperty || 'backgroundColor';
$(selector).css(colorProperty,pigment);
}
},
init:function(){
if(!conpigurator.active){
$('body').on('change',function(event){conpigurator.handleChange(event);});
conpigurator.active = true;
}
}
};
| Fix 'body' selector in init function | Fix 'body' selector in init function | JavaScript | mit | nathanielwiley/conpigurator | ---
+++
@@ -22,7 +22,7 @@
},
init:function(){
if(!conpigurator.active){
- $(body).on('change',function(event){conpigurator.handleChange(event);});
+ $('body').on('change',function(event){conpigurator.handleChange(event);});
conpigurator.active = true;
}
} |
8d09481893114d9d38f7bbf3c263988e76bbcada | src/common/components/utils/ErrorList.js | src/common/components/utils/ErrorList.js | import React from 'react';
import { connect } from 'react-redux';
import Grid from 'react-bootstrap/lib/Grid';
import Errors from '../../constants/Errors';
import { removeError } from '../../actions/errorActions';
let ErrorList = ({ errors, dispatch }) => (
<Grid>
{errors.map((error) => (
<div
key={error.id}
className="alert alert-danger alert-dismissible"
role="alert"
>
<button
type="button"
className="close"
data-dismiss="alert"
aria-label="Close"
onClick={() => dispatch(removeError(error.id))}
>
<span aria-hidden="true">×</span>
</button>
<strong>{error.title}</strong>
{' ' + error.detail}
{error.meta && [(
<p key="0">
{error.code === Errors.STATE_PRE_FETCHING_FAIL.code && (
<span>{error.meta.detail}</span>
)}
</p>
), (
<p key="1">
{error.meta.path && `(at path '${error.meta.path}')`}
</p>
)]}
</div>
))}
</Grid>
);
export default connect(state => ({
errors: state.errors,
}))(ErrorList);
| import React from 'react';
import { connect } from 'react-redux';
import Grid from 'react-bootstrap/lib/Grid';
import Errors from '../../constants/Errors';
import { removeError } from '../../actions/errorActions';
let ErrorList = ({ errors, dispatch }) => (
<Grid>
{errors.map((error) => (
<div
key={error.id}
className="alert alert-danger alert-dismissible"
role="alert"
>
<button
type="button"
className="close"
data-dismiss="alert"
aria-label="Close"
onClick={() => dispatch(removeError(error.id))}
>
<span aria-hidden="true">×</span>
</button>
<strong>{error.title}</strong>
{' ' + error.detail}
{error.meta && [(
<p key="0">
{error.code === Errors.STATE_PRE_FETCHING_FAIL.code && (
<span>{error.meta.detail}</span>
)}
</p>
), (
<p key="1">
{error.meta.path && `(at path '${error.meta.path}')`}
</p>
), (
<p key="2">
{error.code === Errors.UNKNOWN_EXCEPTION.code && (
<span>{error.meta.toString()}</span>
)}
</p>
)]}
</div>
))}
</Grid>
);
export default connect(state => ({
errors: state.errors,
}))(ErrorList);
| Add UI for unknow exception | Add UI for unknow exception
| JavaScript | mit | gocreating/express-react-hmr-boilerplate,gocreating/express-react-hmr-boilerplate,gocreating/express-react-hmr-boilerplate | ---
+++
@@ -33,6 +33,12 @@
<p key="1">
{error.meta.path && `(at path '${error.meta.path}')`}
</p>
+ ), (
+ <p key="2">
+ {error.code === Errors.UNKNOWN_EXCEPTION.code && (
+ <span>{error.meta.toString()}</span>
+ )}
+ </p>
)]}
</div>
))} |
7bb4d3264abbc8c03d541a5dcd30b5f90adc5a2a | routes/v1/zivis.js | routes/v1/zivis.js | var express = require('express');
var router = express.Router();
var models = require('../../models/index');
var ZiviService = require('../../services/zivi.service');
router.get('/', function (req, res) {
models.Zivi.find({}).sort('order').exec(function(err, response){
return res.json({
zivicount: response.length,
zivis: response
});
});
});
router.get('/random', function (req, res) {
models.Zivi.find({}).then(function(response){
return res.json(response[Math.floor(Math.random() * response.length)])
});
});
module.exports = router;
| var express = require('express');
var router = express.Router();
var models = require('../../models/index');
var ZiviService = require('../../services/zivi.service');
router.get('/', function (req, res) {
models.Zivi.find({}).sort('order').exec(function(err, response){
return res.json({
zivicount: response.length,
zivis: response
});
});
});
router.get('/random', function (req, res) {
models.Zivi.find({}).then(function(response){
return res.json(response[Math.floor(Math.random() * response.length)])
});
});
router.post('/delete', function (req, res) {
var name = req.body.name;
if(!name) {
return res.status(400).json({error: "No name given"});
}
var zivi = ZiviService.findOneByName(name, function (zivi) {
ZiviService.deleteZivi(zivi, function (err) {
if(err) {
return res.status(500).json({error: err});
} else {
return res.status(200).json({error: false});
}
})
});
});
module.exports = router;
| Add zivi delete by name API | Add zivi delete by name API
| JavaScript | mit | realzimon/backzimon-node,realzimon/backzimon-node | ---
+++
@@ -19,4 +19,20 @@
});
});
+router.post('/delete', function (req, res) {
+ var name = req.body.name;
+ if(!name) {
+ return res.status(400).json({error: "No name given"});
+ }
+ var zivi = ZiviService.findOneByName(name, function (zivi) {
+ ZiviService.deleteZivi(zivi, function (err) {
+ if(err) {
+ return res.status(500).json({error: err});
+ } else {
+ return res.status(200).json({error: false});
+ }
+ })
+ });
+});
+
module.exports = router; |
02708161a50ac518372c60c396dcfc3d964ade9b | test/variable-collection.spec.js | test/variable-collection.spec.js | 'use strict';
var expect = require('chai').expect;
var VariableCollection = require('../app/scripts/variable-collection');
var Variable = require('../app/scripts/variable');
describe('variable collection', function () {
it('should initialize with list of variables', function () {
var variables = new VariableCollection({
items: [
{name: 'u'},
{name: 'v'},
]
});
expect(variables).to.have.property('items');
expect(variables.items).to.have.length(2);
variables.items.forEach(function (variable) {
expect(variable).to.be.an.instanceof(Variable);
});
});
});
| 'use strict';
var expect = require('chai').expect;
var VariableCollection = require('../app/scripts/variable-collection');
var Variable = require('../app/scripts/variable');
describe('variable collection', function () {
it('should initialize with list of variables', function () {
var variables = new VariableCollection({
items: [
{name: 'u'},
{name: 'v'},
]
});
expect(variables).to.have.property('items');
expect(variables.items).to.have.length(2);
variables.items.forEach(function (variable) {
expect(variable).to.be.an.instanceof(Variable);
});
});
it('should serialize to a JSON object', function () {
var variables = new VariableCollection({
items: [{name: 'u'},{name: 'v'}]
});
expect(variables.serialize()).to.deep.equal({
items: [{name: 'u'},{name: 'v'}]
});
});
});
| Add test for variable collection serialization | Add test for variable collection serialization
| JavaScript | mit | caleb531/truthy,caleb531/truthy | ---
+++
@@ -20,4 +20,13 @@
});
});
+ it('should serialize to a JSON object', function () {
+ var variables = new VariableCollection({
+ items: [{name: 'u'},{name: 'v'}]
+ });
+ expect(variables.serialize()).to.deep.equal({
+ items: [{name: 'u'},{name: 'v'}]
+ });
+ });
+
}); |
06410c343ae4d726242b907d7109fbaea84135cf | cli/device-finder.js | cli/device-finder.js | 'use strict';
const { EventEmitter } = require('events');
const { Browser, Devices } = require('../lib/discovery');
function asFilter(filter) {
if(typeof filter === 'string') {
return reg => reg.id === filter || reg.address === filter;
} else if(typeof filter === 'function') {
return filter;
} else {
return () => true;
}
}
function asToplevelFilter(filter) {
return reg => reg.type === 'gateway' || filter(reg);
}
module.exports = function(options) {
const filter = asFilter(options.filter);
let browser;
if(options.instances) {
browser = new Devices({
cacheTime: options.cacheTime || 300,
filter: options.filter ? asToplevelFilter(filter) : null
});
} else {
browser = new Browser({
cachetime: options.cacheTime || 300
});
}
const result = new EventEmitter();
browser.on('available', reg => {
if(filter(reg)) {
result.emit('available', reg);
}
});
browser.on('unavailable', reg => result.emit('unavailable', reg));
return result;
};
| 'use strict';
const { EventEmitter } = require('events');
const { Browser, Devices } = require('../lib/discovery');
function asFilter(filter) {
if(typeof filter === 'string') {
return reg => reg.id === filter || reg.address === filter || reg.model === filter || reg.type === filter;
} else if(typeof filter === 'function') {
return filter;
} else {
return () => true;
}
}
function asToplevelFilter(filter) {
return reg => reg.type === 'gateway' || filter(reg);
}
module.exports = function(options) {
const filter = asFilter(options.filter);
let browser;
if(options.instances) {
browser = new Devices({
cacheTime: options.cacheTime || 300,
filter: options.filter ? asToplevelFilter(filter) : null
});
} else {
browser = new Browser({
cachetime: options.cacheTime || 300
});
}
const result = new EventEmitter();
browser.on('available', reg => {
if(filter(reg)) {
result.emit('available', reg);
}
});
browser.on('unavailable', reg => result.emit('unavailable', reg));
return result;
};
| Allow CLI to find devices based on model and type | Allow CLI to find devices based on model and type
| JavaScript | mit | aholstenson/miio | ---
+++
@@ -5,7 +5,7 @@
function asFilter(filter) {
if(typeof filter === 'string') {
- return reg => reg.id === filter || reg.address === filter;
+ return reg => reg.id === filter || reg.address === filter || reg.model === filter || reg.type === filter;
} else if(typeof filter === 'function') {
return filter;
} else { |
66ce552d3e6658a703eceacbdab1502f8764ae45 | app_api/models/db.js | app_api/models/db.js | var mongoose = require('mongoose');
var dbURI = 'mongodb://localhost/Loc8r';
mongoose.connect(dbURI);
mongoose.connection.on('connected', function() {
console.log('Mongoose connected to ' + dbURI);
});
mongoose.connection.on('error', function(err) {
console.log('Mongoose connection error:' + err);
});
mongoose.connection.on('disconnected', function() {
console.log('Mongoose disconnected');
});
var gracefulShutdown = function(msg, callback) {
mongoose.connection.close(function() {
console.log('Mongoose disconnected through ' + msg);
callback();
})
};
process.once('SIGUSR2', function() {
gracefulShutdown('nodemon restart', function() {
process.kill(process.pid, 'SIGUSR2');
});
});
process.once('SIGINT', function() {
gracefulShutdown('app termination', function() {
process.exit(0);
});
});
process.once('SIGTERM', function() {
gracefulShutdown('Heroku app shutdown', function() {
process.exit(0);
});
});
require('./locations');
| var mongoose = require('mongoose');
var dbURI = (process.env.NODE_ENV === 'production')
? process.env.MONGOLAB_URI
: 'mongodb://localhost/Loc8r';
mongoose.connect(dbURI);
mongoose.connection.on('connected', function() {
console.log('Mongoose connected to ' + dbURI);
});
mongoose.connection.on('error', function(err) {
console.log('Mongoose connection error:' + err);
});
mongoose.connection.on('disconnected', function() {
console.log('Mongoose disconnected');
});
var gracefulShutdown = function(msg, callback) {
mongoose.connection.close(function() {
console.log('Mongoose disconnected through ' + msg);
callback();
})
};
process.once('SIGUSR2', function() {
gracefulShutdown('nodemon restart', function() {
process.kill(process.pid, 'SIGUSR2');
});
});
process.once('SIGINT', function() {
gracefulShutdown('app termination', function() {
process.exit(0);
});
});
process.once('SIGTERM', function() {
gracefulShutdown('Heroku app shutdown', function() {
process.exit(0);
});
});
require('./locations');
| Make the app use the right database | Make the app use the right database
| JavaScript | mit | jonatasleon/getting-mean,jonatasleon/getting-mean | ---
+++
@@ -1,6 +1,9 @@
var mongoose = require('mongoose');
-var dbURI = 'mongodb://localhost/Loc8r';
+var dbURI = (process.env.NODE_ENV === 'production')
+ ? process.env.MONGOLAB_URI
+ : 'mongodb://localhost/Loc8r';
+
mongoose.connect(dbURI);
mongoose.connection.on('connected', function() { |
87b0d1a335d308a0e110616ed0de874856272ba5 | frontend/src/components/Login.js | frontend/src/components/Login.js | // Copyright 2020 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import React, { Component } from "react";
import { Redirect } from "react-router-dom";
class Home extends Component {
constructor(properties) {
super(properties);
this.state = {
isLoggedIn: false,
logUrl: "",
};
}
componentDidMount() {
fetch("/api/login-status")
.then((response) => response.json())
.then((json) =>
this.setState({ isLoggedIn: json.isLoggedIn, logUrl: json.logUrl })
);
}
render() {
if (this.state.isLoggedIn) {
localStorage.setItem("logOutUrl", this.state.logUrl);
return <Redirect to="/home" />;
}
return (
<div>
<h1>Recipe Finder</h1>
<a href={this.state.logUrl} className="home-buttons">
Login
</a>
</div>
);
}
}
export default Home;
| // Copyright 2020 Google LLC
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import React, { Component } from "react";
import { Redirect } from "react-router-dom";
class Home extends Component {
constructor(properties) {
super(properties);
this.state = {
isLoggedIn: false,
logUrl: "",
};
}
componentDidMount() {
fetch("/api/login-status")
.then((response) => response.json())
.then((json) =>
this.setState({ isLoggedIn: json.isLoggedIn, logUrl: json.logUrl })
);
}
render() {
if (this.state.isLoggedIn) {
localStorage.setItem("logOutUrl", this.state.logUrl);
return <Redirect to="/home" />;
}
return (
<div>
<h1>Recipe Finder</h1>
<a href={this.state.logUrl}>Login</a>
</div>
);
}
}
export default Home;
| Remove non existing class name | Remove non existing class name
| JavaScript | apache-2.0 | googleinterns/step-2020-recipe-finder,googleinterns/step-2020-recipe-finder,googleinterns/step-2020-recipe-finder | ---
+++
@@ -40,9 +40,7 @@
return (
<div>
<h1>Recipe Finder</h1>
- <a href={this.state.logUrl} className="home-buttons">
- Login
- </a>
+ <a href={this.state.logUrl}>Login</a>
</div>
);
} |
4b86b42945e86f5d7f4c5dd7743c4b03b8d0cb03 | scripts/test-js.js | scripts/test-js.js | const exec = require('shell-utils').exec;
const _ = require('lodash');
const fix = _.includes(process.argv, '--fix') ? '--fix' : '';
const dirs = [
'lib/src',
'integration',
'e2e',
'scripts',
'playground/src'
];
run();
function run() {
exec.execSync('node -v');
const paths = _.chain(dirs).map((d) => `'${d}/**/*.[tj]s*'`).join(' ').value();
exec.execSync(`tslint ${paths} ${fix} --format verbose`);
assertAllTsFilesInSrc();
exec.execSync(`jest --coverage`);
}
function assertAllTsFilesInSrc() {
const allFiles = exec.execSyncRead('find ./lib/src -type f');
const lines = _.split(allFiles, '\n');
const offenders = _.filter(lines, (f) => !f.endsWith('.ts') && !f.endsWith('.tsx'));
if (offenders.length) {
throw new Error(`\n\nOnly ts/tsx files are allowed:\n${offenders.join('\n')}\n\n\n`);
}
}
| const exec = require('shell-utils').exec;
const _ = require('lodash');
const fix = _.includes(process.argv, '--fix') ? '--fix' : '';
const dirs = [
'lib/src',
'integration',
'e2e',
'scripts',
'playground/src'
];
run();
function run() {
const paths = _.chain(dirs).map((d) => `'${d}/**/*.[tj]s*'`).join(' ').value();
exec.execSync(`tslint ${paths} ${fix} --format verbose`);
assertAllTsFilesInSrc();
exec.execSync(`jest --coverage`);
}
function assertAllTsFilesInSrc() {
const allFiles = exec.execSyncRead('find ./lib/src -type f');
const lines = _.split(allFiles, '\n');
const offenders = _.filter(lines, (f) => !f.endsWith('.ts') && !f.endsWith('.tsx'));
if (offenders.length) {
throw new Error(`\n\nOnly ts/tsx files are allowed:\n${offenders.join('\n')}\n\n\n`);
}
}
| Remove node version debug line | Remove node version debug line
| JavaScript | mit | guyca/react-native-navigation,chicojasl/react-native-navigation,ceyhuno/react-native-navigation,Jpoliachik/react-native-navigation,Jpoliachik/react-native-navigation,Jpoliachik/react-native-navigation,ceyhuno/react-native-navigation,thanhzusu/react-native-navigation,guyca/react-native-navigation,guyca/react-native-navigation,chicojasl/react-native-navigation,ceyhuno/react-native-navigation,ceyhuno/react-native-navigation,thanhzusu/react-native-navigation,Jpoliachik/react-native-navigation,chicojasl/react-native-navigation,thanhzusu/react-native-navigation,wix/react-native-navigation,ceyhuno/react-native-navigation,chicojasl/react-native-navigation,3sidedcube/react-native-navigation,chicojasl/react-native-navigation,3sidedcube/react-native-navigation,wix/react-native-navigation,wix/react-native-navigation,thanhzusu/react-native-navigation,thanhzusu/react-native-navigation,wix/react-native-navigation,wix/react-native-navigation,3sidedcube/react-native-navigation,wix/react-native-navigation,3sidedcube/react-native-navigation,guyca/react-native-navigation,Jpoliachik/react-native-navigation,ceyhuno/react-native-navigation,chicojasl/react-native-navigation,thanhzusu/react-native-navigation,Jpoliachik/react-native-navigation | ---
+++
@@ -14,7 +14,6 @@
run();
function run() {
- exec.execSync('node -v');
const paths = _.chain(dirs).map((d) => `'${d}/**/*.[tj]s*'`).join(' ').value();
exec.execSync(`tslint ${paths} ${fix} --format verbose`);
assertAllTsFilesInSrc(); |
eeee845d7a576a257a8f34d7d2b5fc15ac6e41f8 | runtime-init.js | runtime-init.js | Error.stackTraceLimit = Infinity; // And beyond
require('babel-core/register')(require('./babel-defaults'));
// Must be after babel so our fork overrides the one installed by babel.
// Aren't unresponsive OSS projects fun!.
require('source-map-support').install({
environment: 'node',
handleUncaughtExceptions: false,
hookRequire: true
});
| /* eslint-disable no-process-env */
var Path = require('path');
Error.stackTraceLimit = Infinity; // And beyond
if (!process.env.BABEL_CACHE_PATH) {
process.env.BABEL_CACHE_PATH = Path.resolve('./.babel.cache.json');
}
require('babel-core/register')(require('./babel-defaults'));
// Must be after babel so our fork overrides the one installed by babel.
// Aren't unresponsive OSS projects fun!.
require('source-map-support').install({
environment: 'node',
handleUncaughtExceptions: false,
hookRequire: true
});
| Move babel cache to local project | Move babel cache to local project
This removes potentially large performance overhead from loading the babel cache across many unrelated projects.
| JavaScript | mit | kpdecker/linoleum | ---
+++
@@ -1,4 +1,11 @@
+/* eslint-disable no-process-env */
+var Path = require('path');
+
Error.stackTraceLimit = Infinity; // And beyond
+
+if (!process.env.BABEL_CACHE_PATH) {
+ process.env.BABEL_CACHE_PATH = Path.resolve('./.babel.cache.json');
+}
require('babel-core/register')(require('./babel-defaults'));
|
9061475dcf4f2e0c0d5a00a6eb655d21396aa51c | troposphere/static/js/context.js | troposphere/static/js/context.js | define([], function () {
return {
hasLoggedInUser: function() {
return !!(this.profile && this.profile.get('username'));
},
profile: null
}
});
| define([], function () {
return {
hasLoggedInUser: function() {
return !!(this.profile && this.profile.get('selected_identity'));
},
profile: null
}
});
| Use selected_identity for logged in user predicate | Use selected_identity for logged in user predicate
| JavaScript | apache-2.0 | CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend,CCI-MOC/GUI-Frontend | ---
+++
@@ -1,7 +1,7 @@
define([], function () {
return {
hasLoggedInUser: function() {
- return !!(this.profile && this.profile.get('username'));
+ return !!(this.profile && this.profile.get('selected_identity'));
},
profile: null
} |
3bcfe2e095583932296e04e0f9acc27128ecabaa | server/index.js | server/index.js | const express = require('express');
const path = require('path');
const PORT = process.env.PORT || 4000;
const app = express();
// API endpoints
app.get('/api/hello', (req, res) => {
res.set('Content-Type', 'application/json');
res.json({ message: 'Hello from the server!' });
});
// Serve any static files.
app.use(express.static(path.resolve(__dirname, '../client/build')));
// All remaining requests return the React app, so it can handle routing.
app.get('*', (request, response) => {
response.sendFile(path.resolve(__dirname, '../client/build', 'index.html'));
});
// Enforce HTTPS
function enforceHTTPS(request, response, next) {
if (process.env.NODE_ENV === 'development') return next();
if (request.headers['x-forwarded-proto'] !== 'https') {
const httpsUrl = ['https://', request.headers.host, request.url].join('');
return response.redirect(httpsUrl);
}
return next();
}
app.use(enforceHTTPS);
// Start the server
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}.`);
}); | const express = require('express');
const path = require('path');
const PORT = process.env.PORT || 4000;
const app = express();
// Enforce HTTPS
function enforceHTTPS(request, response, next) {
if (process.env.NODE_ENV === 'development') return next();
if (request.headers['x-forwarded-proto'] !== 'https') {
const httpsUrl = ['https://', request.headers.host, request.url].join('');
return response.redirect(httpsUrl);
}
return next();
}
app.use(enforceHTTPS);
// API endpoints
app.get('/api/hello', (req, res) => {
res.set('Content-Type', 'application/json');
res.json({ message: 'Hello from the server!' });
});
// Serve any static files.
app.use(express.static(path.resolve(__dirname, '../client/build')));
// All remaining requests return the React app, so it can handle routing.
app.get('*', (request, response) => {
response.sendFile(path.resolve(__dirname, '../client/build', 'index.html'));
});
// Start the server
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}.`);
}); | Move https middleware up front | Move https middleware up front
| JavaScript | mit | mit-teaching-systems-lab/swipe-right-for-cs,mit-teaching-systems-lab/swipe-right-for-cs | ---
+++
@@ -3,6 +3,18 @@
const PORT = process.env.PORT || 4000;
const app = express();
+// Enforce HTTPS
+function enforceHTTPS(request, response, next) {
+ if (process.env.NODE_ENV === 'development') return next();
+
+ if (request.headers['x-forwarded-proto'] !== 'https') {
+ const httpsUrl = ['https://', request.headers.host, request.url].join('');
+ return response.redirect(httpsUrl);
+ }
+
+ return next();
+}
+app.use(enforceHTTPS);
// API endpoints
app.get('/api/hello', (req, res) => {
@@ -18,19 +30,6 @@
response.sendFile(path.resolve(__dirname, '../client/build', 'index.html'));
});
-// Enforce HTTPS
-function enforceHTTPS(request, response, next) {
- if (process.env.NODE_ENV === 'development') return next();
-
- if (request.headers['x-forwarded-proto'] !== 'https') {
- const httpsUrl = ['https://', request.headers.host, request.url].join('');
- return response.redirect(httpsUrl);
- }
-
- return next();
-}
-app.use(enforceHTTPS);
-
// Start the server
app.listen(PORT, () => {
console.log(`Listening on port ${PORT}.`); |
5f43150bc204114da78ed011ddb7ee31626a08b0 | www/js/services/BalanceSocket.js | www/js/services/BalanceSocket.js | angular.module("omniServices")
.service("BalanceSocket", ["$rootScope","$location",function BalanceSocketService($rootScope,$location){
var self = this;
self.connected =false;
self.connect = function(){
self.socket = io.connect($location.protocol()+'://' + $location.host() + ':' + $location.port() + "/balance");
self.connected=true;
}
self.disconnect = function(){
self.socket.disconnect();
self.socket=null;
self.connected =false;
}
self.on = function(eventName,callback){
self.socket.on(eventName,callback);
// function(msg){
// $rootScope.$apply(function(){callback(msg)});
// })
}
self.emit = function(eventName,data){
self.socket.emit(eventName,data);
}
}]) | angular.module("omniServices")
.service("BalanceSocket", ["$rootScope","$location",function BalanceSocketService($rootScope,$location){
var self = this;
self.connected =false;
self.connect = function(){
self.socket = io.connect($location.protocol()+'://' + $location.host() + ':' + $location.port() + "/balance", {'force new connection':true});
self.connected=true;
}
self.disconnect = function(){
self.socket.disconnect();
self.socket=null;
self.connected =false;
}
self.on = function(eventName,callback){
self.socket.on(eventName,callback);
// function(msg){
// $rootScope.$apply(function(){callback(msg)});
// })
}
self.emit = function(eventName,data){
self.socket.emit(eventName,data);
}
}])
| Fix weird logout/login websocket connection issue | Fix weird logout/login websocket connection issue
| JavaScript | agpl-3.0 | OmniLayer/omniwallet,achamely/omniwallet,Nevtep/omniwallet,Nevtep/omniwallet,Nevtep/omniwallet,OmniLayer/omniwallet,OmniLayer/omniwallet,Nevtep/omniwallet,achamely/omniwallet,OmniLayer/omniwallet,achamely/omniwallet,achamely/omniwallet | ---
+++
@@ -3,7 +3,7 @@
var self = this;
self.connected =false;
self.connect = function(){
- self.socket = io.connect($location.protocol()+'://' + $location.host() + ':' + $location.port() + "/balance");
+ self.socket = io.connect($location.protocol()+'://' + $location.host() + ':' + $location.port() + "/balance", {'force new connection':true});
self.connected=true;
}
|
3ced1a1655308df281184d57938ec65a2e692a7f | lib/config/accounts.js | lib/config/accounts.js |
AccountsTemplates.addFields([
{
_id: "username",
type: "text",
displayName: "username",
required: true,
minLength: 3,
},
]);
| AccountsTemplates.removeField('password');
AccountsTemplates.removeField('email');
AccountsTemplates.addFields([
{
_id: "username",
type: "text",
displayName: "User name",
required: true,
minLength: 3,
},
{
_id: 'email',
type: 'email',
required: true,
displayName: "Email",
re: /.+@(.+){2,}\.(.+){2,}/,
errStr: 'Invalid email',
},
{
_id: 'password',
type: 'password',
placeholder: {
signUp: "At least six characters"
},
required: true,
minLength: 6,
re: /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,
errStr: 'At least 1 digit, 1 lowercase and 1 uppercase',
},
]);
| Fix order of fields in registration form. | Fix order of fields in registration form.
User name was displayed after passwords. The only way to control the order
seems to remove the standard fields first and then to add them again.
| JavaScript | mit | 4minitz/4minitz,RobNeXX/4minitz,Huggle77/4minitz,4minitz/4minitz,RobNeXX/4minitz,Huggle77/4minitz,4minitz/4minitz,Huggle77/4minitz,RobNeXX/4minitz | ---
+++
@@ -1,10 +1,34 @@
+AccountsTemplates.removeField('password');
+AccountsTemplates.removeField('email');
AccountsTemplates.addFields([
{
_id: "username",
type: "text",
- displayName: "username",
+ displayName: "User name",
required: true,
minLength: 3,
},
+
+ {
+ _id: 'email',
+ type: 'email',
+ required: true,
+ displayName: "Email",
+ re: /.+@(.+){2,}\.(.+){2,}/,
+ errStr: 'Invalid email',
+ },
+
+ {
+ _id: 'password',
+ type: 'password',
+ placeholder: {
+ signUp: "At least six characters"
+ },
+ required: true,
+ minLength: 6,
+ re: /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,
+ errStr: 'At least 1 digit, 1 lowercase and 1 uppercase',
+ },
+
]); |
1b15e8d52f2445dec0af737fe5dce22669fd817f | elements/PathsMixin.js | elements/PathsMixin.js | 'use strict';
var React = require('react');
var paths = require('../paths');
module.exports = {
contextTypes: function() {
return {
getCurrentPathname: React.PropTypes.func.isRequired,
getCurrentParams: React.PropTypes.func.isRequired,
};
},
getAllPosts: function () {
return paths.allPosts();
},
getAllPages: function() {
return paths.getPages();
},
getPost: function() {
var params = this.context.getCurrentParams();
var post = params.post;
var splat = params.splat;
if(splat) {
return this.getPostForPath(splat + '/' + post);
}
return this.getPostForPath(post);
},
getPage: function() {
// remove leading slash
return this.getPageForPath(this.context.getCurrentPath().slice(1));
},
getPostForPath: function(path) {
return paths.postForPath(path);
},
getPageForPath: function(path) {
return paths.pageForPath(path);
},
getPageTitle: function() {
var post = this.getPost();
if(post && post.name) {
return post.name;
}
var routes = this.context.getCurrentRoutes();
var routeName = routes[routes.length - 1].name;
if(routeName) {
return routeName.replace('/', '');
}
return '';
},
};
| 'use strict';
var React = require('react');
var paths = require('../paths');
module.exports = {
contextTypes: function() {
return {
getCurrentPathname: React.PropTypes.func.isRequired,
getCurrentParams: React.PropTypes.func.isRequired,
};
},
getAllPosts: function () {
return paths.allPosts();
},
getAllPages: function() {
return paths.getPages();
},
getPost: function() {
var params = this.context.getCurrentParams();
var post = params.post;
var splat = params.splat;
if(splat) {
return this.getPostForPath(splat + '/' + post);
}
return this.getPostForPath(post);
},
getPage: function() {
// remove leading slash
return this.getPageForPath(this.context.getCurrentPath().slice(1));
},
getPostForPath: function(path) {
return paths.postForPath(path);
},
getPageForPath: function(path) {
return paths.pageForPath(path);
},
getPageTitle: function() {
var post = this.getPost();
if(post && post.title) {
return post.title;
}
var routes = this.context.getCurrentRoutes();
var routeName = routes[routes.length - 1].name;
if(routeName) {
return routeName.replace('/', '');
}
return '';
},
};
| Use post.title for page title | Use post.title for page title
| JavaScript | mit | RamonGebben/antwar,antwarjs/antwar,RamonGebben/antwar | ---
+++
@@ -41,8 +41,8 @@
getPageTitle: function() {
var post = this.getPost();
- if(post && post.name) {
- return post.name;
+ if(post && post.title) {
+ return post.title;
}
var routes = this.context.getCurrentRoutes(); |
d5b783795c6aafc05962a821f05bf2d27659e45c | lib/station/reducer.js | lib/station/reducer.js | import * as Types from './types'
const initialState = {
server: {}
}
const mapServerState = (serverState, state) => {
return {
...state,
server: serverState
}
}
export default (state = initialState, action) => {
switch (action.type) {
case Types.SERVER_STATE_LOADED:
return mapServerState(action.serverState, state)
return state;
case Types.REQUEST_ACCEPTED_BY_SERVER:
console.log('Request accepted:', action.url);
return state;
case Types.SERVER_STATE_LOAD_FAILED:
case Types.REQUEST_ACCEPTED_BY_SERVER:
console.error(action.error)
return state
default:
return state
}
}
| import * as Types from './types'
const initialState = {
server: {}
}
const mapServerState = (serverState, state) => {
return {
...state,
server: serverState
}
}
export default (state = initialState, action) => {
switch (action.type) {
case Types.SERVER_STATE_LOADED:
return mapServerState(action.serverState, state)
return state
case Types.REQUEST_ACCEPTED_BY_SERVER:
console.debug('Request accepted:', action.url)
return state
case Types.SERVER_STATE_LOAD_FAILED:
case Types.REQUEST_ACCEPTED_BY_SERVER:
console.error(action.error)
return state
default:
return state
}
}
| Change log level for 'Request accepted' | Change log level for 'Request accepted'
| JavaScript | apache-2.0 | openstardrive/flight-director | ---
+++
@@ -15,10 +15,10 @@
switch (action.type) {
case Types.SERVER_STATE_LOADED:
return mapServerState(action.serverState, state)
- return state;
+ return state
case Types.REQUEST_ACCEPTED_BY_SERVER:
- console.log('Request accepted:', action.url);
- return state;
+ console.debug('Request accepted:', action.url)
+ return state
case Types.SERVER_STATE_LOAD_FAILED:
case Types.REQUEST_ACCEPTED_BY_SERVER:
console.error(action.error) |
5275ad48ffbec47195b85db30ea1ca7dae8f0dd1 | lib/transcode-error.js | lib/transcode-error.js | export default class TranscodeError extends Error {
constructor(message, file, additional = '') {
super();
this.message = message;
this.file = file;
this.additional = additional;
}
toString() {
return [`[TranscodeError: ${this.message}]`, `File: ${this.file}`, this.additional].join("\n");
}
}
| export default class TranscodeError extends Error {
constructor(message, file, additional = '') {
super();
this._message = message;
this.file = file;
this.additional = additional;
this.message = [`[TranscodeError: ${this._message}]`, `File: ${this.file}`, this.additional].join("\n");
}
toString() {
return this.message;
}
}
| Include original error message in TranscodeError. | Include original error message in TranscodeError.
Include original error message in error output for a
`TranscodeError`.
| JavaScript | mit | nwronski/batch-transcode-video | ---
+++
@@ -1,12 +1,13 @@
export default class TranscodeError extends Error {
constructor(message, file, additional = '') {
super();
- this.message = message;
+ this._message = message;
this.file = file;
this.additional = additional;
+ this.message = [`[TranscodeError: ${this._message}]`, `File: ${this.file}`, this.additional].join("\n");
}
toString() {
- return [`[TranscodeError: ${this.message}]`, `File: ${this.file}`, this.additional].join("\n");
+ return this.message;
}
} |
713b769f7d45092df124b7c5170d9f6d5c2e7c59 | test/amd/strict.js | test/amd/strict.js | /*jslint node:true, sloppy:true*/
/*globals define*/
if (!global.evaluated) {
require('../util/adapter.js');
}
var path = '../dist/amd/strict';
global.modules = [path + '/Class.js', path + '/AbstractClass', path + '/Interface', path + '/FinalClass', path + '/instanceOf', path + '/common/hasDefineProperty'];
global.build = 'amd/strict';
define(['../verifications', '../functional'], function () { }); | /*jslint node:true, sloppy:true*/
/*globals define*/
if (!global.evaluated) {
require('../util/adapter.js');
}
var path = '../dist/amd/strict';
global.modules = [path + '/Class', path + '/AbstractClass', path + '/Interface', path + '/FinalClass', path + '/instanceOf', path + '/common/hasDefineProperty'];
global.build = 'amd/strict';
define(['../verifications', '../functional'], function () { }); | Fix Class being loaded 2 times in tests. | Fix Class being loaded 2 times in tests.
| JavaScript | mit | IndigoUnited/js-dejavu,IndigoUnited/js-dejavu | ---
+++
@@ -6,6 +6,7 @@
}
var path = '../dist/amd/strict';
-global.modules = [path + '/Class.js', path + '/AbstractClass', path + '/Interface', path + '/FinalClass', path + '/instanceOf', path + '/common/hasDefineProperty'];
+global.modules = [path + '/Class', path + '/AbstractClass', path + '/Interface', path + '/FinalClass', path + '/instanceOf', path + '/common/hasDefineProperty'];
global.build = 'amd/strict';
+
define(['../verifications', '../functional'], function () { }); |
5ebc832fee00e16867678e2f22a26a3ae5f16206 | server/transformers/movieTransformer.js | server/transformers/movieTransformer.js | const _ = require('lodash');
const imageConfig = require('../config/tmdb.json').images;
const formatApiResponse = require('../utils/formatApiResponse');
const { createTransformMany } = require('./utils');
const ORIGINAL_IMAGE_SIZE = 'original';
const BASE_IMAGE_URL = imageConfig.base_url;
const getImageUrl = (baseUrl, size, imagePath) => `${baseUrl}${size}${imagePath}`;
const getAllImageSizes = (imagePath, type) => {
const sizes = imageConfig[`${type}_sizes`];
if (!imagePath) {
return null;
}
if (!sizes) {
throw new Error(`Incorrect image type ${type} provided`);
}
return sizes.filter((size) => size !== ORIGINAL_IMAGE_SIZE)
.map((size) => ({
width: parseInt(size.replace(/[^0-9]/g, '')),
name: imagePath.replace('/', ''),
url: getImageUrl(BASE_IMAGE_URL, size, imagePath),
}));
};
const transformMovie = (movie) => {
return {
...movie,
apiId: movie.tmdbId,
images: {
poster: {
altText: movie.title,
original: getImageUrl(BASE_IMAGE_URL, ORIGINAL_IMAGE_SIZE, movie.poster),
sizes: getAllImageSizes(movie.poster, 'poster'),
},
backdrop: getAllImageSizes(movie.backdrop, 'backdrop'),
},
};
};
module.exports = {
transformOne: transformMovie,
transformMany: _.flow(createTransformMany('movies', transformMovie), formatApiResponse.forMany),
};
| const _ = require('lodash');
const imageConfig = require('../config/tmdb.json').images;
const formatApiResponse = require('../utils/formatApiResponse');
const { createTransformMany } = require('./utils');
const ORIGINAL_IMAGE_SIZE = 'original';
const BASE_IMAGE_URL = imageConfig.secure_base_url;
const getImageUrl = (baseUrl, size, imagePath) => `${baseUrl}${size}${imagePath}`;
const getAllImageSizes = (imagePath, type) => {
const sizes = imageConfig[`${type}_sizes`];
if (!imagePath) {
return null;
}
if (!sizes) {
throw new Error(`Incorrect image type ${type} provided`);
}
return sizes.filter((size) => size !== ORIGINAL_IMAGE_SIZE)
.map((size) => ({
width: parseInt(size.replace(/[^0-9]/g, '')),
name: imagePath.replace('/', ''),
url: getImageUrl(BASE_IMAGE_URL, size, imagePath),
}));
};
const transformMovie = (movie) => {
return {
...movie,
apiId: movie.tmdbId,
images: {
poster: {
altText: movie.title,
original: getImageUrl(BASE_IMAGE_URL, ORIGINAL_IMAGE_SIZE, movie.poster),
sizes: getAllImageSizes(movie.poster, 'poster'),
},
backdrop: getAllImageSizes(movie.backdrop, 'backdrop'),
},
};
};
module.exports = {
transformOne: transformMovie,
transformMany: _.flow(createTransformMany('movies', transformMovie), formatApiResponse.forMany),
};
| Upgrade image base_url to SSL | Upgrade image base_url to SSL
| JavaScript | mit | nathanhood/mmdb,nathanhood/mmdb | ---
+++
@@ -4,7 +4,7 @@
const { createTransformMany } = require('./utils');
const ORIGINAL_IMAGE_SIZE = 'original';
-const BASE_IMAGE_URL = imageConfig.base_url;
+const BASE_IMAGE_URL = imageConfig.secure_base_url;
const getImageUrl = (baseUrl, size, imagePath) => `${baseUrl}${size}${imagePath}`;
|
72feb40f9756bf53b4ab6a7151bc452c2aa87956 | installations/index.js | installations/index.js | const firebase = require("firebase");
async function deleteInstallation() {
try {
// [START delete_installation]
await firebase.installations().delete();
// [END delete_installation]
} catch (err) {
console.error('Unable to delete installation: ', err);
}
}
async function getInstallationId() {
try {
// [START get_installation_id]
const installationId = await firebase.installations().getId();
console.log(installationId);
// [END get_installation_id]
} catch (err) {
console.error('Unable to get Installation ID: ', err);
}
}
async function getAuthenticationToken() {
try {
// [START get_auth_token]
const authToken = await firebase.installations()
.getToken(/* forceRefresh */ true);
console.log(authToken);
// [END get_auth_token]
} catch (err) {
console.error('Unable to get auth token: ', err);
}
}
async function setOnIdChangeHandler() {
try {
// [START set_id_change_handler]
await firebase.installations().onIdChange((newId) => {
console.log(newId);
// TODO: Handle new installation ID.
});
// [START set_id_change_handler]
} catch (err) {
console.error('Unable to set ID change handler: ', err);
}
} | const firebase = require("firebase");
async function deleteInstallation() {
try {
// [START delete_installation]
await firebase.installations().delete();
// [END delete_installation]
} catch (err) {
console.error('Unable to delete installation: ', err);
}
}
async function getInstallationId() {
try {
// [START get_installation_id]
const installationId = await firebase.installations().getId();
console.log(installationId);
// [END get_installation_id]
} catch (err) {
console.error('Unable to get Installation ID: ', err);
}
}
async function getAuthenticationToken() {
try {
// [START get_auth_token]
const installationToken = await firebase.installations()
.getToken(/* forceRefresh */ true);
console.log(installationToken);
// [END get_auth_token]
} catch (err) {
console.error('Unable to get auth token: ', err);
}
}
async function setOnIdChangeHandler() {
try {
// [START set_id_change_handler]
await firebase.installations().onIdChange((newId) => {
console.log(newId);
// TODO: Handle new installation ID.
});
// [START set_id_change_handler]
} catch (err) {
console.error('Unable to set ID change handler: ', err);
}
}
| Use consistent auth token variable | Use consistent auth token variable
Other snippets for installations auth token is called `installationToken` using that here instead. | JavaScript | apache-2.0 | firebase/snippets-web,firebase/snippets-web,firebase/snippets-web,firebase/snippets-web | ---
+++
@@ -24,9 +24,9 @@
async function getAuthenticationToken() {
try {
// [START get_auth_token]
- const authToken = await firebase.installations()
+ const installationToken = await firebase.installations()
.getToken(/* forceRefresh */ true);
- console.log(authToken);
+ console.log(installationToken);
// [END get_auth_token]
} catch (err) {
console.error('Unable to get auth token: ', err); |
4ccd4b566f9dacb128914f136b6d652aea3832af | js/app/models/wants.js | js/app/models/wants.js | define(['jquery', 'underscore', 'backbone', 'model_want', 'utils'], function($, _, Backbone, Models, Utils) {
Models.Wants = Backbone.Collection.extend({
model: Models.Want,
initialize: function() {
this.fetch({
dataType: 'json',
success: function(model, response, options) {
},
error: function(model, response, options) {
if (response.status === 403) {
Utils.logIn();
}
}
});
},
parse: function(response) {
return response.listings;
},
comparator: function(first, second) {
var dateValue1 = first.get("dateStart");
var dateValue2 = second.get("dateStart");
var firstDate = Date.parse(dateValue1);
var secondDate = Date.parse(dateValue2);
var difference = secondDate - firstDate;
if (difference > 0) {
return 1;
} else if (difference == 0) {
return 0;
} else {
return -1;
}
}
});
return Models;
}); | define(['jquery', 'underscore', 'backbone', 'model_want', 'utils'], function($, _, Backbone, Models, Utils) {
Models.Wants = Backbone.Collection.extend({
model: Models.Want,
initialize: function() {
this.fetch({
dataType: 'json',
success: function(model, response, options) {
},
error: function(model, response, options) {
if (response.status === 403) {
Utils.logIn();
}
}
});
},
parse: function(response) {
return response.listings;
},
comparator: function(first, second) {
var dateValue1 = first.get("dateStart").replace(/ /, 'T');
var dateValue2 = second.get("dateStart").replace(/ /, 'T');
var firstDate = Date.parse(dateValue1);
var secondDate = Date.parse(dateValue2);
var difference = secondDate - firstDate;
if (difference > 0) {
return 1;
} else if (difference === 0) {
return 0;
} else {
return -1;
}
}
});
return Models;
}); | Replace space with "T" in date strings, to allow parsing. | Replace space with "T" in date strings, to allow parsing.
| JavaScript | mit | burnflare/CrowdBuy,burnflare/CrowdBuy | ---
+++
@@ -19,8 +19,8 @@
},
comparator: function(first, second) {
- var dateValue1 = first.get("dateStart");
- var dateValue2 = second.get("dateStart");
+ var dateValue1 = first.get("dateStart").replace(/ /, 'T');
+ var dateValue2 = second.get("dateStart").replace(/ /, 'T');
var firstDate = Date.parse(dateValue1);
var secondDate = Date.parse(dateValue2);
@@ -28,7 +28,7 @@
var difference = secondDate - firstDate;
if (difference > 0) {
return 1;
- } else if (difference == 0) {
+ } else if (difference === 0) {
return 0;
} else {
return -1; |
5c7a9212ae97adec9af1f737e9cf862b35b8331b | js/marcuswestin/app.js | js/marcuswestin/app.js | module.path.unshift('js');
(function(){
module('import class ui.TabContainer');
module('import class marcuswestin.Layout');
module('import class lib.navigationManager');
module('import class marcuswestin.views.factory');
var layout = new marcuswestin.Layout();
var tabContainer = new ui.TabContainer();
document.body.appendChild(layout.getElement());
layout.getHeader().appendChild(tabContainer.getElement());
tabContainer.addTab('All');
tabContainer.addTab('Blog');
tabContainer.addTab('Twitter');
tabContainer.addTab('Youtube');
tabContainer.addTab('Projects');
tabContainer.addTab('Bio & Resume');
lib.navigationManager.subscribe('Navigate', function(destination, items){
var content = layout.getContent();
content.innerHTML = '';
for (var i=0, item; item = items[i]; i++) {
var view = marcuswestin.views.factory.getView(item);
content.appendChild(view.getElement());
}
layout.onResize();
});
})();
| module.path.unshift('js');
(function(){
module('import class ui.TabContainer');
module('import class marcuswestin.Layout');
module('import class lib.navigationManager');
module('import class marcuswestin.views.factory');
var layout = new marcuswestin.Layout();
var tabContainer = new ui.TabContainer();
document.body.appendChild(layout.getElement());
layout.getHeader().appendChild(tabContainer.getElement());
tabContainer.addTab('All');
tabContainer.addTab('Blog');
tabContainer.addTab('Github');
tabContainer.addTab('Twitter');
tabContainer.addTab('Youtube');
tabContainer.addTab('Projects');
tabContainer.addTab('Bio & Resume');
lib.navigationManager.subscribe('Navigate', function(destination, items){
var content = layout.getContent();
content.innerHTML = '';
for (var i=0, item; item = items[i]; i++) {
var view = marcuswestin.views.factory.getView(item);
content.appendChild(view.getElement());
}
layout.onResize();
});
})();
| Add github to list of streams | Add github to list of streams
| JavaScript | mit | marcuswestin/marcuswestin.com,marcuswestin/marcuswestin.com | ---
+++
@@ -14,6 +14,7 @@
tabContainer.addTab('All');
tabContainer.addTab('Blog');
+ tabContainer.addTab('Github');
tabContainer.addTab('Twitter');
tabContainer.addTab('Youtube');
tabContainer.addTab('Projects'); |
06c4909dd0bd8178547991fb99c0825567eff41b | tools/testCi.js | tools/testCi.js | import {spawn} from 'child_process';
const requiresHarmonyFlag = parseInt(/^v(\d+)\./.exec(process.version)[1], 10) < 7;
const harmonyProxies = requiresHarmonyFlag ? ['--harmony_proxies'] : [];
const args = [
...harmonyProxies,
'node_modules/jest/bin/jest',
// First two args are always node and the script running, i.e. ['node', './tools/testCi.js', ...]
...process.argv.slice(2)
];
const testCi = spawn('node', args);
const consoleLogger = data => console.log(`${data}`);
testCi.stdout.on('data', consoleLogger);
testCi.stderr.on('data', consoleLogger);
| import {spawn} from 'child_process';
const requiresHarmonyFlag = parseInt(/^v(\d+)\./.exec(process.version)[1], 10) < 7;
const harmonyProxies = requiresHarmonyFlag ? ['--harmony_proxies'] : [];
const args = [
...harmonyProxies,
'node_modules/jest/bin/jest',
// First two args are always node and the script running, i.e. ['node', './tools/testCi.js', ...]
...process.argv.slice(2)
];
const testCi = spawn('node', args);
const consoleLogger = data => console.log(`${data}`); // eslint-disable-line no-console
testCi.stdout.on('data', consoleLogger);
testCi.stderr.on('data', consoleLogger);
| Remove linting warning in build script | Remove linting warning in build script
| JavaScript | mit | oshalygin/react-slingshot,flibertigibet/react-redux-starter-kit-custom,danpersa/remindmetolive-react,garusis/up-designer,danpersa/remindmetolive-react,oshalygin/react-slingshot,lisavogtsf/canned-react-slingshot-app,MouseZero/nightlife-frontend,git-okuzenko/react-redux,coryhouse/react-slingshot,garusis/up-designer,flibertigibet/react-redux-starter-kit-custom,danpersa/remindmetolive-react,kpuno/survey-app,BenMGilman/react-lunch-and-learn,coryhouse/react-slingshot,AurimasSk/DemoStore,MouseZero/nightlife-frontend,kpuno/survey-app,lisavogtsf/canned-react-slingshot-app,git-okuzenko/react-redux,AurimasSk/DemoStore,BenMGilman/react-lunch-and-learn | ---
+++
@@ -10,7 +10,7 @@
];
const testCi = spawn('node', args);
-const consoleLogger = data => console.log(`${data}`);
+const consoleLogger = data => console.log(`${data}`); // eslint-disable-line no-console
testCi.stdout.on('data', consoleLogger);
testCi.stderr.on('data', consoleLogger); |
7124186c630cae16e4faec3b4205db75eaefb5c7 | src/article/shared/EditEntityCommand.js | src/article/shared/EditEntityCommand.js | import { Command } from 'substance'
/*
This command intended to switch view and scroll to the selected node.
Command state becoming active only for certain type of custom selection,
e.g. if you want to use it, provide config with selectionType property.
*/
export default class EditEntityCommand extends Command {
getCommandState (params, context) {
let sel = params.selection
let newState = {
disabled: true
}
if (sel.isCustomSelection()) {
if (sel.customType === this.config.selectionType) {
newState.disabled = false
newState.nodeId = sel.nodeId
}
}
return newState
}
execute (params, context) {
const appState = context.appState
const viewName = appState.get('viewName')
if (viewName !== 'metadata') {
context.editor.send('updateViewName', 'metadata')
context.articlePanel.refs.content.send('executeCommand', this.name, params)
} else {
const api = context.api
const editorSession = params.editorSession
const doc = editorSession.getDocument()
const sel = params.selection
const node = doc.get(sel.nodeId)
const newSel = api._selectFirstRequiredPropertyOfMetadataCard(node)
api._setSelection(newSel)
}
}
}
| import { Command } from 'substance'
/*
This command intended to switch view and scroll to the selected node.
Command state becoming active only for certain type of custom selection,
e.g. if you want to use it, provide config with selectionType property.
*/
export default class EditEntityCommand extends Command {
getCommandState (params, context) {
let sel = params.selection
let newState = {
disabled: true
}
if (sel.isCustomSelection()) {
if (sel.customType === this.config.selectionType) {
newState.disabled = false
newState.nodeId = sel.nodeId
}
}
return newState
}
execute (params, context) {
const appState = context.appState
const viewName = appState.get('viewName')
if (viewName !== 'metadata') {
const sel = params.selection
context.editor.send('updateViewName', 'metadata')
context.articlePanel.refs.content.send('scrollTo', { nodeId: sel.nodeId })
}
}
}
| Use scrollTo action for edit entity commands. | Use scrollTo action for edit entity commands.
| JavaScript | mit | substance/texture,substance/texture | ---
+++
@@ -26,16 +26,9 @@
const appState = context.appState
const viewName = appState.get('viewName')
if (viewName !== 'metadata') {
+ const sel = params.selection
context.editor.send('updateViewName', 'metadata')
- context.articlePanel.refs.content.send('executeCommand', this.name, params)
- } else {
- const api = context.api
- const editorSession = params.editorSession
- const doc = editorSession.getDocument()
- const sel = params.selection
- const node = doc.get(sel.nodeId)
- const newSel = api._selectFirstRequiredPropertyOfMetadataCard(node)
- api._setSelection(newSel)
+ context.articlePanel.refs.content.send('scrollTo', { nodeId: sel.nodeId })
}
}
} |
d78ebdbc5b1a4ff59ae67b492fc3550698231279 | TC/control/Click.js | TC/control/Click.js | TC.control = TC.control || {};
if (!TC.Control) {
TC.syncLoadJS(TC.apiLocation + 'TC/Control');
}
TC.control.Click = function () {
var self = this;
TC.Control.apply(self, arguments);
self.callback = (self.options && self.options.callback) || function (coord, point) {
console.log('[Click][' + coord[0] + ', ' + coord[1] + '][' + point[0] + ', ' + point[1] + ']');
};
self.wrap = new TC.wrap.control.Click(self);
};
TC.inherit(TC.control.Click, TC.Control);
(function () {
var ctlProto = TC.control.Click.prototype;
ctlProto.CLASS = 'tc-ctl-click';
ctlProto.register = function (map) {
var self = this;
self.wrap.register(map);
TC.Control.prototype.register.call(self, map);
};
ctlProto.activate = function () {
var self = this;
TC.Control.prototype.activate.call(self);
self.wrap.activate();
};
ctlProto.deactivate = function () {
var self = this;
self.wrap.deactivate();
TC.Control.prototype.deactivate.call(self);
};
})(); | TC.control = TC.control || {};
if (!TC.Control) {
TC.syncLoadJS(TC.apiLocation + 'TC/Control');
}
TC.control.Click = function () {
var self = this;
TC.Control.apply(self, arguments);
if (self.options && self.options.callback) {
self.callback = self.options.callback;
}
self.wrap = new TC.wrap.control.Click(self);
};
TC.inherit(TC.control.Click, TC.Control);
(function () {
var ctlProto = TC.control.Click.prototype;
ctlProto.CLASS = 'tc-ctl-click';
ctlProto.register = function (map) {
var self = this;
self.wrap.register(map);
TC.Control.prototype.register.call(self, map);
};
ctlProto.activate = function () {
var self = this;
TC.Control.prototype.activate.call(self);
self.wrap.activate();
};
ctlProto.deactivate = function () {
var self = this;
self.wrap.deactivate();
TC.Control.prototype.deactivate.call(self);
};
ctlProto.callback = function (coord, point) {
console.log('[Click][' + coord[0] + ', ' + coord[1] + '][' + point[0] + ', ' + point[1] + ']');
};
})(); | Move callback method to prototype | Move callback method to prototype
| JavaScript | bsd-2-clause | sitna/api-sitna,sitna/api-sitna | ---
+++
@@ -9,9 +9,9 @@
TC.Control.apply(self, arguments);
- self.callback = (self.options && self.options.callback) || function (coord, point) {
- console.log('[Click][' + coord[0] + ', ' + coord[1] + '][' + point[0] + ', ' + point[1] + ']');
- };
+ if (self.options && self.options.callback) {
+ self.callback = self.options.callback;
+ }
self.wrap = new TC.wrap.control.Click(self);
};
@@ -41,4 +41,7 @@
TC.Control.prototype.deactivate.call(self);
};
+ ctlProto.callback = function (coord, point) {
+ console.log('[Click][' + coord[0] + ', ' + coord[1] + '][' + point[0] + ', ' + point[1] + ']');
+ };
})(); |
7206d486166786c27862f373a90d942bddbff935 | Server/src/test/resources/client/sector_identifier.js | Server/src/test/resources/client/sector_identifier.js | [ "https://${test.server.name}/oxauth-rp/home.seam",
"https://client.example.org/callback",
"https://client.example.org/callback2",
"https://client.other_company.example.net/callback",
"https://client.example.com/cb",
"https://client.example.com/cb1",
"https://client.example.com/cb2" ] | [ "https://${test.server.name}/oxauth-rp/home.htm",
"https://client.example.org/callback",
"https://client.example.org/callback2",
"https://client.other_company.example.net/callback",
"https://client.example.com/cb",
"https://client.example.com/cb1",
"https://client.example.com/cb2" ] | Fix uri in secto_identifier js | Fix uri in secto_identifier js
| JavaScript | mit | madumlao/oxAuth,madumlao/oxAuth,madumlao/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,GluuFederation/oxAuth,GluuFederation/oxAuth,madumlao/oxAuth,GluuFederation/oxAuth,GluuFederation/oxAuth | ---
+++
@@ -1,4 +1,4 @@
-[ "https://${test.server.name}/oxauth-rp/home.seam",
+[ "https://${test.server.name}/oxauth-rp/home.htm",
"https://client.example.org/callback",
"https://client.example.org/callback2",
"https://client.other_company.example.net/callback", |
a4d968cb25e706bd5dccaf2ada554382df77bad7 | src/legacy/js/classes/log.js | src/legacy/js/classes/log.js | var log = {
add: function(eventType, payload) {
var timestamp = new Date();
var event = {
type: eventType,
instanceID: Florence.instanceID,
created: timestamp.toISOString(),
timestamp: timestamp.getTime(),
payload: payload || null
}
websocket.send("log:" + JSON.stringify(event));
},
eventTypes: {
appInitialised: "APP_INITIALISED",
requestSent: "REQUEST_SENT",
requestReceived: "REQUEST_RECEIVED",
requestFailed: "REQUEST_FAILED",
pingSent: "PING_SENT",
pingReceived: "PING_RECEIVED",
pingFailed: "PING_FAILED",
socketOpen: "SOCKET_OPEN",
socketBufferFull: "SOCKET_BUFFER_FULL",
socketError: "SOCKET_ERROR",
unexpectedRuntimeError: "UNEXPECTED_RUNTIME_ERROR",
runtimeWarning: "RUNTIME_WARNING"
}
}
| var log = {
add: function(eventType, payload) {
var timestamp = new Date();
var event = {
type: eventType,
instanceID: Florence.instanceID,
created: timestamp.toISOString(),
timestamp: timestamp.getTime(),
payload: payload || null
}
// Add unrecognised log type to log event
if (!log.eventTypesMap[eventType]) {
console.log("Unrecognised log type: ", eventType, payload);
event.type = log.eventTypes.unrecognisedLogType;
}
websocket.send("log:" + JSON.stringify(event));
},
eventTypes: {
appInitialised: "APP_INITIALISED",
requestSent: "REQUEST_SENT",
requestReceived: "REQUEST_RECEIVED",
requestFailed: "REQUEST_FAILED",
pingSent: "PING_SENT",
pingReceived: "PING_RECEIVED",
pingFailed: "PING_FAILED",
socketOpen: "SOCKET_OPEN",
socketBufferFull: "SOCKET_BUFFER_FULL",
socketError: "SOCKET_ERROR",
unexpectedRuntimeError: "UNEXPECTED_RUNTIME_ERROR",
runtimeWarning: "RUNTIME_WARNING",
unrecognisedLogType: "UNRECOGNISED_LOG_TYPE"
},
eventTypesMap: {}
}
// Create a map for event type values to property name
// so that we can detect when we're logging an unrecognised event
for (var eventType in log.eventTypes) {
log.eventTypesMap[log.eventTypes[eventType]] = eventType;
}
$.ajaxSetup({
beforeSend: function(request) {
var requestID = (S4() + S4());
request.setRequestHeader("X-Request-ID", requestID);
request.uniqueID = requestID;
log.add(
log.eventTypes.requestSent, {
requestID
}
);
}
});
$(document).ajaxSuccess(function(event, request, settings) {
log.add(
log.eventTypes.requestReceived, {
requestID: request.uniqueID,
status: request.statusText
}
);
});
$(document).ajaxError(function(event, request, settings) {
log.add(
log.eventTypes.requestReceived, {
requestID: request.uniqueID,
status: request.statusText
}
);
});
| Add request ID to every ajax in legacy Florence | Add request ID to every ajax in legacy Florence
Former-commit-id: f0107e87b690b2b6eb77ef75692ab09718e70988
Former-commit-id: 094331c7554b4043bf296e6728ff0de511a8fb55
Former-commit-id: 1fc95c6218fe635a11d05b7f2dfa3db24796bebf | JavaScript | mit | ONSdigital/florence,ONSdigital/florence,ONSdigital/florence,ONSdigital/florence | ---
+++
@@ -8,6 +8,13 @@
timestamp: timestamp.getTime(),
payload: payload || null
}
+
+ // Add unrecognised log type to log event
+ if (!log.eventTypesMap[eventType]) {
+ console.log("Unrecognised log type: ", eventType, payload);
+ event.type = log.eventTypes.unrecognisedLogType;
+ }
+
websocket.send("log:" + JSON.stringify(event));
},
eventTypes: {
@@ -22,6 +29,45 @@
socketBufferFull: "SOCKET_BUFFER_FULL",
socketError: "SOCKET_ERROR",
unexpectedRuntimeError: "UNEXPECTED_RUNTIME_ERROR",
- runtimeWarning: "RUNTIME_WARNING"
+ runtimeWarning: "RUNTIME_WARNING",
+ unrecognisedLogType: "UNRECOGNISED_LOG_TYPE"
+ },
+ eventTypesMap: {}
+}
+
+// Create a map for event type values to property name
+// so that we can detect when we're logging an unrecognised event
+for (var eventType in log.eventTypes) {
+ log.eventTypesMap[log.eventTypes[eventType]] = eventType;
+}
+
+$.ajaxSetup({
+ beforeSend: function(request) {
+ var requestID = (S4() + S4());
+ request.setRequestHeader("X-Request-ID", requestID);
+ request.uniqueID = requestID;
+ log.add(
+ log.eventTypes.requestSent, {
+ requestID
+ }
+ );
}
-}
+});
+
+$(document).ajaxSuccess(function(event, request, settings) {
+ log.add(
+ log.eventTypes.requestReceived, {
+ requestID: request.uniqueID,
+ status: request.statusText
+ }
+ );
+});
+
+$(document).ajaxError(function(event, request, settings) {
+ log.add(
+ log.eventTypes.requestReceived, {
+ requestID: request.uniqueID,
+ status: request.statusText
+ }
+ );
+}); |
359c0084212dd2f824e3f34f5f3f1a1c27eac35c | src/ui/examples/inspecting-an-object.js | src/ui/examples/inspecting-an-object.js | // If you try printing the below you would see "[object Object]"" which is not that useful.
// Instead, you can click "Inspect it" to see the result in the JavaScript console where you can look inside the object.
// That result is not displayed in the editor window -- it is only displayed in the console.
// To open the console in various browsers, see:
// https://webmasters.stackexchange.com/questions/8525/how-do-i-open-the-javascript-console-in-different-browsers
// You can also try selecting just parts of the object (like the array) and use "Inspect It" or "Print it".
const myObject = {
hello: "world",
coding: "is fun!",
todo: ["learn Mithril.js", "learn Tachyons.js"],
snippetIndex: 3
}
myObject | // If you try printing the below you would see "[object Object]"" which is not that useful.
// Instead, you can click "Inspect it" to see the result in the JavaScript console where you can look inside the object.
// That result is not displayed in the editor window -- it is only displayed in the console.
// To open the console in various browsers, see:
// https://webmasters.stackexchange.com/questions/8525/how-do-i-open-the-javascript-console-in-different-browsers
// You can also try selecting just parts of the object (like the array) and use "Inspect It" or "Print it".
const myObject = {
hello: "world",
coding: "is fun!",
todo: ["learn Mithril.js", "learn Tachyons.css"],
snippetIndex: 3
}
myObject | Update inspecitng an object example | Update inspecitng an object example
| JavaScript | mit | pdfernhout/Twirlip7,pdfernhout/Twirlip7,pdfernhout/Twirlip7 | ---
+++
@@ -11,7 +11,7 @@
const myObject = {
hello: "world",
coding: "is fun!",
- todo: ["learn Mithril.js", "learn Tachyons.js"],
+ todo: ["learn Mithril.js", "learn Tachyons.css"],
snippetIndex: 3
}
|
087c7bdb215baa4f1f6369dcfb7d0e19fe010bf2 | statics/scripts/angular.jsdoc.search.js | statics/scripts/angular.jsdoc.search.js | angular
.module('search', ['angucomplete-alt'])
.controller('SearchController', ['SEARCH_DATA', '$window', function (searchData, $window) {
var me = this;
me.docs = searchData.data;
me.src = searchData.src;
me.search = function (selected) {
var doc,
path,
url;
if (selected) {
doc = selected.originalObject;
me.src.forEach(function (src) {
if (src[src.length-1] === '/') {
src = src.slice(0, src.length-1);
}
if (doc.meta.path.indexOf(src) === 0) {
path = doc.meta.path.slice(src.length);
}
});
if (path !== undefined) {
url = '/' + path.split('/')
.concat([doc.meta.filename])
.filter(function (p) { return p; })
.join('_') + '.html#line' + doc.meta.lineno;
$window.location = url;
}
}
};
}]);
| angular
.module('search', ['angucomplete-alt'])
.controller('SearchController', ['SEARCH_DATA', '$window', function (searchData, $window) {
var me = this;
me.docs = searchData.data;
me.src = searchData.src;
me.search = function (selected) {
var doc,
path,
url;
if (selected) {
doc = selected.originalObject;
me.src.forEach(function (src) {
if (src[src.length-1] === '/') {
src = src.slice(0, src.length-1);
}
if (doc.meta.path.indexOf(src) === 0) {
path = doc.meta.path.slice(src.length);
}
});
if (path !== undefined) {
url = path.split('/')
.concat([doc.meta.filename])
.filter(function (p) { return p; })
.join('_') + '.html#line' + doc.meta.lineno;
$window.location = url;
}
}
};
}]);
| Fix url redirection to relative | Fix url redirection to relative
| JavaScript | mit | haochi/jsdoc-search | ---
+++
@@ -24,10 +24,10 @@
});
if (path !== undefined) {
- url = '/' + path.split('/')
- .concat([doc.meta.filename])
- .filter(function (p) { return p; })
- .join('_') + '.html#line' + doc.meta.lineno;
+ url = path.split('/')
+ .concat([doc.meta.filename])
+ .filter(function (p) { return p; })
+ .join('_') + '.html#line' + doc.meta.lineno;
$window.location = url;
} |
373d991ce474bb74fe51053d80c33c92abb1685b | gulpfile.babel.js/tasks/serve.js | gulpfile.babel.js/tasks/serve.js | /*
* `server` task
* =============
*
* Creates a Browsersync Web server instance for live development. Makes use of
* some Webpack middlewares to enable live reloading features.
*/
import browsersync from 'browser-sync';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import config from '../config/browsersync';
import webpack from '../lib/webpack';
const server = browsersync.create();
const serve = () => {
const compiler = webpack('development');
config.middleware = [
webpackDevMiddleware(compiler, {
quiet: true,
stats: {
colors: true
}
}),
webpackHotMiddleware(compiler, {
log: () => {}
})
];
server.init(config);
};
serve.description = `Create a Browsersync instance for live development.`;
export default serve;
| /*
* `server` task
* =============
*
* Creates a Browsersync Web server instance for live development. Makes use of
* some Webpack middlewares to enable live reloading features.
*/
import browsersync from 'browser-sync';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import config from '../config/browsersync';
import webpack from '../lib/webpack';
const server = browsersync.create();
const serve = () => {
const compiler = webpack('development');
config.middleware = [
webpackDevMiddleware(compiler, {
quiet: true,
stats: {
colors: true,
modules: false
}
}),
webpackHotMiddleware(compiler, {
log: () => {}
})
];
server.init(config);
};
serve.description = `Create a Browsersync instance for live development.`;
export default serve;
| Make Webpack logs a bit less verbose. | Make Webpack logs a bit less verbose.
| JavaScript | mit | rblopes/phaser-3-snake-game,rblopes/phaser-3-snake-game | ---
+++
@@ -21,7 +21,8 @@
webpackDevMiddleware(compiler, {
quiet: true,
stats: {
- colors: true
+ colors: true,
+ modules: false
}
}),
webpackHotMiddleware(compiler, { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.