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
| #!/usr/bin/env zsh | |
| # | |
| # Works best with blinking text; the last heart will blink | |
| # when you have less than 25% of your battery life remaining. | |
| BATTERY="$(pmset -g ps | awk 'NR==2' | perl -pe 's/.*?(\d+)%.*/\1/')" | |
| if [[ $BATTERY -lt 25 ]]; then | |
| echo "\e[5;31m♥\e[0;31m♡♡\e[0m" | |
| elif [[ $BATTERY -lt 50 ]]; then |
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://stedolan.github.com/jq/ | |
| $ brew install jq | |
| $ curl https://api.github.com/repos/rails/rails/commits | jq '.[].sha' | |
| "abb38feac84da59f6686d9abcce61d2a9a64efa9" | |
| "61425f2c6d14fe7151b09ffe5a5353924582e5b0" | |
| "03ef833b804fe17ff834ac957a300d45bbb24fab" | |
| "ce60672342f8da447d24d25f8c0f2049fc81c0c8" | |
| "e492c446d520e8941624564b157b297cfd0aeaa9" | |
| "bba8fc4294ca7f7d90c3e64e7fea059b17caef5c" |
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
| /* | |
| * FormData for XMLHttpRequest 2 - Polyfill for Web Worker (c) 2012 Rob W | |
| * License: Creative Commons BY - http://creativecommons.org/licenses/by/3.0/ | |
| * - append(name, value[, filename]) | |
| * - toString: Returns an ArrayBuffer object | |
| * | |
| * Specification: http://www.w3.org/TR/XMLHttpRequest/#formdata | |
| * http://www.w3.org/TR/XMLHttpRequest/#the-send-method | |
| * The .append() implementation also accepts Uint8Array and ArrayBuffer objects | |
| * Web Workers do not natively support FormData: |
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 { | |
| proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; | |
| proxy_temp_path /var/tmp; | |
| include mime.types; | |
| default_type application/octet-stream; | |
| sendfile on; | |
| keepalive_timeout 65; | |
| gzip on; | |
| gzip_comp_level 6; |
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
| require 'date' | |
| # Actually doesn't matter WHAT you choose as the epoch, it | |
| # won't change the algorithm. Just don't change it after you | |
| # have cached computed scores. Choose something before your first | |
| # post to avoid annoying negative numbers. Choose something close | |
| # to your first post to keep the numbers smaller. This is, I think, | |
| # reddit's own epoch. | |
| $our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time |
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 parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
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
| // helper to create proper asset paths if an asset host is configured | |
| App.assets = { | |
| assets : { | |
| <% AssetsUtil.images.each do |img| %> | |
| "<%= img %>" : "<%= asset_path(img) %>", | |
| <% 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
| var swipeFunc = { | |
| touches : { | |
| "touchstart": {"x":-1, "y":-1}, | |
| "touchmove" : {"x":-1, "y":-1}, | |
| "touchend" : false, | |
| "direction" : "undetermined" | |
| }, | |
| touchHandler: function(event) { | |
| var touch; | |
| if (typeof event !== 'undefined'){ |
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
| // Require libraries | |
| var os = require("os"); | |
| var fs = require("fs"); | |
| var readline = require("readline"); | |
| var cluster = require("cluster"); | |
| var express = require("express"); | |
| var site = express(); | |
| // Var up, bro | |
| var i, read; |
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
| #! /usr/bin/env python | |
| import redis | |
| import random | |
| import pylibmc | |
| import sys | |
| r = redis.Redis(host = 'localhost', port = 6389) | |
| mc = pylibmc.Client(['localhost:11222']) |