This file contains hidden or 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
| process.once('SIGUSR2', function () { | |
| gracefulShutdown(function () { | |
| process.kill(process.pid, 'SIGUSR2'); | |
| }) | |
| }); |
This file contains hidden or 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://www.2ality.com/2013/10/safe-integers.html | |
| isSafeInteger = function(n) { | |
| Number.MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; | |
| Number.MIN_SAFE_INTEGER = -Number.MAX_SAFE_INTEGER; | |
| return (typeof n === 'number' && | |
| Math.round(n) === n && | |
| Number.MIN_SAFE_INTEGER <= n && | |
| n <= Number.MAX_SAFE_INTEGER); | |
| }; |
This file contains hidden or 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
| /* JavaScript-XPath 0.1.12 | |
| * (c) 2007 Cybozu Labs, Inc. | |
| * | |
| * JavaScript-XPath is freely distributable under the terms of an MIT-style license. | |
| * For details, see the JavaScript-XPath web site: http://coderepos.org/share/wiki/JavaScript-XPath | |
| * | |
| /*--------------------------------------------------------------------------*/ | |
This file contains hidden or 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
| exiftool -all= *.jpg | |
| This removes all meta data from all files ending with the extension .jpg in the current folder, moving the originals to files with the additional extension "_original". | |
| exiftool -overwrite_original -tagsfromfile *_original -make -model -exposuretime -aperturevalue -flash -iso -lens -focallength -orientation -datetimeoriginal *.jpg | |
| This copies the specified meta data (Make, Model, Exposure, etc.) from the "backuped" _original files to those stripped clean of any data. | |
| exiftool -all= *.jpg;exiftool -overwrite_original -tagsfromfile *_original -make -model -exposuretime -aperturevalue -flash -iso -lens -focallength -orientation -datetimeoriginal *.jpg |
This file contains hidden or 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 MacBook() { | |
| this.cost = function() { | |
| return 997; | |
| }; | |
| this.screenSize = function() { | |
| return 11.6; | |
| }; | |
| } | |
| //Decorator1 |
This file contains hidden or 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 Car(options) { | |
| // some defaults | |
| this.doors = options.doors || 4; | |
| this.state = options.state || "brand new"; | |
| this.color = options.color || "silver"; | |
| } | |
| function Truck(options) { | |
| this.state = options.state || "used"; | |
| this.wheelSize = options.wheelSize || "large"; |
This file contains hidden or 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
| /** | |
| * convert bytes to human readable size | |
| * | |
| * @params int bytes | |
| * @params int decimalPlaces, default=2 | |
| * @params boolean autoSize, default=false | |
| * @return string | |
| */ | |
| function szxHumanSize(bytes, decimalPlaces, autoSize) { | |
| if (typeof (decimalPlaces) == "undefined") decimalPlaces = 2; |
This file contains hidden or 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
| perl -MYAML -e 'YAML::LoadFile "tmp/config.yml";' |
This file contains hidden or 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
| jQuery.fn.brightness = function() { | |
| var bg_color, rgba, y; | |
| bg_color = this.css('background-color'); | |
| if ((bg_color != null) && bg_color.length) { | |
| rgba = bg_color.match(/^rgb(?:a)?\(([0-9]{1,3}),\s([0-9]{1,3}),\s([0-9]{1,3})(?:,\s)?([0-9]{1,3})?\)$/); | |
| if (rgba != null) { | |
| if (rgba[4] === '0') { | |
| if (this.parent().length) return this.parent().brightness(); | |
| } else { | |
| y = 2.99 * rgba[1] + 5.87 * rgba[2] + 1.14 * rgba[3]; |
This file contains hidden or 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 copyToClipboard(text) { | |
| if (window.clipboardData && window.clipboardData.setData) { | |
| window.clipboardData.setData('text', text); | |
| } else { | |
| window.prompt ("Copy to clipboard: Ctrl+C, Enter", text); | |
| } | |
| } |