Skip to content

Instantly share code, notes, and snippets.

View theconektd's full-sized avatar

theconektd theconektd

View GitHub Profile
@theconektd
theconektd / vividchalkish.itermcolors
Created July 6, 2012 17:14
Colors for iTerm that are pretty close to vividchalk.vim
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.0</real>
<key>Green Component</key>
<real>0.0</real>
@theconektd
theconektd / chosen_helper.rb
Created May 8, 2012 21:43
Chosen Select Capybara Helper
def chooze_from original_field_selector, *selected_values
original_field = find original_field_selector
original_field_id = original_field[:id]
container_selector = "##{ original_field_id }_chzn"
container = find container_selector
if container[:class].include? 'chzn-container-multi'
activator = find "#{ container_selector } .chzn-choices"
else
@theconektd
theconektd / github.css
Created April 30, 2012 02:11
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@theconektd
theconektd / gist:1217638
Created September 14, 2011 20:09
find and replace text in a directory
grep -rl test_database_client . | xargs gsed -i 's/test_database_client/test_db/g'
Host *
ForwardAgent yes
Compression yes
ControlMaster auto
Host github.com
IdentitiesOnly yes
ForwardAgent no
Host *.wfhack.com
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set to the name theme to load.
# Look in ~/.oh-my-zsh/themes/
export ZSH_THEME="andyferra"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
require 'selenium-webdriver'
Capybara.register_driver :selenium do |app|
browser = ENV['BROWSER'] ? ENV['BROWSER'].downcase.to_sym : :chrome
if browser == :htmlunit
capabilities = Selenium::WebDriver::Remote::Capabilities.htmlunit
capabilities.javascript_enabled = true
Capybara::Driver::Selenium.new app, :browser => :remote, :desired_capabilities => capabilities
@theconektd
theconektd / js_reek.rb
Created March 3, 2011 03:31
Helps you identify unused functions in your javascript.
js_files = Dir['*.js', 'lib/*.js', 'messages/*.js']
defined_functions = js_files.map {|file|
[ file, File.read(file).scan( /function ([_a-z0-9]+)/i ).flatten.uniq ]
}.reject {|file_name, functions| functions.empty? }
called_functions = js_files.map {|file|
defined_functions.map {|file_name, functions| functions }.flatten.map do |function|
File.read(file).scan /(?<!function )#{function}/
end
$ rake bootstrap:reload --trace
(in /Users/andy/code/np)
** Invoke bootstrap:reload (first_time)
** Invoke bootstrap:reset (first_time)
** Invoke db:drop (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:drop
var $$ = function(param) {
var node = $(param)[0];
var id = $.data(node);
$.cache[id] = $.cache[id] || {};
$.cache[id].node = node;
return $.cache[id];
};
// Now, instead of doing $("#foo").data("foo") and ("#foo").data("foo", "bar"),
// you can do $$("#foo").foo and $$("#foo").foo = bar.