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
| var fs = require('fs'); | |
| module.exports = function () { | |
| return fs | |
| .readdirSync(__dirname) | |
| .filter(function (file) { return /\.json$/.test(file); }) | |
| .reduce(function (config, file) { | |
| return extend(config, require(__dirname + '/' + file)); | |
| }, {}); | |
| }; |
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
| Object.prototype.random = function() { | |
| return this.toRandomArray()[0]; | |
| }; | |
| Object.prototype.toRandomArray = function() { | |
| function object_values(object, values) { | |
| Object.keys(object).forEach(function (key) { | |
| typeof object[key] === 'object' | |
| ? object_values(object[key], values) | |
| : values.push(object[key]); |
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
| var DI = function (dependency) { | |
| this.dependency = dependency; | |
| }; | |
| DI.prototype.inject = function (func) { | |
| var $scope = func | |
| .toString() | |
| .match(/function *\((.*)\)/)[1] | |
| .split(',') | |
| .map(function (e) { return e.trim(); }) |
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
| def top_3_words(text) | |
| text | |
| .gsub(/[^A-Za-z ']+/, '') | |
| .split(/\s+/) | |
| .inject(Hash.new 0) { |v, w| v[w.downcase] += 1; v } | |
| .sort_by { |w, c| c } | |
| .reverse | |
| .map { |v, k| v } | |
| .reject(&:empty?) | |
| .select { |e| e =~ /\w/i } |
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
| // this is unfinished as you can guess... | |
| RomanNumerals = { | |
| dict: { | |
| I: 1, | |
| V: 5, | |
| X: 10, | |
| L: 50, | |
| C: 100, | |
| D: 500, |
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 formatDuration (seconds) { | |
| return [60, 3600, 86400, 31536000] | |
| .reduceRight(function (results, current) { | |
| var seconds = results.pop(); | |
| results.push(Math.floor(seconds / current)); | |
| results.push(seconds - results[results.length - 1] * current); | |
| return results; | |
| }, [seconds]) | |
| .map(function (value, index) { | |
| var words = ['year', 'day', 'hour', 'minute', 'second']; |
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
| "\x80w\x01\x03\x01\x00N\x00\x00\x00 \x00\x009\x00\x008\x00\x005\x00\x00\x16\x00\x00\x13\x00\x00" 400 181 "-" "-" | |
| "GET /HNAP1/ HTTP/1.1" 404 9 "http://188.226.164.45/" "Mozilla/4.0 (compatible; MSIE 4.01; Mac_PowerPC)" | |
| "GET / HTTP/1.1" 200 2482 "-" "python-requests/2.2.1 CPython/2.7.3 Linux/3.2.0-61-virtual" | |
| "GET / HTTP/1.1" 200 2482 "-" "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34" | |
| "GET / HTTP/1.1" 200 2482 "-" "python-requests/2.2.1 CPython/2.7.3 Linux/3.2.0-61-virtual" | |
| "GET / HTTP/1.1" 200 2482 "-" "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34" | |
| "GET / HTTP/1.1" 200 2482 "-" "python-requests/2.2.1 CPython/2.7.3 Linux/3.2.0-61-virtual" | |
| "GET / HTTP/1.1" 200 2482 "-" "Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34" | |
| "GET /muieblackcat HTTP/1.1" 404 9 "-" "-" | |
| "GET //phpAdmin/scripts/setup.php HTTP/1.1" 404 9 "-" "-" |
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
| span { | |
| color: #6EACFF; | |
| animation: hue-rotate 60s linear infinite; | |
| } | |
| @keyframes hue-rotate { | |
| from { | |
| .hue-rotate(); | |
| } | |
| to { |
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
| def count str | |
| str.split('').reduce(Hash.new 0) { |memo, c| memo[c] += 1; memo } | |
| end |
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 count (string) { | |
| return string.split('').reduce(function (w, c) { return (w[c] ? w[c]++ : w[c] = 1) && w; }, {}); | |
| } |