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
@Pjax = | |
skip_on: [], | |
push_state: false, | |
load_is_safe: false, | |
refresh: (func) -> Pjax.load(location.pathname+location.search, { func:func, no_scroll:true }) | |
init: (@full_page=false) -> | |
return alert "#full_page ID referece not defined in PJAX!\n\nWrap whole page in one DIV element" unless @full_page | |
if window.history && window.history.pushState |
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
$.memento = (func) -> | |
if typeof func == 'function' | |
console.log '$.memento :store' | |
$.memento_stack ||= [] | |
$.memento_stack.push func | |
$ -> func() | |
unless func | |
console.log '$.memento :reattach' | |
setTimeout -> |
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
module Haml::Filters::Xmp | |
include Haml::Filters::Base | |
def render(text) | |
text.gsub /</, '<' | |
end | |
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
#!/usr/bin/ruby | |
require 'colorize' | |
require 'optparse' | |
options = {} | |
op = OptionParser.new do |opts| | |
opts.banner = "Usage: git-stat.rb [options]" | |
opts.on("-d", "--days N", Integer, "In last x days") do |v| | |
options[:days] = v |
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/ruby | |
require 'colorize' | |
@locations = [] | |
def generate_file( file_name, data ) | |
if File.exist?(file_name) | |
info = 'exists'.red | |
else |
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
// GOOD bookmarklet, copy and paste | |
javascript:elms=['masthead-positioner-height-offset', 'content', 'footer-container', 'masthead-positioner'];for (i in elms) { var e=document.getElementById(elms[i]); if (e) e.parentNode.removeChild(e); };document.getElementById('player-api').setAttribute('class','player-api');window.exTFS=function(){ s = document.body.clientHeight-1; document.getElementById('player-api').setAttribute('style','position:absolute;top:0px; left:0px; width:100%; min-height:'+s+'px;z-index:100000000000');document.getElementById('movie_player').setAttribute('style','min-height:'+s+'px;');void(document.getElementsByTagName('video')[0].setAttribute('style','width:100%;min-height:'+s+'px;'))};window.onresize=exTFS;exTFS(); | |
// annotated source | |
elms=['masthead-positioner-height-offset', 'content', 'footer-container', 'masthead-positioner']; | |
for (i in elms) { var e=document.getElementById(elms[i]); if (e) e.parentNode.removeChild(e); } | |
document.getElementById('player-api').setAttribute('class','player- |
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
#!/bin/bash | |
[email protected] | |
REMOTE_DB_NAME=db_production | |
REMOTE_DB_USER=db_user | |
REMOTE_DB_PASS=db_pass | |
LOCAL_DB=db_local | |
echo $REMOTE_DB_PASS | pbcopy |
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/ruby | |
find = ARGV.join(' ') | |
unless find =~ /\w/ | |
print "WHAT: Finds text via grep -r, trims long reponses, pretty print and open file interface\n" | |
print "USAGE: ./finds [text to find in realtive path without quotes]\n" | |
print "EXAMPLE: ./finds def avatar\n" | |
print "@dux 2014\n" | |
exit |
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/ruby | |
require 'colorize' | |
colors = [:green, :red, :yelow, :blue] | |
$stdin.each_line do |l| | |
for el, i in ARGV.each_with_index | |
next unless l =~ /#{el}/ | |
print l.send(colors[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
module StringBase | |
KEYS = 'bcdfghjklmnpqrstvwxyz' | |
def self.encode( value ) | |
ring = Hash[KEYS.chars.map.with_index.to_a.map(&:reverse)] | |
base = KEYS.length | |
result = [] | |
until value == 0 | |
result << ring[ value % base ] | |
value /= base |