// Without running these in the browser, can you tell what each of the following would return?
['1', '2', '3', '4'].map(parseInt);
(new Array(2)).map(function() {
return 1;
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
/** | |
* Validate an input string if it is inside ASCII 32 - 126 range | |
* @param string | |
* @return true if all characters in the string are in range, else false | |
*/ | |
var chkASCII32_126 = function(string) { | |
return !string.match(/[^\x20-\x7e]/g); | |
} | |
$(".chorusASCIIValidation").keyup(function() { |
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
build:install-vendor: | |
stage: build | |
image: <any-image-with-composer> | |
before_script: | |
- composer config -g cache-dir "$(pwd)/.composer-cache" | |
script: | |
- composer install --ignore-platform-reqs --no-dev --optimize-autoloader --no-ansi --no-interaction --no-progress | |
cache: | |
paths: | |
- .composer-cache/ |
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
#!/bin/sh | |
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r | column -t |
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
rabbitmqctl add_user test test | |
rabbitmqctl set_user_tags test administrator | |
rabbitmqctl set_permissions -p / test ".*" ".*" ".*" |
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 arrayToCSV (twoDiArray) { | |
// Modified from: http://stackoverflow.com/questions/17836273/ | |
// export-javascript-data-to-csv-file-without-server-interaction | |
var csvRows = []; | |
for (var i = 0; i < twoDiArray.length; ++i) { | |
for (var j = 0; j < twoDiArray[i].length; ++j) { | |
twoDiArray[i][j] = '\"' + twoDiArray[i][j] + '\"'; // Handle elements that contain commas | |
} | |
csvRows.push(twoDiArray[i].join(',')); | |
} |
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
# Designed to be included in any server {} block. | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
allow all; | |
log_not_found off; | |
access_log off; |
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
/** | |
* Small regular expression to match ASCII-chars between 32-126 | |
* | |
* For a conversion table for ASCII chars see: | |
* http://de.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange | |
*/ | |
var expr = /([\x20-\x7E]{1,})/gi; | |
var testString = "Foo Bar Barz"; | |
var testString2 = "Foo Bar\tBarz"; |
NewerOlder