This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_computeSearchUrlParameters(freeTextSearch, originFilter, destinationFilter, quotationStatusFilter) { | |
const argNames = ['freeTextSearch', 'originFilter', 'destinationFilter', 'quotationStatusFilter']; | |
let result = '?'; | |
[].forEach.call(arguments, (arg, index) => { | |
if (arg && arg.length) { | |
result += argNames[index] + '=' + arg + '&'; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calcSum = (items, prop) => { | |
return items.reduce((a, b) => a + b[prop], 0); | |
} | |
let foo = [{price: 1}, {price: 2}, {price: 3}]; | |
calcSum(foo, 'price'); // 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Twitch Auto Fullscreen | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Enter fullscreen after a countdown (ESC to cancel) | |
// @author You | |
// @include https://www.twitch.tv/* | |
// @include https://twitch.tv/* | |
// @require https://cdnjs.cloudflare.com/ajax/libs/umbrella/3.1.0/umbrella.min.js | |
// @grant GM_addStyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* http://blog.mgechev.com/2014/04/16/singleton-in-javascript/ | |
* | |
* - It instantiates only a single object | |
* - Its safe – it keeps the reference to the singleton inside a variable, which | |
* lives inside a lexical closure and is not accessible by the outside world | |
* - It allows you to initialize the singleton with some arguments. The module | |
* pattern, which wraps the singleton is not aware of the initialization | |
* arguments – it simply forwards the call with apply | |
* - You can use the instanceof operator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
'use strict'; | |
$.fn.wrapRegExp = function(options) { | |
// defaults | |
var settings = $.extend({ | |
regExp: /([\s\S]*)/, | |
wrapper: '<div style="border:1px solid red;" />' | |
}, options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAABQMAAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAREQAAAAAAEREREQAAAAEiIREREAAAEiIiERERAAASESIhEREAASIRIiERERABIiIiEREREAEiIiEREREQASIiIRIhERAAEiIhEiERAAASIiEREREAAAEiIhEREAAAABEiIREAAAAAABERAAAAAAAAAAAAAAD//wAA/D8AAPAPAADgBwAAwAMAAMADAACAAQAAgAEAAIABAACAAQAAwAMAAMADAADgBwAA8A8AAPw/AAD//wAA" rel="icon" type="image/x-icon"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name load_replace_css_js | |
// @namespace https://gist.github.com/search?q=thegitfather+UserScript | |
// @author thegitfather | |
// @version 0.11 | |
// @description load/replace css/js | |
// @updateURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js | |
// @downloadURL https://gist.github.com/thegitfather/679c9bc76e9b058790e3/raw/load_replace_css_js.user.js | |
// @include http://127.0.0.1/* | |
// @grant none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__________________ | |
/\ ______________ \ | |
/::\ \ZZZZZZZZZZZZ/\ \ | |
/:/\.\ \ /:/\:\ \ | |
/:/Z/\:\ \ /:/Z/\:\ \ | |
/:/Z/__\:\ \____/:/Z/ \:\ \ | |
/:/Z/____\:\ \___\/Z/ \:\ \ | |
\:\ \ZZZZZ\:\ \ZZ/\ \ \:\ \ | |
\:\ \ \:\ \ \:\ \ \:\ \ | |
\:\ \ \:\ \_\;\_\_____\;\ \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.container { | |
display: flex; | |
flex-flow: row wrap; |