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
// Convert from decimal to binary | |
(11).toString(2) // “1011" | |
// Convert from decimal to hexadecimal | |
(255).toString(16) // ‘ff' | |
// Convert from binary to decimal | |
parseInt("1011", 2); // 11 | |
// Convert from binary to hexadecimal |
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/bash | |
# $1 has to match this pattern: http://example.com/file.js:3:10 | |
# First get back the url, the line and the column | |
regex="(https?:.*):([0-9]+):([0-9]+)" | |
dir="/tmp/" | |
[[ $1 =~ $regex ]] |
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 comparejsmin() { | |
local origsize=$(wc -c < "$1") | |
local uglifysize=$(uglifyjs "$1" | wc -c) | |
local ratio=$(echo "$uglifysize * 100/ $origsize" | bc -l) | |
printf "Unminified file: %d bytes\n" "$origsize" | |
printf "Minified file: %d bytes (%2.2f%%)\n" "$uglifysize" "$ratio" | |
} |
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
# editorconfig.org | |
root = true | |
[*] | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
insert_final_newline = true |