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 |
|---|---|---|---|---|---|---|---|---|---|---|
929a80bb98e44a2c0f0bd05716d3152d7828e72f | webdiagrams/uml.js | webdiagrams/uml.js | /**
* Created by Leandro Luque on 24/07/17.
*/
/* JSHint configurations */
/* jshint esversion: 6 */
/* jshint -W097 */
'use strict';
// A.
const ATTRIBUTE = "A1";
// C.
const CLASS = "C1";
// D.
const DEFAULT = "~";
// I.
const INITIAL_VALUE = "I1";
const INTERFACE = "I2";
const IS_ABSTRACT = "I3";
const IS_LEAF = "I4";
const IS_READ_ONLY = "I5";
const IS_STATIC = "I6";
// M.
const MODEL = "M1";
// O.
const OPERATION = "O1";
// P.
const PRIVATE = "-";
const PROTECTED = "#";
const PUBLIC = "+";
// R.
const RETURN_TYPE = "R1";
// S.
const STEREOTYPE = "S1";
// T.
const TYPE = "T1";
// V.
const VISIBILITY = "V1"; | /**
* Created by Leandro Luque on 24/07/17.
*/
/* JSHint configurations */
/* jshint esversion: 6 */
/* jshint -W097 */
'use strict';
// A.
const ATTRIBUTE = "A1";
// C.
const CLASS = "C1";
// D.
const DEFAULT = "~";
// I.
const INITIAL_VALUE = "I1";
const INTERFACE = "I2";
const IS_ABSTRACT = "I3";
const IS_LEAF = "I4";
const IS_READ_ONLY = "I5";
const IS_STATIC = "I6";
// M.
const MODEL = "M1";
// O.
const OPERATION = "O1";
// P.
const PRIVATE = "-";
const PROTECTED = "#";
const PUBLIC = "+";
const PARAMETER = "P1"
// R.
const RETURN_TYPE = "R1";
// S.
const STEREOTYPE = "S1";
// T.
const TYPE = "T1";
// V.
const VISIBILITY = "V1"; | Add parameter to UML constants | Add parameter to UML constants
| JavaScript | mit | leluque/webdiagrams,leluque/webdiagrams | ---
+++
@@ -35,6 +35,7 @@
const PRIVATE = "-";
const PROTECTED = "#";
const PUBLIC = "+";
+const PARAMETER = "P1"
// R.
const RETURN_TYPE = "R1"; |
3f0e7f20fcb361418c7cf76c89c034540dec7382 | src/nih_wayfinding/app/scripts/views/navbar/navbar-controller.js | src/nih_wayfinding/app/scripts/views/navbar/navbar-controller.js | (function () {
'use strict';
// TODO: This should likely be a directive, something like nih-navbar once
// we have profiles to link to
/* ngInject */
function NavbarController($scope, $timeout, $state, NavbarConfig) {
var ctl = this;
var defaultAlertHeight = 50;
var alertTimeout = null;
var history = [];
initialize();
function initialize() {
ctl.config = NavbarConfig.config;
ctl.alert = {};
ctl.alertHeight = 0;
ctl.back = back;
ctl.hideAlert = hideAlert;
$scope.$on('nih.notifications.hide', hideAlert);
$scope.$on('nih.notifications.show', showAlert);
$scope.$on('$stateChangeSuccess', function (event, toState) {
history.push(toState);
});
}
function back() {
var stateName = history.length > 1 ? history.splice(-2)[0].name : 'profiles';
$state.go(stateName);
}
function showAlert(event, alert) {
ctl.alert = alert;
ctl.alertHeight = defaultAlertHeight;
if (alert.timeout) {
alertTimeout = $timeout(hideAlert, alert.timeout);
}
}
function hideAlert() {
ctl.alertHeight = 0;
if (alertTimeout) {
$timeout.cancel(alertTimeout);
alertTimeout = null;
}
}
}
angular.module('nih.views.navbar')
.controller('NavbarController', NavbarController);
})(); | (function () {
'use strict';
// TODO: This should likely be a directive, something like nih-navbar once
// we have profiles to link to
/* ngInject */
function NavbarController($scope, $timeout, $state, NavbarConfig) {
var ctl = this;
var defaultAlertHeight = 50;
var defaultBackState = 'locations';
var alertTimeout = null;
var history = [];
initialize();
function initialize() {
ctl.config = NavbarConfig.config;
ctl.alert = {};
ctl.alertHeight = 0;
ctl.back = back;
ctl.hideAlert = hideAlert;
$scope.$on('nih.notifications.hide', hideAlert);
$scope.$on('nih.notifications.show', showAlert);
$scope.$on('$stateChangeSuccess', function (event, toState) {
history.push(toState);
});
}
function back() {
// Get the last two states from the history array
// [0] is last state, [1] is current state
// and return the state name
var stateName = history.length > 1 ? history.splice(-2)[0].name : defaultBackState;
$state.go(stateName);
}
function showAlert(event, alert) {
ctl.alert = alert;
ctl.alertHeight = defaultAlertHeight;
if (alert.timeout) {
alertTimeout = $timeout(hideAlert, alert.timeout);
}
}
function hideAlert() {
ctl.alertHeight = 0;
if (alertTimeout) {
$timeout.cancel(alertTimeout);
alertTimeout = null;
}
}
}
angular.module('nih.views.navbar')
.controller('NavbarController', NavbarController);
})(); | Comment NavbarController.back() and update default state | Comment NavbarController.back() and update default state
| JavaScript | apache-2.0 | azavea/nih-wayfinding,azavea/nih-wayfinding | ---
+++
@@ -7,6 +7,7 @@
function NavbarController($scope, $timeout, $state, NavbarConfig) {
var ctl = this;
var defaultAlertHeight = 50;
+ var defaultBackState = 'locations';
var alertTimeout = null;
var history = [];
initialize();
@@ -27,7 +28,10 @@
}
function back() {
- var stateName = history.length > 1 ? history.splice(-2)[0].name : 'profiles';
+ // Get the last two states from the history array
+ // [0] is last state, [1] is current state
+ // and return the state name
+ var stateName = history.length > 1 ? history.splice(-2)[0].name : defaultBackState;
$state.go(stateName);
}
|
ed3c2a0de70dd7e96fcb376d2199425f0130809a | node-tests/unit/utils/validate-platforms-test.js | node-tests/unit/utils/validate-platforms-test.js | 'use strict';
const expect = require('../../helpers/expect');
const ValidatePlatforms = require('../../../src/utils/validate-platforms');
describe('ValidatePlatforms', () => {
context('when platforms contain valid platforms', () => {
it('returns true', () => {
const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
expect(ValidatePlatforms(platforms)).to.equal(true);
});
});
context('when platforms contain invalid platforms', () => {
it('returns false', () => {
const platforms = ['symbian'];
expect(ValidatePlatforms(platforms)).to.equal(false);
});
});
});
| 'use strict';
const expect = require('../../helpers/expect');
const ValidatePlatforms = require('../../../src/utils/validate-platforms');
describe('ValidatePlatforms', () => {
context('when platforms contain valid platforms', () => {
const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
it('returns true', () => {
expect(ValidatePlatforms(platforms)).to.equal(true);
});
});
context('when platforms contain invalid platforms', () => {
const platforms = ['symbian'];
it('returns false', () => {
expect(ValidatePlatforms(platforms)).to.equal(false);
});
});
});
| Update test to move context code to context block | style(validate-platforms): Update test to move context code to context block
| JavaScript | mit | isleofcode/splicon | ---
+++
@@ -6,17 +6,17 @@
describe('ValidatePlatforms', () => {
context('when platforms contain valid platforms', () => {
+ const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
+
it('returns true', () => {
- const platforms = ['all', 'ios', 'android', 'blackberry', 'windows'];
-
expect(ValidatePlatforms(platforms)).to.equal(true);
});
});
context('when platforms contain invalid platforms', () => {
+ const platforms = ['symbian'];
+
it('returns false', () => {
- const platforms = ['symbian'];
-
expect(ValidatePlatforms(platforms)).to.equal(false);
});
}); |
ff15e37b70578c1eb202773f310879e6451b4e9e | src/storage/storage.js | src/storage/storage.js | const { remote } = require('electron');
const path = require('path');
const Config = require('electron-config');
const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');
const KEYS = {
BASE_DESTINATION: 'base_destination',
};
let config;
export var init = function () {
config = new Config();
if (! config.has(KEYS.BASE_DESTINATION)) {
config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
}
};
export var save = function (key, value) {
config.set(key, value);
};
export var get = function (key) {
config.get(key);
};
export var getBaseDestination = function () {
return config.get(KEYS.BASE_DESTINATION);
}
| const { remote } = require('electron');
const path = require('path');
const Config = require('electron-config');
const DEFAULT_BASE_DESTINATION = path.join(remote.app.getPath('videos'), 'YouTube');
const KEYS = {
BASE_DESTINATION: 'base_destination',
};
let config;
export var init = function () {
config = new Config();
if (! config.has(KEYS.BASE_DESTINATION)) {
config.set(KEYS.BASE_DESTINATION, DEFAULT_BASE_DESTINATION);
}
};
export var save = function (key, value) {
config.set(key, value);
};
export var get = function (key) {
config.get(key);
};
export var getBaseDestination = function () {
return config.get(KEYS.BASE_DESTINATION);
}
export var setBaseDestination = function (baseDestination) {
config.set(KEYS.BASE_DESTINATION, baseDestination);
}
| Add method to set base destination | Add method to set base destination
| JavaScript | mit | yannbertrand/youtube-dl-gui,yannbertrand/youtube-dl-gui,yannbertrand/youtube-dl-gui | ---
+++
@@ -28,3 +28,7 @@
export var getBaseDestination = function () {
return config.get(KEYS.BASE_DESTINATION);
}
+
+export var setBaseDestination = function (baseDestination) {
+ config.set(KEYS.BASE_DESTINATION, baseDestination);
+} |
cab77f9829497b5557ca33ccea9ae1bd52e5e351 | options.js | options.js | function generate_key_pair() {
generateKeyPair().then(function(key) {
exportKey(key.privateKey).then(function(exported_private_key) {
chrome.storage.local.set(
{ exported_private_key: exported_private_key },
function() {
var status = document.getElementById('status');
status.textContent = 'Key pair was successfully created.';
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
});
}
function export_public_key() {}
document.getElementById('generate-key-pair').addEventListener('click', generate_key_pair);
//document.getElementById('export-public-key').addEventListener('click', export_public_key);
| function generate_key_pair() {
generateKeyPair().then(function(key) {
// export and store private key
exportKey(key.privateKey).then(function(exported_private_key) {
chrome.storage.local.set(
{ exported_private_key: exported_private_key },
function() {
var status = document.getElementById('status');
status.textContent = 'Key pair was successfully created.';
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
// export and store public key
exportKey(key.publicKey).then(function(exported_public_key) {
chrome.storage.local.set(
{ exported_public_key: exported_public_key },
function() {
setTimeout(function() {
status.textContent = '';
}, 750);
}
);
});
});
}
function export_public_key() {}
document.getElementById('generate-key-pair').addEventListener('click', generate_key_pair);
//document.getElementById('export-public-key').addEventListener('click', export_public_key);
| Store generated public key on chrome.storage.local. | Store generated public key on chrome.storage.local.
| JavaScript | bsd-3-clause | microwaves/autonomous-messages,microwaves/autonomous-messages | ---
+++
@@ -1,5 +1,6 @@
function generate_key_pair() {
generateKeyPair().then(function(key) {
+ // export and store private key
exportKey(key.privateKey).then(function(exported_private_key) {
chrome.storage.local.set(
{ exported_private_key: exported_private_key },
@@ -13,6 +14,18 @@
}
);
});
+
+ // export and store public key
+ exportKey(key.publicKey).then(function(exported_public_key) {
+ chrome.storage.local.set(
+ { exported_public_key: exported_public_key },
+ function() {
+ setTimeout(function() {
+ status.textContent = '';
+ }, 750);
+ }
+ );
+ });
});
}
|
575077bf8be2efc2809fa8aa2a77f122f3239396 | src/js/main.js | src/js/main.js | ;(function(){
angular.module('flockTogether', ['ngRoute'], function($routeProvider, $httpProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
controller: 'loginCtrl'
})//END .when '/'
})//END angular.module 'flock'
.controller('MainController', function(){
// window.fbAsyncInit = function() {
// FB.init({
// appId : '531876423645126',
// xfbml : true,
// version : 'v2.5'
// });
// };
})//END MainController
})();//END IIFE
| ;(function(){
angular.module('flockTogether', ['ngRoute'], function($routeProvider, $httpProvider) {
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
controller: 'homeCtrl'
})//END .when '/home'
.when('/login', {
templateUrl: 'partials/login.html',
controller: 'loginCtrl'
})//END .when '/login'
.when('/create-event', {
templateUrl: 'partials/create_event.html',
controller: 'createEventCtrl'
})
})//END angular.module 'flock'
.controller('MainController', function($http, $scope){
})//END MainController
})();//END IIFE
| Add .when for each current partial. | Add .when for each current partial.
| JavaScript | mit | flock-together/flock-fee,flock-together/flock-fee | ---
+++
@@ -3,19 +3,20 @@
$routeProvider
.when('/', {
templateUrl: 'partials/home.html',
+ controller: 'homeCtrl'
+ })//END .when '/home'
+ .when('/login', {
+ templateUrl: 'partials/login.html',
controller: 'loginCtrl'
- })//END .when '/'
+ })//END .when '/login'
+ .when('/create-event', {
+ templateUrl: 'partials/create_event.html',
+ controller: 'createEventCtrl'
+ })
+ })//END angular.module 'flock'
+ .controller('MainController', function($http, $scope){
- })//END angular.module 'flock'
- .controller('MainController', function(){
- // window.fbAsyncInit = function() {
- // FB.init({
- // appId : '531876423645126',
- // xfbml : true,
- // version : 'v2.5'
- // });
- // };
- })//END MainController
+ })//END MainController
})();//END IIFE |
cdf96b8268996f5c4b7eea4fe2077d0b37205d79 | js/navbar.js | js/navbar.js | (function() {
// construct Headroom
var headroom = new Headroom(document.querySelector(".js-nvbr"), {
"offset": Options.navbarOffset,
"tolerance": Options.navbarTolerance
});
// initialize Headroom
headroom.init();
// add click events to sidebar nav links
document.addEventListener("DOMContentLoaded", function() {
// choose elements to add click event to
var elements = document.getElementsByClassName("x2b-sdbr-lnk");
// iterate over elements
for (var i = 0; elements[i]; ++i) {
// add click event
elements[i].onclick = function() {
// fudge scroll position to make Headroom pin
headroom.lastKnownScrollY = headroom.getScrollerHeight();
}
}
});
})();
| (function() {
// construct Headroom
var headroom = new Headroom(document.querySelector(".js-nvbr"), {
"offset": Options.navbarOffset,
"tolerance": Options.navbarTolerance
});
// initialize Headroom
headroom.init();
// add click events to sidebar nav links
document.addEventListener("DOMContentLoaded", function() {
// choose elements to add click event to
var elements = document.getElementsByClassName("x2b-sdbr-lnk");
// iterate over elements
for (var i = 0; elements[i]; ++i) {
// add click event
elements[i].onclick = function() {
// fudge scroll position to make Headroom pin
headroom.lastKnownScrollY = headroom.getScrollerHeight();
// make Headroom pin even if scroll position has not changed
window.requestAnimationFrame(function() { headroom.pin() });
}
}
});
})();
| Make Headroom pin even if scroll position has not changed | Make Headroom pin even if scroll position has not changed
| JavaScript | mit | acch/XML-to-bootstrap,acch/XML-to-bootstrap | ---
+++
@@ -19,6 +19,9 @@
elements[i].onclick = function() {
// fudge scroll position to make Headroom pin
headroom.lastKnownScrollY = headroom.getScrollerHeight();
+
+ // make Headroom pin even if scroll position has not changed
+ window.requestAnimationFrame(function() { headroom.pin() });
}
}
}); |
f8aa1ab924c19b8bab4be2b9f69b68b70bae6576 | package.js | package.js | Package.describe({
summary: "Fast and reactive jQuery DataTables using standard Cursors / DataTables API. Supports Bootstrap 3.",
version: "1.0.1",
git: "https://github.com/ephemer/meteor-reactive-datatables.git"
});
Package.onUse(function(api) {
api.versionsFrom('METEOR@0.9.0');
api.use(['templating'], 'client');
api.addFiles([
'jquery.dataTables.min.js',
'reactive-datatables.js',
'reactive-datatable-template.html',
'reactive-datatable-template.js',
], 'client');
});
/*Package.onTest(function(api) {
api.use('tinytest');
api.use('ephemer:reactive-datatables');
api.addFiles('reactive-datatables-tests.js');
});
*/ | Package.describe({
name: 'ephemer:reactive-datatables',
summary: "Fast and reactive jQuery DataTables using standard Cursors / DataTables API. Supports Bootstrap 3.",
version: "1.0.1",
git: "https://github.com/ephemer/meteor-reactive-datatables.git"
});
Package.onUse(function(api) {
api.versionsFrom('0.9.0');
api.use(['templating'], 'client');
api.addFiles([
'jquery.dataTables.min.js',
'reactive-datatables.js',
'reactive-datatable-template.html',
'reactive-datatable-template.js',
], 'client');
});
/*Package.onTest(function(api) {
api.use('tinytest');
api.use('ephemer_reactive-datatables');
api.addFiles('reactive-datatables-tests.js');
});
*/
| Add name, prepare test filename to be Windows-friendly | Add name, prepare test filename to be Windows-friendly | JavaScript | mit | rossmartin/meteor-reactive-datatables,ephemer/meteor-reactive-datatables,rossmartin/meteor-reactive-datatables,ephemer/meteor-reactive-datatables | ---
+++
@@ -1,11 +1,12 @@
Package.describe({
+ name: 'ephemer:reactive-datatables',
summary: "Fast and reactive jQuery DataTables using standard Cursors / DataTables API. Supports Bootstrap 3.",
version: "1.0.1",
git: "https://github.com/ephemer/meteor-reactive-datatables.git"
});
Package.onUse(function(api) {
- api.versionsFrom('METEOR@0.9.0');
+ api.versionsFrom('0.9.0');
api.use(['templating'], 'client');
api.addFiles([
'jquery.dataTables.min.js',
@@ -17,7 +18,7 @@
/*Package.onTest(function(api) {
api.use('tinytest');
- api.use('ephemer:reactive-datatables');
+ api.use('ephemer_reactive-datatables');
api.addFiles('reactive-datatables-tests.js');
});
*/ |
e41da8cb181392a7cc5f7ed4afcfe469f9b3d2b6 | scripts/main/app.js | scripts/main/app.js | /*global MusicPlayer, Vue */
(function (global, undefined) {
'use strict';
document.addEventListener('DOMContentLoaded', function () {
var musicPlayer = new MusicPlayer();
var hasSource = false;
var isPlay = false;
new Vue({
el: '#app',
data: {
names: [],
sources: []
},
methods: {
loadMusic: function (event) {
var that = this;
var files = event.target.files;
[].forEach.call(files, function (file) {
musicPlayer.loadMusic(file, function (src) {
return that.$data.sources.push(src);
});
if (!musicPlayer.isMusicFile) {
return;
}
that.$data.names.push(file.name);
});
},
toggle: function (event) {
var elm = event.currentTarget;
var index = this.$data.names.indexOf(elm.textContent);
var audioElms = document.getElementsByTagName('audio'),
audioE = audioElms[index];
if (!hasSource) {
musicPlayer.createSource(audioE);
hasSource = true;
}
if (!isPlay) {
musicPlayer.play(audioE);
isPlay = true;
return;
}
musicPlayer.stop(audioE);
isPlay = false;
}
}
});
}, false);
})(this.self, void 0);
| /*global MusicPlayer, Vue */
(function (global, undefined) {
'use strict';
document.addEventListener('DOMContentLoaded', function () {
var musicPlayer = new MusicPlayer();
var hasSource = false;
var isPlay = false;
new Vue({
el: '#app',
data: {
names: [],
sources: []
},
methods: {
loadMusic: function (event) {
var that = this;
var files = event.target.files;
[].forEach.call(files, function (file) {
musicPlayer.loadMusic(file, function (src) {
return that.$data.sources.push(src);
});
if (!musicPlayer.isMusicFile) {
return;
}
that.$data.names.push(file.name);
});
},
toggle: function (event) {
var elm = event.currentTarget;
var index = this.$data.names.indexOf(elm.textContent);
var audioElms = document.getElementsByTagName('audio'),
audioE = audioElms[index];
if (!hasSource) {
musicPlayer.createSource(audioE);
hasSource = true;
}
if (!isPlay) {
musicPlayer.play(audioE);
isPlay = true;
return;
}
musicPlayer.pause(audioE);
isPlay = false;
}
}
});
}, false);
})(this.self, void 0);
| Rename method name (stop -> pause) | Rename method name (stop -> pause)
| JavaScript | mit | kubosho/simple-music-player | ---
+++
@@ -46,7 +46,7 @@
return;
}
- musicPlayer.stop(audioE);
+ musicPlayer.pause(audioE);
isPlay = false;
}
} |
5a75c19eb69bb3d00ec892e6334fb7e6202c8eb8 | config/build.js | config/build.js | module.exports = {
scripts: {
loader: 'browserify',
files: [
'public/scripts/main.js'
]
},
styles: {
directory: 'public/styles'
},
server: {
files: [
'views/**/*.ejs',
'routes/**/*.js',
'models/**/*.js',
'lib/**/*.js',
'config/**/*.js',
'errors/**/*.js',
'app.js'
]
},
watching: {
poll: false,
interval: 100
}
};
| module.exports = {
scripts: {
loader: 'browserify',
files: [
'public/scripts/main.js'
]
},
styles: {
directory: 'public/styles'
},
server: {
files: [
'views/**/*.html',
'routes/**/*.js',
'models/**/*.js',
'lib/**/*.js',
'config/**/*.js',
'errors/**/*.js',
'app.js'
]
},
watching: {
poll: false,
interval: 100
}
};
| Watch for html instead of ejs files | Watch for html instead of ejs files
| JavaScript | mit | hammour/perk,hammour/perk,alarner/perk,alarner/perk | ---
+++
@@ -10,7 +10,7 @@
},
server: {
files: [
- 'views/**/*.ejs',
+ 'views/**/*.html',
'routes/**/*.js',
'models/**/*.js',
'lib/**/*.js', |
53d364b5d98c7e2d83b7d8c3d5bde46c37615d64 | src/js/containers/main-content/header-filter.js | src/js/containers/main-content/header-filter.js | 'use strict'
import React from 'react'
import FormSelect from '../../components/form-select'
import FormSearch from './form-search'
const filterFields = [{
icon: { id: 'date', label: 'Data' },
label: 'Escolha um mês',
options: [
{ text: 'Escolha um mês', value: '' },
{ text: 'Janeiro', value: 'Janeiro' },
{ text: 'Fevereiro', value: 'Fevereiro' },
{ text: 'Março', value: 'Março' }
]
}, {
icon: { id: 'location', label: 'Local' },
label: 'Escolha um estado',
options: [
{ text: 'Escolha um estado', value: '' },
{ text: 'São Paulo', value: 'São Paulo' },
{ text: 'Acre', value: 'Acre' },
{ text: 'Paraná', value: 'Paraná' }
]
}]
const HeaderFilter = () => (
<nav className='filter'>
{filterFields.map((props, index) => (
<FormSelect key={index} {...props} />
))}
<FormSearch />
</nav>
)
export default HeaderFilter
| 'use strict'
import React, { PropTypes } from 'react'
import FormSelect from '../../components/form-select'
import FormSearch from './form-search'
const HeaderFilter = ({ monthFilter, stateFilter, searchField }) => (
<nav className='filter'>
<FormSelect key='months' {...monthFilter} />
<FormSelect key='states' {...stateFilter} />
<FormSearch />
</nav>
)
HeaderFilter.propTypes = {
monthFilter: PropTypes.object.isRequired,
stateFilter: PropTypes.object.isRequired,
searchField: PropTypes.string.isRequired
}
export default HeaderFilter
| Update header filter, passing props down | Update header filter, passing props down
| JavaScript | mit | campinas-front-end/institucional,campinas-front-end-meetup/institucional,campinas-front-end-meetup/institucional,campinas-front-end/institucional,frontendbr/eventos | ---
+++
@@ -1,37 +1,22 @@
'use strict'
-import React from 'react'
+import React, { PropTypes } from 'react'
import FormSelect from '../../components/form-select'
import FormSearch from './form-search'
-const filterFields = [{
- icon: { id: 'date', label: 'Data' },
- label: 'Escolha um mês',
- options: [
- { text: 'Escolha um mês', value: '' },
- { text: 'Janeiro', value: 'Janeiro' },
- { text: 'Fevereiro', value: 'Fevereiro' },
- { text: 'Março', value: 'Março' }
- ]
-}, {
- icon: { id: 'location', label: 'Local' },
- label: 'Escolha um estado',
- options: [
- { text: 'Escolha um estado', value: '' },
- { text: 'São Paulo', value: 'São Paulo' },
- { text: 'Acre', value: 'Acre' },
- { text: 'Paraná', value: 'Paraná' }
- ]
-}]
-
-const HeaderFilter = () => (
+const HeaderFilter = ({ monthFilter, stateFilter, searchField }) => (
<nav className='filter'>
- {filterFields.map((props, index) => (
- <FormSelect key={index} {...props} />
- ))}
+ <FormSelect key='months' {...monthFilter} />
+ <FormSelect key='states' {...stateFilter} />
<FormSearch />
</nav>
)
+HeaderFilter.propTypes = {
+ monthFilter: PropTypes.object.isRequired,
+ stateFilter: PropTypes.object.isRequired,
+ searchField: PropTypes.string.isRequired
+}
+
export default HeaderFilter |
e4694ee5e0491344ed04336e2eaabf3838c7f037 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require ckeditor-jquery
//= require_tree .
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require_tree .
| Remove CKEditor-jquery JS from default app JS | Remove CKEditor-jquery JS from default app JS
| JavaScript | agpl-3.0 | AsunaYuukio/quienmanda.es,civio/quienmanda.es,civio/quienmanda.es,AsunaYuukio/quienmanda.es,AsunaYuukio/quienmanda.es,civio/quienmanda.es,AsunaYuukio/quienmanda.es,civio/quienmanda.es | ---
+++
@@ -12,5 +12,4 @@
//
//= require jquery
//= require jquery_ujs
-//= require ckeditor-jquery
//= require_tree . |
033ee79b6e2fd0ff747efab5b42e8a03ff65d92d | lib/assets/javascript.js | lib/assets/javascript.js | "use strict";
var util = require('util'),
path = require('path'),
jsParser = require('uglify-js').parser,
compressor = require('uglify-js').uglify,
Asset = require('../Asset'),
JSAsset = function(settings) {
settings.compressor = settings.compressor || 'uglify';
this.init(settings);
var self = this;
this.on('variantPostRenderFile', function(variant, file, cb) {
if (!Asset.COMPRESS) return cb();
var basename = path.basename(file);
self.compress(file, variant.getRenderCache(file), function(err, data) {
// errors are already signaled by the compressor
variant.setRenderCache(file, "/* " + basename + " */\n" + data + "\n\n");
cb();
});
});
};
util.inherits(JSAsset, Asset);
Asset.registerCompressor('uglify', function(filepath, data, cb) {
try {
var ast = compressor.ast_squeeze(compressor.ast_mangle(jsParser.parse(data)));
cb(null, ';' + compressor.gen_code(ast));
} catch (ex) {
console.error('ERROR: Uglify compressor error in ' + filepath);
console.error(ex);
// only show the error in the logs...don't stop serving because of this
cb(null, data);
}
});
JSAsset.configure = function(opts) {
Asset.configure(opts);
};
module.exports = JSAsset;
| "use strict";
var util = require('util'),
path = require('path'),
jsParser = require('uglify-js').parser,
compressor = require('uglify-js').uglify,
Asset = require('../Asset'),
JSAsset = function(settings) {
settings.compressor = settings.compressor || 'uglify';
this.init(settings);
var self = this;
this.on('variantPostRenderFile', function(variant, file, cb) {
var basename = path.basename(file),
contents = variant.getRenderCache(file);
if (!Asset.COMPRESS) {
variant.setRenderCache(file, contents + "\n\n");
return cb();
}
self.compress(file, contents, function(err, data) {
// errors are already signaled by the compressor
variant.setRenderCache(file, "/* " + basename + " */\n" + data + "\n\n");
cb();
});
});
};
util.inherits(JSAsset, Asset);
Asset.registerCompressor('uglify', function(filepath, data, cb) {
try {
var ast = compressor.ast_squeeze(compressor.ast_mangle(jsParser.parse(data)));
cb(null, ';' + compressor.gen_code(ast));
} catch (ex) {
console.error('ERROR: Uglify compressor error in ' + filepath);
console.error(ex);
// only show the error in the logs...don't stop serving because of this
cb(null, data);
}
});
JSAsset.configure = function(opts) {
Asset.configure(opts);
};
module.exports = JSAsset;
| Add \n\n even when only concat'ing and not compressing JS assets | Add \n\n even when only concat'ing and not compressing JS assets
| JavaScript | mit | 2sidedfigure/exstatic | ---
+++
@@ -14,11 +14,15 @@
var self = this;
this.on('variantPostRenderFile', function(variant, file, cb) {
- if (!Asset.COMPRESS) return cb();
+ var basename = path.basename(file),
+ contents = variant.getRenderCache(file);
- var basename = path.basename(file);
+ if (!Asset.COMPRESS) {
+ variant.setRenderCache(file, contents + "\n\n");
+ return cb();
+ }
- self.compress(file, variant.getRenderCache(file), function(err, data) {
+ self.compress(file, contents, function(err, data) {
// errors are already signaled by the compressor
variant.setRenderCache(file, "/* " + basename + " */\n" + data + "\n\n");
cb(); |
3fb764521d2f503bf33e667c2ea1b7a524526359 | app/assets/javascripts/application.js | app/assets/javascripts/application.js | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require foundation
//= require turbolinks
//= require_tree .
| // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
$(function(){ $(document).foundation(); });
| Add scripting for Foundation to fix issue with carousel | Add scripting for Foundation to fix issue with carousel
| JavaScript | mit | TerrenceLJones/not-bored-tonight,TerrenceLJones/not-bored-tonight | ---
+++
@@ -11,6 +11,8 @@
// about supported directives.
//
//= require jquery
+//= require jquery_ujs
//= require foundation
//= require turbolinks
//= require_tree .
+$(function(){ $(document).foundation(); }); |
542491ba818da8768340464323e9fa38fff268cf | app/initializers/extend-ember-link.js | app/initializers/extend-ember-link.js | import Ember from 'ember';
export function initialize(/*application */) {
Ember.LinkComponent.reopen({
attributeBindings: ['tooltip', 'data-placement'],
// Set activeParent=true on a {{link-to}} to automatically propagate the active
// class to the parent element (like <li>{{link-to}}</li>)
activeParent: false,
addActiveObserver: function() {
if ( this.get('activeParent') ) {
this.addObserver('active', this, 'activeChanged');
this.activeChanged();
}
}.on('didInsertElement'),
activeChanged() {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
// need to mark the parent drop down as active as well
if (this.get('submenuItem')) {
if (!!this.get('active')) {
if (!this.$().closest('li.dropdown.active').length) {
var $dropdown = this.$().closest('li.dropdown');
$dropdown.addClass('active');
$dropdown.siblings('li.active').removeClass('active');
}
}
}
this.$().parent().toggleClass('active', !!this.get('active'));
}
});
}
export default {
name: 'extend-ember-link',
initialize: initialize
};
| import Ember from 'ember';
export function initialize(/*application */) {
Ember.LinkComponent.reopen({
attributeBindings: ['tooltip', 'data-placement'],
// Set activeParent=true on a {{link-to}} to automatically propagate the active
// class to the parent element (like <li>{{link-to}}</li>)
activeParent: false,
addActiveObserver: function() {
if ( this.get('activeParent') ) {
this.addObserver('active', this, 'activeChanged');
this.activeChanged();
}
}.on('didInsertElement'),
activeChanged() {
if ( this.isDestroyed || this.isDestroying ) {
return;
}
// need to mark the parent drop down as active as well
if (!!this.get('active')) {
if (this.get('submenuItem')) {
if (!this.$().closest('li.dropdown.active').length) {
var $dropdown = this.$().closest('li.dropdown');
$dropdown.addClass('active');
$dropdown.siblings('li.active').removeClass('active');
}
} else {
if (this.$().parent().siblings('li.dropdown.active').length) {
this.$().parent().siblings('li.dropdown.active').removeClass('active');
}
}
}
this.$().parent().toggleClass('active', !!this.get('active'));
}
});
}
export default {
name: 'extend-ember-link',
initialize: initialize
};
| Update to nav-header dropdown active highlighting | Update to nav-header dropdown active highlighting
| JavaScript | apache-2.0 | rancher/ui,rancherio/ui,rancherio/ui,vincent99/ui,westlywright/ui,lvuch/ui,rancher/ui,westlywright/ui,lvuch/ui,rancherio/ui,rancher/ui,vincent99/ui,pengjiang80/ui,pengjiang80/ui,lvuch/ui,vincent99/ui,pengjiang80/ui,westlywright/ui | ---
+++
@@ -21,12 +21,16 @@
}
// need to mark the parent drop down as active as well
- if (this.get('submenuItem')) {
- if (!!this.get('active')) {
+ if (!!this.get('active')) {
+ if (this.get('submenuItem')) {
if (!this.$().closest('li.dropdown.active').length) {
var $dropdown = this.$().closest('li.dropdown');
$dropdown.addClass('active');
$dropdown.siblings('li.active').removeClass('active');
+ }
+ } else {
+ if (this.$().parent().siblings('li.dropdown.active').length) {
+ this.$().parent().siblings('li.dropdown.active').removeClass('active');
}
}
} |
7c5db77f4b63c60f06cd2f872d09bf83acaf5c7b | app/initializers/route-spy.js | app/initializers/route-spy.js | import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on('didTransition'),
willTranstionNotify: function(transition) {
const router = window.ls('router');
window.top.postMessage({
action: 'before-navigation',
target: transition.targetName,
url: router.urlFor(transition.targetName)
})
}.on('willTransition')
});
// Add listener for post messages to change the route in the application
window.addEventListener('message', (event) => {
const msg = event.data || {};
// Navigate when asked to
if (msg.action === 'navigate') {
const router = window.ls('router');
// If the route being asked for is already loaded, then
if (router.currentRouteName === msg.name) {
window.top.postMessage({
action: 'did-transition',
url: router.urlFor(msg.name)
})
}
router.transitionTo(msg.name);
}
});
}
}
export default {
name: 'route-spy',
initialize,
};
| import Router from '@ember/routing/router';
export function initialize() {
const isEmbedded = window !== window.top;
if (isEmbedded) {
Router.reopen({
notifyTopFrame: function() {
window.top.postMessage({
action: 'did-transition',
url: this.currentURL
})
}.on('didTransition'),
willTranstionNotify: function(transition) {
const router = window.ls('router');
window.top.postMessage({
action: 'before-navigation',
target: transition.targetName,
url: router.urlFor(transition.targetName)
})
}.on('willTransition')
});
// Add listener for post messages to change the route in the application
window.addEventListener('message', (event) => {
const msg = event.data || {};
// Navigate when asked to
if (msg.action === 'navigate') {
const router = window.ls('router');
// If the route being asked for is already loaded, then
if (router.currentRouteName === msg.name) {
window.top.postMessage({
action: 'did-transition',
url: router.urlFor(msg.name)
})
}
router.transitionTo(msg.name);
} else if (msg.action == 'set-theme') {
const userTheme = window.ls('userTheme');
if (userTheme) {
userTheme.setTheme( msg.name, false);
}
}
});
}
}
export default {
name: 'route-spy',
initialize,
};
| Allow theme to be changed | Allow theme to be changed
| JavaScript | apache-2.0 | westlywright/ui,vincent99/ui,westlywright/ui,rancherio/ui,rancherio/ui,vincent99/ui,rancher/ui,rancher/ui,vincent99/ui,rancherio/ui,westlywright/ui,rancher/ui | ---
+++
@@ -40,6 +40,12 @@
}
router.transitionTo(msg.name);
+ } else if (msg.action == 'set-theme') {
+ const userTheme = window.ls('userTheme');
+
+ if (userTheme) {
+ userTheme.setTheme( msg.name, false);
+ }
}
});
} |
85c90d0443f280fe722619a735a9866239e94322 | spec/javascripts/bootstrap_toggle_spec.js | spec/javascripts/bootstrap_toggle_spec.js | describe('bootstrap toggle', function() {
var header;
beforeEach(function() {
setFixtures('<li class="dropdown" id="menuOrgs">'+
'<a class="dropdown-toggle" href="#" data-toggle ="dropdown">Organisations</a>' +
'<ul class="dropdown-menu">' +
' <li><a href="/organization_reports/without_users">Without Users</a></li>' +
'</ul>' +
'</li>');
link = $('a')[0];
});
describe('when clicking on the parent', function() {
it('pops up a list', function() {
link.click();
expect($('li#menuOrgs')).toHaveClass('open');
link.click();
expect($('li#menuOrgs')).not.toHaveClass('open');
});
});
});
| describe('bootstrap toggle', function() {
var link;
beforeEach(function() {
setFixtures('<li class="dropdown" id="menuOrgs">'+
'<a class="dropdown-toggle" href="#" data-toggle ="dropdown">Organisations</a>' +
'<ul class="dropdown-menu">' +
' <li><a href="/organization_reports/without_users">Without Users</a></li>' +
'</ul>' +
'</li>');
link = $('a').first();
});
describe('when clicking on the parent', function() {
it('pops up a list', function() {
link.click();
expect($('li#menuOrgs')).toHaveClass('open');
link.click();
expect($('li#menuOrgs')).not.toHaveClass('open');
});
});
});
| Use first method instead of zero indexing into an array to fix jasmine spec | Use first method instead of zero indexing into an array to fix jasmine spec
| JavaScript | mit | Aleks4ndr/LocalSupport,SergiosLen/LocalSupport,dsbabbar/LocalSupport,Aleks4ndr/LocalSupport,marianmosley/LocalSupport,Aleks4ndr/LocalSupport,Aleks4ndr/LocalSupport,tansaku/LocalSupport,curlygirly/LocalSupport,intfrr/LocalSupport,tansaku/LocalSupport,tansaku/LocalSupport,SergiosLen/LocalSupport,dsbabbar/LocalSupport,davidbebb/local_support,ZmagoD/LocalSupport,decareano/LocalSupport,curlygirly/LocalSupport,dsbabbar/LocalSupport,decareano/LocalSupport,johnnymo87/LocalSupport,johnnymo87/LocalSupport,tansaku/LocalSupport,ZmagoD/LocalSupport,SergiosLen/LocalSupport,SergiosLen/LocalSupport,davidbebb/local_support,curlygirly/LocalSupport,decareano/LocalSupport,dsbabbar/LocalSupport,ZmagoD/LocalSupport,johnnymo87/LocalSupport,intfrr/LocalSupport,intfrr/LocalSupport,marianmosley/LocalSupport,intfrr/LocalSupport,davidbebb/local_support,marianmosley/LocalSupport,davidbebb/local_support,ZmagoD/LocalSupport,curlygirly/LocalSupport | ---
+++
@@ -1,5 +1,5 @@
describe('bootstrap toggle', function() {
- var header;
+ var link;
beforeEach(function() {
setFixtures('<li class="dropdown" id="menuOrgs">'+
'<a class="dropdown-toggle" href="#" data-toggle ="dropdown">Organisations</a>' +
@@ -7,7 +7,7 @@
' <li><a href="/organization_reports/without_users">Without Users</a></li>' +
'</ul>' +
'</li>');
- link = $('a')[0];
+ link = $('a').first();
});
describe('when clicking on the parent', function() {
it('pops up a list', function() { |
630e1aefd56854b312b16c2ccd1fcde677a3da00 | activities/measuring-resistance/javascript/activity-dom-helper.js | activities/measuring-resistance/javascript/activity-dom-helper.js | (function () {
var mr = sparks.activities.mr;
var str = sparks.string;
mr.ActivityDomHelper = {
ratedResistanceFormId: '#rated_resistance',
ratedResistanceValueId: '#rated_resistance_value_input',
ratedResistanceUnitId: '#rated_resitance_unit_select',
getAnswer: function (questionNum) {
var value, unit;
switch (questionNum) {
case 1:
value = $(this.ratedResistanceValueId).val();
unit = $(this.ratedResistanceUnitId).val();
return [value, unit];
case 2:
case 3:
case 4:
default:
alert('ERROR: ActivityDomHelper.getAnswer: invalid question number ' + questionNum);
return null;
}
},
validateNumberString: function (s) {
var s2 = str.strip(s);
return s2 !== '' && Number(s2) !== NaN;
},
validateResistanceUnitString: function (s) {
}
};
})();
| (function () {
var mr = sparks.activities.mr;
var str = sparks.string;
mr.ActivityDomHelper = {
ratedResistanceFormId: '#rated_resistance',
ratedResistanceValueId: '#rated_resistance_value_input',
ratedResistanceUnitId: '#rated_resitance_unit_select',
getAnswer: function (questionNum) {
var value, unit;
switch (questionNum) {
case 1:
value = $(this.ratedResistanceValueId).val();
unit = $(this.ratedResistanceUnitId).val();
return [value, unit];
case 2:
case 3:
case 4:
default:
alert('ERROR: ActivityDomHelper.getAnswer: invalid question number ' + questionNum);
return null;
}
},
validateNumberString: function (s) {
var s2 = str.strip(s);
return s2 !== '' && !isNaN(Number(s2));
},
selected: function(selectElem) {
return selectElem.children('option:selected').val();
}
};
})();
| Use isNaN() to check for NaN. Comparison op '!===' doesn't work. | Use isNaN() to check for NaN. Comparison op '!==='
doesn't work.
Also add a method 'selected' to factor out
retrieval of selected value
| JavaScript | apache-2.0 | concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks,concord-consortium/sparks | ---
+++
@@ -27,11 +27,11 @@
validateNumberString: function (s) {
var s2 = str.strip(s);
- return s2 !== '' && Number(s2) !== NaN;
+ return s2 !== '' && !isNaN(Number(s2));
},
- validateResistanceUnitString: function (s) {
-
+ selected: function(selectElem) {
+ return selectElem.children('option:selected').val();
}
};
|
296408107789c142f65f4b6434d85a78a31a51bc | setups/plugin/lib/socketRoutes.js | setups/plugin/lib/socketRoutes.js | "use strict";
var settings = require("./settings");
/*
* This file defines socket routes for data-transmission to the client-side.
*/
//function initUserSockets(Socket) {
// Socket[settings.iD] = function (socket, data, cb) {
// cb(null, {dev: settings.dev, version: settings.pkg.version, settings: settings.get()});
// };
//}
function initAdminSockets(Socket) {
// Needed by default settings template for requesting a sync of the settings (when the user requests a save or reset)
Socket.settings["sync" + settings.Id] = function (socket, data, cb) {
settings.sync(function (settings) { cb(null, settings); });
};
// Needed by default settings template for fetching the default settings (when the user requests a reset)
Socket.settings["get" + settings.Id + "Defaults"] = function (socket, data, cb) {
cb(null, settings.createDefaultWrapper());
};
}
module.exports.init = function () {
//initUserSockets(require.main.require("./src/socket.io/modules"));
initAdminSockets(require.main.require("./src/socket.io/admin"));
};
| "use strict";
var settings = require("./settings");
/*
* This file defines socket routes for data-transmission to the client-side.
*/
//function initUserSockets(Socket) {
// Socket[settings.iD] = function (socket, data, cb) {
// cb(null, {dev: settings.dev, version: settings.pkg.version, settings: settings.get()});
// };
//}
function initAdminSockets(Socket) {
// Needed by default settings template for requesting a sync of the settings (when the user requests a save or reset)
Socket.settings["sync" + settings.Id] = function (socket, data, cb) {
settings.sync(function (settings) { cb(null, settings); });
};
// Needed by default settings template for fetching the default settings (when the user requests a reset)
Socket.settings["get" + settings.Id + "Defaults"] = function (socket, data, cb) {
cb(null, settings.createDefaultWrapper());
};
}
module.exports.init = function () {
//initUserSockets(require.main.require("./src/socket.io/plugins"));
initAdminSockets(require.main.require("./src/socket.io/admin"));
};
| Update comments to apply better to core | Update comments to apply better to core
| JavaScript | mit | NodeBB-Community/nodebb-grunt,NodeBB-Community/nodebb-grunt | ---
+++
@@ -24,6 +24,6 @@
}
module.exports.init = function () {
- //initUserSockets(require.main.require("./src/socket.io/modules"));
+ //initUserSockets(require.main.require("./src/socket.io/plugins"));
initAdminSockets(require.main.require("./src/socket.io/admin"));
}; |
5f57ba41403a960278da9e08f71a53fabfb86726 | obfuscate-email.js | obfuscate-email.js | (function(){
function random(a,b) {
return Math.floor(Math.random() * b) + a;
};
function obfuscateEmail(email) {
if (!email) return email;
var re = /^(.*)(@)(.*?)(\.)(.*)$/;
return email.replace(re, function(m,username,at,hostname,dot,tld) {
function obs(s) {
var a = [];
var n = s.length;
while (n--) {
if (random(0,3) !== 0) {
a.push('*');
} else {
a.push(s[s.length-1-n]);
}
}
return a.join('');
}
return obs(username) + at + obs(hostname) + dot + obs(tld);
});
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = obfuscateEmail;
} else if (typeof exports !== 'undefined') {
exports.obfuscateEmail = obfuscateEmail;
} else {
window.hasprop = obfuscateEmail;
}
})();
| (function(){
function random(a,b) {
return Math.floor(Math.random() * b) + a;
};
function obfuscateEmail(email) {
if (!email) return email;
var re = /^(.*)(@)(.*?)(\.)(.*)$/;
return email.replace(re, function(m,username,at,hostname,dot,tld) {
function obs(s) {
var a = [];
var n = s.length;
while (n--) {
if (random(0,3) !== 0) {
a.push('*');
} else {
a.push(s[s.length-1-n]);
}
}
return a.join('');
}
return obs(username) + at + obs(hostname) + dot + obs(tld);
});
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = obfuscateEmail;
} else if (typeof exports !== 'undefined') {
exports.obfuscateEmail = obfuscateEmail;
} else {
window.obfuscateEmail = obfuscateEmail;
}
})();
| Fix global variable name for browser usage | Fix global variable name for browser usage | JavaScript | mit | miguelmota/obfuscate-email | ---
+++
@@ -30,7 +30,7 @@
} else if (typeof exports !== 'undefined') {
exports.obfuscateEmail = obfuscateEmail;
} else {
- window.hasprop = obfuscateEmail;
+ window.obfuscateEmail = obfuscateEmail;
}
})(); |
2e28dec3d91379b4bc7ed93d854fe5d1e080495e | test/unit/controllers/statusControllerSpec.js | test/unit/controllers/statusControllerSpec.js | 'use strict';
var expect = chai.expect;
describe('StatusCtrl', function(){
});
| 'use strict';
var expect = chai.expect;
function run(scope,done) {
done();
}
describe('StatusCtrl', function(){
var rootScope, scope, controller_injector, dependencies, ctrl;
beforeEach(module("rp"));
beforeEach(inject(function($rootScope, $controller, $q) {
rootScope = rootScope;
scope = $rootScope.$new();
controller_injector = $controller;
dependencies = {
$scope: scope,
$element: null
}
ctrl = controller_injector("StatusCtrl", dependencies);
}));
it('should initialize properly', function (done) {
assert.isNotNull(ctrl);
run(scope,done);
});
describe('public functions on $scope', function () {
it('should toggle the secondary', function (done) {
assert.isFunction(scope.toggle_secondary);
run(scope,done);
});
it('should logout', function (done) {
assert.isFunction(scope.logout);
run(scope,done);
});
});
describe('private functions', function() {
it('should set the connection status', function (done) {
assert.isFunction(ctrl.setConnectionStatus);
run(scope,done);
});
it('should enqueue', function (done) {
assert.isFunction(ctrl.enqueue);
run(scope,done);
});
it('should tick', function (done) {
assert.isFunction(ctrl.tick);
run(scope,done);
});
});
});
| Initialize StatusCtrl and add basic tests | [CHORE] Initialize StatusCtrl and add basic tests
Test that private functions and functions on $scope are present
| JavaScript | isc | bankonme/ripple-client-desktop,dncohen/ripple-client-desktop,MatthewPhinney/ripple-client,ripple/ripple-client,xdv/ripple-client-desktop,h0vhannes/ripple-client,ripple/ripple-client,wangbibo/ripple-client,MatthewPhinney/ripple-client,thics/ripple-client-desktop,resilience-me/DEPRICATED_ripple-client,xdv/ripple-client,ripple/ripple-client-desktop,yongsoo/ripple-client,xdv/ripple-client-desktop,yongsoo/ripple-client,MatthewPhinney/ripple-client-desktop,dncohen/ripple-client-desktop,bsteinlo/ripple-client,wangbibo/ripple-client,mrajvanshy/ripple-client-desktop,darkdarkdragon/ripple-client,h0vhannes/ripple-client,h0vhannes/ripple-client,yongsoo/ripple-client-desktop,yxxyun/ripple-client,arturomc/ripple-client,mrajvanshy/ripple-client,Madsn/ripple-client,vhpoet/ripple-client-desktop,darkdarkdragon/ripple-client-desktop,vhpoet/ripple-client-desktop,arturomc/ripple-client,ripple/ripple-client,darkdarkdragon/ripple-client,MatthewPhinney/ripple-client,xdv/ripple-client,xdv/ripple-client-desktop,yxxyun/ripple-client,darkdarkdragon/ripple-client-desktop,arturomc/ripple-client,mrajvanshy/ripple-client,yxxyun/ripple-client,h0vhannes/ripple-client,arturomc/ripple-client,ripple/ripple-client,wangbibo/ripple-client,MatthewPhinney/ripple-client-desktop,xdv/ripple-client,Madsn/ripple-client,yxxyun/ripple-client-desktop,Madsn/ripple-client,yongsoo/ripple-client,vhpoet/ripple-client,yxxyun/ripple-client-desktop,xdv/ripple-client,bankonme/ripple-client-desktop,vhpoet/ripple-client,Madsn/ripple-client,yxxyun/ripple-client,vhpoet/ripple-client,mrajvanshy/ripple-client,yongsoo/ripple-client-desktop,thics/ripple-client-desktop,darkdarkdragon/ripple-client,MatthewPhinney/ripple-client,ripple/ripple-client-desktop,vhpoet/ripple-client,mrajvanshy/ripple-client-desktop,yongsoo/ripple-client,mrajvanshy/ripple-client,resilience-me/DEPRICATED_ripple-client,wangbibo/ripple-client,darkdarkdragon/ripple-client,bsteinlo/ripple-client | ---
+++
@@ -1,6 +1,61 @@
'use strict';
var expect = chai.expect;
+function run(scope,done) {
+ done();
+}
+
describe('StatusCtrl', function(){
-
+ var rootScope, scope, controller_injector, dependencies, ctrl;
+
+ beforeEach(module("rp"));
+ beforeEach(inject(function($rootScope, $controller, $q) {
+ rootScope = rootScope;
+ scope = $rootScope.$new();
+ controller_injector = $controller;
+
+ dependencies = {
+ $scope: scope,
+ $element: null
+ }
+
+ ctrl = controller_injector("StatusCtrl", dependencies);
+ }));
+
+ it('should initialize properly', function (done) {
+ assert.isNotNull(ctrl);
+ run(scope,done);
+ });
+
+ describe('public functions on $scope', function () {
+
+ it('should toggle the secondary', function (done) {
+ assert.isFunction(scope.toggle_secondary);
+ run(scope,done);
+ });
+
+ it('should logout', function (done) {
+ assert.isFunction(scope.logout);
+ run(scope,done);
+ });
+ });
+
+ describe('private functions', function() {
+
+ it('should set the connection status', function (done) {
+ assert.isFunction(ctrl.setConnectionStatus);
+ run(scope,done);
+ });
+
+ it('should enqueue', function (done) {
+ assert.isFunction(ctrl.enqueue);
+ run(scope,done);
+ });
+
+ it('should tick', function (done) {
+ assert.isFunction(ctrl.tick);
+ run(scope,done);
+ });
+
+ });
}); |
39a23c72bc6c082a69c8aa61abfc6b83cb267c28 | chai-adapter.js | chai-adapter.js | (function(window, karma) {
window.should = window.chai.should();
window.expect = window.chai.expect;
window.assert = window.chai.assert;
var chaiConfig = karma.config.chai;
if (chaiConfig) {
for (var key in chaiConfig) {
if (chaiConfig.hasOwnProperty(key)) {
window.chai.config[key] = chaiConfig[key];
}
}
}
karma.loaded = function() {
karma.start();
};
})(window, window.__karma__);
| (function(window, karma) {
window.should = null;
window.should = window.chai.should();
window.expect = window.chai.expect;
window.assert = window.chai.assert;
var chaiConfig = karma.config.chai;
if (chaiConfig) {
for (var key in chaiConfig) {
if (chaiConfig.hasOwnProperty(key)) {
window.chai.config[key] = chaiConfig[key];
}
}
}
karma.loaded = function() {
karma.start();
};
})(window, window.__karma__);
| Fix 'Maximum call stack size exceeded' in PhantomJS... again | Fix 'Maximum call stack size exceeded' in PhantomJS... again
| JavaScript | mit | kmees/karma-sinon-chai | ---
+++
@@ -1,4 +1,5 @@
(function(window, karma) {
+ window.should = null;
window.should = window.chai.should();
window.expect = window.chai.expect;
window.assert = window.chai.assert; |
61edab4f12e26652f6d53f3456b0b1c75de8faa4 | app/routes/quotes/components/QuoteList.js | app/routes/quotes/components/QuoteList.js | // @flow
import React, { Component } from 'react';
import Quote from './Quote';
type Props = {
quotes: Array<Object>,
approve: number => Promise<*>,
deleteQuote: number => Promise<*>,
unapprove: number => Promise<*>,
actionGrant: Array<string>,
currentUser: any,
loggedIn: boolean,
comments: Object
};
type State = {
displayAdminId: number
};
export default class QuoteList extends Component<Props, State> {
state = {
displayAdminId: -1
};
componentWillReceiveProps(newProps: Object) {
this.setState({ displayAdminId: -1 });
}
setDisplayAdmin = (id: number) => {
this.setState(state => ({
displayAdminId: state.displayAdminId === id ? -1 : id
}));
};
render() {
const {
quotes,
actionGrant,
approve,
unapprove,
deleteQuote,
currentUser,
loggedIn,
comments
} = this.props;
return (
<ul>
{quotes.map(quote => (
<Quote
actionGrant={actionGrant}
approve={approve}
unapprove={unapprove}
deleteQuote={deleteQuote}
quote={quote}
key={quote.id}
setDisplayAdmin={this.setDisplayAdmin}
displayAdmin={quote.id === this.state.displayAdminId}
currentUser={currentUser}
loggedIn={loggedIn}
comments={comments}
/>
))}
</ul>
);
}
}
| // @flow
import React, { Component } from 'react';
import Quote from './Quote';
type Props = {
quotes: Array<Object>,
approve: number => Promise<*>,
deleteQuote: number => Promise<*>,
unapprove: number => Promise<*>,
actionGrant: Array<string>,
currentUser: any,
loggedIn: boolean,
comments: Object
};
type State = {
displayAdminId: number
};
export default class QuoteList extends Component<Props, State> {
state = {
displayAdminId: -1
};
componentWillReceiveProps(newProps: Object) {
this.setState({ displayAdminId: -1 });
}
setDisplayAdmin = (id: number) => {
this.setState(state => ({
displayAdminId: state.displayAdminId === id ? -1 : id
}));
};
render() {
const {
quotes,
actionGrant,
approve,
unapprove,
deleteQuote,
currentUser,
loggedIn,
comments
} = this.props;
return (
<ul>
{quotes
.filter(Boolean)
.map(quote => (
<Quote
actionGrant={actionGrant}
approve={approve}
unapprove={unapprove}
deleteQuote={deleteQuote}
quote={quote}
key={quote.id}
setDisplayAdmin={this.setDisplayAdmin}
displayAdmin={quote.id === this.state.displayAdminId}
currentUser={currentUser}
loggedIn={loggedIn}
comments={comments}
/>
))}
</ul>
);
}
}
| Fix undefined quotes causing error | Fix undefined quotes causing error
| JavaScript | mit | webkom/lego-webapp,webkom/lego-webapp,webkom/lego-webapp | ---
+++
@@ -47,21 +47,23 @@
return (
<ul>
- {quotes.map(quote => (
- <Quote
- actionGrant={actionGrant}
- approve={approve}
- unapprove={unapprove}
- deleteQuote={deleteQuote}
- quote={quote}
- key={quote.id}
- setDisplayAdmin={this.setDisplayAdmin}
- displayAdmin={quote.id === this.state.displayAdminId}
- currentUser={currentUser}
- loggedIn={loggedIn}
- comments={comments}
- />
- ))}
+ {quotes
+ .filter(Boolean)
+ .map(quote => (
+ <Quote
+ actionGrant={actionGrant}
+ approve={approve}
+ unapprove={unapprove}
+ deleteQuote={deleteQuote}
+ quote={quote}
+ key={quote.id}
+ setDisplayAdmin={this.setDisplayAdmin}
+ displayAdmin={quote.id === this.state.displayAdminId}
+ currentUser={currentUser}
+ loggedIn={loggedIn}
+ comments={comments}
+ />
+ ))}
</ul>
);
} |
6fd9db13f5e52651029d18615fd24359898865d5 | lib/assets/core/javascripts/cartodb3/components/icon/icon-view.js | lib/assets/core/javascripts/cartodb3/components/icon/icon-view.js | var $ = require('jquery');
var CoreView = require('backbone/core-view');
var iconTemplates = {};
var importAllIconTemplates = function () {
var templates = require.context('./templates', false, /\.tpl$/);
templates.keys().forEach(function (template) {
iconTemplates[template] = templates(template);
});
};
importAllIconTemplates();
module.exports = CoreView.extend({
initialize: function (opts) {
if (!opts || !opts.icon) throw new Error('An icon is required to render IconView');
this.icon = opts.icon;
this.iconTemplate = this._getIconTemplate(this.icon);
if (!this.iconTemplate) {
throw new Error('The selected icon does not have any available template');
}
this.placeholder = opts && opts.placeholder;
},
render: function () {
this.$el.html(this.iconTemplate);
if (this.placeholder) {
var placeholder = $(this.placeholder);
this.$el.removeClass().addClass(placeholder.attr('class'));
placeholder.replaceWith(this.$el);
}
return this;
},
_getIconTemplate: function (icon) {
var iconTemplate = './' + this.icon + '.tpl';
return iconTemplates[iconTemplate];
}
});
| var $ = require('jquery');
var CoreView = require('backbone/core-view');
var iconTemplates = {};
var importAllIconTemplates = function () {
var templates = require.context('./templates', false, /\.tpl$/);
templates.keys().forEach(function (template) {
iconTemplates[template] = templates(template);
});
};
importAllIconTemplates();
module.exports = CoreView.extend({
constructor: function (opts) {
this.placeholder = this._preinitializeWithPlaceholder(opts && opts.placeholder);
CoreView.prototype.constructor.call(this, opts);
},
initialize: function (opts) {
if (!opts || !opts.icon) throw new Error('An icon is required to render IconView');
this.icon = opts.icon;
this.iconTemplate = this._getIconTemplate(this.icon);
if (!this.iconTemplate) {
throw new Error('The selected icon does not have any available template');
}
},
render: function () {
this.$el.html(this.iconTemplate);
if (this.placeholder) {
this.placeholder.replaceWith(this.$el);
}
return this;
},
_getIconTemplate: function (icon) {
var iconTemplate = './' + this.icon + '.tpl';
return iconTemplates[iconTemplate];
},
_preinitializeWithPlaceholder: function (placeholderNode) {
if (!placeholderNode) {
return;
}
var placeholder = $(placeholderNode);
this.tagName = placeholder.prop('tagName');
this.className = placeholder.attr('class');
return placeholder;
}
});
| Refactor IconView to simplify placeholder behaviour | Refactor IconView to simplify placeholder behaviour
| JavaScript | bsd-3-clause | CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb,splashblot/dronedb,splashblot/dronedb,splashblot/dronedb,CartoDB/cartodb,CartoDB/cartodb,splashblot/dronedb,CartoDB/cartodb | ---
+++
@@ -13,6 +13,11 @@
importAllIconTemplates();
module.exports = CoreView.extend({
+ constructor: function (opts) {
+ this.placeholder = this._preinitializeWithPlaceholder(opts && opts.placeholder);
+ CoreView.prototype.constructor.call(this, opts);
+ },
+
initialize: function (opts) {
if (!opts || !opts.icon) throw new Error('An icon is required to render IconView');
@@ -22,17 +27,13 @@
if (!this.iconTemplate) {
throw new Error('The selected icon does not have any available template');
}
-
- this.placeholder = opts && opts.placeholder;
},
render: function () {
this.$el.html(this.iconTemplate);
if (this.placeholder) {
- var placeholder = $(this.placeholder);
- this.$el.removeClass().addClass(placeholder.attr('class'));
- placeholder.replaceWith(this.$el);
+ this.placeholder.replaceWith(this.$el);
}
return this;
@@ -41,5 +42,17 @@
_getIconTemplate: function (icon) {
var iconTemplate = './' + this.icon + '.tpl';
return iconTemplates[iconTemplate];
+ },
+
+ _preinitializeWithPlaceholder: function (placeholderNode) {
+ if (!placeholderNode) {
+ return;
+ }
+
+ var placeholder = $(placeholderNode);
+ this.tagName = placeholder.prop('tagName');
+ this.className = placeholder.attr('class');
+
+ return placeholder;
}
}); |
22a7e91036fb1556edeb638610631f49a38efdcb | packages/strapi-plugin-users-permissions/admin/src/components/InputSearchLi/index.js | packages/strapi-plugin-users-permissions/admin/src/components/InputSearchLi/index.js | /**
*
* InputSearchLi
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import styles from './styles.scss';
function InputSearchLi({ onClick, isAdding, item }) {
const icon = isAdding ? 'fa-plus' : 'fa-minus-circle';
const liStyle = isAdding ? { cursor: 'pointer' } : {};
const handleClick = isAdding ? () => onClick(item) : () => {};
const path = `/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
return (
<li className={styles.li} style={liStyle} onClick={handleClick}>
<div>
<div className={styles.container}>
{item.username}
<a href={`${path}`} target="_blank">
<i className="fa fa-external-link" />
</a>
</div>
<div
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onClick(item);
}}
>
<i className={`fa ${icon}`} />
</div>
</div>
</li>
);
}
InputSearchLi.defaultProps = {
item: {
name: '',
},
};
InputSearchLi.propTypes = {
isAdding: PropTypes.bool.isRequired,
item: PropTypes.object,
onClick: PropTypes.func.isRequired,
};
export default InputSearchLi;
| /**
*
* InputSearchLi
*
*/
import React from 'react';
import PropTypes from 'prop-types';
import styles from './styles.scss';
function InputSearchLi({ onClick, isAdding, item }) {
const icon = isAdding ? 'fa-plus' : 'fa-minus-circle';
const liStyle = isAdding ? { cursor: 'pointer' } : {};
const handleClick = isAdding ? () => onClick(item) : () => {};
const path = `/admin/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
return (
<li className={styles.li} style={liStyle} onClick={handleClick}>
<div>
<div className={styles.container}>
{item.username}
<a href={`${path}`} target="_blank">
<i className="fa fa-external-link" />
</a>
</div>
<div
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
onClick(item);
}}
>
<i className={`fa ${icon}`} />
</div>
</div>
</li>
);
}
InputSearchLi.defaultProps = {
item: {
name: '',
},
};
InputSearchLi.propTypes = {
isAdding: PropTypes.bool.isRequired,
item: PropTypes.object,
onClick: PropTypes.func.isRequired,
};
export default InputSearchLi;
| Fix get user info link in search list | Fix get user info link in search list
| JavaScript | mit | wistityhq/strapi,wistityhq/strapi | ---
+++
@@ -12,7 +12,7 @@
const icon = isAdding ? 'fa-plus' : 'fa-minus-circle';
const liStyle = isAdding ? { cursor: 'pointer' } : {};
const handleClick = isAdding ? () => onClick(item) : () => {};
- const path = `/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
+ const path = `/admin/plugins/content-manager/user/${item.id}?redirectUrl=/plugins/content-manager/user/?page=1&limit=20&sort=id&source=users-permissions`;
return (
<li className={styles.li} style={liStyle} onClick={handleClick}> |
5e9bea97acb8948f41b5f3d007ccc250dab13e51 | packages/base/resources/js/main_page.js | packages/base/resources/js/main_page.js | function generate_board_page(that, board_id){
/* Generate the board page */
// Gets the node of board page
var bp_node = that.nodeById('board_page');
// Make a serverCall to gets lists and cards related
// to the board.
var result = genro.serverCall(
'get_lists_cards',
{board_id: board_id}
);
// sets the return result to the board datapath
that.setRelativeData('board', result);
var res_asDict = result.asDict(true);
for (var k in res_asDict){
var list_wrapper = bp_node._('div', {_class:'list-wrapper'});
// name of the list
var list_div = list_wrapper._('div', {_class: 'gen-list'})
list_div._('h3', {innerHTML: '^.' + k + '?list_name'});
// create a ul for the cards
var list_cards = list_div._('div', {_class: 'list-cards'});
var cards = res_asDict[k];
for (var c in cards){
var card =list_cards._('div', {
_class: 'list-card'
});
card._('div', {
innerHTML: '^.' + k + '.' + c + '.name',
_class: 'list-card-label'
});
}
}
// Once done with the rendering change the page
that.setRelativeData('page_selected', 1);
}
| function generate_board_page(that, board_id){
/* Generate the board page */
// Gets the node of board page
var bp_node = that.nodeById('board_page');
// Make a serverCall to gets lists and cards related
// to the board.
var result = genro.serverCall(
'get_lists_cards',
{board_id: board_id}
);
// sets the return result to the board datapath
that.setRelativeData('board', result);
var res_asDict = result.asDict(true);
for (var k in res_asDict){
var list_wrapper = bp_node._('div', {_class:'list-wrapper'});
// name of the list
var list_div = list_wrapper._('div', {_class: 'gen-list'})
list_div._('h3', {innerHTML: '^.' + k + '?list_name'});
// create a ul for the cards
var list_cards = list_div._('div', {
_class: 'list-cards',
dropTarget: true, dropTypes:'*',
});
var cards = res_asDict[k];
for (var c in cards){
var card =list_cards._('div', {
_class: 'list-card', draggable: true,
});
card._('div', {
innerHTML: '^.' + k + '.' + c + '.name',
_class: 'list-card-label'
});
}
}
// Once done with the rendering change the page
that.setRelativeData('page_selected', 1);
}
| Add attributes for drag and drop | Add attributes for drag and drop
| JavaScript | mit | mkshid/genrello,mkshid/genrello,mkshid/genrello | ---
+++
@@ -22,11 +22,14 @@
list_div._('h3', {innerHTML: '^.' + k + '?list_name'});
// create a ul for the cards
- var list_cards = list_div._('div', {_class: 'list-cards'});
+ var list_cards = list_div._('div', {
+ _class: 'list-cards',
+ dropTarget: true, dropTypes:'*',
+ });
var cards = res_asDict[k];
for (var c in cards){
var card =list_cards._('div', {
- _class: 'list-card'
+ _class: 'list-card', draggable: true,
});
card._('div', {
innerHTML: '^.' + k + '.' + c + '.name', |
61a3ac70939314548f8e3d31a2de6124cc72cce1 | plugins/templateLayout/src/templateLayout.wef.js | plugins/templateLayout/src/templateLayout.wef.js | /*!
* TemplateLayout Wef plugin
* Copyright (c) 2011 Pablo Escalada
* MIT Licensed
*/
//requires: cssParser
//exports: templateLayout
(function () {
var templateLayout = {
name:"templateLayout",
version:"0.0.1",
description:"W3C CSS Template Layout Module",
authors:["Pablo Escalada <uo1398@uniovi.es>"],
licenses:["MIT"], //TODO: Licenses
templateLayout:function () {
document.addEventListener('selectorFound', function (e) {
// e.target matches the elem from above
lastEvent = e;
//console.log(lastEvent.selectorText | lastEvent.property);
}, false);
document.addEventListener('propertyFound', function (e) {
// e.target matches the elem from above
lastEvent = e;
//console.log(lastEvent.selectorText | lastEvent.property);
}, false);
return templateLayout;
},
getLastEvent:function () {
return lastEvent;
}
};
var lastEvent = 0;
wef.plugins.register("templateLayout", templateLayout);
})(); | /*!
* TemplateLayout Wef plugin
* Copyright (c) 2011 Pablo Escalada
* MIT Licensed
*/
//requires: cssParser
//exports: templateLayout
(function () {
var templateLayout = {
name:"templateLayout",
version:"0.0.1",
description:"W3C CSS Template Layout Module",
authors:["Pablo Escalada <uo1398@uniovi.es>"],
licenses:["MIT"], //TODO: Licenses
init:function () {
document.addEventListener('propertyFound', function (e) {
// e.target matches the elem from above
lastEvent = e;
//console.log(lastEvent.property);
}, false);
return templateLayout;
},
getLastEvent:function () {
return lastEvent;
}
};
var lastEvent = 0;
wef.plugins.register("templateLayout", templateLayout);
})(); | Remove selectorFound event listener Rename templateLayout() to init() | Remove selectorFound event listener
Rename templateLayout() to init()
| JavaScript | mit | diesire/wef,diesire/wef,diesire/wef | ---
+++
@@ -13,17 +13,12 @@
description:"W3C CSS Template Layout Module",
authors:["Pablo Escalada <uo1398@uniovi.es>"],
licenses:["MIT"], //TODO: Licenses
- templateLayout:function () {
- document.addEventListener('selectorFound', function (e) {
- // e.target matches the elem from above
- lastEvent = e;
- //console.log(lastEvent.selectorText | lastEvent.property);
- }, false);
+ init:function () {
document.addEventListener('propertyFound', function (e) {
// e.target matches the elem from above
lastEvent = e;
- //console.log(lastEvent.selectorText | lastEvent.property);
+ //console.log(lastEvent.property);
}, false);
return templateLayout;
}, |
53c000c7c048f8a8ccbd66415f94f7d079598961 | middleware/cors.js | middleware/cors.js | const leancloudHeaders = require('leancloud-cors-headers');
module.exports = function() {
return function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
if (req.method.toLowerCase() === 'options') {
res.statusCode = 200;
res.setHeader('Access-Control-Max-Age','86400');
res.setHeader('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', leancloudHeaders);
res.setHeader('Content-Length', 0);
res.end();
} else {
next();
}
};
};
| const leancloudHeaders = require('leancloud-cors-headers');
module.exports = function() {
return function(req, res, next) {
res.setHeader('Access-Control-Allow-Origin', req.headers.origin || '*');
if (req.method.toLowerCase() === 'options') {
res.statusCode = 200;
res.setHeader('Access-Control-Max-Age','86400');
res.setHeader('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', leancloudHeaders.join(', '));
res.setHeader('Content-Length', 0);
res.end();
} else {
next();
}
};
};
| Fix Access-Control-Allow-Headers to single line | :rotating_light: Fix Access-Control-Allow-Headers to single line
| JavaScript | mit | leancloud/leanengine-node-sdk,sdjcw/leanengine-node-sdk | ---
+++
@@ -8,7 +8,7 @@
res.statusCode = 200;
res.setHeader('Access-Control-Max-Age','86400');
res.setHeader('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, DELETE, OPTIONS');
- res.setHeader('Access-Control-Allow-Headers', leancloudHeaders);
+ res.setHeader('Access-Control-Allow-Headers', leancloudHeaders.join(', '));
res.setHeader('Content-Length', 0);
res.end();
} else { |
4c44ced323cd3efba9b6590ceaa99e3915cf9f69 | code-generator-utils.js | code-generator-utils.js | define(function (require, exports, module) {
'use strict';
function CodeWriter(indentString) {
this.lines = [];
this.indentString = (indentString ? indentString : ' ');
this.indentations = [];
}
CodeWriter.prototype.indent = function () {
this.indentations.push(this.indentString);
};
CodeWriter.prototype.outdent = function () {
this.indentations.splice(this.indentations.length - 1, 1);
};
CodeWriter.prototype.writeLine = function (line) {
if (line) {
this.lines.push(this.indentations.join('') + line);
} else {
this.lines.push('');
}
};
CodeWriter.prototype.getData = function () {
return this.lines.join('\n');
};
exports.CodeWriter = CodeWriter;
});
| define(function (require, exports, module) {
'use strict';
function CodeWriter(indentString) {
this.lines = [];
this.indentString = (indentString ? indentString : ' ');
this.indentations = [];
}
CodeWriter.prototype.indent = function () {
this.indentations.push(this.indentString);
};
CodeWriter.prototype.outdent = function () {
this.indentations.splice(this.indentations.length - 1, 1);
};
CodeWriter.prototype.writeLine = function (line) {
if (line) {
this.lines.push(this.indentations.join('') + line);
} else {
this.lines.push('');
}
};
CodeWriter.prototype.getData = function () {
return this.lines.join('\n');
};
CodeWriter.prototype.fileName = function (className) {
return className.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
};
exports.CodeWriter = CodeWriter;
});
| Add function to generate general Ruby file name | Add function to generate general Ruby file name
| JavaScript | mit | meisyal/staruml-ruby | ---
+++
@@ -27,5 +27,9 @@
return this.lines.join('\n');
};
+ CodeWriter.prototype.fileName = function (className) {
+ return className.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
+ };
+
exports.CodeWriter = CodeWriter;
}); |
d5f48fe6281e63f60ffd1c9737d6f04bb58c2d70 | packages/react-app-rewire-less/index.js | packages/react-app-rewire-less/index.js | function rewireLess (config, env, lessLoaderOptions = {}) {
const lessExtension = /\.less$/;
const fileLoader = config.module.rules
.find(rule => rule.loader && rule.loader.endsWith('/file-loader/index.js'));
fileLoader.exclude.push(lessExtension);
const cssRules = config.module.rules
.find(rule => String(rule.test) === String(/\.css$/));
let lessRules;
if (env === 'production') {
lessRules = {
test: lessExtension,
loader: [
// TODO: originally this part is wrapper in extract-text-webpack-plugin
// which we cannot do, so some things like relative publicPath
// will not work.
// https://github.com/timarney/react-app-rewired/issues/33
...cssRules.loader,
{ loader: 'less-loader', options: lessLoaderOptions }
]
};
} else {
lessRules = {
test: lessExtension,
use: [
...cssRules.use,
{ loader: 'less-loader', options: lessLoaderOptions }
]
};
}
config.module.rules.push(lessRules);
return config;
}
module.exports = rewireLess;
| const path = require('path')
function rewireLess (config, env, lessLoaderOptions = {}) {
const lessExtension = /\.less$/;
const fileLoader = config.module.rules
.find(rule => rule.loader && rule.loader.endsWith(`${path.sep}file-loader${path.sep}index.js`));
fileLoader.exclude.push(lessExtension);
const cssRules = config.module.rules
.find(rule => String(rule.test) === String(/\.css$/));
let lessRules;
if (env === 'production') {
lessRules = {
test: lessExtension,
loader: [
// TODO: originally this part is wrapper in extract-text-webpack-plugin
// which we cannot do, so some things like relative publicPath
// will not work.
// https://github.com/timarney/react-app-rewired/issues/33
...cssRules.loader,
{ loader: 'less-loader', options: lessLoaderOptions }
]
};
} else {
lessRules = {
test: lessExtension,
use: [
...cssRules.use,
{ loader: 'less-loader', options: lessLoaderOptions }
]
};
}
config.module.rules.push(lessRules);
return config;
}
module.exports = rewireLess;
| Fix react-app-rewire-less not working on Windows | Fix react-app-rewire-less not working on Windows
Closes #53 | JavaScript | mit | timarney/react-app-rewired,timarney/react-app-rewired | ---
+++
@@ -1,8 +1,10 @@
+const path = require('path')
+
function rewireLess (config, env, lessLoaderOptions = {}) {
const lessExtension = /\.less$/;
const fileLoader = config.module.rules
- .find(rule => rule.loader && rule.loader.endsWith('/file-loader/index.js'));
+ .find(rule => rule.loader && rule.loader.endsWith(`${path.sep}file-loader${path.sep}index.js`));
fileLoader.exclude.push(lessExtension);
const cssRules = config.module.rules |
60e6634acab3e41f3cee688b9379e21040763254 | public/js/index.js | public/js/index.js | $(document).ready(function(){
$('.log-btn').click(function(){
$('.log-status').addClass('wrong-entry');
$('.alert').fadeIn(500);
setTimeout( "$('.alert').fadeOut(1500);",3000 );
});
$('.form-control').keypress(function(){
$('.log-status').removeClass('wrong-entry');
});
});
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
return {
'total': t,
'minutes': minutes,
'seconds': seconds
};
}
function initializeClock(id, endtime) {
var clock = document.getElementById(id);
var minutesSpan = clock.querySelector('.minutes');
var secondsSpan = clock.querySelector('.seconds');
function updateClock() {
var t = getTimeRemaining(endtime);
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
if (t.total <= 0) {
clearInterval(timeinterval);
}
}
updateClock();
var timeinterval = setInterval(updateClock, 1000);
}
var deadline = new Date(Date.parse(time));
initializeClock('clockdiv', deadline)
| $(document).ready(function(){
$('.log-btn').click(function(){
$('.log-status').addClass('wrong-entry');
$('.alert').fadeIn(500);
setTimeout( "$('.alert').fadeOut(1500);",3000 );
});
$('.form-control').keypress(function(){
$('.log-status').removeClass('wrong-entry');
});
});
function getTimeRemaining(endtime) {
var t = Date.parse(endtime) - Date.parse(new Date());
var seconds = Math.floor((t / 1000) % 60);
var minutes = Math.floor((t / 1000 / 60) % 60);
return {
'total': t,
'minutes': minutes,
'seconds': seconds
};
}
function initializeClock(id, endtime) {
var clock = document.getElementById(id);
var minutesSpan = clock.querySelector('.minutes');
var secondsSpan = clock.querySelector('.seconds');
function updateClock() {
var t = getTimeRemaining(endtime);
minutesSpan.innerHTML = ('0' + t.minutes).slice(-2);
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
if (t.total <= 0) {
minutesSpan.innerHTML = ('00');
secondsSpan.innerHTML = ('00');
clearInterval(timeinterval);
}
}
updateClock();
var timeinterval = setInterval(updateClock, 1000);
}
var deadline = new Date(Date.parse(time));
initializeClock('clockdiv', deadline)
| Set the coutdown min and sec values to 00 when the deadline time has been reached. | Set the coutdown min and sec values to 00 when the deadline time has been reached.
| JavaScript | apache-2.0 | KalenWessel/lockandkey,KalenWessel/lockandkey,KalenWessel/lockandkey | ---
+++
@@ -32,6 +32,8 @@
secondsSpan.innerHTML = ('0' + t.seconds).slice(-2);
if (t.total <= 0) {
+ minutesSpan.innerHTML = ('00');
+ secondsSpan.innerHTML = ('00');
clearInterval(timeinterval);
}
} |
2dfa337cd2ccaf9bdd98c47c99b5180846285e57 | mods/lowtierrandom/formats-data.js | mods/lowtierrandom/formats-data.js | exports.BattleFormatsData = {
kangaskhanmega: {
randomBattleMoves: ["fakeout","return","suckerpunch","earthquake","poweruppunch","crunch"],
randomDoubleBattleMoves: ["fakeout","return","suckerpunch","earthquake","facade","poweruppunch","crunch"],
tier: "Uber"
}
};
| exports.BattleFormatsData = {
kangaskhanmega: {
randomBattleMoves: ["fakeout","return","suckerpunch","earthquake","poweruppunch","crunch"],
randomDoubleBattleMoves: ["fakeout","return","suckerpunch","earthquake","doubleedge","poweruppunch","crunch","protect"],
tier: "Uber"
},
altariamega: {
randomBattleMoves: ["dragondance","return","outrage","dragonclaw","earthquake","roost","dracometeor","fireblast"],
randomDoubleBattleMoves: ["dragondance","return","doubleedge","dragonclaw","earthquake","protect","fireblast"],
tier: "BL"
},
gallademega: {
randomBattleMoves: ["closecombat","stoneedge","drainpunch","icepunch","zenheadbutt","swordsdance","knockoff"],
randomDoubleBattleMoves: ["closecombat","stoneedge","drainpunch","icepunch","zenheadbutt","swordsdance","knockoff","protect"],
tier: "BL"
},
lopunnymega: {
randomBattleMoves: ["return","highjumpkick","poweruppunch","fakeout","icepunch"],
randomDoubleBattleMoves: ["return","highjumpkick","protect","fakeout","icepunch","encore"],
tier: "BL"
},
dianciemega: {
randomBattleMoves: ["diamondstorm","moonblast","calmmind","psyshock","earthpower","hiddenpowerfire"],
randomDoubleBattleMoves: ["diamondstorm","moonblast","calmmind","psyshock","earthpower","hiddenpowerfire","dazzlinggleam","protect"],
tier: "BL"
}
};
| Remove various BL Megas from Low Tier Random | Remove various BL Megas from Low Tier Random | JavaScript | mit | lFernanl/Mudkip-Server,MayukhKundu/Technogear,MayukhKundu/Pokemon-Domain,yashagl/pokemon-showdown,TheManwithskills/DS,yashagl/pokemon,MayukhKundu/Flame-Savior,yashagl/yash-showdown,SkyeTheFemaleSylveon/Mudkip-Server,MayukhKundu/Flame-Savior,MayukhKundu/Technogear-Final,MayukhKundu/Mudkip-Server,MayukhKundu/Pokemon-Domain,TheManwithskills/DS,TheManwithskills/Server,lFernanl/Mudkip-Server,yashagl/pokecommunity,yashagl/pokecommunity,SkyeTheFemaleSylveon/Mudkip-Server,yashagl/pokemon,MayukhKundu/Mudkip-Server,MayukhKundu/Technogear,yashagl/pokemon-showdown,MayukhKundu/Technogear-Final,TheManwithskills/Server,yashagl/yash-showdown | ---
+++
@@ -1,7 +1,27 @@
exports.BattleFormatsData = {
kangaskhanmega: {
randomBattleMoves: ["fakeout","return","suckerpunch","earthquake","poweruppunch","crunch"],
- randomDoubleBattleMoves: ["fakeout","return","suckerpunch","earthquake","facade","poweruppunch","crunch"],
+ randomDoubleBattleMoves: ["fakeout","return","suckerpunch","earthquake","doubleedge","poweruppunch","crunch","protect"],
tier: "Uber"
+ },
+ altariamega: {
+ randomBattleMoves: ["dragondance","return","outrage","dragonclaw","earthquake","roost","dracometeor","fireblast"],
+ randomDoubleBattleMoves: ["dragondance","return","doubleedge","dragonclaw","earthquake","protect","fireblast"],
+ tier: "BL"
+ },
+ gallademega: {
+ randomBattleMoves: ["closecombat","stoneedge","drainpunch","icepunch","zenheadbutt","swordsdance","knockoff"],
+ randomDoubleBattleMoves: ["closecombat","stoneedge","drainpunch","icepunch","zenheadbutt","swordsdance","knockoff","protect"],
+ tier: "BL"
+ },
+ lopunnymega: {
+ randomBattleMoves: ["return","highjumpkick","poweruppunch","fakeout","icepunch"],
+ randomDoubleBattleMoves: ["return","highjumpkick","protect","fakeout","icepunch","encore"],
+ tier: "BL"
+ },
+ dianciemega: {
+ randomBattleMoves: ["diamondstorm","moonblast","calmmind","psyshock","earthpower","hiddenpowerfire"],
+ randomDoubleBattleMoves: ["diamondstorm","moonblast","calmmind","psyshock","earthpower","hiddenpowerfire","dazzlinggleam","protect"],
+ tier: "BL"
}
}; |
04ad49650b7aca55d03a7a90097a038d6195345a | client/src/components/advancedSelectWidget/AdvancedSingleSelect.js | client/src/components/advancedSelectWidget/AdvancedSingleSelect.js | import AdvancedSelect, {
propTypes as advancedSelectPropTypes
} from "components/advancedSelectWidget/AdvancedSelect"
import { AdvancedSingleSelectOverlayTable } from "components/advancedSelectWidget/AdvancedSelectOverlayTable"
import * as FieldHelper from "components/FieldHelper"
import _isEmpty from "lodash/isEmpty"
import PropTypes from "prop-types"
import React from "react"
import REMOVE_ICON from "resources/delete.png"
const AdvancedSingleSelect = props => {
return (
<AdvancedSelect
{...props}
handleAddItem={handleAddItem}
handleRemoveItem={handleRemoveItem}
closeOverlayOnAdd
selectedValueAsString={
!_isEmpty(props.value) ? props.value[props.valueKey] : ""
}
extraAddon={
props.showRemoveButton && !_isEmpty(props.value) ? (
<img
style={{ cursor: "pointer" }}
src={REMOVE_ICON}
height={16}
alt=""
onClick={handleRemoveItem}
/>
) : null
}
/>
)
function handleAddItem(newItem) {
FieldHelper.handleSingleSelectAddItem(newItem, props.onChange)
}
function handleRemoveItem(oldItem) {
FieldHelper.handleSingleSelectRemoveItem(oldItem, props.onChange)
}
}
AdvancedSingleSelect.propTypes = {
...advancedSelectPropTypes,
value: PropTypes.object.isRequired,
valueKey: PropTypes.string
}
AdvancedSingleSelect.defaultProps = {
value: {},
overlayTable: AdvancedSingleSelectOverlayTable,
showRemoveButton: true // whether to display a remove button in the input field to allow removing the selected value
}
export default AdvancedSingleSelect
| import AdvancedSelect, {
propTypes as advancedSelectPropTypes
} from "components/advancedSelectWidget/AdvancedSelect"
import { AdvancedSingleSelectOverlayTable } from "components/advancedSelectWidget/AdvancedSelectOverlayTable"
import * as FieldHelper from "components/FieldHelper"
import _isEmpty from "lodash/isEmpty"
import PropTypes from "prop-types"
import React from "react"
import REMOVE_ICON from "resources/delete.png"
const AdvancedSingleSelect = props => {
return (
<AdvancedSelect
{...props}
handleAddItem={handleAddItem}
handleRemoveItem={handleRemoveItem}
closeOverlayOnAdd
selectedValueAsString={
!_isEmpty(props.value) ? props.value[props.valueKey] : ""
}
extraAddon={
props.showRemoveButton && !_isEmpty(props.value) ? (
<img
style={{ cursor: "pointer" }}
src={REMOVE_ICON}
height={16}
alt=""
onClick={handleRemoveItem}
/>
) : null
}
/>
)
function handleAddItem(newItem) {
FieldHelper.handleSingleSelectAddItem(newItem, props.onChange)
}
function handleRemoveItem(oldItem) {
FieldHelper.handleSingleSelectRemoveItem(oldItem, props.onChange)
}
}
AdvancedSingleSelect.propTypes = {
...advancedSelectPropTypes,
value: PropTypes.object,
valueKey: PropTypes.string
}
AdvancedSingleSelect.defaultProps = {
value: {},
overlayTable: AdvancedSingleSelectOverlayTable,
showRemoveButton: true // whether to display a remove button in the input field to allow removing the selected value
}
export default AdvancedSingleSelect
| Fix required value prop failing on null values | Fix required value prop failing on null values
| JavaScript | mit | NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet,NCI-Agency/anet | ---
+++
@@ -42,7 +42,7 @@
}
AdvancedSingleSelect.propTypes = {
...advancedSelectPropTypes,
- value: PropTypes.object.isRequired,
+ value: PropTypes.object,
valueKey: PropTypes.string
}
AdvancedSingleSelect.defaultProps = { |
361ae111b35cc261cfad3f1b37477b93dc15cbda | client/src/components/Form.js | client/src/components/Form.js | import React from 'react'
const Form = ({fields, handleChange, handleSubmit, submitValue, message}) => {
const formFields = fields.map(field => {
return (
<div>
<label>{field.label} </label>
<input type={field.type} name={field.name} value={field.value} onChange={handleChange} /><br />
</div>
)
})
return (
<form onSubmit={handleSubmit} >
{formFields}
<input type="Submit" className="button" value={submitValue} /><br />
<span>{message}</span>
</form>
)
}
export default Form
| import React from 'react'
const Form = ({fields, handleChange, handleSubmit, submitValue, message}) => {
const formFields = fields.map(field => {
return (
<div>
<label>{field.label} </label>
<input type={field.type} name={field.name} value={field.value} onChange={handleChange} /><br />
</div>
)
})
return (
<form onSubmit={handleSubmit} >
{formFields}
<input type="Submit" className="button" value={submitValue} /><br />
<span className="message">{message}</span>
</form>
)
}
export default Form
| Add message prop and display | Add message prop and display
| JavaScript | mit | kevinladkins/newsfeed,kevinladkins/newsfeed,kevinladkins/newsfeed | ---
+++
@@ -13,7 +13,7 @@
<form onSubmit={handleSubmit} >
{formFields}
<input type="Submit" className="button" value={submitValue} /><br />
- <span>{message}</span>
+ <span className="message">{message}</span>
</form>
)
} |
7bc420a4da3b05819b57737b37d1fc8bae6f729b | coderstats/data/coderstats.js | coderstats/data/coderstats.js | var link = document.getElementsByClassName('octicon-link')[0],
path = document.location.pathname,
details,
login,
url;
if (m = path.match(/^\/([\w-]+)\??.*?/)) {
login = m[1].trim();
if (-1 === ['timeline', 'languages', 'blog', 'explore'].indexOf(login)) {
url = 'http://coderstats.net/github/' + login + '/';
details = document.getElementsByClassName('vcard-details');
if (details.length > 0) {
addLink();
document.addEventListener('DOMSubtreeModified', navClick, false);
}
}
}
function addLink() {
let cslink = document.getElementById('coderstats');
if (cslink) return;
var li = document.createElement('li');
li.setAttribute('id', 'coderstats');
li.setAttribute('class', 'vcard-detail pt-1');
li.setAttribute('itemprop', 'url');
var a = document.createElement('a');
a.setAttribute('href', url);
a.textContent = "CoderStats('" + login + "')";
var svg = link.cloneNode();
svg.appendChild(link.childNodes[0].cloneNode())
li.appendChild(svg);
li.appendChild(a);
details[0].appendChild(li);
}
// https://github.com/KyroChi/GitHub-Profile-Fluency/blob/Google-Chrome/chrome/content.js
function navClick() {
document.removeEventListener('DOMSubtreeModified', navClick);
setTimeout(function() {
addLink();
document.addEventListener('DOMSubtreeModified', navClick, false);
}, 500);
}
| var path = document.location.pathname,
details,
login,
url;
if (m = path.match(/^\/([\w-]+)\??.*?/)) {
login = m[1].trim();
if (-1 === ['timeline', 'languages', 'blog', 'explore'].indexOf(login)) {
url = 'http://coderstats.net/github/' + login + '/';
details = document.getElementsByClassName('vcard-details');
if (details.length > 0) {
addLink();
}
}
}
function addLink() {
let cslink = document.getElementById('coderstats');
if (cslink) return;
var li = document.createElement('li');
li.setAttribute('id', 'coderstats');
li.setAttribute('class', 'vcard-detail pt-1');
li.setAttribute('itemprop', 'url');
let span = document.createElement('span');
span.setAttribute('class', 'octicon');
span.setAttribute('style', 'margin-top:-2px;');
span.textContent = "📊";
li.appendChild(span)
let a = document.createElement('a');
a.setAttribute('href', url);
a.textContent = "CoderStats('" + login + "')";
li.appendChild(a);
details[0].appendChild(li);
} | Append CoderStats link rather than cloning posibly non-existing link item. Don't listen on DOMSubtreeModified event | Append CoderStats link rather than cloning posibly non-existing link item.
Don't listen on DOMSubtreeModified event
| JavaScript | mit | coderstats/fxt_coderstats | ---
+++
@@ -1,5 +1,4 @@
-var link = document.getElementsByClassName('octicon-link')[0],
- path = document.location.pathname,
+var path = document.location.pathname,
details,
login,
url;
@@ -11,7 +10,6 @@
details = document.getElementsByClassName('vcard-details');
if (details.length > 0) {
addLink();
- document.addEventListener('DOMSubtreeModified', navClick, false);
}
}
}
@@ -26,24 +24,16 @@
li.setAttribute('class', 'vcard-detail pt-1');
li.setAttribute('itemprop', 'url');
- var a = document.createElement('a');
+ let span = document.createElement('span');
+ span.setAttribute('class', 'octicon');
+ span.setAttribute('style', 'margin-top:-2px;');
+ span.textContent = "📊";
+ li.appendChild(span)
+
+ let a = document.createElement('a');
a.setAttribute('href', url);
a.textContent = "CoderStats('" + login + "')";
- var svg = link.cloneNode();
- svg.appendChild(link.childNodes[0].cloneNode())
-
- li.appendChild(svg);
li.appendChild(a);
details[0].appendChild(li);
}
-
-
-// https://github.com/KyroChi/GitHub-Profile-Fluency/blob/Google-Chrome/chrome/content.js
-function navClick() {
- document.removeEventListener('DOMSubtreeModified', navClick);
- setTimeout(function() {
- addLink();
- document.addEventListener('DOMSubtreeModified', navClick, false);
- }, 500);
-} |
2087652170835f7542746d81f2e693738dce1210 | packages/vulcan-lib/lib/server/utils.js | packages/vulcan-lib/lib/server/utils.js | import sanitizeHtml from 'sanitize-html';
import { Utils } from '../modules';
import { throwError } from './errors.js';
Utils.sanitizeAllowedTags = [
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul',
'ol', 'nl', 'li', 'b', 'i', 'u', 'strong', 'em', 'strike',
'code', 'hr', 'br', 'div', 'table', 'thead', 'caption',
'tbody', 'tr', 'th', 'td', 'pre', 'img', 'figure', 'figcaption'
]
Utils.sanitize = function(s) {
return sanitizeHtml(s, {
allowedTags: Utils.sanitizeAllowedTags,
allowedAttributes: {
...sanitizeHtml.defaults.allowedAttributes,
'figure': ['style']
},
allowedStyles: {
...sanitizeHtml.defaults.allowedStyles,
'figure': {
'width': [/^(?:\d|\.)+(?:px|em|%)$/]
}
}
});
};
Utils.performCheck = (operation, user, checkedObject, context, documentId, operationName, collectionName) => {
if (!checkedObject) {
throwError({ id: 'app.document_not_found', data: { documentId, operationName } });
}
if (!operation(user, checkedObject, context)) {
throwError({ id: 'app.operation_not_allowed', data: { documentId, operationName } });
}
};
export { Utils };
| import sanitizeHtml from 'sanitize-html';
import { Utils } from '../modules';
import { throwError } from './errors.js';
Utils.sanitizeAllowedTags = [
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul',
'ol', 'nl', 'li', 'b', 'i', 'u', 'strong', 'em', 'strike',
'code', 'hr', 'br', 'div', 'table', 'thead', 'caption',
'tbody', 'tr', 'th', 'td', 'pre', 'img', 'figure', 'figcaption'
]
Utils.sanitize = function(s) {
return sanitizeHtml(s, {
allowedTags: Utils.sanitizeAllowedTags,
allowedAttributes: {
...sanitizeHtml.defaults.allowedAttributes,
img: [ 'src' , 'srcset'],
figure: ['style']
},
allowedStyles: {
...sanitizeHtml.defaults.allowedStyles,
'figure': {
'width': [/^(?:\d|\.)+(?:px|em|%)$/]
}
}
});
};
Utils.performCheck = (operation, user, checkedObject, context, documentId, operationName, collectionName) => {
if (!checkedObject) {
throwError({ id: 'app.document_not_found', data: { documentId, operationName } });
}
if (!operation(user, checkedObject, context)) {
throwError({ id: 'app.operation_not_allowed', data: { documentId, operationName } });
}
};
export { Utils };
| Allow srcset attribute on images | Allow srcset attribute on images
| JavaScript | mit | Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2,Discordius/Telescope,Discordius/Telescope,Discordius/Lesswrong2,Discordius/Lesswrong2 | ---
+++
@@ -14,7 +14,8 @@
allowedTags: Utils.sanitizeAllowedTags,
allowedAttributes: {
...sanitizeHtml.defaults.allowedAttributes,
- 'figure': ['style']
+ img: [ 'src' , 'srcset'],
+ figure: ['style']
},
allowedStyles: {
...sanitizeHtml.defaults.allowedStyles, |
47e8d2692ea40a3a8d31433f53ac530c8bea85cf | tests/dummy/app/routes/nodes/detail/draft-registrations/detail.js | tests/dummy/app/routes/nodes/detail/draft-registrations/detail.js | import Ember from 'ember';
export default Ember.Route.extend({
model(params) {
let node = this.modelFor('nodes.detail');
this.store.adapterFor('draft-registration').set('namespace', 'v2/nodes/' + node.id);
var draft = this.store.findRecord('draft-registration', params.draft_registration_id);
return draft;
},
setupController(controller, model) {
this._super(controller, model);
controller.set('node', this.modelFor('nodes.detail'));
}
});
| import Ember from 'ember';
import config from 'ember-get-config';
export default Ember.Route.extend({
model(params) {
let node = this.modelFor('nodes.detail');
this.store.adapterFor('draft-registration').set('namespace', config.OSF.apiNamespace + '/nodes/' + node.id);
var draft = this.store.findRecord('draft-registration', params.draft_registration_id);
return draft;
},
setupController(controller, model) {
this._super(controller, model);
controller.set('node', this.modelFor('nodes.detail'));
}
});
| Use config.OSF.apiNamespace instead of hardcoding original namespace. | Use config.OSF.apiNamespace instead of hardcoding original namespace.
| JavaScript | apache-2.0 | chrisseto/ember-osf,binoculars/ember-osf,jamescdavis/ember-osf,cwilli34/ember-osf,hmoco/ember-osf,baylee-d/ember-osf,CenterForOpenScience/ember-osf,baylee-d/ember-osf,hmoco/ember-osf,cwilli34/ember-osf,pattisdr/ember-osf,CenterForOpenScience/ember-osf,binoculars/ember-osf,pattisdr/ember-osf,jamescdavis/ember-osf,crcresearch/ember-osf,crcresearch/ember-osf,chrisseto/ember-osf | ---
+++
@@ -1,9 +1,10 @@
import Ember from 'ember';
+import config from 'ember-get-config';
export default Ember.Route.extend({
model(params) {
let node = this.modelFor('nodes.detail');
- this.store.adapterFor('draft-registration').set('namespace', 'v2/nodes/' + node.id);
+ this.store.adapterFor('draft-registration').set('namespace', config.OSF.apiNamespace + '/nodes/' + node.id);
var draft = this.store.findRecord('draft-registration', params.draft_registration_id);
return draft;
}, |
d19531fe58474652b45f133fcc8cf34724c6e965 | tests/integration/components/maintenance-banner/component-test.js | tests/integration/components/maintenance-banner/component-test.js | import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('maintenance-banner', 'Integration | Component | maintenance banner', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{maintenance-banner}}`);
assert.equal(this.$().text().trim(), '');
});
| import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('maintenance-banner', 'Integration | Component | maintenance banner', {
integration: true
});
test('it renders', function(assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.on('myAction', function(val) { ... });
this.render(hbs`{{maintenance-banner}}`);
assert.ok(this.$());
});
| Test no longer checks for blank, checks that it spits out somehting | Test no longer checks for blank, checks that it spits out somehting
| JavaScript | apache-2.0 | jamescdavis/ember-osf,CenterForOpenScience/ember-osf,baylee-d/ember-osf,binoculars/ember-osf,jamescdavis/ember-osf,CenterForOpenScience/ember-osf,baylee-d/ember-osf,binoculars/ember-osf | ---
+++
@@ -12,5 +12,5 @@
this.render(hbs`{{maintenance-banner}}`);
- assert.equal(this.$().text().trim(), '');
+ assert.ok(this.$());
}); |
26e7eb17fcdc93d0356d7a8ef60d3ab5a430d394 | app/lib/db.js | app/lib/db.js | const path = require('path');
const fs = require('fs');
const streamsql = require('streamsql');
const config = require('./config');
const configStore = require('../../lib/config.js');
const dbm = require('db-migrate')
var env = config('DATABASE_ENVIRONMENT', 'dev');
dbm.config.load(path.join(__dirname, '../../database.json'));
if (!dbm.config[env])
throw new Error('Database environment ' + env + ' not defined in database.json');
// db-migrate's config loader doesn't ensure ENV variables exist
for (var entry in dbm.config[env]) {
if (dbm.config[env][entry] === undefined)
throw new Error('Illegal undefined value for ' + entry);
}
var dbconfig = configStore(dbm.config[env]);
module.exports = streamsql.connect({
'driver': dbconfig('driver'),
'host': dbconfig('host'),
'user': dbconfig('user'),
'password': dbconfig('password'),
'database': dbconfig('database')
});
| const path = require('path');
const fs = require('fs');
const streamsql = require('streamsql');
const config = require('./config');
const configStore = require('config-store');
const dbm = require('db-migrate')
var env = config('DATABASE_ENVIRONMENT', 'dev');
dbm.config.load(path.join(__dirname, '../../database.json'));
if (!dbm.config[env])
throw new Error('Database environment ' + env + ' not defined in database.json');
// db-migrate's config loader doesn't ensure ENV variables exist
for (var entry in dbm.config[env]) {
if (dbm.config[env][entry] === undefined)
throw new Error('Illegal undefined value for ' + entry);
}
var dbconfig = configStore(dbm.config[env]);
module.exports = streamsql.connect({
'driver': dbconfig('driver'),
'host': dbconfig('host'),
'user': dbconfig('user'),
'password': dbconfig('password'),
'database': dbconfig('database')
});
| Use lib from npm instead of ./lib | Use lib from npm instead of ./lib
| JavaScript | mpl-2.0 | phusion/openbadges-badgekit,larssvekis/openbadges-badgekit,mozilla/openbadges-badgekit,larssvekis/openbadges-badgekit,friedger/openbadges-badgekit,friedger/openbadges-badgekit,mozilla/openbadges-badgekit,phusion/openbadges-badgekit,bethadele/openbadges-badgekit,bethadele/openbadges-badgekit | ---
+++
@@ -2,7 +2,7 @@
const fs = require('fs');
const streamsql = require('streamsql');
const config = require('./config');
-const configStore = require('../../lib/config.js');
+const configStore = require('config-store');
const dbm = require('db-migrate')
var env = config('DATABASE_ENVIRONMENT', 'dev'); |
8c0c4f4f3016cca574878c27be9ecbeebc4e844d | app/routes.js | app/routes.js | import React from 'react';
import { Route } from 'react-router';
import App from 'containers/App';
import HomePage from 'containers/HomePage';
import LoginPage from 'containers/LoginPage';
import UserReservationsPage from 'containers/UserReservationsPage';
import NotFoundPage from 'containers/NotFoundPage';
import ReservationPage from 'containers/ReservationPage';
import ResourcePage from 'containers/ResourcePage';
import SearchPage from 'containers/SearchPage';
export default (params) => {
function requireAuth(nextState, replaceState, cb) {
setTimeout(() => {
const { auth } = params.getState();
if (!auth.userId) {
replaceState(null, '/login');
}
cb();
}, 0);
}
return (
<Route component={App}>
<Route onEnter={requireAuth}>
<Route component={UserReservationsPage} path="/my-reservations" />
</Route>
<Route component={HomePage} path="/" />
<Route component={LoginPage} path="/login" />
<Route component={ResourcePage} path="/resources/:id" />
<Route component={ReservationPage} path="/resources/:id/reservation" />
<Route component={SearchPage} path="/search" />
<Route component={NotFoundPage} path="*" />
</Route>
);
};
| import React from 'react';
import { Route } from 'react-router';
import App from 'containers/App';
import HomePage from 'containers/HomePage';
import LoginPage from 'containers/LoginPage';
import UserReservationsPage from 'containers/UserReservationsPage';
import NotFoundPage from 'containers/NotFoundPage';
import ReservationPage from 'containers/ReservationPage';
import ResourcePage from 'containers/ResourcePage';
import SearchPage from 'containers/SearchPage';
export default (params) => {
function removeFacebookAppendedHash(nextState, replaceState, cb) {
if (window.location.hash && window.location.hash.indexOf('_=_') !== -1) {
replaceState(null, window.location.hash.replace('_=_', ''));
}
cb();
}
function requireAuth(nextState, replaceState, cb) {
setTimeout(() => {
const { auth } = params.getState();
if (!auth.userId) {
replaceState(null, '/login');
}
cb();
}, 0);
}
return (
<Route component={App} onEnter={removeFacebookAppendedHash}>
<Route onEnter={requireAuth}>
<Route component={UserReservationsPage} path="/my-reservations" />
</Route>
<Route component={HomePage} path="/" />
<Route component={LoginPage} path="/login" />
<Route component={ResourcePage} path="/resources/:id" />
<Route component={ReservationPage} path="/resources/:id/reservation" />
<Route component={SearchPage} path="/search" />
<Route component={NotFoundPage} path="*" />
</Route>
);
};
| Fix Facebook "_=_" appended hash issue | Fix Facebook "_=_" appended hash issue
Refs #104.
| JavaScript | mit | fastmonkeys/respa-ui | ---
+++
@@ -11,6 +11,13 @@
import SearchPage from 'containers/SearchPage';
export default (params) => {
+ function removeFacebookAppendedHash(nextState, replaceState, cb) {
+ if (window.location.hash && window.location.hash.indexOf('_=_') !== -1) {
+ replaceState(null, window.location.hash.replace('_=_', ''));
+ }
+ cb();
+ }
+
function requireAuth(nextState, replaceState, cb) {
setTimeout(() => {
const { auth } = params.getState();
@@ -23,7 +30,7 @@
}
return (
- <Route component={App}>
+ <Route component={App} onEnter={removeFacebookAppendedHash}>
<Route onEnter={requireAuth}>
<Route component={UserReservationsPage} path="/my-reservations" />
</Route> |
664d631ff80e2d1adf29138cb0ccfbb3c3412155 | src/config/index.js | src/config/index.js | var defaults = require('./defaults.json'),
_ = require('lodash'),
path = require('path'),
fs = require('fs'),
mkpath = require('mkpath'),
home = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
configDir = path.join(home, ".config"),
configPath = path.join(configDir, "ymklogue.json"),
config = {};
var errorLogger = (err, res, rej) => {
if (err) {
console.log(err);
reject(rej);
} else {
resolve(res)
}
}
var resolve = (res) => res ? res() : undefined;
var reject = (err, rej) => rej ? rej(err) : err;
var saveConfig = (res) => fs.writeFile(configPath, JSON.stringify(config, null, 2), { flag: 'w' }, (err) => errorLogger(err, res));
try {
config = require(configPath);
} catch (e) {
console.log("No config file. Writing with defaults.");
mkpath(configDir, (err) => {
errorLogger(err);
fs.writeFile(configPath, JSON.stringify(defaults, null, 2), { flag: 'wx' }, errorLogger);
});
}
config = _.merge({}, defaults, config);
saveConfig();
module.exports = _.merge({
setKey: (key) => {
return new Promise(function (res, rej) {
config.key = key;
saveConfig(res);
});
}
}, config);
| var defaults = require('./defaults.json'),
_ = require('lodash'),
path = require('path'),
fs = require('fs'),
mkpath = require('mkpath'),
home = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
configDir = path.join(home, ".config"),
configPath = path.join(configDir, "ymklogue.json"),
config = {};
var errorLogger = (err, res, rej) => {
if (err) {
console.log(err);
reject(rej);
} else {
resolve(res)
}
}
var resolve = (res) => res ? res() : undefined;
var reject = (err, rej) => rej ? rej(err) : err;
var saveConfig = (res) => fs.writeFile(configPath, JSON.stringify(config, null, 2), { flag: 'w' }, (err) => errorLogger(err, res));
try {
config = require(configPath);
} catch (e) {
console.log("No config file. Writing with defaults.");
mkpath(configDir, (err) => {
errorLogger(err);
fs.writeFile(configPath, JSON.stringify(defaults, null, 2), { flag: 'wx' }, errorLogger);
});
}
config = _.assign({}, defaults, config);
saveConfig();
module.exports = _.assign({
setKey: (key) => {
return new Promise(function (res, rej) {
config.key = key;
saveConfig(res);
});
}
}, config);
| Fix small issue with contsantly copying over the hidden chans | Fix small issue with contsantly copying over the hidden chans
| JavaScript | mit | YaManicKill/ymklogue,YaManicKill/ymklogue | ---
+++
@@ -30,10 +30,10 @@
});
}
-config = _.merge({}, defaults, config);
+config = _.assign({}, defaults, config);
saveConfig();
-module.exports = _.merge({
+module.exports = _.assign({
setKey: (key) => {
return new Promise(function (res, rej) {
config.key = key; |
332a33c2f48a1cca5ad01eb3a18600fc9c0e28f1 | web/static/js/views/insight_chart_view.js | web/static/js/views/insight_chart_view.js | App.InsightChartView = Em.View.extend({
classNames: ["chart"],
thumbNailBinding: "controller.thumbNail",
width:null,
height: null,
viz: null,
specUpdated: function(){
var spec = this.get("controller.spec"),
element = this.get("element"),
documents = this.get("controller.controllers.query.records");
if(!spec || !element || !documents) return;
var self = this;
vg.parse.spec(spec, function(chart) {
var viz = chart({el:element});
self.set('viz', viz);
viz.data({
"documents": documents
});
viz.update();
self.set('thumbNail', self.makeThumbNail());
});
}.observes("controller.spec", "controller.controllers.query.records.@each"),
didInsertElement: function(){
this.specUpdated();
},
makeThumbNail: function(){
var canvas = this.$("canvas")[0];
return canvas.toDataURL("image/png");
}
});
| App.InsightChartView = Em.View.extend({
classNames: ["chart"],
thumbNailBinding: "controller.thumbNail",
width:null,
height: null,
viz: null,
updateProps: ["controller.spec", "controller.controllers.query.records.@each"],
specUpdated: function(){
var spec = this.get("controller.spec"),
element = this.get("element"),
documents = this.get("controller.controllers.query.records");
if(!spec || !element || !documents) return;
var self = this;
vg.parse.spec(spec, function(chart) {
var viz = chart({el:element});
self.set('viz', viz);
viz.data({
"documents": documents
});
viz.update();
self.set('thumbNail', self.makeThumbNail());
});
},
didInsertElement: function(){
//.observes("controller.spec", "controller.controllers.query.records")
this.get('updateProps').forEach(function(p){
this.addObserver(p, this, this.specUpdated)
}.bind(this));
this.specUpdated();
},
willDestroyElement: function(){
this.get('updateProps').forEach(function(p){
this.removeObserver(p, this, this.specUpdated)
}.bind(this));
},
makeThumbNail: function(){
var canvas = this.$("canvas");
if(canvas && canvas.length){
return canvas[0].toDataURL("image/png");
}
}
});
| Stop observing value changes when the view is unloaded. | Stop observing value changes when the view is unloaded. | JavaScript | mpl-2.0 | mozilla/caravela,mozilla/caravela,mozilla/caravela,mozilla/caravela | ---
+++
@@ -5,6 +5,8 @@
width:null,
height: null,
viz: null,
+ updateProps: ["controller.spec", "controller.controllers.query.records.@each"],
+
specUpdated: function(){
var spec = this.get("controller.spec"),
@@ -18,7 +20,6 @@
var viz = chart({el:element});
self.set('viz', viz);
-
viz.data({
"documents": documents
@@ -31,15 +32,28 @@
- }.observes("controller.spec", "controller.controllers.query.records.@each"),
+ },
didInsertElement: function(){
+ //.observes("controller.spec", "controller.controllers.query.records")
+ this.get('updateProps').forEach(function(p){
+ this.addObserver(p, this, this.specUpdated)
+ }.bind(this));
this.specUpdated();
},
+ willDestroyElement: function(){
+ this.get('updateProps').forEach(function(p){
+ this.removeObserver(p, this, this.specUpdated)
+ }.bind(this));
+ },
+
+
makeThumbNail: function(){
- var canvas = this.$("canvas")[0];
- return canvas.toDataURL("image/png");
+ var canvas = this.$("canvas");
+ if(canvas && canvas.length){
+ return canvas[0].toDataURL("image/png");
+ }
}
|
82ab743f3c119e1036151c7a68d506c35bd6396e | components/link/Link.js | components/link/Link.js | import React, { Fragment, PureComponent } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import theme from './theme.css';
class Link extends PureComponent {
render() {
const { children, className, icon, iconPlacement, element, inherit, ...others } = this.props;
const classNames = cx(
theme['link'],
{
[theme['inherit']]: inherit,
},
className,
);
const ChildrenWrapper = icon ? 'span' : Fragment;
const Element = element;
return (
<Element className={classNames} data-teamleader-ui="link" {...others}>
{icon && iconPlacement === 'left' && icon}
<ChildrenWrapper>{children}</ChildrenWrapper>
{icon && iconPlacement === 'right' && icon}
</Element>
);
}
}
Link.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
/** The icon displayed inside the button. */
icon: PropTypes.element,
/** The position of the icon inside the button. */
iconPlacement: PropTypes.oneOf(['left', 'right']),
inherit: PropTypes.bool,
element: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
};
Link.defaultProps = {
className: '',
element: 'a',
inherit: true,
};
export default Link;
| import React, { Fragment, PureComponent } from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import theme from './theme.css';
class Link extends PureComponent {
render() {
const { children, className, icon, iconPlacement, element, inherit, ...others } = this.props;
const classNames = cx(
theme['link'],
{
[theme['inherit']]: inherit,
},
className,
);
const ChildrenWrapper = icon ? 'span' : Fragment;
const Element = element;
return (
<Element className={classNames} data-teamleader-ui="link" {...others}>
{icon && iconPlacement === 'left' && icon}
<ChildrenWrapper>{children}</ChildrenWrapper>
{icon && iconPlacement === 'right' && icon}
</Element>
);
}
}
Link.propTypes = {
children: PropTypes.node.isRequired,
className: PropTypes.string,
/** The icon displayed inside the button. */
icon: PropTypes.element,
/** The position of the icon inside the button. */
iconPlacement: PropTypes.oneOf(['left', 'right']),
inherit: PropTypes.bool,
element: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
/** Callback function that is fired when mouse leaves the component. */
onMouseLeave: PropTypes.func,
/** Callback function that is fired when the mouse button is released. */
onMouseUp: PropTypes.func,
};
Link.defaultProps = {
className: '',
element: 'a',
inherit: true,
};
export default Link;
| Add 'onMouseLeave' & 'onMouseUp' props | Add 'onMouseLeave' & 'onMouseUp' props
| JavaScript | mit | teamleadercrm/teamleader-ui | ---
+++
@@ -37,6 +37,10 @@
iconPlacement: PropTypes.oneOf(['left', 'right']),
inherit: PropTypes.bool,
element: PropTypes.oneOfType([PropTypes.element, PropTypes.string]),
+ /** Callback function that is fired when mouse leaves the component. */
+ onMouseLeave: PropTypes.func,
+ /** Callback function that is fired when the mouse button is released. */
+ onMouseUp: PropTypes.func,
};
Link.defaultProps = { |
05056d99ade4e113419db11c4897fd1157774d81 | src/Home.js | src/Home.js | import React, {Component} from "react";
import RaisedButton from "material-ui/RaisedButton";
const styles = {
button: {
margin: 12,
},
}
class Home extends Component {
render() {
return (
<div className="buttons">
<h1>Gregory N. Katchmar</h1>
<h2>JavaScript Developer</h2>
<hr></hr>
<h4>More information at:</h4>
<RaisedButton
href="https://www.linkedin.com/in/gregory-katchmar-3a48275a"
target="_blank"
label="LinkedIn"
primary={true}
style={styles.button}
/>
<RaisedButton
href="https://github.com/gnkatchmar"
target="_blank"
label="Github"
primary={true}
style={styles.button}
/>
<RaisedButton
href="https://drive.google.com/open?id=0B-QmArVwrgLGSHJnbFN6VXZGb0k"
target="_blank"
label="Resume (PDF)"
primary={true}
style={styles.button}
/>
<hr></hr>
<h4>Contact me at:</h4>
<a href="mailto:gregkatchmar@gmail.com">gregkatchmar@gmail.com</a>
<hr></hr>
<p>Last updated August 26, 2017</p>
<hr></hr>
<p>A React/material-ui site</p>
</div>
);
}
}
export default Home; | import React, {Component} from "react";
import RaisedButton from "material-ui/RaisedButton";
const styles = {
button: {
margin: 12,
},
}
class Home extends Component {
render() {
return (
<div className="buttons">
<h1>Gregory N. Katchmar</h1>
<h2>JavaScript Developer</h2>
<hr></hr>
<h4>More information at:</h4>
<RaisedButton
href="https://www.linkedin.com/in/gregory-katchmar-3a48275a"
target="_blank"
label="LinkedIn"
primary={true}
style={styles.button}
/>
<RaisedButton
href="https://github.com/gnkatchmar"
target="_blank"
label="Github"
primary={true}
style={styles.button}
/>
<RaisedButton
href="https://drive.google.com/open?id=0B-QmArVwrgLGSHJnbFN6VXZGb0k"
target="_blank"
label="Resume (PDF)"
primary={true}
style={styles.button}
/>
<hr></hr>
<h4>Contact me at:</h4>
<a href="mailto:gregkatchmar@gmail.com">gregkatchmar@gmail.com</a>
<hr></hr>
<p>Last updated September 6, 2017</p>
<hr></hr>
<p>A React/material-ui site</p>
</div>
);
}
}
export default Home; | Update date change for build | Update date change for build
| JavaScript | isc | gnkatchmar/new-gkatchmar,gnkatchmar/new-gkatchmar | ---
+++
@@ -40,7 +40,7 @@
<h4>Contact me at:</h4>
<a href="mailto:gregkatchmar@gmail.com">gregkatchmar@gmail.com</a>
<hr></hr>
- <p>Last updated August 26, 2017</p>
+ <p>Last updated September 6, 2017</p>
<hr></hr>
<p>A React/material-ui site</p>
</div> |
a54ad382cdfa461d705e0d8c469a793680b71d3b | server/ymlHerokuConfig.js | server/ymlHerokuConfig.js |
var path = require('path');
var yaml_config = require('node-yaml-config');
var _ = require('lodash');
function ymlHerokuConfigModule() {
var HEROKU_VARS_SUPPORT = [
'user', 'password', 'url', 'pipeline', 'jobs', 'key', 'secret', 'account', 'debug', 'dangerzone', 'acceptableTimeFailed'
];
var create = function (configKey) {
var config;
var id = configKey;
init();
var get = function () {
return config[id];
};
function init() {
try {
config = yaml_config.load('config.yml');
} catch (err) {
console.log('could not read yml, trying Heroku vars', err);
config = {};
config[id] = {};
_.each(HEROKU_VARS_SUPPORT, function(varName) {
config[id][varName] = process.env[id.toUpperCase() + '_' + varName.toUpperCase()];
});
if(config[id].jobs) {
config[id].jobs = config[id].jobs.split(',');
}
if (!config[id].user || !config[id].password || !config[id].url) {
console.log('ERROR: Not enough values in ' + id + ' config, cannot get data');
}
}
config[id] = config[id] || { sample: true };
}
return {
get: get
};
};
return {
create: create
};
}
exports.create = ymlHerokuConfigModule().create; |
var path = require('path');
var yaml_config = require('node-yaml-config');
var _ = require('lodash');
function ymlHerokuConfigModule() {
var HEROKU_VARS_SUPPORT = [
'user', 'password', 'url', 'pipeline', 'jobs', 'key', 'secret', 'account', 'debug', 'dangerzone', 'acceptableTimeFailed', 'timeDiff'
];
var create = function (configKey) {
var config;
var id = configKey;
init();
var get = function () {
return config[id];
};
function init() {
try {
config = yaml_config.load('config.yml');
} catch (err) {
console.log('could not read yml, trying Heroku vars', err);
config = {};
config[id] = {};
_.each(HEROKU_VARS_SUPPORT, function(varName) {
config[id][varName] = process.env[id.toUpperCase() + '_' + varName.toUpperCase()];
});
if(config[id].jobs) {
config[id].jobs = config[id].jobs.split(',');
}
if (!config[id].user || !config[id].password || !config[id].url) {
console.log('ERROR: Not enough values in ' + id + ' config, cannot get data');
}
}
config[id] = config[id] || { sample: true };
}
return {
get: get
};
};
return {
create: create
};
}
exports.create = ymlHerokuConfigModule().create; | Add missing config variable name | Add missing config variable name
| JavaScript | mit | birgitta410/monart,artwise/artwise,birgitta410/monart,birgitta410/monart,artwise/artwise,artwise/artwise | ---
+++
@@ -6,7 +6,7 @@
function ymlHerokuConfigModule() {
var HEROKU_VARS_SUPPORT = [
- 'user', 'password', 'url', 'pipeline', 'jobs', 'key', 'secret', 'account', 'debug', 'dangerzone', 'acceptableTimeFailed'
+ 'user', 'password', 'url', 'pipeline', 'jobs', 'key', 'secret', 'account', 'debug', 'dangerzone', 'acceptableTimeFailed', 'timeDiff'
];
var create = function (configKey) { |
db7c53d359e9bc56fcddea038e0dc7acb1cdaffb | src/components/Lane/LaneHeader.js | src/components/Lane/LaneHeader.js | import React from 'react'
import PropTypes from 'prop-types'
import EditableLabel from 'components/widgets/EditableLabel'
import {Title, LaneHeader, RightContent } from 'styles/Base'
import LaneMenu from './LaneHeader/LaneMenu'
const LaneHeaderComponent = ({
updateTitle, canAddLanes, onDelete, onDoubleClick, inlineEditTitle, label, title, titleStyle, labelStyle, t
}) => {
return (
<LaneHeader onDoubleClick={onDoubleClick}>
<Title style={{...titleStyle, margin: '-5px'}}>
{inlineEditTitle ?
<EditableLabel value={title} border placeholder={t('placeholder.title')} onSave={updateTitle} /> :
title
}
</Title>
{label && (
<RightContent>
<span style={labelStyle}>{label}</span>
</RightContent>
)}
{canAddLanes && <LaneMenu t={t} onDelete={onDelete}/>}
</LaneHeader>
)
}
LaneHeaderComponent.propTypes = {
updateTitle: PropTypes.func,
inlineEditTitle: PropTypes.bool,
canAddLanes: PropTypes.bool,
label: PropTypes.string,
title: PropTypes.string,
onDelete: PropTypes.func,
onDoubleClick: PropTypes.func,
t: PropTypes.func.isRequired
}
LaneHeaderComponent.defaultProps = {
updateTitle: () => {},
inlineEditTitle: false,
canAddLanes: false
}
export default LaneHeaderComponent;
| import React from 'react'
import PropTypes from 'prop-types'
import EditableLabel from 'components/widgets/EditableLabel'
import {Title, LaneHeader, RightContent } from 'styles/Base'
import LaneMenu from './LaneHeader/LaneMenu'
const LaneHeaderComponent = ({
updateTitle, canAddLanes, onDelete, onDoubleClick, inlineEditTitle, label, title, titleStyle, labelStyle, t
}) => {
return (
<LaneHeader onDoubleClick={onDoubleClick}>
<Title style={titleStyle}>
{inlineEditTitle ?
<EditableLabel value={title} border placeholder={t('placeholder.title')} onSave={updateTitle} /> :
title
}
</Title>
{label && (
<RightContent>
<span style={labelStyle}>{label}</span>
</RightContent>
)}
{canAddLanes && <LaneMenu t={t} onDelete={onDelete}/>}
</LaneHeader>
)
}
LaneHeaderComponent.propTypes = {
updateTitle: PropTypes.func,
inlineEditTitle: PropTypes.bool,
canAddLanes: PropTypes.bool,
label: PropTypes.string,
title: PropTypes.string,
onDelete: PropTypes.func,
onDoubleClick: PropTypes.func,
t: PropTypes.func.isRequired
}
LaneHeaderComponent.defaultProps = {
updateTitle: () => {},
inlineEditTitle: false,
canAddLanes: false
}
export default LaneHeaderComponent;
| Remove style hardcoding (margin: '-5px') in Title component | Remove style hardcoding (margin: '-5px') in Title component
| JavaScript | mit | rcdexta/react-trello,rcdexta/react-trello | ---
+++
@@ -11,19 +11,19 @@
return (
<LaneHeader onDoubleClick={onDoubleClick}>
- <Title style={{...titleStyle, margin: '-5px'}}>
- {inlineEditTitle ?
- <EditableLabel value={title} border placeholder={t('placeholder.title')} onSave={updateTitle} /> :
- title
- }
- </Title>
- {label && (
- <RightContent>
- <span style={labelStyle}>{label}</span>
- </RightContent>
- )}
- {canAddLanes && <LaneMenu t={t} onDelete={onDelete}/>}
- </LaneHeader>
+ <Title style={titleStyle}>
+ {inlineEditTitle ?
+ <EditableLabel value={title} border placeholder={t('placeholder.title')} onSave={updateTitle} /> :
+ title
+ }
+ </Title>
+ {label && (
+ <RightContent>
+ <span style={labelStyle}>{label}</span>
+ </RightContent>
+ )}
+ {canAddLanes && <LaneMenu t={t} onDelete={onDelete}/>}
+ </LaneHeader>
)
}
|
68f2a223588cf0be920427ca4f39124a063d0a30 | public/js/admin.js | public/js/admin.js | jQuery(function($) {
$('.setting .js-save-on-change').each(function () {
var $field = $(this);
$field.closest('.setting').data('old', $field.val());
});
$(document).on('change', '.js-save-on-change', function() {
var $field = $(this);
var name = $field.attr('name');
var value = $field.val();
$field.closest('.setting').trigger('changed', [name, value]);
});
$(document).on('changed', '.setting', function(event, name, value) {
var $setting = $(this);
var old = $setting.data('old');
$setting.removeClass('saved').addClass('saving');
if (old !== value) {
FluxBB.ajax('POST', 'admin/settings/' + name, {
value: value
}).success(function(data) {
$setting.data('old', value);
$setting.addClass('saved');
}).always(function() {
$setting.removeClass('saving');
});
}
});
});
| jQuery(function($) {
$('.setting .js-save-on-change').each(function () {
var $field = $(this);
$field.closest('.setting').data('old', $field.val());
});
$(document).on('change', '.js-save-on-change', function() {
var $field = $(this);
var name = $field.attr('name');
var value = $field.val();
$field.closest('.setting').trigger('changed', [name, value]);
});
$(document).on('changed', '.setting', function(event, name, value) {
var $setting = $(this);
var old = $setting.data('old');
$setting.removeClass('saved').addClass('saving');
if (old !== value) {
FluxBB.ajax('POST', 'admin/settings/' + name, {
value: value
}).success(function(data) {
$setting.data('old', value);
$setting.addClass('saved');
}).fail(function () {
$setting.trigger('failed', [old]);
}).always(function() {
$setting.removeClass('saving');
});
}
});
$(document).on('failed', '.setting', function(event, oldValue) {
var $field = $(this).find('.js-save-on-change');
$field.val(oldValue);
});
});
| Reset setting fields when saving fails. | Reset setting fields when saving fails.
| JavaScript | mit | fluxbb/core,fluxbb/core | ---
+++
@@ -24,9 +24,16 @@
}).success(function(data) {
$setting.data('old', value);
$setting.addClass('saved');
+ }).fail(function () {
+ $setting.trigger('failed', [old]);
}).always(function() {
$setting.removeClass('saving');
});
}
});
+
+ $(document).on('failed', '.setting', function(event, oldValue) {
+ var $field = $(this).find('.js-save-on-change');
+ $field.val(oldValue);
+ });
}); |
5760b9bc06813d6411b9d575d5f7d918e49217d3 | public/js/index.js | public/js/index.js | "use strict";
var router = new VueRouter({
routes: [
{ path: "/search", component: Vue.component("main-search") },
{ path: "/tags", component: Vue.component("main-tags") },
{ path: "/upload", component: Vue.component("main-upload") },
{ path: "/options", component: Vue.component("main-options") },
{ path: "/view/:id", component: Vue.component("main-view") },
{ path: "/wiki/:name", component: Vue.component("main-wiki") },
{ path: "/", redirect: "/search" },
],
});
Vue.http.options.root = "/api";
var app = new Vue({
router: router,
data: {
title: "JSBooru",
itemsPerPage: 20,
},
methods: {
setItemsPerPage: function (newValue) {
console.log(newValue);
this.itemsPerPage = newValue;
},
},
}).$mount("#app");
| "use strict";
var router = new VueRouter({
routes: [
{ path: "/search", component: Vue.component("main-search") },
{ path: "/tags", component: Vue.component("main-tags") },
{ path: "/upload", component: Vue.component("main-upload") },
{ path: "/options", component: Vue.component("main-options") },
{ path: "/view/:id", component: Vue.component("main-view") },
{ path: "/wiki/:name", component: Vue.component("main-wiki") },
{ path: "/", redirect: "/search" },
],
});
Vue.http.options.root = "/api";
var app = new Vue({
router: router,
data: {
title: "JSBooru",
itemsPerPage: 20,
},
methods: {
setItemsPerPage: function (newValue) {
this.itemsPerPage = newValue;
this.saveToLocalStorage();
},
saveToLocalStorage: function () {
var data = {
itemsPerPage: this.itemsPerPage,
};
var dataAsDecodedString = JSON.stringify(data);
var dataAsEncodedString = btoa(dataAsDecodedString);
window.localStorage.setItem("options", dataAsEncodedString);
},
loadFromLocalStorage: function () {
var dataAsEncodedString =
window.localStorage.getItem("options") || "";
var dataAsDecodedString = atob(dataAsEncodedString) || "";
var data = {};
try {
data = JSON.parse(dataAsDecodedString) || {};
} catch {
// NO OP
}
this.itemsPerPage = data.itemsPerPage || 20;
},
},
created: function () {
this.loadFromLocalStorage();
},
}).$mount("#app");
| Store the options in the local storage | Store the options in the local storage
| JavaScript | mit | Dexesttp/jsbooru,Dexesttp/jsbooru | ---
+++
@@ -22,8 +22,31 @@
},
methods: {
setItemsPerPage: function (newValue) {
- console.log(newValue);
this.itemsPerPage = newValue;
+ this.saveToLocalStorage();
+ },
+ saveToLocalStorage: function () {
+ var data = {
+ itemsPerPage: this.itemsPerPage,
+ };
+ var dataAsDecodedString = JSON.stringify(data);
+ var dataAsEncodedString = btoa(dataAsDecodedString);
+ window.localStorage.setItem("options", dataAsEncodedString);
+ },
+ loadFromLocalStorage: function () {
+ var dataAsEncodedString =
+ window.localStorage.getItem("options") || "";
+ var dataAsDecodedString = atob(dataAsEncodedString) || "";
+ var data = {};
+ try {
+ data = JSON.parse(dataAsDecodedString) || {};
+ } catch {
+ // NO OP
+ }
+ this.itemsPerPage = data.itemsPerPage || 20;
},
},
+ created: function () {
+ this.loadFromLocalStorage();
+ },
}).$mount("#app"); |
dc39de1103dc4f0f5e29f88fbed4d3d704a1b46b | src/foam/nanos/client/Client.js | src/foam/nanos/client/Client.js | /**
* @license
* Copyright 2018 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.GENMODEL({
package: 'foam.nanos.client',
name: 'Client',
implements: [ 'foam.box.Context' ],
requires: [
// TODO This is just for the build part. Without it, there's no way of
// knowing that this class uses ClientBuilder so it won't get built by build
// tool without explicitly listing it.
'foam.nanos.client.ClientBuilder',
'foam.box.HTTPBox',
'foam.dao.RequestResponseClientDAO',
'foam.dao.ClientDAO',
'foam.dao.EasyDAO'
],
build: function(X) {
return X.classloader.load('foam.nanos.client.ClientBuilder').then(function(cls) {
return new Promise(function(resolve, reject) {
var b = cls.create(null, X);
b.then(resolve);
});
});
}
});
| /**
* @license
* Copyright 2018 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
foam.GENMODEL({
package: 'foam.nanos.client',
name: 'Client',
implements: [ 'foam.box.Context' ],
requires: [
// TODO This is just for the build part. Without it, there's no way of
// knowing that this class uses ClientBuilder so it won't get built by build
// tool without explicitly listing it. Think of a better place for this.
'foam.nanos.client.ClientBuilder',
'foam.box.HTTPBox',
'foam.dao.RequestResponseClientDAO',
'foam.dao.ClientDAO',
'foam.dao.EasyDAO'
],
build: function(X) {
return X.classloader.load('foam.nanos.client.ClientBuilder').then(function(cls) {
return new Promise(function(resolve, reject) {
var b = cls.create(null, X);
b.then(resolve);
});
});
}
});
| Add action item to TODO. | Add action item to TODO.
| JavaScript | apache-2.0 | foam-framework/foam2,foam-framework/foam2,jacksonic/vjlofvhjfgm,jacksonic/vjlofvhjfgm,foam-framework/foam2,jacksonic/vjlofvhjfgm,foam-framework/foam2,foam-framework/foam2 | ---
+++
@@ -11,7 +11,7 @@
requires: [
// TODO This is just for the build part. Without it, there's no way of
// knowing that this class uses ClientBuilder so it won't get built by build
- // tool without explicitly listing it.
+ // tool without explicitly listing it. Think of a better place for this.
'foam.nanos.client.ClientBuilder',
'foam.box.HTTPBox', |
9869d0cf8a88e3d5c88c5f0cb49c1b3debf16c02 | src/components/floating-button/FloatingButton.js | src/components/floating-button/FloatingButton.js | 'use strict';
import React, { Component } from 'react';
import ReactCSS from 'reactcss';
class FloatingButton extends Component {
classes() {
return {
'default': {
},
};
}
render() {
return <div>
<button>Item</button>
</div>;
}
}
export default ReactCSS(FloatingButton);
| 'use strict';
import React, { Component } from 'react';
import ReactCSS from 'reactcss';
class FloatingButton extends Component {
classes() {
return {
'default': {
},
};
}
handleClick = () => this.props.onClick && this.props.onClick();
render() {
return <div onClick={ this.handleClick }>
<a is="floatingButton">Item</a>
</div>;
}
}
export default ReactCSS(FloatingButton);
| Update floating button to use handleClick callback | Update floating button to use handleClick callback
| JavaScript | mit | henryboldi/felony,tobycyanide/felony,tobycyanide/felony,henryboldi/felony | ---
+++
@@ -12,9 +12,11 @@
};
}
+ handleClick = () => this.props.onClick && this.props.onClick();
+
render() {
- return <div>
- <button>Item</button>
+ return <div onClick={ this.handleClick }>
+ <a is="floatingButton">Item</a>
</div>;
}
} |
e1d37539f73bc201bc4b65baa6f77727ac4adc99 | Text.js | Text.js | enyo.kind({
name: "enyo.canvas.Text",
kind: enyo.canvas.Shape,
published: {
text: "",
font: "12pt Arial",
align: "left",
},
renderSelf: function(ctx) {
ctx.textAlign = this.align;
ctx.font = this.font;
this.draw(ctx);
},
fill: function(ctx) {
ctx.fillText(this.text, this.bounds.l, this.bounds.t);
},
outline: function(ctx) {
ctx.strokeText(this.text, this.bounds.l, this.bounds.t);
}
});
| enyo.kind({
name: "enyo.canvas.Text",
kind: enyo.canvas.Shape,
published: {
text: "",
font: "12pt Arial",
align: "left"
},
renderSelf: function(ctx) {
ctx.textAlign = this.align;
ctx.font = this.font;
this.draw(ctx);
},
fill: function(ctx) {
ctx.fillText(this.text, this.bounds.l, this.bounds.t);
},
outline: function(ctx) {
ctx.strokeText(this.text, this.bounds.l, this.bounds.t);
}
});
| Fix trailing comma that causes load problems in IE | Fix trailing comma that causes load problems in IE
| JavaScript | apache-2.0 | wleopar-d/html5-Canvas2-,enyojs/canvas | ---
+++
@@ -4,7 +4,7 @@
published: {
text: "",
font: "12pt Arial",
- align: "left",
+ align: "left"
},
renderSelf: function(ctx) {
ctx.textAlign = this.align; |
8c2dff812e52fcc0cad59778675a5a9f4e78ca0a | src/domain/createApiActionCreator/index.js | src/domain/createApiActionCreator/index.js | import { fetch } from 'domain/Api';
import ApiCall from 'containers/ApiCalls';
/*
* Supports currying so that args can be recycled more conveniently.
* A contrived example:
* ```
* const createCreatorForX =
* createApiActionCreator('X_REQUEST', 'X_SUCCESS', 'X_FAILURE', 'http://...');
* const getXActionCreator = createCreatorForX('GET');
* const postXActionCreator = createCreatorForX('POST');
* ```
*/
const createApiActionCreator = (
requestActionType, successActionType, failureActionType, url, method) =>
(dispatch) => {
return dispatch(createFetchRequestAction()).payload
.then((response) => dispatch(createFetchSuccessAction(response)))
.catch((error) => dispatch(createFetchFailureAction(error)));
function createFetchRequestAction() {
return ApiCall.createAction({
type: requestActionType,
payload: fetch(url),
url,
method,
});
}
function createFetchSuccessAction(response) {
return ApiCall.createAction({
type: successActionType,
payload: response,
url,
method,
});
}
function createFetchFailureAction(error) {
return ApiCall.createAction({
type: failureActionType,
error,
url,
method,
});
}
};
const curried = (...args) => {
if (args.length >= createApiActionCreator.length) {
return createApiActionCreator.apply(this, args);
}
return (...rest) => curried.apply(this, args.concat(rest));
};
export default curried;
| import { fetch } from 'domain/Api';
import ApiCall from 'containers/ApiCalls';
/*
* Supports currying so that args can be recycled more conveniently.
* A contrived example:
* ```
* const createCreatorForX =
* createApiActionCreator('X_REQUEST', 'X_SUCCESS', 'X_FAILURE', 'http://...');
* const getXActionCreator = createCreatorForX('GET');
* const postXActionCreator = createCreatorForX('POST');
* ```
*/
const createApiActionCreator = (
requestActionType, successActionType, failureActionType, url, method = 'GET') =>
(dispatch) => {
return dispatch(createFetchRequestAction()).payload
.then((response) => dispatch(createFetchSuccessAction(response)))
.catch((error) => dispatch(createFetchFailureAction(error)));
function createFetchRequestAction() {
return ApiCall.createAction({
type: requestActionType,
payload: fetch(url),
url,
method,
});
}
function createFetchSuccessAction(response) {
return ApiCall.createAction({
type: successActionType,
payload: response,
url,
method,
});
}
function createFetchFailureAction(error) {
return ApiCall.createAction({
type: failureActionType,
error,
url,
method,
});
}
};
const curried = (...args) => {
if (args.length >= createApiActionCreator.length) {
return createApiActionCreator.apply(this, args);
}
return (...rest) => curried.apply(this, args.concat(rest));
};
export default curried;
| Put an arg default back | createNotificationsMiddleware: Put an arg default back
| JavaScript | mit | e1-bsd/omni-common-ui,e1-bsd/omni-common-ui | ---
+++
@@ -13,7 +13,7 @@
*/
const createApiActionCreator = (
- requestActionType, successActionType, failureActionType, url, method) =>
+ requestActionType, successActionType, failureActionType, url, method = 'GET') =>
(dispatch) => {
return dispatch(createFetchRequestAction()).payload
.then((response) => dispatch(createFetchSuccessAction(response))) |
12d0f923a9d8f45d131aa54d8a92784a743449db | server.js | server.js | 'use strict';
var express = require('express')
, logger = require('morgan')
, mongoose = require('mongoose')
, path = require('path')
, messages = require('./routes/messages')
, users = require('./routes/users')
, config = require('./lib/config')
, app
;
app = express();
mongoose.connect(config.mongoUri, function (err) {
if (err) {
throw 'Couldn\'t connect to MongoDB: ' + err;
}
});
app.use(logger(config.logger));
app.use(require('body-parser').json());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/users', users);
app.use('/messages', messages);
/// catch 404 and forwarding to error handler
app.use(function (req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.json({ error: err.message });
if (err.status !== 404) {
console.error(err.stack);
}
});
module.exports = app;
| 'use strict';
var express = require('express')
, logger = require('morgan')
, mongoose = require('mongoose')
, path = require('path')
, messages = require('./routes/messages')
, users = require('./routes/users')
, config = require('./lib/config')
, app
;
app = express();
mongoose.connect(config.mongoUri, function (err) {
if (err) {
throw 'Couldn\'t connect to MongoDB: ' + err;
}
});
app.use(logger(config.logger));
app.use(require('body-parser').json());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/users', users);
app.use('/messages', messages);
/// catch 404 and forwarding to error handler
app.use(function (req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.json({ error: err.message });
if (err.stack) {
console.error(err.stack);
}
});
module.exports = app;
| Print stack trace on all errors that have it | Print stack trace on all errors that have it
| JavaScript | mit | Hilzu/SecureChat | ---
+++
@@ -35,7 +35,7 @@
app.use(function (err, req, res, next) {
res.status(err.status || 500);
res.json({ error: err.message });
- if (err.status !== 404) {
+ if (err.stack) {
console.error(err.stack);
}
}); |
44465f21591a5497a687e2cceecaef5cb278833e | server.js | server.js | var express = require('express'),
routes = require(__dirname + '/app/routes.js'),
app = express(),
port = (process.env.PORT || 3000);
// Application settings
app.engine('html', require(__dirname + '/lib/template-engine.js').__express);
app.set('view engine', 'html');
app.set('vendorViews', __dirname + '/govuk_modules/views');
app.set('views', __dirname + '/app/views');
// Middleware to serve static assets
app.use('/public', express.static(__dirname + '/public'));
app.use('/public', express.static(__dirname + '/govuk_modules/public'));
app.use(express.json()); // to support JSON-encoded bodies
app.use(express.urlencoded()); // to support URL-encoded bodies
// send assetPath to all views
app.use(function (req, res, next) {
res.locals.asset_path="/public/";
next();
});
// routes (found in routes.js)
routes.bind(app, '/public/');
// start the app
app.listen(port);
console.log('');
console.log('Listening on port ' + port);
console.log('');
| var express = require('express'),
routes = require(__dirname + '/app/routes.js'),
app = express(),
port = (process.env.PORT || 3000);
// Application settings
app.engine('html', require(__dirname + '/lib/template-engine.js').__express);
app.set('view engine', 'html');
app.set('vendorViews', __dirname + '/govuk_modules/views');
app.set('views', __dirname + '/app/views');
// Middleware to serve static assets
app.use('/public', express.static(__dirname + '/public'));
app.use('/public', express.static(__dirname + '/govuk_modules/govuk_template/assets'));
app.use('/public', express.static(__dirname + '/govuk_modules/govuk_frontend_toolkit'));
app.use(express.json()); // to support JSON-encoded bodies
app.use(express.urlencoded()); // to support URL-encoded bodies
// send assetPath to all views
app.use(function (req, res, next) {
res.locals.asset_path="/public/";
next();
});
// routes (found in routes.js)
routes.bind(app, '/public/');
// start the app
app.listen(port);
console.log('');
console.log('Listening on port ' + port);
console.log('');
| Add Middleware to serve static assets | Add Middleware to serve static assets
| JavaScript | mit | joelanman/govuk_elements,joelanman/govuk_elements | ---
+++
@@ -11,7 +11,8 @@
// Middleware to serve static assets
app.use('/public', express.static(__dirname + '/public'));
-app.use('/public', express.static(__dirname + '/govuk_modules/public'));
+app.use('/public', express.static(__dirname + '/govuk_modules/govuk_template/assets'));
+app.use('/public', express.static(__dirname + '/govuk_modules/govuk_frontend_toolkit'));
app.use(express.json()); // to support JSON-encoded bodies
app.use(express.urlencoded()); // to support URL-encoded bodies
|
35debf8c05fb5233841374331ae40853ec851437 | server.js | server.js | var express = require('express');
var redis = require('ioredis');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/endpoints');
var users = require('./routes/users');
var api = express();
// var redis = new Redis('/tmp/redis.sock');
api.get('/', function(req, res){
res.send('Hello World');
});
api.use(function(err, req, res, next){
console.error(err.stack);
res.send(500, 'Something broke!');
});
api.set('port', process.env.PORT || 3000);
var server = api.listen(api.get('port'), function() {
console.log('Listening on port %d', server.address().port);
});
| var express = require('express');
var redis = require('ioredis');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/endpoints');
var users = require('./routes/users');
var api = express();
// var redis = new Redis('/tmp/redis.sock');
api.get('/', function(req, res){
res.send('Hello World');
});
api.use(function(err, req, res, next){
console.error(err.stack);
res.send(500, 'Something broke!');
});
api.set('port', process.env.PORT || 3000);
var server = api.listen(api.get('port'), function() {
console.log('Listening on port %d', server.address().port);
});
module.exports = api;
| Add api to module exports | Add api to module exports
| JavaScript | mit | nathansmyth/node-stack,nathansmyth/node-stack | ---
+++
@@ -23,3 +23,5 @@
var server = api.listen(api.get('port'), function() {
console.log('Listening on port %d', server.address().port);
});
+
+module.exports = api; |
3a5c59ddecc7e5948d93afb00e2487c9001d64f3 | app/assets/javascripts/peoplefinder/help-area.js | app/assets/javascripts/peoplefinder/help-area.js | $('.help-content').hide()
$('.help-toggle').click(function(){
$(this).toggleClass('open').next('.help-content').slideToggle('slow');
}); | /* global $ */
$('.help-content').hide();
$('.help-toggle').click(function(){
$(this).toggleClass('open').next('.help-content').slideToggle('slow');
});
| Tweak JavaScript to pass lint | Tweak JavaScript to pass lint
| JavaScript | mit | MjAbuz/peoplefinder,ministryofjustice/peoplefinder,ministryofjustice/peoplefinder,ministryofjustice/peoplefinder,ministryofjustice/peoplefinder,MjAbuz/peoplefinder,MjAbuz/peoplefinder,MjAbuz/peoplefinder,ministryofjustice/peoplefinder | ---
+++
@@ -1,4 +1,6 @@
-$('.help-content').hide()
+/* global $ */
+
+$('.help-content').hide();
$('.help-toggle').click(function(){
$(this).toggleClass('open').next('.help-content').slideToggle('slow');
}); |
f7443077399ae76499cb339afcbef5db45c5ace8 | app/components/shared/Panel/intro-with-button.js | app/components/shared/Panel/intro-with-button.js | import React from "react";
class IntroWithButton extends React.Component {
static displayName = "Panel.IntroWithButton";
static propTypes = {
children: React.PropTypes.node.isRequired
};
render() {
return (
<div className="py3 px3 flex">
{this.props.children[0]}
<div className="ml3">
{this.props.children[1]}
</div>
</div>
);
}
}
export default IntroWithButton;
| import React from "react";
class IntroWithButton extends React.Component {
static displayName = "Panel.IntroWithButton";
static propTypes = {
children: React.PropTypes.node.isRequired
};
render() {
let children = React.Children.toArray(this.props.children);
let intro;
let button;
if(children.length == 1) {
intro = children;
} else {
button = children.pop();
intro = children;
}
if(button) {
button = (
<div className="ml3">
{button}
</div>
);
}
return (
<div className="py3 px3 flex">
{intro}
{button}
</div>
);
}
}
export default IntroWithButton;
| Handle case where IntroWithButton has no button | Handle case where IntroWithButton has no button
| JavaScript | mit | buildkite/frontend,fotinakis/buildkite-frontend,buildkite/frontend,fotinakis/buildkite-frontend | ---
+++
@@ -8,12 +8,29 @@
};
render() {
+ let children = React.Children.toArray(this.props.children);
+
+ let intro;
+ let button;
+ if(children.length == 1) {
+ intro = children;
+ } else {
+ button = children.pop();
+ intro = children;
+ }
+
+ if(button) {
+ button = (
+ <div className="ml3">
+ {button}
+ </div>
+ );
+ }
+
return (
<div className="py3 px3 flex">
- {this.props.children[0]}
- <div className="ml3">
- {this.props.children[1]}
- </div>
+ {intro}
+ {button}
</div>
);
} |
ee33df0c5c35339239ce82662d295dc2204035a5 | assets/scripts/bookmark/controller/BookMark.js | assets/scripts/bookmark/controller/BookMark.js | angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | angular.module('caco.bookmark.crtl', ['caco.bookmark.REST'])
.controller('BookMarkCrtl', function ($rootScope, $scope, $stateParams, $location, BookMarkREST) {
$rootScope.module = 'bookmark';
if ($stateParams.id) {
BookMarkREST.one({id: $stateParams.id}, function (data) {
$scope.bookmark = data.response;
});
}
if ($location.path() === '/bookmark') {
BookMarkREST.all({}, function (data) {
$scope.bookmarks = data.response;
});
}
$scope.add = function () {
BookMarkREST.add({}, $scope.newBookmark, function () {
$location.path('/bookmark');
});
};
$scope.delete = function (id) {
if (!confirm('Confirm delete')) {
return;
}
BookMarkREST.remove({id: id}, {}, function(data) {
if (data.status != 200) {
return;
}
for (var i = $scope.bookmarks.length - 1; i >= 0; i--) {
if ($scope.bookmarks[i].id != id) {
continue;
}
$scope.bookmarks.splice(i, 1);
}
});
};
$scope.edit = function () {
BookMarkREST.edit({id: $scope.bookmark.id}, $scope.bookmark, function (data) {
$location.path('/bookmark');
});
};
}); | Save one request on bookmark delete. | Save one request on bookmark delete.
| JavaScript | mit | Cacodaimon/CacoCloud,Cacodaimon/CacoCloud,Cacodaimon/CacoCloud,Cacodaimon/CacoCloud | ---
+++
@@ -25,9 +25,17 @@
}
BookMarkREST.remove({id: id}, {}, function(data) {
- BookMarkREST.all({}, function (data) {
- $scope.bookmarks = data.response;
- });
+ if (data.status != 200) {
+ return;
+ }
+
+ for (var i = $scope.bookmarks.length - 1; i >= 0; i--) {
+ if ($scope.bookmarks[i].id != id) {
+ continue;
+ }
+
+ $scope.bookmarks.splice(i, 1);
+ }
});
};
|
57ec8ec0afca5b79742deecddb4fe4a509b05918 | commons/js/index.js | commons/js/index.js | (function main() {
var active = $('ul.nav li.active');
$('#ART').add('#credits').show(900);
$('ul.nav').on('click', 'li', function() {
$(active.removeClass('active')
.find('a')
.attr('href')).hide(300);
$((active = $(this)).addClass('active')
.find('a')
.attr('href')).show(600);
});
})(); | (function main() {
var active = $('ul.nav li.active');
$('#ART').add('#credits').fadeIn(900);
$('ul.nav').on('click', 'li', function() {
$(active.removeClass('active')
.find('a')
.attr('href')).fadeOut(300);
$((active = $(this)).addClass('active')
.find('a')
.attr('href')).fadeIn(1800);
});
})(); | Use fadeIn/Out instead of show/hide since the latter are laggy in weaker machines | Use fadeIn/Out instead of show/hide since the latter are laggy in weaker machines
| JavaScript | mit | artbytrie/artbytrie.github.io,artbytrie/artbytrie.github.io | ---
+++
@@ -1,14 +1,14 @@
(function main() {
var active = $('ul.nav li.active');
- $('#ART').add('#credits').show(900);
+ $('#ART').add('#credits').fadeIn(900);
$('ul.nav').on('click', 'li', function() {
$(active.removeClass('active')
.find('a')
- .attr('href')).hide(300);
+ .attr('href')).fadeOut(300);
$((active = $(this)).addClass('active')
.find('a')
- .attr('href')).show(600);
+ .attr('href')).fadeIn(1800);
});
})(); |
068b8cb55fb5f0ab6e51f9a19e202c88f1cc1210 | src/js/weapon/bow.js | src/js/weapon/bow.js | 'use strict';
Darwinator.Bow = function(game, coolDown, bulletSpeed, bullets, damage, owner) {
Darwinator.Weapon.call(this, game, coolDown, bulletSpeed, damage, owner);
this.bullets.createMultiple(30, 'arrow');
this.bullets.setAll('anchor.x', 0.5);
this.bullets.setAll('anchor.y', 0.5);
this.bullets.setAll('outOfBoundsKill', true);
this.game.physics.enable(this.bullets, Phaser.Physics.ARCADE);
bullets.add(this.bullets);
};
Darwinator.Bow.prototype = Object.create(Darwinator.Weapon.prototype);
| 'use strict';
Darwinator.Bow = function(game, coolDown, bulletSpeed, bullets, damage, owner) {
Darwinator.Weapon.call(this, game, coolDown, bulletSpeed, damage, owner);
this.bullets.createMultiple(30, 'arrow');
this.bullets.setAll('anchor.x', 0.5);
this.bullets.setAll('anchor.y', 0.5);
this.bullets.setAll('outOfBoundsKill', true);
this.bullets.setAll('owner', this.owner);
this.game.physics.enable(this.bullets, Phaser.Physics.ARCADE);
bullets.add(this.bullets);
};
Darwinator.Bow.prototype = Object.create(Darwinator.Weapon.prototype);
| Make bullets keep track of their weapons owners | Make bullets keep track of their weapons owners
| JavaScript | mit | werme/DATX02 | ---
+++
@@ -6,6 +6,7 @@
this.bullets.setAll('anchor.x', 0.5);
this.bullets.setAll('anchor.y', 0.5);
this.bullets.setAll('outOfBoundsKill', true);
+ this.bullets.setAll('owner', this.owner);
this.game.physics.enable(this.bullets, Phaser.Physics.ARCADE);
bullets.add(this.bullets);
}; |
f2354cb75e3413130d53ae7fe81572d1d43a46c1 | lib/exposure/exposure.config.schema.js | lib/exposure/exposure.config.schema.js | import createGraph from '../query/lib/createGraph.js';
import {Match} from 'meteor/check';
export const ExposureDefaults = {
blocking: false,
method: true,
publication: true,
};
export const ExposureSchema = {
firewall: Match.Maybe(
Match.OneOf(Function, [Function])
),
maxLimit: Match.Maybe(Match.Integer),
maxDepth: Match.Maybe(Match.Integer),
publication: Match.Maybe(Boolean),
method: Match.Maybe(Boolean),
blocking: Match.Maybe(Boolean),
body: Match.Maybe(Object),
restrictedFields: Match.Maybe([String]),
restrictLinks: Match.Maybe(
Match.OneOf(Function, [String])
),
};
export function validateBody(collection, body) {
try {
createGraph(collection, body);
} catch (e) {
throw new Meteor.Error('invalid-body', 'We could not build a valid graph when trying to create your exposure: ' + e.toString())
}
} | import createGraph from '../query/lib/createGraph.js';
import {Match} from 'meteor/check';
export const ExposureDefaults = {
blocking: false,
method: true,
publication: true,
};
export const ExposureSchema = {
firewall: Match.Maybe(
Match.OneOf(Function, [Function])
),
maxLimit: Match.Maybe(Match.Integer),
maxDepth: Match.Maybe(Match.Integer),
publication: Match.Maybe(Boolean),
method: Match.Maybe(Boolean),
blocking: Match.Maybe(Boolean),
body: Match.Maybe(Match.OneOf(Object, Function)),
restrictedFields: Match.Maybe([String]),
restrictLinks: Match.Maybe(
Match.OneOf(Function, [String])
),
};
export function validateBody(collection, body) {
try {
createGraph(collection, body);
} catch (e) {
throw new Meteor.Error('invalid-body', 'We could not build a valid graph when trying to create your exposure: ' + e.toString())
}
}
| Allow functions in global exposure bodies | Allow functions in global exposure bodies | JavaScript | mit | cult-of-coders/grapher | ---
+++
@@ -16,7 +16,7 @@
publication: Match.Maybe(Boolean),
method: Match.Maybe(Boolean),
blocking: Match.Maybe(Boolean),
- body: Match.Maybe(Object),
+ body: Match.Maybe(Match.OneOf(Object, Function)),
restrictedFields: Match.Maybe([String]),
restrictLinks: Match.Maybe(
Match.OneOf(Function, [String]) |
470493391503d7884774348909dc78b2c0f3cb06 | data.js | data.js | var async = require('async');
var pingdom = require('./pingdom');
function checks(config, limit, done) {
var api = pingdom(config);
api.checks(function(err, checks) {
if(err) return console.error(err);
async.map(checks, function(check, cb) {
api.results(function(err, results) {
if(err) return cb(err);
cb(null, {
name: check.name,
host: check.hostname,
type: check.type,
lastresponse: check.lastresponsetime,
data: results.map(function(result) {
return {
x: result.time,
y: result.responsetime
};
})
});
}, {
target: check.id,
qs: {
limit: limit
}
});
}, done);
});
}
exports.checks = checks;
| var async = require('async');
var pingdom = require('./pingdom');
function checks(config, limit, done) {
var api = pingdom(config);
api.checks(function(err, checks) {
if(err) return console.error(err);
async.map(checks, function(check, cb) {
api.results(function(err, results) {
if(err) return cb(err);
cb(null, {
name: check.name,
host: check.hostname,
type: check.type,
lastresponse: check.lastresponsetime,
data: results.map(function(result) {
return {
x: result.time * 1000, // s to ms
y: result.responsetime
};
})
});
}, {
target: check.id,
qs: {
limit: limit
}
});
}, done);
});
}
exports.checks = checks;
| Convert time to JS format | Convert time to JS format
JS uses ms instead of s provided by the API.
| JavaScript | mit | bebraw/cdnperf,cdnperf/cdnperf,cdnperf/cdnperf,bebraw/cdnperf | ---
+++
@@ -20,7 +20,7 @@
lastresponse: check.lastresponsetime,
data: results.map(function(result) {
return {
- x: result.time,
+ x: result.time * 1000, // s to ms
y: result.responsetime
};
}) |
b5a89d7e56dac058396cbd417c1c0abedc5f5aac | test/app.js | test/app.js | require('dotenv/config')
const sinon = require('sinon')
const tap = require('tap')
const App = require('../lib/app')
tap.test('App', async t => {
await t.test('run', async t => {
await t.test(`logs 'Hello, $NAME!'`, async t => {
const message = `Hello, ${process.env.NAME}!`
const mock = sinon.mock(console)
mock
.expects('log')
.calledWithExactly(message)
const app = new App()
await app.run()
mock.verify()
mock.restore()
})
})
})
| require('dotenv/config')
const sinon = require('sinon')
const tap = require('tap')
const App = require('../lib/app')
tap.test('App', async t => {
await t.test('run', async t => {
await t.test(`logs 'Hello, $NAME!'`, async () => {
const message = `Hello, ${process.env.NAME}!`
const mock = sinon.mock(console)
mock
.expects('log')
.calledWithExactly(message)
const app = new App()
await app.run()
mock.verify()
mock.restore()
})
})
})
| Remove unused var in test | Remove unused var in test
| JavaScript | mit | jordanbtucker/node-init,jordanbtucker/node-init | ---
+++
@@ -6,7 +6,7 @@
tap.test('App', async t => {
await t.test('run', async t => {
- await t.test(`logs 'Hello, $NAME!'`, async t => {
+ await t.test(`logs 'Hello, $NAME!'`, async () => {
const message = `Hello, ${process.env.NAME}!`
const mock = sinon.mock(console) |
39d54af818c9c1c02c79b041fc662e49c1879ec5 | app/javascript/components/Filters/FilterOverlayTrigger/component.js | app/javascript/components/Filters/FilterOverlayTrigger/component.js | import React from 'react';
import PropTypes from 'prop-types';
import Button from 'react-bootstrap/Button';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import { getButtonHintString } from '../utils';
import FilterPopover from '../FilterPopover/component';
class FilterOverlayTrigger extends React.Component {
static propTypes = {
id: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
popoverContent: PropTypes.node.isRequired,
popoverClass: PropTypes.string,
buttonsContainerClass: PropTypes.string,
onSubmit: PropTypes.func.isRequired,
hints: PropTypes.arrayOf(PropTypes.string),
buttonClass: PropTypes.string,
};
renderPopover = () => {
const { id, popoverContent, popoverClass, buttonsContainerClass, onSubmit } = this.props;
return (
<FilterPopover
id={id}
onSubmit={onSubmit}
className={popoverClass}
buttonsContainerClass={buttonsContainerClass}
>
{popoverContent}
</FilterPopover>
);
}
render() {
const { id, title, hints, buttonClass } = this.props;
return (
<OverlayTrigger
id={id}
containerPadding={25}
overlay={this.renderPopover()}
placement="bottom"
rootClose
trigger="click"
>
<Button id={id} variant="secondary" className={buttonClass}>
{title + getButtonHintString(hints)}
</Button>
</OverlayTrigger>
);
}
}
export default FilterOverlayTrigger;
| import React from 'react';
import PropTypes from 'prop-types';
import Button from 'react-bootstrap/Button';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import { getButtonHintString } from '../utils';
import FilterPopover from '../FilterPopover/component';
class FilterOverlayTrigger extends React.Component {
static propTypes = {
id: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
popoverContent: PropTypes.node.isRequired,
popoverClass: PropTypes.string,
buttonsContainerClass: PropTypes.string,
onSubmit: PropTypes.func.isRequired,
hints: PropTypes.arrayOf(PropTypes.string),
buttonClass: PropTypes.string,
};
handleExit = () => {
const { onSubmit } = this.props;
// TODO: Don't search if nothing was modified.
onSubmit();
}
renderPopover = () => {
const { id, popoverContent, popoverClass, buttonsContainerClass, onSubmit } = this.props;
return (
<FilterPopover
id={id}
onSubmit={onSubmit}
className={popoverClass}
buttonsContainerClass={buttonsContainerClass}
>
{popoverContent}
</FilterPopover>
);
}
render() {
const { id, title, hints, buttonClass } = this.props;
return (
<OverlayTrigger
id={id}
containerPadding={25}
overlay={this.renderPopover()}
placement="bottom"
rootClose
onExit={this.handleExit}
trigger="click"
>
<Button id={id} variant="secondary" className={buttonClass}>
{title + getButtonHintString(hints)}
</Button>
</OverlayTrigger>
);
}
}
export default FilterOverlayTrigger;
| Apply search when dismissing any popover | 9623: Apply search when dismissing any popover
| JavaScript | apache-2.0 | thecartercenter/elmo,thecartercenter/elmo,thecartercenter/elmo | ---
+++
@@ -17,6 +17,12 @@
hints: PropTypes.arrayOf(PropTypes.string),
buttonClass: PropTypes.string,
};
+
+ handleExit = () => {
+ const { onSubmit } = this.props;
+ // TODO: Don't search if nothing was modified.
+ onSubmit();
+ }
renderPopover = () => {
const { id, popoverContent, popoverClass, buttonsContainerClass, onSubmit } = this.props;
@@ -43,6 +49,7 @@
overlay={this.renderPopover()}
placement="bottom"
rootClose
+ onExit={this.handleExit}
trigger="click"
>
<Button id={id} variant="secondary" className={buttonClass}> |
0f0e4153ad6041a834d06a7947662e6e15e3eca4 | schema/settings.js | schema/settings.js | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
var SettingSchema = new Schema({
modLogID: {
type: Number,
required: false
},
filterInvites: {
type: Boolean,
required: false,
default: false
}
});
module.exports = SettingSchema; | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
var SettingSchema = new Schema({
modLogID: {
type: Number,
required: false
},
muteRoleID: {
type: Number,
required: false
},
filterInvites: {
type: Boolean,
required: false,
default: false
}
});
module.exports = SettingSchema; | Add support for mute role | Add support for mute role
| JavaScript | mit | steamboat-dev/shared | ---
+++
@@ -3,6 +3,10 @@
var SettingSchema = new Schema({
modLogID: {
+ type: Number,
+ required: false
+ },
+ muteRoleID: {
type: Number,
required: false
}, |
779fdd103374a6edb27d555e23aaace7a6f7caa3 | public/assets/default/js/thread.js | public/assets/default/js/thread.js |
$(document).ready(function(){
var simplemde = new SimpleMDE({
element: $("#postreply")[0],
autosave: {
enabled: true,
delay: 2000,
unique_id: "thread-" + window.thread_id // save drafts based on thread id
},
spellChecker: false
});
});
|
$(document).ready(function(){
var simplemde = new SimpleMDE({
element: $("#postreply")[0],
// Autosave disabled temporarily because it keeps it's content even after submitting (Clearboard will use a custom AJAX submit function)
/*autosave: {
enabled: true,
delay: 2000,
unique_id: "thread-" + window.thread_id // save drafts based on thread id
},*/
spellChecker: false
});
});
| Disable SimpleMDE autosaving, as it retains it would retain it's content after posting | Disable SimpleMDE autosaving, as it retains it would retain it's content after posting
| JavaScript | mit | clearboard/clearboard,mitchfizz05/clearboard,mitchfizz05/clearboard,clearboard/clearboard | ---
+++
@@ -2,11 +2,12 @@
$(document).ready(function(){
var simplemde = new SimpleMDE({
element: $("#postreply")[0],
- autosave: {
+ // Autosave disabled temporarily because it keeps it's content even after submitting (Clearboard will use a custom AJAX submit function)
+ /*autosave: {
enabled: true,
delay: 2000,
unique_id: "thread-" + window.thread_id // save drafts based on thread id
- },
+ },*/
spellChecker: false
});
}); |
45dfb547c46f25255759f6ebcdc95f59cf1d9c75 | commonjs/cookie-opt.js | commonjs/cookie-opt.js | var componentEvent = require('kwf/component-event');
var cookies = require('js-cookie');
var CookieOpt = {};
CookieOpt.getDefaultOpt = function() {
return 'in'; // TODO get from baseProperty
};
CookieOpt.isSetOpt = function() {
return !!cookies.get('cookieOpt');
};
CookieOpt.getOpt = function() {
if (CookieOpt.isSetOpt()) {
return cookies.get('cookieOpt');
} else {
return CookieOpt.getDefaultOpt();
}
};
CookieOpt.setOpt = function(value) {
var opt = cookies.get('cookieOpt');
cookies.set('cookieOpt', value, { expires: 3*365 });
if (opt != value) {
componentEvent.trigger('cookieOptChanged', value);
}
};
CookieOpt.onOptChange = function(callback) {
componentEvent.on('cookieOptChanged', callback);
};
module.exports = CookieOpt;
| var componentEvent = require('kwf/component-event');
var cookies = require('js-cookie');
var $ = require('jQuery');
var CookieOpt = {};
CookieOpt.getDefaultOpt = function() {
var defaultOpt = $('body').data('cookieDefaultOpt');
if (defaultOpt != 'in' && defaultOpt != 'out') defaultOpt = 'in';
return defaultOpt;
};
CookieOpt.isSetOpt = function() {
return !!cookies.get('cookieOpt');
};
CookieOpt.getOpt = function() {
if (CookieOpt.isSetOpt()) {
return cookies.get('cookieOpt');
} else {
return CookieOpt.getDefaultOpt();
}
};
CookieOpt.setOpt = function(value) {
var opt = cookies.get('cookieOpt');
cookies.set('cookieOpt', value, { expires: 3*365 });
if (opt != value) {
componentEvent.trigger('cookieOptChanged', value);
}
};
CookieOpt.onOptChange = function(callback) {
componentEvent.on('cookieOptChanged', callback);
};
module.exports = CookieOpt;
| Read default cookie opt setting from body data tag | Read default cookie opt setting from body data tag
| JavaScript | bsd-2-clause | koala-framework/koala-framework,kaufmo/koala-framework,kaufmo/koala-framework,kaufmo/koala-framework,koala-framework/koala-framework | ---
+++
@@ -1,10 +1,13 @@
var componentEvent = require('kwf/component-event');
var cookies = require('js-cookie');
+var $ = require('jQuery');
var CookieOpt = {};
CookieOpt.getDefaultOpt = function() {
- return 'in'; // TODO get from baseProperty
+ var defaultOpt = $('body').data('cookieDefaultOpt');
+ if (defaultOpt != 'in' && defaultOpt != 'out') defaultOpt = 'in';
+ return defaultOpt;
};
CookieOpt.isSetOpt = function() { |
20347bfe721a0189e77978561400e5cb23132a11 | Kwf_js/Utils/YoutubePlayer.js | Kwf_js/Utils/YoutubePlayer.js | Ext.namespace('Kwf.Utils.YoutubePlayer');
Kwf.Utils.YoutubePlayer.isLoaded = false;
Kwf.Utils.YoutubePlayer.isCallbackCalled = false;
Kwf.Utils.YoutubePlayer.callbacks = [];
Kwf.Utils.YoutubePlayer.load = function(callback, scope)
{
if (Kwf.Utils.YoutubePlayer.isCallbackCalled) {
callback.call(scope || window);
return;
}
Kwf.Utils.YoutubePlayer.callbacks.push({
callback: callback,
scope: scope
});
if (Kwf.Utils.YoutubePlayer.isLoaded) return;
Kwf.Utils.YoutubePlayer.isLoaded = true;
var tag = document.createElement('script');
tag.setAttribute('type', 'text/javascript');
tag.setAttribute('src', '//www.youtube.com/iframe_api');
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
if (typeof window.onYouTubePlayerAPIReady == 'undefined') {
window.onYouTubePlayerAPIReady = function() {
Kwf.Utils.YoutubePlayer.isCallbackCalled = true;
Kwf.Utils.YoutubePlayer.callbacks.forEach(function(i) {
i.callback.call(i.scope || window);
});
}
}
| Ext.namespace('Kwf.Utils.YoutubePlayer');
Kwf.Utils.YoutubePlayer.isLoaded = false;
Kwf.Utils.YoutubePlayer.isCallbackCalled = false;
Kwf.Utils.YoutubePlayer.callbacks = [];
Kwf.Utils.YoutubePlayer.load = function(callback, scope)
{
if (Kwf.Utils.YoutubePlayer.isCallbackCalled) {
callback.call(scope || window);
return;
}
Kwf.Utils.YoutubePlayer.callbacks.push({
callback: callback,
scope: scope
});
if (Kwf.Utils.YoutubePlayer.isLoaded) return;
Kwf.Utils.YoutubePlayer.isLoaded = true;
var tag = document.createElement('script');
tag.setAttribute('type', 'text/javascript');
tag.setAttribute('src', 'http://www.youtube.com/iframe_api');
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
if (typeof window.onYouTubePlayerAPIReady == 'undefined') {
window.onYouTubePlayerAPIReady = function() {
Kwf.Utils.YoutubePlayer.isCallbackCalled = true;
Kwf.Utils.YoutubePlayer.callbacks.forEach(function(i) {
i.callback.call(i.scope || window);
});
}
}
| Revert "get dynamicly if https or http is supported for youtube iframe api" | Revert "get dynamicly if https or http is supported for youtube iframe api"
This reverts commit ffbdfe78a884b06447ff6da01137820224081962.
| JavaScript | bsd-2-clause | koala-framework/koala-framework,yacon/koala-framework,nsams/koala-framework,Ben-Ho/koala-framework,Sogl/koala-framework,kaufmo/koala-framework,koala-framework/koala-framework,yacon/koala-framework,kaufmo/koala-framework,Sogl/koala-framework,Ben-Ho/koala-framework,yacon/koala-framework,kaufmo/koala-framework,nsams/koala-framework,nsams/koala-framework | ---
+++
@@ -19,7 +19,7 @@
var tag = document.createElement('script');
tag.setAttribute('type', 'text/javascript');
- tag.setAttribute('src', '//www.youtube.com/iframe_api');
+ tag.setAttribute('src', 'http://www.youtube.com/iframe_api');
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
}; |
a62a28a4819f038ab46a32fee32869cc54c920e2 | web/src/searchQuery.js | web/src/searchQuery.js | // This is a second entry point to speed up our query
// to fetch search results.
// We've patched react-scripts to add this as another entry
// point. E.g., the Webpack config by running lives at
// web/node_modules/react-scripts/config/webpack.config.js.
// After modifying files in react-scripts, commit the
// patches with:
// `yarn patch-package react-scripts`
// You can view the patch diff in ./web/patches.
// For this to be meaningful, we have to make sure we inject
// this script first, before all other app code.
// Return an empty script when building the newtab app.
// The newtab app will still build this entry point because
// we share Webpack configs.
if (process.env.REACT_APP_WHICH_APP === 'search') {
const {
// eslint-disable-next-line no-unused-vars
prefetchSearchResults,
} = require('js/components/Search/fetchBingSearchResults')
const getSearchResults = () => {
var t = performance.now()
// console.log('searchQuery', t)
window.debug.searchQuery = t
// TODO
// If the path is /query, call fetchBingSearchResults.
// Let it handle the logic of determining the search query, etc.
// prefetchSearchResults()
}
getSearchResults()
}
| // This is a second entry point to speed up our query
// to fetch search results.
// We've patched react-scripts to add this as another entry
// point. E.g., the Webpack config by running lives at
// web/node_modules/react-scripts/config/webpack.config.js.
// After modifying files in react-scripts, commit the
// patches with:
// `yarn patch-package react-scripts`
// You can view the patch diff in ./web/patches.
// For this to be meaningful, we have to make sure we inject
// this script first, before all other app code.
// TODO: add tests for env var and other logic
// Return an empty script when building the newtab app.
// The newtab app will still build this entry point because
// we share Webpack configs.
if (process.env.REACT_APP_WHICH_APP === 'search') {
const {
// eslint-disable-next-line no-unused-vars
prefetchSearchResults,
} = require('js/components/Search/fetchBingSearchResults')
const getSearchResults = () => {
var t = performance.now()
// console.log('searchQuery', t)
window.debug.searchQuery = t
// TODO
// If the path is /query, call fetchBingSearchResults.
// Let it handle the logic of determining the search query, etc.
prefetchSearchResults()
}
getSearchResults()
}
| Enable prefetching to try it out | Enable prefetching to try it out
| JavaScript | mpl-2.0 | gladly-team/tab,gladly-team/tab,gladly-team/tab | ---
+++
@@ -9,6 +9,8 @@
// You can view the patch diff in ./web/patches.
// For this to be meaningful, we have to make sure we inject
// this script first, before all other app code.
+
+// TODO: add tests for env var and other logic
// Return an empty script when building the newtab app.
// The newtab app will still build this entry point because
@@ -26,7 +28,7 @@
// TODO
// If the path is /query, call fetchBingSearchResults.
// Let it handle the logic of determining the search query, etc.
- // prefetchSearchResults()
+ prefetchSearchResults()
}
getSearchResults() |
ba9c863de909906382b55309e1cfe0e0ce935308 | spec/html/QueryStringSpec.js | spec/html/QueryStringSpec.js | describe("QueryString", function() {
describe("#setParam", function() {
it("sets the query string to include the given key/value pair", function() {
var windowLocation = {
search: ""
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
queryString.setParam("foo", "bar baz");
expect(windowLocation.search).toMatch(/foo=bar%20baz/);
});
});
describe("#getParam", function() {
it("returns the value of the requested key", function() {
var windowLocation = {
search: "?baz=quux%20corge"
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
expect(queryString.getParam("baz")).toEqual("quux corge");
});
it("returns null if the key is not present", function() {
var windowLocation = {
search: ""
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
expect(queryString.getParam("baz")).toBeFalsy();
});
});
});
| describe("QueryString", function() {
describe("#setParam", function() {
it("sets the query string to include the given key/value pair", function() {
var windowLocation = {
search: ""
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
queryString.setParam("foo", "bar baz");
expect(windowLocation.search).toMatch(/foo=bar%20baz/);
});
it("leaves existing params alone", function() {
var windowLocation = {
search: "?foo=bar"
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
queryString.setParam("baz", "quux");
expect(windowLocation.search).toMatch(/foo=bar/);
expect(windowLocation.search).toMatch(/baz=quux/);
});
});
describe("#getParam", function() {
it("returns the value of the requested key", function() {
var windowLocation = {
search: "?baz=quux%20corge"
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
expect(queryString.getParam("baz")).toEqual("quux corge");
});
it("returns null if the key is not present", function() {
var windowLocation = {
search: ""
},
queryString = new j$.QueryString({
getWindowLocation: function() { return windowLocation }
});
expect(queryString.getParam("baz")).toBeFalsy();
});
});
});
| Add spec to verify custom query params are left alone | Add spec to verify custom query params are left alone
[#29578495]
| JavaScript | mit | faizalpribadi/jasmine,danielalexiuc/jasmine,GerHobbelt/jasmine,Contagious06/jasmine,tsaikd/jasmine,negherbon/jasmine,soycode/jasmine,mashroomxl/jasmine,mashroomxl/jasmine,WY08271/jasmine,GerHobbelt/jasmine,songshuangkk/jasmine,rlugojr/jasmine,paulcbetts/jasmine,IveWong/jasmine,leahciMic/jasmine,morsdyce/jasmine,danielalexiuc/jasmine,kalins/samples-javascript.jasmine,rlugojr/jasmine,qiangyee/jasmine,caravenase/jasmine,songshuangkk/jasmine,kalins/samples-javascript.jasmine,kidaa/jasmine,deborahleehamel/jasmine,caravenase/jasmine,paulcbetts/jasmine,aaron-goshine/jasmine,aln787/jasmine,suvarnaraju/jasmine,faizalpribadi/jasmine,rlugojr/jasmine,GerHobbelt/jasmine,soycode/jasmine,tsaikd/jasmine,Contagious06/jasmine,denisKaranja/jasmine,Contagious06/jasmine,leahciMic/jasmine,JoseRoman/jasmine,Sanjo/jasmine,faizalpribadi/jasmine,kyroskoh/jasmine,rlugojr/jasmine,wongterrencew/jasmine,marcioj/jasmine,morsdyce/jasmine,Muktesh01/jasmine,kidaa/jasmine,Muktesh01/jasmine,tsaikd/jasmine,mashroomxl/jasmine,suvarnaraju/jasmine,antialias/jasmine,seanparmelee/jasmine,jnayoub/jasmine,caravenase/jasmine,negherbon/jasmine,jnayoub/jasmine,faizalpribadi/jasmine,James-Dunn/jasmine,James-Dunn/jasmine,qiangyee/jasmine,seanlin816/jasmine,SimenB/jasmine,James-Dunn/jasmine,Contagious06/jasmine,SimenB/jasmine,paulcbetts/jasmine,SimenB/jasmine,kyroskoh/jasmine,seanlin816/jasmine,xolvio/jasmine,aln787/jasmine,caravenase/jasmine,xolvio/jasmine,jnayoub/jasmine,songshuangkk/jasmine,yy8597/jasmine,Sanjo/jasmine,caravena-nisum-com/jasmine,seanlin816/jasmine,WY08271/jasmine,qiangyee/jasmine,caravenase/jasmine,caravena-nisum-com/jasmine,marcioj/jasmine,yy8597/jasmine,deborahleehamel/jasmine,tsaikd/jasmine,martinma4/jasmine,danielalexiuc/jasmine,IveWong/jasmine,danielalexiuc/jasmine,WY08271/jasmine,yy8597/jasmine,morsdyce/jasmine,aln787/jasmine,xolvio/jasmine,songshuangkk/jasmine,JoseRoman/jasmine,Jahred/jasmine,wongterrencew/jasmine,WY08271/jasmine,negherbon/jasmine,caravena-nisum-com/jasmine,suvarnaraju/jasmine,wongterrencew/jasmine,martinma4/jasmine,Sanjo/jasmine,paulcbetts/jasmine,aln787/jasmine,caravena-nisum-com/jasmine,rlugojr/jasmine,kalins/samples-javascript.jasmine,aln787/jasmine,aaron-goshine/jasmine,seanlin816/jasmine,kyroskoh/jasmine,Muktesh01/jasmine,qiangyee/jasmine,martinma4/jasmine,leahciMic/jasmine,denisKaranja/jasmine,SimenB/jasmine,GerHobbelt/jasmine,seanparmelee/jasmine,kidaa/jasmine,antialias/jasmine,deborahleehamel/jasmine,qiangyee/jasmine,songshuangkk/jasmine,negherbon/jasmine,martinma4/jasmine,James-Dunn/jasmine,negherbon/jasmine,paulcbetts/jasmine,wongterrencew/jasmine,Jahred/jasmine,xolvio/jasmine,kyroskoh/jasmine,marcioj/jasmine,seanparmelee/jasmine,deborahleehamel/jasmine,tsaikd/jasmine,Sanjo/jasmine,danielalexiuc/jasmine,SimenB/jasmine,mashroomxl/jasmine,JoseRoman/jasmine,mashroomxl/jasmine,seanlin816/jasmine,aaron-goshine/jasmine,aaron-goshine/jasmine,imshibaji/jasmine,marcioj/jasmine,morsdyce/jasmine,yy8597/jasmine,Muktesh01/jasmine,denisKaranja/jasmine,leahciMic/jasmine,caravena-nisum-com/jasmine,soycode/jasmine,deborahleehamel/jasmine,JoseRoman/jasmine,WY08271/jasmine,jnayoub/jasmine,Jahred/jasmine,kidaa/jasmine,Jahred/jasmine,IveWong/jasmine,suvarnaraju/jasmine,kalins/samples-javascript.jasmine,leahciMic/jasmine,imshibaji/jasmine,imshibaji/jasmine,soycode/jasmine,GerHobbelt/jasmine,kyroskoh/jasmine,Contagious06/jasmine,jnayoub/jasmine,imshibaji/jasmine,soycode/jasmine,IveWong/jasmine,antialias/jasmine,faizalpribadi/jasmine,marcioj/jasmine,denisKaranja/jasmine,xolvio/jasmine,kidaa/jasmine,JoseRoman/jasmine,Sanjo/jasmine,Jahred/jasmine,imshibaji/jasmine,seanparmelee/jasmine,yy8597/jasmine,antialias/jasmine,wongterrencew/jasmine,suvarnaraju/jasmine,morsdyce/jasmine,James-Dunn/jasmine,antialias/jasmine,IveWong/jasmine,aaron-goshine/jasmine,kalins/samples-javascript.jasmine,denisKaranja/jasmine,seanparmelee/jasmine,Muktesh01/jasmine,martinma4/jasmine | ---
+++
@@ -1,7 +1,6 @@
describe("QueryString", function() {
describe("#setParam", function() {
-
it("sets the query string to include the given key/value pair", function() {
var windowLocation = {
search: ""
@@ -13,6 +12,20 @@
queryString.setParam("foo", "bar baz");
expect(windowLocation.search).toMatch(/foo=bar%20baz/);
+ });
+
+ it("leaves existing params alone", function() {
+ var windowLocation = {
+ search: "?foo=bar"
+ },
+ queryString = new j$.QueryString({
+ getWindowLocation: function() { return windowLocation }
+ });
+
+ queryString.setParam("baz", "quux");
+
+ expect(windowLocation.search).toMatch(/foo=bar/);
+ expect(windowLocation.search).toMatch(/baz=quux/);
});
});
|
585467648d0ec67da6cde967a1e17b07014638b8 | src/native/app/components/Text.react.js | src/native/app/components/Text.react.js | import React, { Component, PropTypes } from 'react';
import theme from '../theme';
import { StyleSheet, Text } from 'react-native';
const styles = StyleSheet.create({
text: {
color: theme.textColor,
fontFamily: theme.fontFamily,
fontSize: theme.fontSize,
},
});
// Normalize multiline strings because Text component preserves spaces.
const normalizeMultilineString = message => message.replace(/ +/g, ' ').trim();
export default class AppText extends Component {
static propTypes = {
children: PropTypes.node,
style: Text.propTypes.style,
};
constructor() {
super();
this.onTextRef = this.onTextRef.bind(this);
}
onTextRef(text) {
this.text = text;
}
setNativeProps(nativeProps) {
this.text.setNativeProps(nativeProps);
}
render() {
const { children, style } = this.props;
const fontSize = (style && style.fontSize) || theme.fontSize;
const lineHeight = fontSize * theme.lineHeight;
return (
<Text
{...this.props}
ref={this.onTextRef}
style={[styles.text, style, { lineHeight }]}
>
{typeof children === 'string'
? normalizeMultilineString(children)
: children
}
</Text>
);
}
}
| import React, { Component, PropTypes } from 'react';
import theme from '../theme';
import { StyleSheet, Text } from 'react-native';
const styles = StyleSheet.create({
text: { // eslint-disable-line react-native/no-unused-styles
color: theme.textColor,
fontFamily: theme.fontFamily,
fontSize: theme.fontSize,
lineHeight: theme.fontSize * theme.lineHeight,
},
});
// Normalize multiline strings because Text component preserves spaces.
const normalizeMultilineString = message => message.replace(/ +/g, ' ').trim();
export default class AppText extends Component {
static propTypes = {
children: PropTypes.node,
style: Text.propTypes.style,
};
constructor() {
super();
this.onTextRef = this.onTextRef.bind(this);
}
onTextRef(text) {
this.text = text;
}
setNativeProps(nativeProps) {
this.text.setNativeProps(nativeProps);
}
getTextStyleWithMaybeComputedLineHeight() {
const { style } = this.props;
if (!style) {
return styles.text;
}
const customFontSize = StyleSheet.flatten(style).fontSize;
if (!Number.isInteger(customFontSize)) {
return [styles.text, style];
}
const lineHeight = customFontSize * theme.lineHeight;
return [styles.text, style, { lineHeight }];
}
render() {
const { children } = this.props;
const textStyle = this.getTextStyleWithMaybeComputedLineHeight();
return (
<Text {...this.props} ref={this.onTextRef} style={textStyle}>
{typeof children === 'string'
? normalizeMultilineString(children)
: children
}
</Text>
);
}
}
| Fix native Text computed lineHeight | Fix native Text computed lineHeight
| JavaScript | mit | este/este,robinpokorny/este,TheoMer/Gyms-Of-The-World,skallet/este,christophediprima/este,robinpokorny/este,cjk/smart-home-app,christophediprima/este,TheoMer/Gyms-Of-The-World,TheoMer/este,christophediprima/este,christophediprima/este,steida/este,TheoMer/este,TheoMer/este,sikhote/davidsinclair,sikhote/davidsinclair,este/este,este/este,steida/este,skallet/este,sikhote/davidsinclair,TheoMer/Gyms-Of-The-World,skallet/este,este/este,robinpokorny/este | ---
+++
@@ -3,10 +3,11 @@
import { StyleSheet, Text } from 'react-native';
const styles = StyleSheet.create({
- text: {
+ text: { // eslint-disable-line react-native/no-unused-styles
color: theme.textColor,
fontFamily: theme.fontFamily,
fontSize: theme.fontSize,
+ lineHeight: theme.fontSize * theme.lineHeight,
},
});
@@ -33,17 +34,25 @@
this.text.setNativeProps(nativeProps);
}
+ getTextStyleWithMaybeComputedLineHeight() {
+ const { style } = this.props;
+ if (!style) {
+ return styles.text;
+ }
+ const customFontSize = StyleSheet.flatten(style).fontSize;
+ if (!Number.isInteger(customFontSize)) {
+ return [styles.text, style];
+ }
+ const lineHeight = customFontSize * theme.lineHeight;
+ return [styles.text, style, { lineHeight }];
+ }
+
render() {
- const { children, style } = this.props;
- const fontSize = (style && style.fontSize) || theme.fontSize;
- const lineHeight = fontSize * theme.lineHeight;
+ const { children } = this.props;
+ const textStyle = this.getTextStyleWithMaybeComputedLineHeight();
return (
- <Text
- {...this.props}
- ref={this.onTextRef}
- style={[styles.text, style, { lineHeight }]}
- >
+ <Text {...this.props} ref={this.onTextRef} style={textStyle}>
{typeof children === 'string'
? normalizeMultilineString(children)
: children |
9692dfc1f91f9fe3c87a1afe4df8d613f78f885c | bin/startBot.js | bin/startBot.js | const RoundpiecesBot = require('./../src/roundpiecesbot');
const token = process.env.ROUNDPIECES_API_KEY;
const adminUserName = process.env.ROUNDPIECES_ADMIN_USERNAME;
const listPath = process.env.ROUNDPIECES_LIST_PATH;
const startSearch = '00 * * * * *';
const endSearch = '30 * * * * *';
const resetSearch = '55 * * * * *';
if (token && adminUserName && listPath) {
const roundpiecesBot = new RoundpiecesBot({
token: token,
name: 'Roundpieces Administration Bot',
adminUserName: adminUserName,
listPath: listPath,
cronRanges: {
start: startSearch,
end: endSearch,
reset: resetSearch
}
});
roundpiecesBot.run();
}
else {
console.error(`Environment is not properly configured. Please make sure you have set\n
ROUNDPIECES_API_KEY to the slack bot API token
ROUNDPIECES_ADMIN_USERNAME to the slack username of your roundpieces administrator
ROUNDPIECES_LIST_PATH to the absolute path to your list of participants`);
}
| const RoundpiecesBot = require('./../src/roundpiecesbot');
const token = process.env.ROUNDPIECES_API_KEY;
const adminUserName = process.env.ROUNDPIECES_ADMIN_USERNAME;
const listPath = process.env.ROUNDPIECES_LIST_PATH;
const startSearch = '00 00 9 * * 4'; // 09.00 Thursdays
const endSearch = '00 00 12 * * 4'; // 12.00 Thursdays
const resetSearch = '00 00 9 * * 5'; // 09.00 Fridays
if (token && adminUserName && listPath) {
const roundpiecesBot = new RoundpiecesBot({
token: token,
name: 'Roundpieces Administration Bot',
adminUserName: adminUserName,
listPath: listPath,
cronRanges: {
start: startSearch,
end: endSearch,
reset: resetSearch
}
});
roundpiecesBot.run();
}
else {
console.error(`Environment is not properly configured. Please make sure you have set\n
ROUNDPIECES_API_KEY to the slack bot API token
ROUNDPIECES_ADMIN_USERNAME to the slack username of your roundpieces administrator
ROUNDPIECES_LIST_PATH to the absolute path to your list of participants`);
}
| Set cron ranges to match real arrangement times | Set cron ranges to match real arrangement times
| JavaScript | mit | jbroni/roundpieces-slackbot | ---
+++
@@ -4,9 +4,9 @@
const adminUserName = process.env.ROUNDPIECES_ADMIN_USERNAME;
const listPath = process.env.ROUNDPIECES_LIST_PATH;
-const startSearch = '00 * * * * *';
-const endSearch = '30 * * * * *';
-const resetSearch = '55 * * * * *';
+const startSearch = '00 00 9 * * 4'; // 09.00 Thursdays
+const endSearch = '00 00 12 * * 4'; // 12.00 Thursdays
+const resetSearch = '00 00 9 * * 5'; // 09.00 Fridays
if (token && adminUserName && listPath) {
const roundpiecesBot = new RoundpiecesBot({ |
cc033abb20799f36b170e607ce95297491781eda | utility.js | utility.js | const path = require( 'path' )
const fs = require( 'fs' )
// Create a new path from arguments.
const getAbsolutePath = ( ...args ) => path.resolve( path.join.apply( null, args ) )
const isExist = filePath => {
try {
fs.statSync( path.resolve( filePath ) )
return true
} catch( error ){
return false
}
}
module.exports = {
getAbsolutePath: getAbsolutePath,
isExist : isExist
}
| const path = require( 'path' )
const fs = require( 'fs' )
// Create a new path from arguments.
const getAbsolutePath = ( ...args ) => path.resolve( path.join.apply( null, args ) )
const isExist = filePath => {
try {
fs.statSync( path.resolve( filePath ) )
return true
} catch( error ){
return false
}
}
const read = filePath => fs.readFileSync( filePath, 'utf-8' )
const write = ( filePath, content ) => fs.writeFileSync( filePath, content )
module.exports = {
getAbsolutePath: getAbsolutePath,
isExist : isExist,
read : read,
write : write
}
| Add method to read and write | Add method to read and write
| JavaScript | mit | Yacona/yacona | ---
+++
@@ -12,7 +12,12 @@
}
}
+const read = filePath => fs.readFileSync( filePath, 'utf-8' )
+const write = ( filePath, content ) => fs.writeFileSync( filePath, content )
+
module.exports = {
getAbsolutePath: getAbsolutePath,
- isExist : isExist
+ isExist : isExist,
+ read : read,
+ write : write
} |
edeca61db29c3076b41c005eace74e2555f76be3 | test/helpers/benchmarkReporter.js | test/helpers/benchmarkReporter.js | const chalk = require('chalk');
function benchmarkResultsToConsole(suite){
console.log("\n");
console.log("==================");
console.log("Benchmark results:");
console.log("------------------");
var bench;
for(var testNo = 0; testNo < suite.length; testNo++){
bench = suite[testNo];
console.log(chalk.green.underline(bench.name) +
"\n Ops/sec: " + chalk.bold.bgBlue(bench.hz.toFixed(bench.hz < 100 ? 2 : 0)) +
chalk.dim(' ±' + bench.stats.rme.toFixed(2) + '% ') +
chalk.gray('Ran ' + bench.count + ' times in ' +
bench.times.cycle.toFixed(3) + ' seconds.'));
}
console.log("===================");
}
if (typeof exports !== "undefined") {
exports.benchmarkResultsToConsole = benchmarkResultsToConsole;
}
| const chalk = require('chalk');
function benchmarkResultsToConsole(suite){
console.log("\n");
console.log("==================");
console.log("Benchmark results:");
console.log("------------------");
var bench;
for(var testNo = 0; testNo < suite.length; testNo++){
bench = suite[testNo];
console.log(chalk.green.underline(bench.name) +
"\n Ops/sec: " + chalk.bold.magenta(bench.hz.toFixed(bench.hz < 100 ? 2 : 0)) +
chalk.dim(' ±' + bench.stats.rme.toFixed(2) + '% ') +
chalk.gray('Ran ' + bench.count + ' times in ' +
bench.times.cycle.toFixed(3) + ' seconds.'));
}
console.log("===================");
}
if (typeof exports !== "undefined") {
exports.benchmarkResultsToConsole = benchmarkResultsToConsole;
}
| Change benchmark results color to magenta | Change benchmark results color to magenta
as white on blue is barely visible in travis
| JavaScript | mit | baranga/JSON-Patch,Starcounter-Jack/JSON-Patch,baranga/JSON-Patch,Starcounter-Jack/JSON-Patch,baranga/JSON-Patch,baranga/JSON-Patch,Starcounter-Jack/JSON-Patch,Starcounter-Jack/JSON-Patch | ---
+++
@@ -8,7 +8,7 @@
for(var testNo = 0; testNo < suite.length; testNo++){
bench = suite[testNo];
console.log(chalk.green.underline(bench.name) +
- "\n Ops/sec: " + chalk.bold.bgBlue(bench.hz.toFixed(bench.hz < 100 ? 2 : 0)) +
+ "\n Ops/sec: " + chalk.bold.magenta(bench.hz.toFixed(bench.hz < 100 ? 2 : 0)) +
chalk.dim(' ±' + bench.stats.rme.toFixed(2) + '% ') +
chalk.gray('Ran ' + bench.count + ' times in ' +
bench.times.cycle.toFixed(3) + ' seconds.')); |
f55703a7a027651e141b753058abec7cbdf28e89 | test/jsx-no-logical-expression.js | test/jsx-no-logical-expression.js | import test from 'ava';
import avaRuleTester from 'eslint-ava-rule-tester';
import rule from '../src/rules/jsx-no-logical-expression';
const ruleTester = avaRuleTester(test, {
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true
}
}
});
const ruleId = 'jsx-no-logical-expression';
const message = 'JSX should not use logical expression';
const error = {
ruleId,
message,
type: 'LogicalExpression'
};
ruleTester.run(ruleId, rule, {
valid: [
'{true ? <div /> : null}',
'{false || false ? <div /> : null}',
'{true && true ? <div /> : null}'
],
invalid: [
{
code: '{true && <div />}',
errors: [error]
},
{
code: '{true || <div />}',
errors: [error]
}
]
});
| import test from 'ava';
import avaRuleTester from 'eslint-ava-rule-tester';
import rule from '../src/rules/jsx-no-logical-expression';
const ruleTester = avaRuleTester(test, {
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true
}
}
});
const ruleId = 'jsx-no-logical-expression';
const message = 'JSX should not use logical expression';
const error = {
ruleId,
message,
type: 'LogicalExpression'
};
ruleTester.run(ruleId, rule, {
valid: [
'{true ? <div /> : null}',
'{false || false ? <div /> : null}',
'{true && true ? <div /> : null}'
],
invalid: [
{
code: '{true && <div />}',
errors: [error]
},
{
code: '{true || <div />}',
errors: [error]
},
{
code: '{false && <div />}',
errors: [error]
},
{
code: '{undefined && <div />}',
errors: [error]
},
{
code: '{0 && <div />}',
errors: [error]
}
]
});
| Add another invalid use case | Add another invalid use case
| JavaScript | mit | CoorpAcademy/eslint-plugin-coorpacademy | ---
+++
@@ -34,6 +34,18 @@
{
code: '{true || <div />}',
errors: [error]
+ },
+ {
+ code: '{false && <div />}',
+ errors: [error]
+ },
+ {
+ code: '{undefined && <div />}',
+ errors: [error]
+ },
+ {
+ code: '{0 && <div />}',
+ errors: [error]
}
]
}); |
d05e4d520f627b555fc52f243db307275eb7ca39 | tests/unit/adapters/github-release-test.js | tests/unit/adapters/github-release-test.js | import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:github-release', 'Unit | Adapter | github release', {
// Specify the other units that are required for this test.
// needs: ['serializer:foo']
});
// Replace this with your real tests.
test('it exists', function(assert) {
let adapter = this.subject();
assert.ok(adapter);
});
test('it builds the URL for the releases query correctly', function(assert) {
let adapter = this.subject();
const host = adapter.get('host');
const repo = 'jimmay5469/old-hash';
assert.equal(adapter.buildURL('github-release', null, null, 'query', { repo: repo }), `${host}/repos/${repo}/releases`);
});
test('it builds the URL for a specific release query correctly', function(assert) {
let adapter = this.subject();
const host = adapter.get('host');
const repo = 'jimmay5469/old-hash';
const release = 1;
assert.equal(
adapter.buildURL('github-release', null, null, 'queryRecord', { repo: repo, releaseId: release }),
`${host}/repos/${repo}/releases/${release}`
);
});
| import { moduleFor, test } from 'ember-qunit';
moduleFor('adapter:github-release', 'Unit | Adapter | github release', {
// Specify the other units that are required for this test.
// needs: ['serializer:foo']
});
test('it exists', function(assert) {
let adapter = this.subject();
assert.ok(adapter);
});
test('it builds the URL for the releases query correctly', function(assert) {
let adapter = this.subject();
const host = adapter.get('host');
const repo = 'jimmay5469/old-hash';
assert.equal(adapter.buildURL('github-release', null, null, 'query', { repo: repo }), `${host}/repos/${repo}/releases`);
});
test('it builds the URL for a specific release query correctly', function(assert) {
let adapter = this.subject();
const host = adapter.get('host');
const repo = 'jimmay5469/old-hash';
const release = 1;
assert.equal(
adapter.buildURL('github-release', null, null, 'queryRecord', { repo: repo, releaseId: release }),
`${host}/repos/${repo}/releases/${release}`
);
});
| Remove the boilerplate comment now that we have more tests. | Remove the boilerplate comment now that we have more tests.
| JavaScript | mit | elwayman02/ember-data-github,jimmay5469/ember-data-github,elwayman02/ember-data-github,jimmay5469/ember-data-github | ---
+++
@@ -5,7 +5,6 @@
// needs: ['serializer:foo']
});
-// Replace this with your real tests.
test('it exists', function(assert) {
let adapter = this.subject();
assert.ok(adapter); |
0b13a34c60150e8eee5394b61233d451c7a933cb | assets/js/app.js | assets/js/app.js | $( document ).ready(function() {
/* Sidebar height set */
$('.sidebar').css('min-height',$(document).height());
/* Secondary contact links */
var scontacts = $('#contact-list-secondary');
var contact_list = $('#contact-list');
scontacts.hide();
contact_list.mouseenter(function(){ scontacts.fadeIn(); });
contact_list.mouseleave(function(){ scontacts.fadeOut(); });
});
| $( document ).ready(function() {
/* Sidebar height set */
$('.sidebar').css('min-height',$(document).height());
/* Secondary contact links */
var scontacts = $('#contact-list-secondary');
var contact_list = $('#contact-list');
scontacts.hide();
contact_list.mouseenter(function(){ scontacts.fadeIn(); });
contact_list.mouseleave(function(){ scontacts.fadeOut(); });
// prevent line-breaks in links and make open in new tab
$('div.article_body a').not('[rel="footnote"], [rev="footnote"]').html(function(i, str) {
return str.replace(/ /g,' ');
}).attr('target','_blank');
});
| Add target _blank on article links | Add target _blank on article links
| JavaScript | mit | meumobi/meumobi.github.io,meumobi/meumobi.github.io,meumobi/meumobi.github.io | ---
+++
@@ -13,4 +13,9 @@
contact_list.mouseleave(function(){ scontacts.fadeOut(); });
+ // prevent line-breaks in links and make open in new tab
+ $('div.article_body a').not('[rel="footnote"], [rev="footnote"]').html(function(i, str) {
+ return str.replace(/ /g,' ');
+ }).attr('target','_blank');
+
}); |
59c5b0cf7aade3943a2d9b664c5efacd4f23a14d | src/api-gateway-websocket/lambda-events/WebSocketDisconnectEvent.js | src/api-gateway-websocket/lambda-events/WebSocketDisconnectEvent.js | import WebSocketRequestContext from './WebSocketRequestContext.js'
// TODO this should be probably moved to utils, and combined with other header
// functions and utilities
function createMultiValueHeaders(headers) {
return Object.entries(headers).reduce((acc, [key, value]) => {
acc[key] = [value]
return acc
}, {})
}
export default class WebSocketDisconnectEvent {
constructor(connectionId) {
this._connectionId = connectionId
}
create() {
const headers = {
Host: 'localhost',
'x-api-key': '',
'x-restapi': '',
}
const multiValueHeaders = createMultiValueHeaders(headers)
const requestContext = new WebSocketRequestContext(
'DISCONNECT',
'$disconnect',
this._connectionId,
).create()
return {
headers,
isBase64Encoded: false,
multiValueHeaders,
requestContext,
}
}
}
| import WebSocketRequestContext from './WebSocketRequestContext.js'
import { parseHeaders, parseMultiValueHeaders } from '../../utils/index.js'
export default class WebSocketDisconnectEvent {
constructor(connectionId) {
this._connectionId = connectionId
}
create() {
// TODO FIXME not sure where the headers come from
const rawHeaders = ['Host', 'localhost', 'x-api-key', '', 'x-restapi', '']
const headers = parseHeaders(rawHeaders)
const multiValueHeaders = parseMultiValueHeaders(rawHeaders)
const requestContext = new WebSocketRequestContext(
'DISCONNECT',
'$disconnect',
this._connectionId,
).create()
return {
headers,
isBase64Encoded: false,
multiValueHeaders,
requestContext,
}
}
}
| Rewrite header handling in websocket disconnect event | Rewrite header handling in websocket disconnect event
| JavaScript | mit | dherault/serverless-offline,dherault/serverless-offline,dherault/serverless-offline,dherault/serverless-offline,dherault/serverless-offline,dherault/serverless-offline,dherault/serverless-offline | ---
+++
@@ -1,14 +1,5 @@
import WebSocketRequestContext from './WebSocketRequestContext.js'
-
-// TODO this should be probably moved to utils, and combined with other header
-// functions and utilities
-function createMultiValueHeaders(headers) {
- return Object.entries(headers).reduce((acc, [key, value]) => {
- acc[key] = [value]
-
- return acc
- }, {})
-}
+import { parseHeaders, parseMultiValueHeaders } from '../../utils/index.js'
export default class WebSocketDisconnectEvent {
constructor(connectionId) {
@@ -16,13 +7,11 @@
}
create() {
- const headers = {
- Host: 'localhost',
- 'x-api-key': '',
- 'x-restapi': '',
- }
+ // TODO FIXME not sure where the headers come from
+ const rawHeaders = ['Host', 'localhost', 'x-api-key', '', 'x-restapi', '']
- const multiValueHeaders = createMultiValueHeaders(headers)
+ const headers = parseHeaders(rawHeaders)
+ const multiValueHeaders = parseMultiValueHeaders(rawHeaders)
const requestContext = new WebSocketRequestContext(
'DISCONNECT', |
3a1638c1538b902bc8cebbf6b969798240f84157 | demo/server.js | demo/server.js | var config = require('./webpack.config.js');
var webpack = require('webpack');
var webpackDevServer = require('webpack-dev-server');
var compiler;
var server;
// Source maps
config.devtool = 'source-map';
config.output.publicPath = '/dist/';
// Remove minification to speed things up.
config.plugins.splice(1, 2);
// Add Hot Loader server entry points.
config.entry.app.unshift(
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server'
);
// Add HMR plugin
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
// Add React Hot loader
config.module.loaders[0].loaders.unshift('react-hot');
compiler = webpack(config);
server = new webpackDevServer(compiler, {
publicPath: config.output.publicPath,
hot: true
});
server.listen(8080);
| var config = require('./webpack.config.js');
var webpack = require('webpack');
var webpackDevServer = require('webpack-dev-server');
var compiler;
var server;
// Source maps
config.devtool = 'eval';
config.output.publicPath = '/dist/';
// Remove minification to speed things up.
config.plugins.splice(1, 2);
// Add Hot Loader server entry points.
config.entry.app.unshift(
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/dev-server'
);
// Add HMR plugin
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
// Add React Hot loader
config.module.loaders[0].loaders.unshift('react-hot');
compiler = webpack(config);
server = new webpackDevServer(compiler, {
publicPath: config.output.publicPath,
hot: true
});
server.listen(8080);
| Improve hot loading compile time | Improve hot loading compile time
| JavaScript | mit | acorn421/react-html5video-subs,mderrick/react-html5video,Caseworx/inferno-html5video,Caseworx/inferno-html5video,acorn421/react-html5video-subs | ---
+++
@@ -5,7 +5,7 @@
var server;
// Source maps
-config.devtool = 'source-map';
+config.devtool = 'eval';
config.output.publicPath = '/dist/';
|
49d8d01a14fb235c999473915667144d890e125b | src/components/video_list.js | src/components/video_list.js | import React from 'react'
import VideoListItem from './video_list_item'
const VideoList = (props) => {
const videoItems = props.videos.map((video) => {
return <VideoListItem video={video} />
});
return (
<ul className="col-md-4 list-group">
{videoItems}
</ul>
);
};
export default VideoList;
| import React from 'react'
import VideoListItem from './video_list_item'
const VideoList = (props) => {
const videoItems = props.videos.map((video) => {
return <VideoListItem key={video.etag} video={video} />
});
return (
<ul className="col-md-4 list-group">
{videoItems}
</ul>
);
};
export default VideoList;
| Add etag as unique key | Add etag as unique key
Finish 25
| JavaScript | mit | fifiteen82726/ReduxSimpleStarter,fifiteen82726/ReduxSimpleStarter | ---
+++
@@ -4,7 +4,7 @@
const VideoList = (props) => {
const videoItems = props.videos.map((video) => {
- return <VideoListItem video={video} />
+ return <VideoListItem key={video.etag} video={video} />
});
return ( |
60b20d83f4fdc9c625b56a178c93af1533b82a60 | src/redux/modules/card.js | src/redux/modules/card.js | import uuid from 'uuid';
import { Record as record } from 'immutable';
export class CardModel extends record({
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
}) {
constructor(obj) {
super(obj);
this.id = uuid.v4();
}
}
| // import uuid from 'uuid';
import { Record as record } from 'immutable';
export const CardModel = record({
id: null,
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
});
| Remove id from Record and add id field | Remove id from Record and add id field
Reason: on CardModel.update() it doesn’t keep the id field, so shit
crashes
| JavaScript | mit | inooid/react-redux-card-game,inooid/react-redux-card-game | ---
+++
@@ -1,15 +1,11 @@
-import uuid from 'uuid';
+// import uuid from 'uuid';
import { Record as record } from 'immutable';
-export class CardModel extends record({
+export const CardModel = record({
+ id: null,
name: '',
mana: null,
attack: null,
defense: null,
portrait: null,
-}) {
- constructor(obj) {
- super(obj);
- this.id = uuid.v4();
- }
-}
+}); |
153b9121bc2971e916ddc78045ebc6afc8a8ec5e | src/acorn_plugin/skipBlockComment.js | src/acorn_plugin/skipBlockComment.js | export default function skipSpace() {
// https://github.com/ternjs/acorn/blob/master/src/tokenize.js#L100-L116
return function ha(endSign) {
const endS = endSign ? endSign : '*/';
let startLoc = this.options.onComment && this.curPosition();
let start = this.pos, end = this.input.indexOf(endS, this.pos += endS.length);
if (end === -1) this.raise(this.pos - 2, "Unterminated comment")
this.pos = end + endS.length
if (this.options.locations) {
lineBreakG.lastIndex = start
let match
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
++this.curLine
this.lineStart = match.index + match[0].length
}
}
if (this.options.onComment)
this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
startLoc, this.curPosition())
};
}
| // eslint-disable
export default function skipSpace() {
// https://github.com/ternjs/acorn/blob/master/src/tokenize.js#L100-L116
return function ha(endSign) {
const endS = endSign ? endSign : '*/';
let startLoc = this.options.onComment && this.curPosition();
let start = this.pos,
end = this.input.indexOf(endS, this.pos += endS.length);
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
this.pos = end + endS.length;
if (this.options.locations) {
lineBreakG.lastIndex = start
let match
while ((match = lineBreakG.exec(this.input)) && match.index < this.pos) {
++this.curLine
this.lineStart = match.index + match[0].length
}
}
if (this.options.onComment)
this.options.onComment(true, this.input.slice(start + 2, end), start, this.pos,
startLoc, this.curPosition())
};
}
| Disable eslint for this for now. | Disable eslint for this for now. | JavaScript | mit | laosb/hatp | ---
+++
@@ -1,11 +1,13 @@
+// eslint-disable
export default function skipSpace() {
// https://github.com/ternjs/acorn/blob/master/src/tokenize.js#L100-L116
return function ha(endSign) {
const endS = endSign ? endSign : '*/';
let startLoc = this.options.onComment && this.curPosition();
- let start = this.pos, end = this.input.indexOf(endS, this.pos += endS.length);
- if (end === -1) this.raise(this.pos - 2, "Unterminated comment")
- this.pos = end + endS.length
+ let start = this.pos,
+ end = this.input.indexOf(endS, this.pos += endS.length);
+ if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
+ this.pos = end + endS.length;
if (this.options.locations) {
lineBreakG.lastIndex = start
let match |
bc24c83daef21248ee0ab141675bd6170c399403 | tests/specs/misc/on-error/main.js | tests/specs/misc/on-error/main.js | define(function(require) {
var test = require('../../../test')
var n = 0
// 404
var a = require('./a')
test.assert(a === null, '404 a')
// exec error
setTimeout(function() {
var b = require('./b')
}, 0)
require.async('./c', function(c) {
test.assert(c === null, '404 c')
done()
})
require.async('./e', function(e) {
test.assert(e === null, 'exec error e')
done()
})
seajs.use('./d', function(d) {
test.assert(d === null, '404 d')
done()
})
// 404 css
//require('./f.css')
function done() {
if (++n === 3) {
test.assert(w_errors.length === 2, w_errors.length)
test.assert(s_errors.length === 4, s_errors.length)
test.next()
}
}
})
| define(function(require) {
var test = require('../../../test')
var n = 0
// 404
var a = require('./a')
test.assert(a === null, '404 a')
// exec error
setTimeout(function() {
var b = require('./b')
}, 0)
require.async('./c', function(c) {
test.assert(c === null, '404 c')
done()
})
require.async('./e', function(e) {
test.assert(e === null, 'exec error e')
done()
})
seajs.use('./d', function(d) {
test.assert(d === null, '404 d')
done()
})
// 404 css
//require('./f.css')
function done() {
if (++n === 3) {
test.assert(w_errors.length > 0, w_errors.length)
test.assert(s_errors.length === 4, s_errors.length)
test.next()
}
}
})
| Improve specs for error event | Improve specs for error event
| JavaScript | mit | jishichang/seajs,eleanors/SeaJS,baiduoduo/seajs,ysxlinux/seajs,kaijiemo/seajs,wenber/seajs,uestcNaldo/seajs,PUSEN/seajs,zaoli/seajs,JeffLi1993/seajs,13693100472/seajs,tonny-zhang/seajs,chinakids/seajs,ysxlinux/seajs,kuier/seajs,Gatsbyy/seajs,wenber/seajs,miusuncle/seajs,mosoft521/seajs,treejames/seajs,Lyfme/seajs,imcys/seajs,yern/seajs,AlvinWei1024/seajs,yuhualingfeng/seajs,yern/seajs,kuier/seajs,FrankElean/SeaJS,lianggaolin/seajs,zwh6611/seajs,tonny-zhang/seajs,13693100472/seajs,treejames/seajs,miusuncle/seajs,FrankElean/SeaJS,MrZhengliang/seajs,baiduoduo/seajs,coolyhx/seajs,angelLYK/seajs,longze/seajs,PUSEN/seajs,sheldonzf/seajs,liupeng110112/seajs,hbdrawn/seajs,judastree/seajs,mosoft521/seajs,judastree/seajs,longze/seajs,hbdrawn/seajs,twoubt/seajs,baiduoduo/seajs,AlvinWei1024/seajs,Lyfme/seajs,lovelykobe/seajs,yuhualingfeng/seajs,zaoli/seajs,jishichang/seajs,ysxlinux/seajs,moccen/seajs,evilemon/seajs,LzhElite/seajs,lee-my/seajs,seajs/seajs,moccen/seajs,lovelykobe/seajs,zwh6611/seajs,miusuncle/seajs,lovelykobe/seajs,chinakids/seajs,yuhualingfeng/seajs,sheldonzf/seajs,twoubt/seajs,LzhElite/seajs,lee-my/seajs,liupeng110112/seajs,treejames/seajs,MrZhengliang/seajs,lianggaolin/seajs,kaijiemo/seajs,judastree/seajs,longze/seajs,imcys/seajs,Gatsbyy/seajs,coolyhx/seajs,Lyfme/seajs,angelLYK/seajs,121595113/seajs,uestcNaldo/seajs,seajs/seajs,evilemon/seajs,JeffLi1993/seajs,eleanors/SeaJS,liupeng110112/seajs,kaijiemo/seajs,Gatsbyy/seajs,sheldonzf/seajs,jishichang/seajs,PUSEN/seajs,eleanors/SeaJS,LzhElite/seajs,AlvinWei1024/seajs,JeffLi1993/seajs,evilemon/seajs,121595113/seajs,yern/seajs,seajs/seajs,mosoft521/seajs,kuier/seajs,zaoli/seajs,FrankElean/SeaJS,angelLYK/seajs,zwh6611/seajs,wenber/seajs,moccen/seajs,tonny-zhang/seajs,MrZhengliang/seajs,coolyhx/seajs,twoubt/seajs,lianggaolin/seajs,uestcNaldo/seajs,imcys/seajs,lee-my/seajs | ---
+++
@@ -34,7 +34,7 @@
function done() {
if (++n === 3) {
- test.assert(w_errors.length === 2, w_errors.length)
+ test.assert(w_errors.length > 0, w_errors.length)
test.assert(s_errors.length === 4, s_errors.length)
test.next()
} |
670dff868d04ab149bd252b6835b224a202a5bd1 | lib/provider.js | lib/provider.js | 'use babel';
import {filter} from 'fuzzaldrin';
import commands from './commands';
import variables from './variables';
export const selector = '.source.cmake';
export const disableForSelector = '.source.cmake .comment';
export const inclusionPriority = 1;
function existy(value) {
return value != null;
}
function dispatch() {
var funs = arguments;
return function() {
for (var f of funs) {
var ret = f.apply(null, arguments);
if (existy(ret)) {
return ret;
}
}
};
}
function variables_suggestions(prefix) {
return filter(variables, prefix.toUpperCase()).map((variable) => ({
text: variable,
displayText: variable,
type: 'variable'
}));
}
function commands_suggestions(prefix) {
return filter(commands, prefix.toLowerCase()).map((command) => ({
text: `${command}()`,
displayText: command,
type: 'function'
}));
}
const suggest = dispatch(
(prefix, scope_descriptor) => {
if (scope_descriptor.scopes.length > 1) {
return variables_suggestions(prefix);
}
},
(prefix) => commands_suggestions(prefix)
)
export function getSuggestions({prefix, scopeDescriptor: scope_descriptor}) {
return suggest(prefix, scope_descriptor);
}
| 'use babel';
import {filter} from 'fuzzaldrin';
import commands from './commands';
import variables from './variables';
export const selector = '.source.cmake';
export const disableForSelector = '.source.cmake .comment';
export const inclusionPriority = 1;
function existy(value) {
return value != null;
}
function dispatch() {
var funs = arguments;
return function() {
for (var f of funs) {
var ret = f.apply(null, arguments);
if (existy(ret)) {
return ret;
}
}
};
}
function variables_suggestions(prefix) {
return filter(variables, prefix.toUpperCase()).map((variable) => ({
text: variable,
displayText: variable,
type: 'variable'
}));
}
function commands_suggestions(prefix) {
return filter(commands, prefix.toLowerCase()).map((command) => ({
text: `${command}()`,
displayText: command,
type: 'function'
}));
}
const suggest = dispatch(
(prefix, scope_descriptor) => {
if (scope_descriptor.scopes.length > 1) {
return variables_suggestions(prefix);
}
},
(prefix) => commands_suggestions(prefix)
)
export function getSuggestions({prefix, scopeDescriptor: scope_descriptor}) {
return suggest(prefix, scope_descriptor);
}
export function onDidInsertSuggestion({editor, suggestion}) {
if (suggestion && suggestion.type === 'function') {
editor.moveLeft(1);
}
}
| Move cursor left on function completion. | Move cursor left on function completion.
| JavaScript | mit | NealRame/autocomplete-cmake | ---
+++
@@ -52,3 +52,9 @@
export function getSuggestions({prefix, scopeDescriptor: scope_descriptor}) {
return suggest(prefix, scope_descriptor);
}
+
+export function onDidInsertSuggestion({editor, suggestion}) {
+ if (suggestion && suggestion.type === 'function') {
+ editor.moveLeft(1);
+ }
+} |
7bfb2f65427182294c4582bb6bf1234daa193791 | shell/Gruntfile.js | shell/Gruntfile.js | module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
"download-atom-shell": {
version: "0.20.3",
outputDir: "./atom-shell",
rebuild: true
}
});
grunt.loadNpmTasks('grunt-download-atom-shell');
};
| module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
"download-atom-shell": {
version: "0.19.5",
outputDir: "./atom-shell",
rebuild: true
}
});
grunt.loadNpmTasks('grunt-download-atom-shell');
};
| Revert back to older atom-shell where remote-debugging works | Revert back to older atom-shell where remote-debugging works
This allows console to work again.
In b5b1c142b6d92d3f254c93aa43432230d4d31e14 we upgraded to an
atom-shell where remote-debugging /json doesn't seem to work.
Details at atom/atom-shell#969
| JavaScript | mit | kolya-ay/LightTable,masptj/LightTable,youprofit/LightTable,kausdev/LightTable,0x90sled/LightTable,EasonYi/LightTable,youprofit/LightTable,kenny-evitt/LightTable,kenny-evitt/LightTable,brabadu/LightTable,ashneo76/LightTable,rundis/LightTable,0x90sled/LightTable,youprofit/LightTable,fdserr/LightTable,kolya-ay/LightTable,kausdev/LightTable,kausdev/LightTable,rundis/LightTable,mrwizard82d1/LightTable,masptj/LightTable,masptj/LightTable,ashneo76/LightTable,fdserr/LightTable,mpdatx/LightTable,windyuuy/LightTable,nagyistoce/LightTable,pkdevbox/LightTable,mrwizard82d1/LightTable,LightTable/LightTable,brabadu/LightTable,ashneo76/LightTable,bruno-oliveira/LightTable,Bost/LightTable,LightTable/LightTable,nagyistoce/LightTable,mpdatx/LightTable,hiredgunhouse/LightTable,BenjaminVanRyseghem/LightTable,craftybones/LightTable,mrwizard82d1/LightTable,hiredgunhouse/LightTable,bruno-oliveira/LightTable,pkdevbox/LightTable,EasonYi/LightTable,BenjaminVanRyseghem/LightTable,sbauer322/LightTable,sbauer322/LightTable,EasonYi/LightTable,kenny-evitt/LightTable,nagyistoce/LightTable,Bost/LightTable,bruno-oliveira/LightTable,sbauer322/LightTable,Bost/LightTable,mpdatx/LightTable,BenjaminVanRyseghem/LightTable,brabadu/LightTable,fdserr/LightTable,0x90sled/LightTable,windyuuy/LightTable,hiredgunhouse/LightTable,craftybones/LightTable,rundis/LightTable,craftybones/LightTable,windyuuy/LightTable,LightTable/LightTable,pkdevbox/LightTable,kolya-ay/LightTable | ---
+++
@@ -4,7 +4,7 @@
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
"download-atom-shell": {
- version: "0.20.3",
+ version: "0.19.5",
outputDir: "./atom-shell",
rebuild: true
} |
5a3b4b8010d20793c0ffcb36caeb27283aef61c5 | src/components/Members/NavbarLink.js | src/components/Members/NavbarLink.js | import React from 'react';
import { Link } from 'react-router';
function NavbarLink({to, href, className, component, children}) {
const Comp = component || Link;
return (
<span>
{ href ?
<a href={href}>Yo</a>
:
<Comp to={to} className={className} activeStyle={{
color: '#A94545',
}}>
{children}
</Comp>
}
</span>
);
}
export default NavbarLink;
| import React from 'react';
import { Link } from 'react-router';
function NavbarLink({ children, className, component, href, to }) {
const Comp = component || Link;
let Linkelement = (
<Comp to={to} className={className} activeStyle={{
color: '#A94545',
}}>
{children}
</Comp>
);
if (href) {
Linkelement = (
<a href={href}>
{children}
</a>
);
}
return Linkelement;
}
export default NavbarLink;
| Modify link generation to allow off site links | Modify link generation to allow off site links
| JavaScript | cc0-1.0 | cape-io/acf-client,cape-io/acf-client | ---
+++
@@ -1,22 +1,25 @@
import React from 'react';
import { Link } from 'react-router';
-function NavbarLink({to, href, className, component, children}) {
+function NavbarLink({ children, className, component, href, to }) {
const Comp = component || Link;
- return (
- <span>
- { href ?
- <a href={href}>Yo</a>
- :
- <Comp to={to} className={className} activeStyle={{
- color: '#A94545',
- }}>
- {children}
- </Comp>
- }
- </span>
+ let Linkelement = (
+ <Comp to={to} className={className} activeStyle={{
+ color: '#A94545',
+ }}>
+ {children}
+ </Comp>
);
+ if (href) {
+ Linkelement = (
+ <a href={href}>
+ {children}
+ </a>
+ );
+ }
+
+ return Linkelement;
}
|
f6b0174625f669cef151cf8ef702d38b509fe95a | src/components/finish-order/index.js | src/components/finish-order/index.js | import { Component } from 'preact';
import style from './style';
export default class FinishOrder extends Component {
constructor(props) {
super(props);
}
render(props, state) {
return (
<div class="container">
<p class="">
Děkujeme, za Vaši objednávku. Budeme Vás kontaktovat. Detaily objednávky jsme Vám zaslali na email.
</p>
<a class="button" href="http://3dtovarna.cz/" class={`button two columns offset-by-four ${style['button']}`}>
OK
</a>
</div>
);
}
}
| import { Component } from 'preact';
import style from './style';
export default class FinishOrder extends Component {
constructor(props) {
super(props);
}
render(props, state) {
return (
<div class="container">
<p class="">
Děkujeme, za Vaši objednávku. Budeme Vás kontaktovat. Detaily objednávky jsme Vám zaslali na email.
</p>
{/*<a class="button" href="http://3dtovarna.cz/" class={`button two columns offset-by-four ${style['button']}`}>*/}
{/*OK*/}
{/*</a>*/}
</div>
);
}
}
| Disable redirect button on finish order page | Disable redirect button on finish order page
| JavaScript | agpl-3.0 | MakersLab/custom-print | ---
+++
@@ -12,9 +12,9 @@
<p class="">
Děkujeme, za Vaši objednávku. Budeme Vás kontaktovat. Detaily objednávky jsme Vám zaslali na email.
</p>
- <a class="button" href="http://3dtovarna.cz/" class={`button two columns offset-by-four ${style['button']}`}>
- OK
- </a>
+ {/*<a class="button" href="http://3dtovarna.cz/" class={`button two columns offset-by-four ${style['button']}`}>*/}
+ {/*OK*/}
+ {/*</a>*/}
</div>
);
} |
741414856087c820963d3e688d5bbf88f5edf82a | src/components/googlemap/TaskPlot.js | src/components/googlemap/TaskPlot.js | import React, { PropTypes } from 'react';
import { List } from 'immutable';
import Polyline from './Polyline';
import Marker from './Marker';
class TaskPlot extends React.Component {
shouldComponentUpdate(nextProps) {
return (this.props.map !== nextProps.map) ||
(this.props.googlemaps !== nextProps.googlemaps) ||
(this.props.task !== nextProps.task);
}
render() {
const { task, googlemaps, map } = this.props;
const positions = task.map(waypoint => waypoint.get('position'));
let markers = positions.map((pos, index) =>
<Marker googlemaps={googlemaps} map={map} position={pos} key={index} />)
.toArray();
return (
<span>
<Polyline googlemaps={googlemaps} map={map} path={positions} />
{markers}
</span>
);
}
}
TaskPlot.propTypes = {
task: PropTypes.instanceOf(List),
map: PropTypes.object,
googlemaps: PropTypes.object
};
export default TaskPlot;
| import React, { PropTypes } from 'react';
import { List } from 'immutable';
import Polyline from './Polyline';
import Marker from './Marker';
import * as icons from './icons';
class TaskPlot extends React.Component {
shouldComponentUpdate(nextProps) {
return (this.props.map !== nextProps.map) ||
(this.props.googlemaps !== nextProps.googlemaps) ||
(this.props.task !== nextProps.task);
}
render() {
const { task, googlemaps, map } = this.props;
const positions = task.map(waypoint => waypoint.get('position'));
const lastIndex = positions.count() - 1;
let markers = positions.map((pos, index) => {
let markerLabel;
switch (index) {
case lastIndex:
markerLabel = icons.UNICODE_CHEQUERED_FLAG;
break;
case 0:
markerLabel = 'S';
break;
default:
markerLabel = index.toString();
}
return (<Marker googlemaps={googlemaps} map={map} position={pos} label={markerLabel} key={index} />);
}).toArray();
return (
<span>
<Polyline googlemaps={googlemaps} map={map} path={positions} />
{markers}
</span>
);
}
}
TaskPlot.propTypes = {
task: PropTypes.instanceOf(List),
map: PropTypes.object,
googlemaps: PropTypes.object
};
export default TaskPlot;
| Add labels to task markers. | Add labels to task markers.
| JavaScript | mit | alistairmgreen/soaring-analyst,alistairmgreen/soaring-analyst | ---
+++
@@ -2,6 +2,7 @@
import { List } from 'immutable';
import Polyline from './Polyline';
import Marker from './Marker';
+import * as icons from './icons';
class TaskPlot extends React.Component {
@@ -14,10 +15,23 @@
render() {
const { task, googlemaps, map } = this.props;
const positions = task.map(waypoint => waypoint.get('position'));
+ const lastIndex = positions.count() - 1;
- let markers = positions.map((pos, index) =>
- <Marker googlemaps={googlemaps} map={map} position={pos} key={index} />)
- .toArray();
+ let markers = positions.map((pos, index) => {
+ let markerLabel;
+ switch (index) {
+ case lastIndex:
+ markerLabel = icons.UNICODE_CHEQUERED_FLAG;
+ break;
+ case 0:
+ markerLabel = 'S';
+ break;
+ default:
+ markerLabel = index.toString();
+ }
+
+ return (<Marker googlemaps={googlemaps} map={map} position={pos} label={markerLabel} key={index} />);
+ }).toArray();
return (
<span> |
e8a00e1baad5e8ae7baa8afd9502f20cd0cd0687 | src/store/actions.js | src/store/actions.js | import axios from 'axios';
const API_BASE = 'http://api.zorexsalvo.com/v1';
export default {
getPosts: ({ commit }) => {
axios.get(`${API_BASE}/posts/`).then(
(response) => {
commit('getPosts', response.data);
},
);
},
getPost: ({ commit }, payload) => {
axios.get(`${API_BASE}/posts/${payload}/`).then(
(response) => {
commit('getPost', response.data);
},
);
},
};
| import axios from 'axios';
const API_BASE = 'https://api.zorexsalvo.com/v1';
export default {
getPosts: ({ commit }) => {
axios.get(`${API_BASE}/posts/`).then(
(response) => {
commit('getPosts', response.data);
},
);
},
getPost: ({ commit }, payload) => {
axios.get(`${API_BASE}/posts/${payload}/`).then(
(response) => {
commit('getPost', response.data);
},
);
},
};
| Change api url to https | Change api url to https
| JavaScript | mit | zorexsalvo/zorexsalvo.github.io,zorexsalvo/zorexsalvo.github.io | ---
+++
@@ -1,6 +1,6 @@
import axios from 'axios';
-const API_BASE = 'http://api.zorexsalvo.com/v1';
+const API_BASE = 'https://api.zorexsalvo.com/v1';
export default { |
d456e2986d4b99f09fa291c990dff7c8d6a0d9d9 | src/utils/draw/reset_g.js | src/utils/draw/reset_g.js | // remove all children of the main `g` element
// prepare for re-drawing (e.g. during resize) with margins
export default ({
g,
margin
}) => {
g.selectAll('*').remove()
g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
}
| // remove all children of the main `g` element
// and all children of the base `element` that are flagged with a css class named `--delete-on-update`
// prepare for re-drawing (e.g. during resize) with margins
export default ({
g,
element,
margin
}) => {
element.selectAll('.--delete-on-update').remove()
g.selectAll('*').remove()
g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
}
| Add flag to remove stuff outside of `g` element on resize & update. | Add flag to remove stuff outside of `g` element on resize & update.
| JavaScript | mit | simonwoerpel/d3-playbooks,simonwoerpel/d3-playbooks,simonwoerpel/d3-playbooks | ---
+++
@@ -1,9 +1,12 @@
// remove all children of the main `g` element
+// and all children of the base `element` that are flagged with a css class named `--delete-on-update`
// prepare for re-drawing (e.g. during resize) with margins
export default ({
g,
+ element,
margin
}) => {
+ element.selectAll('.--delete-on-update').remove()
g.selectAll('*').remove()
g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
} |
8d94ee098cbde06564c72cbd44574bd47fd207a5 | vmdb/app/assets/javascripts/application.js | vmdb/app/assets/javascripts/application.js | //= require cfme_application
//= require dialog_import_export
//= require widget_import_export
//= require jquery.jqplot
//= require jqplot-plugins/jqplot.pieRenderer
//= require jqplot-plugins/jqplot.barRenderer
//= require jqplot-plugins/jqplot.categoryAxisRenderer
//= require jqplot-plugins/jqplot.highlighter
//= require jqplot-plugins/jqplot.cursor
//= require jqplot-plugins/jqplot.enhancedLegendRenderer
//= require cfme_jqplot
| //= require cfme_application
//= require dialog_import_export
//= require widget_import_export
//= require excanvas
//= require jquery.jqplot
//= require jqplot-plugins/jqplot.pieRenderer
//= require jqplot-plugins/jqplot.barRenderer
//= require jqplot-plugins/jqplot.categoryAxisRenderer
//= require jqplot-plugins/jqplot.highlighter
//= require jqplot-plugins/jqplot.cursor
//= require jqplot-plugins/jqplot.enhancedLegendRenderer
//= require cfme_jqplot
| Enable jqplot charts to be visible in IE8 | Enable jqplot charts to be visible in IE8
https://bugzilla.redhat.com/show_bug.cgi?id=1058261
| JavaScript | apache-2.0 | juliancheal/manageiq,jvlcek/manageiq,jameswnl/manageiq,djberg96/manageiq,maas-ufcg/manageiq,josejulio/manageiq,fbladilo/manageiq,romanblanco/manageiq,lpichler/manageiq,agrare/manageiq,romanblanco/manageiq,NaNi-Z/manageiq,aufi/manageiq,jntullo/manageiq,tinaafitz/manageiq,tinaafitz/manageiq,mfeifer/manageiq,branic/manageiq,KevinLoiseau/manageiq,maas-ufcg/manageiq,NaNi-Z/manageiq,chessbyte/manageiq,fbladilo/manageiq,djberg96/manageiq,maas-ufcg/manageiq,josejulio/manageiq,mfeifer/manageiq,billfitzgerald0120/manageiq,agrare/manageiq,mresti/manageiq,josejulio/manageiq,tinaafitz/manageiq,ilackarms/manageiq,skateman/manageiq,jrafanie/manageiq,tzumainn/manageiq,ailisp/manageiq,pkomanek/manageiq,hstastna/manageiq,ManageIQ/manageiq,maas-ufcg/manageiq,tzumainn/manageiq,borod108/manageiq,jrafanie/manageiq,durandom/manageiq,yaacov/manageiq,jntullo/manageiq,durandom/manageiq,josejulio/manageiq,syncrou/manageiq,d-m-u/manageiq,tzumainn/manageiq,billfitzgerald0120/manageiq,matobet/manageiq,israel-hdez/manageiq,andyvesel/manageiq,pkomanek/manageiq,mfeifer/manageiq,andyvesel/manageiq,gerikis/manageiq,kbrock/manageiq,matobet/manageiq,juliancheal/manageiq,gerikis/manageiq,NaNi-Z/manageiq,d-m-u/manageiq,mresti/manageiq,aufi/manageiq,NickLaMuro/manageiq,aufi/manageiq,mkanoor/manageiq,andyvesel/manageiq,jameswnl/manageiq,jvlcek/manageiq,mresti/manageiq,durandom/manageiq,billfitzgerald0120/manageiq,mfeifer/manageiq,jntullo/manageiq,skateman/manageiq,matobet/manageiq,mkanoor/manageiq,yaacov/manageiq,gmcculloug/manageiq,gmcculloug/manageiq,fbladilo/manageiq,branic/manageiq,kbrock/manageiq,lpichler/manageiq,jvlcek/manageiq,juliancheal/manageiq,romaintb/manageiq,ailisp/manageiq,syncrou/manageiq,chessbyte/manageiq,agrare/manageiq,gerikis/manageiq,KevinLoiseau/manageiq,mzazrivec/manageiq,NickLaMuro/manageiq,syncrou/manageiq,yaacov/manageiq,aufi/manageiq,lpichler/manageiq,borod108/manageiq,matobet/manageiq,ilackarms/manageiq,ailisp/manageiq,syncrou/manageiq,chessbyte/manageiq,chessbyte/manageiq,maas-ufcg/manageiq,jrafanie/manageiq,fbladilo/manageiq,lpichler/manageiq,kbrock/manageiq,gmcculloug/manageiq,KevinLoiseau/manageiq,yaacov/manageiq,romanblanco/manageiq,israel-hdez/manageiq,KevinLoiseau/manageiq,romaintb/manageiq,mzazrivec/manageiq,djberg96/manageiq,ManageIQ/manageiq,hstastna/manageiq,israel-hdez/manageiq,KevinLoiseau/manageiq,pkomanek/manageiq,kbrock/manageiq,ilackarms/manageiq,NickLaMuro/manageiq,ManageIQ/manageiq,mkanoor/manageiq,gerikis/manageiq,maas-ufcg/manageiq,jrafanie/manageiq,romaintb/manageiq,borod108/manageiq,romanblanco/manageiq,juliancheal/manageiq,tinaafitz/manageiq,ilackarms/manageiq,israel-hdez/manageiq,KevinLoiseau/manageiq,billfitzgerald0120/manageiq,ailisp/manageiq,andyvesel/manageiq,mzazrivec/manageiq,durandom/manageiq,skateman/manageiq,hstastna/manageiq,djberg96/manageiq,skateman/manageiq,jameswnl/manageiq,branic/manageiq,romaintb/manageiq,pkomanek/manageiq,romaintb/manageiq,d-m-u/manageiq,NickLaMuro/manageiq,d-m-u/manageiq,ManageIQ/manageiq,NaNi-Z/manageiq,jvlcek/manageiq,jameswnl/manageiq,gmcculloug/manageiq,agrare/manageiq,borod108/manageiq,tzumainn/manageiq,jntullo/manageiq,branic/manageiq,mresti/manageiq,hstastna/manageiq,mzazrivec/manageiq,mkanoor/manageiq,romaintb/manageiq | ---
+++
@@ -1,6 +1,7 @@
//= require cfme_application
//= require dialog_import_export
//= require widget_import_export
+//= require excanvas
//= require jquery.jqplot
//= require jqplot-plugins/jqplot.pieRenderer
//= require jqplot-plugins/jqplot.barRenderer |
50ff129e6e3a02a03aa63a26e5c7d782a722db0e | src/bacon.react.js | src/bacon.react.js | import Bacon from "baconjs"
import React from "react"
export default React.createClass({
getInitialState() {
return {}
},
tryDispose() {
const {dispose} = this.state
if (dispose) {
dispose()
this.replaceState({})
}
},
trySubscribe(tDOM) {
this.tryDispose()
if (tDOM)
this.setState(
{dispose: (tDOM instanceof Bacon.Observable ? tDOM :
Bacon.combineTemplate(tDOM instanceof Array
? <div>{tDOM}</div>
: tDOM))
.onValue(DOM => this.setState({DOM}))})
},
componentWillReceiveProps(nextProps) {
this.trySubscribe(nextProps.children)
},
componentWillMount() {
this.trySubscribe(this.props.children)
const {willMount} = this.props
!willMount || willMount(this)
},
componentDidMount() {
const {didMount} = this.props
!didMount || didMount(this)
},
shouldComponentUpdate(nextProps, nextState) {
return nextState.DOM !== this.state.DOM
},
componentWillUnmount() {
this.tryDispose()
const {willUnmount} = this.props
!willUnmount || willUnmount(this)
},
render() {
const {DOM} = this.state
return DOM ? DOM : null
}
})
| import Bacon from "baconjs"
import React from "react"
export default React.createClass({
getInitialState() {
return {}
},
tryDispose() {
const {dispose} = this.state
if (dispose) {
dispose()
this.replaceState({})
}
},
trySubscribe(props) {
this.tryDispose()
const {children} = props
if (children) {
let stream = children
if (stream instanceof Array) {
const {className, id} = props
stream = <div className={className} id={id}>{stream}</div>
}
if (!(stream instanceof Bacon.Observable))
stream = Bacon.combineTemplate(stream)
this.setState({dispose: stream.onValue(DOM => this.setState({DOM}))})
}
},
componentWillReceiveProps(nextProps) {
this.trySubscribe(nextProps)
},
componentWillMount() {
this.trySubscribe(this.props)
const {willMount} = this.props
!willMount || willMount(this)
},
componentDidMount() {
const {didMount} = this.props
!didMount || didMount(this)
},
shouldComponentUpdate(nextProps, nextState) {
return nextState.DOM !== this.state.DOM
},
componentWillUnmount() {
this.tryDispose()
const {willUnmount} = this.props
!willUnmount || willUnmount(this)
},
render() {
const {DOM} = this.state
if (!DOM)
return null
if (!(DOM instanceof Array))
return DOM
const {className, id} = this.props
return <div className={className} id={id}>{DOM}</div>
}
})
| Support className & id attrs and stream of arrays. | Support className & id attrs and stream of arrays.
| JavaScript | mit | polytypic/bacon.react | ---
+++
@@ -12,21 +12,25 @@
this.replaceState({})
}
},
- trySubscribe(tDOM) {
+ trySubscribe(props) {
this.tryDispose()
- if (tDOM)
- this.setState(
- {dispose: (tDOM instanceof Bacon.Observable ? tDOM :
- Bacon.combineTemplate(tDOM instanceof Array
- ? <div>{tDOM}</div>
- : tDOM))
- .onValue(DOM => this.setState({DOM}))})
+ const {children} = props
+ if (children) {
+ let stream = children
+ if (stream instanceof Array) {
+ const {className, id} = props
+ stream = <div className={className} id={id}>{stream}</div>
+ }
+ if (!(stream instanceof Bacon.Observable))
+ stream = Bacon.combineTemplate(stream)
+ this.setState({dispose: stream.onValue(DOM => this.setState({DOM}))})
+ }
},
componentWillReceiveProps(nextProps) {
- this.trySubscribe(nextProps.children)
+ this.trySubscribe(nextProps)
},
componentWillMount() {
- this.trySubscribe(this.props.children)
+ this.trySubscribe(this.props)
const {willMount} = this.props
!willMount || willMount(this)
},
@@ -44,6 +48,11 @@
},
render() {
const {DOM} = this.state
- return DOM ? DOM : null
+ if (!DOM)
+ return null
+ if (!(DOM instanceof Array))
+ return DOM
+ const {className, id} = this.props
+ return <div className={className} id={id}>{DOM}</div>
}
}) |
02e191dabf4485f305c09c37592fcdfdf477553b | src/base/Button.js | src/base/Button.js |
mi2JS.comp.add('base/Button', 'Base', '',
// component initializer function that defines constructor and adds methods to the prototype
function(proto, superProto, comp, superComp){
proto.construct = function(el, tpl, parent){
superProto.construct.call(this, el, tpl, parent);
this.lastClick = 0;
this.listen(el,"click",function(evt){
evt.stop();
});
this.listen(el,"mousedown",function(evt){
if(evt.which != 1) return; // only left click
evt.stop();
if(this.isEnabled() && this.parent.fireEvent){
var now = new Date().getTime();
if(now -this.lastClick > 300){ // one click per second
this.parent.fireEvent(this.getEvent(), {
action: this.getAction(),
button:this,
domEvent: evt,
src:this,
eventFor: 'parent'
});
this.lastClick = now;
}
}
});
};
proto.getEvent = function(){
return this.attr("event") || "action";
};
proto.getAction = function(){
return this.attr("action") || "action";
};
proto.setValue = function(value){
this.el.value = value;
};
proto.getValue = function(value){
return this.el.value;
};
});
|
mi2JS.comp.add('base/Button', 'Base', '',
// component initializer function that defines constructor and adds methods to the prototype
function(proto, superProto, comp, superComp){
proto.construct = function(el, tpl, parent){
superProto.construct.call(this, el, tpl, parent);
this.lastClick = 0;
this.listen(el,"click",function(evt){
evt.stop();
});
this.listen(el,"mousedown",function(evt){
if(evt.which != 1) return; // only left click
evt.stop();
if(this.isEnabled() && this.parent.fireEvent){
var now = new Date().getTime();
if(now -this.lastClick > 300){ // one click per second
this.parent.fireEvent(this.getEvent(), {
action: this.getAction(),
button:this,
domEvent: evt,
src:this,
eventFor: 'parent'
});
this.lastClick = now;
}
}
});
};
proto.getEvent = function(){
return this.attr("event") || "action";
};
proto.getAction = function(){
return this.attr("action") || this.__propName;
};
proto.setValue = function(value){
this.el.value = value;
};
proto.getValue = function(value){
return this.el.value;
};
});
| Use __propName as default action for button | Use __propName as default action for button
| JavaScript | mit | hrgdavor/mi2js,hrgdavor/mi2js,hrgdavor/mi2js | ---
+++
@@ -37,7 +37,7 @@
};
proto.getAction = function(){
- return this.attr("action") || "action";
+ return this.attr("action") || this.__propName;
};
proto.setValue = function(value){ |
4d949a2bc8f628dcc66ee62161ae3680b21766d0 | bin/pep-proxy.js | bin/pep-proxy.js | #!/usr/bin/env node
var proxy = require('../lib/fiware-orion-pep'),
config = require('../config');
proxy.start(function (error, proxyObj) {
if (error) {
process.exit();
} else {
var module;
console.log('Loading middlewares');
module = require('../' + config.middlewares.require);
for (var i in config.middlewares.functions) {
proxyObj.middlewares.push(module[config.middlewares.functions[i]]);
}
console.log('Server started');
}
}); | #!/usr/bin/env node
var proxy = require('../lib/fiware-orion-pep'),
config = require('../config');
proxy.start(function(error, proxyObj) {
var module;
if (error) {
process.exit();
} else {
console.log('Loading middlewares');
module = require('../' + config.middlewares.require);
for (var i in config.middlewares.functions) {
proxyObj.middlewares.push(module[config.middlewares.functions[i]]);
}
console.log('Server started');
}
});
| FIX Move the module definition to the top of the function | FIX Move the module definition to the top of the function
| JavaScript | agpl-3.0 | telefonicaid/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,telefonicaid/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin,agroknow/fiware-pep-steelskin | ---
+++
@@ -3,12 +3,12 @@
var proxy = require('../lib/fiware-orion-pep'),
config = require('../config');
-proxy.start(function (error, proxyObj) {
+proxy.start(function(error, proxyObj) {
+ var module;
+
if (error) {
process.exit();
} else {
- var module;
-
console.log('Loading middlewares');
module = require('../' + config.middlewares.require);
|
a439b552acbd586615b15b86d79ed003979aeaed | static/js/sh_init.js | static/js/sh_init.js | var codes = document.getElementsByTagName("code");
var title, elTitle, elPre;
for (var i=0, l=codes.length ; i<l ; i++) {
elPre = codes[i].parentNode;
if (elPre.tagName != "PRE") continue;
// Prepare for highlighting
// elPre.className = elPre.className.replace("sourceCode ","");
if (elPre.className.match("sourceCode"))
switch (elPre.className.replace("sourceCode ","")) {
case 'css':
case 'haskell':
case 'html':
case 'php':
case 'python':
elPre.className = "sourceCode sh_" + elPre.className.replace("sourceCode ", "");
break;
case 'js':
elPre.className += " sh_javascript";
case 'literate haskell':
elPre.className += " sh_haskell";
break;
}
}
//sh_highlightDocument("/static/js/lang/", ".js");
| var codes = document.getElementsByTagName("code");
var title, elTitle, elPre;
for (var i=0, l=codes.length ; i<l ; i++) {
elPre = codes[i].parentNode;
if (elPre.tagName != "PRE") continue;
// Prepare for highlighting
// elPre.className = elPre.className.replace("sourceCode ","");
if (elPre.className.match("sourceCode"))
switch (elPre.className.replace("sourceCode ","")) {
case 'css':
case 'haskell':
case 'html':
case 'php':
case 'java':
case 'python':
elPre.className = "sourceCode sh_" + elPre.className.replace("sourceCode ", "");
break;
case 'js':
elPre.className += " sh_javascript";
case 'literate haskell':
elPre.className += " sh_haskell";
break;
}
}
//sh_highlightDocument("/static/js/lang/", ".js");
| Add java to automatic conversions | Add java to automatic conversions
| JavaScript | bsd-3-clause | MasseR/Blog,MasseR/Blog | ---
+++
@@ -12,6 +12,7 @@
case 'haskell':
case 'html':
case 'php':
+ case 'java':
case 'python':
elPre.className = "sourceCode sh_" + elPre.className.replace("sourceCode ", "");
break; |
c06c26a6987da66dc1722be92625065cacf73603 | src/json-chayns-call/json-calls.js | src/json-chayns-call/json-calls.js | import * as jsonCallFunctions from './calls/index';
const jsonCalls = {
1: jsonCallFunctions.toggleWaitCursor,
2: jsonCallFunctions.selectTapp,
4: jsonCallFunctions.showPictures,
14: jsonCallFunctions.requestGeoLocation,
15: jsonCallFunctions.showVideo,
16: jsonCallFunctions.showAlert,
18: jsonCallFunctions.getGlobalData,
30: jsonCallFunctions.dateTimePicker,
50: jsonCallFunctions.selectDialog,
54: jsonCallFunctions.tobitLogin,
56: jsonCallFunctions.tobitLogout,
72: jsonCallFunctions.showFloatingButton,
73: jsonCallFunctions.setObjectForKey,
74: jsonCallFunctions.getObjectForKey,
75: jsonCallFunctions.addChaynsCallErrorListener,
77: jsonCallFunctions.setIframeHeight,
78: jsonCallFunctions.getWindowMetric,
81: jsonCallFunctions.scrollToPosition,
92: jsonCallFunctions.updateChaynsId,
102: jsonCallFunctions.addScrollListener,
103: jsonCallFunctions.inputDialog,
112: jsonCallFunctions.sendEventToTopFrame,
113: jsonCallFunctions.closeDialog,
114: jsonCallFunctions.setWebsiteTitle,
115: jsonCallFunctions.setTobitAccessToken,
127: jsonCallFunctions.getSavedIntercomChats,
128: jsonCallFunctions.setIntercomChatData,
129: jsonCallFunctions.closeWindow,
};
export default jsonCalls;
| import * as jsonCallFunctions from './calls/index';
const jsonCalls = {
1: jsonCallFunctions.toggleWaitCursor,
2: jsonCallFunctions.selectTapp,
4: jsonCallFunctions.showPictures,
14: jsonCallFunctions.requestGeoLocation,
15: jsonCallFunctions.showVideo,
16: jsonCallFunctions.showAlert,
18: jsonCallFunctions.getGlobalData,
30: jsonCallFunctions.dateTimePicker,
50: jsonCallFunctions.selectDialog,
52: jsonCallFunctions.setTobitAccessToken,
54: jsonCallFunctions.tobitLogin,
56: jsonCallFunctions.tobitLogout,
72: jsonCallFunctions.showFloatingButton,
73: jsonCallFunctions.setObjectForKey,
74: jsonCallFunctions.getObjectForKey,
75: jsonCallFunctions.addChaynsCallErrorListener,
77: jsonCallFunctions.setIframeHeight,
78: jsonCallFunctions.getWindowMetric,
81: jsonCallFunctions.scrollToPosition,
92: jsonCallFunctions.updateChaynsId,
102: jsonCallFunctions.addScrollListener,
103: jsonCallFunctions.inputDialog,
112: jsonCallFunctions.sendEventToTopFrame,
113: jsonCallFunctions.closeDialog,
114: jsonCallFunctions.setWebsiteTitle,
115: jsonCallFunctions.setTobitAccessToken,
127: jsonCallFunctions.getSavedIntercomChats,
128: jsonCallFunctions.setIntercomChatData,
129: jsonCallFunctions.closeWindow,
};
export default jsonCalls;
| Add support for chayns-call 52 | Add support for chayns-call 52
| JavaScript | mit | TobitSoftware/chayns-web-light,TobitSoftware/chayns-web-light | ---
+++
@@ -10,6 +10,7 @@
18: jsonCallFunctions.getGlobalData,
30: jsonCallFunctions.dateTimePicker,
50: jsonCallFunctions.selectDialog,
+ 52: jsonCallFunctions.setTobitAccessToken,
54: jsonCallFunctions.tobitLogin,
56: jsonCallFunctions.tobitLogout,
72: jsonCallFunctions.showFloatingButton, |
e13f0ea5f5e21d63d367e61f4b247ba2a60cfd48 | 5.AdvancedReactAndRedux/test/test_helper.js | 5.AdvancedReactAndRedux/test/test_helper.js | // Set up testing enviroment to run like a browser in the command line
// Build 'renderComponent' helper that should render a given react class
// Build helper for simulating events
// Set up chai-jquery | import jsdom from 'jsdom';
import jquery from 'jquery';
import TestUtils from 'react-addons-test-utils';
// Set up testing enviroment to run like a browser in the command line
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = global.document.defaultView;
const $ = _$(global.window);
// Build 'renderComponent' helper that should render a given react class
function renderComponent(ComponentClass) {
const componentInstance = TestUtils.renderIntoDocument(<ComponentClass />);
return $(ReactDOM.findDOMNode(componentInstance)); // produces HTML
}
// Build helper for simulating events
// Set up chai-jquery | Set up running like browser in command line, build renderComponent helper function | Set up running like browser in command line, build renderComponent helper function
| JavaScript | mit | Branimir123/Learning-React,Branimir123/Learning-React | ---
+++
@@ -1,7 +1,18 @@
+import jsdom from 'jsdom';
+import jquery from 'jquery';
+import TestUtils from 'react-addons-test-utils';
+
// Set up testing enviroment to run like a browser in the command line
-
+global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
+global.window = global.document.defaultView;
+const $ = _$(global.window);
// Build 'renderComponent' helper that should render a given react class
+function renderComponent(ComponentClass) {
+ const componentInstance = TestUtils.renderIntoDocument(<ComponentClass />);
+
+ return $(ReactDOM.findDOMNode(componentInstance)); // produces HTML
+}
// Build helper for simulating events |
61a7bad245a6b365ff7162421545b9004d79b2d5 | firecares/firestation/static/firestation/js/controllers/home.js | firecares/firestation/static/firestation/js/controllers/home.js |
'use strict';
(function() {
angular.module('fireStation.homeController', [])
.controller('home', function($scope, map, $filter) {
var homeMap = map.initMap('map', {scrollWheelZoom: false});
homeMap.setView([40, -90], 4);
var headquartersIcon = L.FireCARESMarkers.headquartersmarker();
if (featured_departments != null) {
L.geoJson(featured_departments, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: headquartersIcon});
},
onEachFeature: function(feature, layer) {
if (feature.properties && feature.properties.name) {
var popUp = '<b><a href="' + feature.properties.url +'">' + feature.properties.name + '</a></b>';
if (feature.properties.dist_model_score != null) {
popUp += '<br><b>Performance score: </b> ' + feature.properties.dist_model_score + ' seconds';
}
if (feature.properties.predicted_fires != null) {
popUp += '<br><b>Predicted annual residential fires: </b> ' + $filter('number')(feature.properties.predicted_fires, 0);
}
layer.bindPopup(popUp);
}
}
}).addTo(homeMap);
}
});
})();
|
'use strict';
(function() {
angular.module('fireStation.homeController', [])
.controller('home', function($scope, map, $filter) {
var homeMap = map.initMap('map', {scrollWheelZoom: false});
homeMap.setView([40, -90], 4);
var headquartersIcon = L.FireCARESMarkers.headquartersmarker();
if (featured_departments != null) {
L.geoJson(featured_departments, {
pointToLayer: function(feature, latlng) {
return L.marker(latlng, {icon: headquartersIcon});
},
onEachFeature: function(feature, layer) {
if (feature.properties && feature.properties.name) {
var popUp = '<b><a href="' + feature.properties.url +'">' + feature.properties.name + '</a></b>';
if (feature.properties.dist_model_score != null) {
popUp += '<br><b>Performance score: </b> ' + feature.properties.dist_model_score + ' seconds';
}
if (feature.properties.predicted_fires != null) {
popUp += '<br><b>Predicted annual residential fires: </b> ' + $filter('number')(feature.properties.predicted_fires, 0);
}
layer.bindPopup(popUp);
}
}
}).addTo(homeMap);
}
});
})();
| Update js to bust compressor cache. | Update js to bust compressor cache.
| JavaScript | mit | meilinger/firecares,HunterConnelly/firecares,garnertb/firecares,FireCARES/firecares,ROGUE-JCTD/vida,garnertb/firecares,HunterConnelly/firecares,ROGUE-JCTD/vida,ROGUE-JCTD/vida,ROGUE-JCTD/vida,HunterConnelly/firecares,FireCARES/firecares,meilinger/firecares,garnertb/firecares,FireCARES/firecares,FireCARES/firecares,FireCARES/firecares,meilinger/firecares,meilinger/firecares,HunterConnelly/firecares,ROGUE-JCTD/vida,garnertb/firecares | ---
+++
@@ -5,32 +5,32 @@
angular.module('fireStation.homeController', [])
.controller('home', function($scope, map, $filter) {
- var homeMap = map.initMap('map', {scrollWheelZoom: false});
- homeMap.setView([40, -90], 4);
- var headquartersIcon = L.FireCARESMarkers.headquartersmarker();
+ var homeMap = map.initMap('map', {scrollWheelZoom: false});
+ homeMap.setView([40, -90], 4);
+ var headquartersIcon = L.FireCARESMarkers.headquartersmarker();
- if (featured_departments != null) {
- L.geoJson(featured_departments, {
- pointToLayer: function(feature, latlng) {
- return L.marker(latlng, {icon: headquartersIcon});
- },
- onEachFeature: function(feature, layer) {
- if (feature.properties && feature.properties.name) {
- var popUp = '<b><a href="' + feature.properties.url +'">' + feature.properties.name + '</a></b>';
+ if (featured_departments != null) {
+ L.geoJson(featured_departments, {
+ pointToLayer: function(feature, latlng) {
+ return L.marker(latlng, {icon: headquartersIcon});
+ },
+ onEachFeature: function(feature, layer) {
+ if (feature.properties && feature.properties.name) {
+ var popUp = '<b><a href="' + feature.properties.url +'">' + feature.properties.name + '</a></b>';
- if (feature.properties.dist_model_score != null) {
- popUp += '<br><b>Performance score: </b> ' + feature.properties.dist_model_score + ' seconds';
- }
+ if (feature.properties.dist_model_score != null) {
+ popUp += '<br><b>Performance score: </b> ' + feature.properties.dist_model_score + ' seconds';
+ }
- if (feature.properties.predicted_fires != null) {
- popUp += '<br><b>Predicted annual residential fires: </b> ' + $filter('number')(feature.properties.predicted_fires, 0);
- }
+ if (feature.properties.predicted_fires != null) {
+ popUp += '<br><b>Predicted annual residential fires: </b> ' + $filter('number')(feature.properties.predicted_fires, 0);
+ }
- layer.bindPopup(popUp);
- }
- }
- }).addTo(homeMap);
- }
- });
+ layer.bindPopup(popUp);
+ }
+ }
+ }).addTo(homeMap);
+ }
+ });
})();
|
6a97907ccc0ceeadcbbef6c66fda080e926c42b2 | packages/ember-metal/lib/error_handler.js | packages/ember-metal/lib/error_handler.js | import Logger from 'ember-console';
import { isTesting } from './testing';
let onerror;
// Ember.onerror getter
export function getOnerror() {
return onerror;
}
// Ember.onerror setter
export function setOnerror(handler) {
onerror = handler;
}
let dispatchOverride;
// dispatch error
export function dispatchError(error) {
if (dispatchOverride) {
dispatchOverride(error);
} else {
defaultDispatch(error);
}
}
// allows testing adapter to override dispatch
export function setDispatchOverride(handler) {
dispatchOverride = handler;
}
function defaultDispatch(error) {
if (isTesting()) {
throw error;
}
if (onerror) {
onerror(error);
} else {
Logger.error(error.stack);
}
}
| import Logger from 'ember-console';
import { isTesting } from './testing';
// To maintain stacktrace consistency across browsers
let getStack = function(error) {
var stack = error.stack;
var message = error.message;
if (stack.indexOf(message) === -1) {
stack = message + '\n' + stack;
}
return stack;
};
let onerror;
// Ember.onerror getter
export function getOnerror() {
return onerror;
}
// Ember.onerror setter
export function setOnerror(handler) {
onerror = handler;
}
let dispatchOverride;
// dispatch error
export function dispatchError(error) {
if (dispatchOverride) {
dispatchOverride(error);
} else {
defaultDispatch(error);
}
}
// allows testing adapter to override dispatch
export function setDispatchOverride(handler) {
dispatchOverride = handler;
}
function defaultDispatch(error) {
if (isTesting()) {
throw error;
}
if (onerror) {
onerror(error);
} else {
Logger.error(getStack(error));
}
}
| Fix Error object's stacktrace inconsistency across browsers | Fix Error object's stacktrace inconsistency across browsers
| JavaScript | mit | johanneswuerbach/ember.js,elwayman02/ember.js,kanongil/ember.js,patricksrobertson/ember.js,intercom/ember.js,Patsy-issa/ember.js,sivakumar-kailasam/ember.js,thoov/ember.js,mixonic/ember.js,kennethdavidbuck/ember.js,sivakumar-kailasam/ember.js,bekzod/ember.js,rfsv/ember.js,kaeufl/ember.js,pixelhandler/ember.js,mike-north/ember.js,mike-north/ember.js,pixelhandler/ember.js,kellyselden/ember.js,karthiick/ember.js,pixelhandler/ember.js,sivakumar-kailasam/ember.js,alexdiliberto/ember.js,thoov/ember.js,Gaurav0/ember.js,bekzod/ember.js,bantic/ember.js,csantero/ember.js,chadhietala/ember.js,skeate/ember.js,mike-north/ember.js,GavinJoyce/ember.js,Gaurav0/ember.js,mfeckie/ember.js,twokul/ember.js,vikram7/ember.js,GavinJoyce/ember.js,code0100fun/ember.js,cbou/ember.js,szines/ember.js,HeroicEric/ember.js,trentmwillis/ember.js,kellyselden/ember.js,tsing80/ember.js,nickiaconis/ember.js,kellyselden/ember.js,mixonic/ember.js,duggiefresh/ember.js,lan0/ember.js,lan0/ember.js,HeroicEric/ember.js,Turbo87/ember.js,miguelcobain/ember.js,HeroicEric/ember.js,thoov/ember.js,lan0/ember.js,fpauser/ember.js,Serabe/ember.js,cibernox/ember.js,fpauser/ember.js,chadhietala/ember.js,jasonmit/ember.js,johanneswuerbach/ember.js,miguelcobain/ember.js,Patsy-issa/ember.js,johanneswuerbach/ember.js,kennethdavidbuck/ember.js,kaeufl/ember.js,jasonmit/ember.js,tsing80/ember.js,cbou/ember.js,chadhietala/ember.js,vikram7/ember.js,emberjs/ember.js,Leooo/ember.js,amk221/ember.js,gfvcastro/ember.js,rlugojr/ember.js,NLincoln/ember.js,knownasilya/ember.js,davidpett/ember.js,patricksrobertson/ember.js,workmanw/ember.js,xiujunma/ember.js,GavinJoyce/ember.js,knownasilya/ember.js,runspired/ember.js,kanongil/ember.js,trentmwillis/ember.js,HeroicEric/ember.js,karthiick/ember.js,johanneswuerbach/ember.js,chadhietala/ember.js,rlugojr/ember.js,elwayman02/ember.js,davidpett/ember.js,alexdiliberto/ember.js,nickiaconis/ember.js,mfeckie/ember.js,karthiick/ember.js,sly7-7/ember.js,vikram7/ember.js,qaiken/ember.js,givanse/ember.js,xiujunma/ember.js,gfvcastro/ember.js,kennethdavidbuck/ember.js,runspired/ember.js,karthiick/ember.js,Turbo87/ember.js,alexdiliberto/ember.js,qaiken/ember.js,sandstrom/ember.js,jherdman/ember.js,davidpett/ember.js,kanongil/ember.js,Gaurav0/ember.js,mixonic/ember.js,tsing80/ember.js,jaswilli/ember.js,jherdman/ember.js,duggiefresh/ember.js,tildeio/ember.js,stefanpenner/ember.js,csantero/ember.js,asakusuma/ember.js,sly7-7/ember.js,code0100fun/ember.js,bantic/ember.js,workmanw/ember.js,patricksrobertson/ember.js,szines/ember.js,Serabe/ember.js,cibernox/ember.js,jaswilli/ember.js,cbou/ember.js,Patsy-issa/ember.js,gfvcastro/ember.js,workmanw/ember.js,bantic/ember.js,fpauser/ember.js,runspired/ember.js,givanse/ember.js,davidpett/ember.js,GavinJoyce/ember.js,jasonmit/ember.js,runspired/ember.js,rfsv/ember.js,patricksrobertson/ember.js,nickiaconis/ember.js,Serabe/ember.js,gfvcastro/ember.js,cibernox/ember.js,jasonmit/ember.js,jasonmit/ember.js,amk221/ember.js,twokul/ember.js,Leooo/ember.js,alexdiliberto/ember.js,jherdman/ember.js,skeate/ember.js,rfsv/ember.js,xiujunma/ember.js,qaiken/ember.js,emberjs/ember.js,stefanpenner/ember.js,emberjs/ember.js,kellyselden/ember.js,tildeio/ember.js,twokul/ember.js,mfeckie/ember.js,elwayman02/ember.js,thoov/ember.js,mfeckie/ember.js,bantic/ember.js,intercom/ember.js,givanse/ember.js,knownasilya/ember.js,sivakumar-kailasam/ember.js,mike-north/ember.js,pixelhandler/ember.js,asakusuma/ember.js,csantero/ember.js,kennethdavidbuck/ember.js,intercom/ember.js,duggiefresh/ember.js,Leooo/ember.js,bekzod/ember.js,lan0/ember.js,kanongil/ember.js,code0100fun/ember.js,sivakumar-kailasam/ember.js,sly7-7/ember.js,asakusuma/ember.js,bekzod/ember.js,Serabe/ember.js,NLincoln/ember.js,asakusuma/ember.js,xiujunma/ember.js,amk221/ember.js,jherdman/ember.js,nickiaconis/ember.js,vikram7/ember.js,tsing80/ember.js,rlugojr/ember.js,skeate/ember.js,stefanpenner/ember.js,Gaurav0/ember.js,cbou/ember.js,sandstrom/ember.js,amk221/ember.js,Turbo87/ember.js,jaswilli/ember.js,trentmwillis/ember.js,kaeufl/ember.js,NLincoln/ember.js,twokul/ember.js,kaeufl/ember.js,code0100fun/ember.js,Turbo87/ember.js,Patsy-issa/ember.js,intercom/ember.js,givanse/ember.js,Leooo/ember.js,szines/ember.js,skeate/ember.js,szines/ember.js,sandstrom/ember.js,miguelcobain/ember.js,jaswilli/ember.js,trentmwillis/ember.js,qaiken/ember.js,rfsv/ember.js,elwayman02/ember.js,csantero/ember.js,cibernox/ember.js,duggiefresh/ember.js,fpauser/ember.js,workmanw/ember.js,miguelcobain/ember.js,rlugojr/ember.js,NLincoln/ember.js,tildeio/ember.js | ---
+++
@@ -1,5 +1,17 @@
import Logger from 'ember-console';
import { isTesting } from './testing';
+
+// To maintain stacktrace consistency across browsers
+let getStack = function(error) {
+ var stack = error.stack;
+ var message = error.message;
+
+ if (stack.indexOf(message) === -1) {
+ stack = message + '\n' + stack;
+ }
+
+ return stack;
+};
let onerror;
// Ember.onerror getter
@@ -33,6 +45,6 @@
if (onerror) {
onerror(error);
} else {
- Logger.error(error.stack);
+ Logger.error(getStack(error));
}
} |
a0045dd29b77217ed86dbf2f1d26925d5416b0ad | example_test.js | example_test.js | var util = require('util'),
webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome'),
retry = require('./index.js');
var driver = chrome.createDriver(
new webdriver.Capabilities({'browserName': 'chrome'}),
new chrome.ServiceBuilder('./chromedriver').build());
driver.get('localhost:8888');
retry.run(function() {
// Note that everything in here will be retried - including the
// first click.
driver.findElement(webdriver.By.id('showmessage')).click();
// This would throw an error without waiting because the message
// is hidden for 3 seconds.
driver.findElement(webdriver.By.id('message')).click();
}, 5000).then(function() {
// run returns a promise which resolves when all the retrying is done
// If the retry fails (either it times out or the error is not in the ignore
// list) the promise will be rejected.
});
// 7 is the error code for element not found.
retry.ignoring(7).run(function() {
driver.findElement(webdriver.By.id('creatediv')).click();
// This would throw an error because the div does not appear for
// 3 seconds.
driver.findElement(webdriver.By.id('inserted')).getText();
}, 5000);
driver.quit();
| var util = require('util'),
webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome'),
retry = require('./index.js');
// Assumes that there is a chromedriver binary in the same directory.
var driver = chrome.createDriver(
new webdriver.Capabilities({'browserName': 'chrome'}),
new chrome.ServiceBuilder('./chromedriver').build());
driver.get('http://juliemr.github.io/webdriverjs-retry/');
retry.run(function() {
// Note that everything in here will be retried - including the
// first click.
driver.findElement(webdriver.By.id('showmessage')).click();
// This would throw an error without waiting because the message
// is hidden for 3 seconds.
driver.findElement(webdriver.By.id('message')).click();
}, 5000).then(function() {
// run returns a promise which resolves when all the retrying is done
// If the retry fails (either it times out or the error is not in the ignore
// list) the promise will be rejected.
});
// 7 is the error code for element not found.
retry.ignoring(7).run(function() {
driver.findElement(webdriver.By.id('creatediv')).click();
// This would throw an error because the div does not appear for
// 3 seconds.
driver.findElement(webdriver.By.id('inserted')).getText();
}, 5000);
driver.quit();
| Make the example test run without requiring local server | Make the example test run without requiring local server
| JavaScript | mit | bbc/webdriverjs-retry,bbc/webdriverjs-retry,juliemr/webdriverjs-retry | ---
+++
@@ -3,11 +3,12 @@
chrome = require('selenium-webdriver/chrome'),
retry = require('./index.js');
+// Assumes that there is a chromedriver binary in the same directory.
var driver = chrome.createDriver(
new webdriver.Capabilities({'browserName': 'chrome'}),
new chrome.ServiceBuilder('./chromedriver').build());
-driver.get('localhost:8888');
+driver.get('http://juliemr.github.io/webdriverjs-retry/');
retry.run(function() {
// Note that everything in here will be retried - including the |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.