Skip to content

Instantly share code, notes, and snippets.

@aokolish
aokolish / init.js
Created November 10, 2011 04:49
Run page JS without switch statement
var LTD = {};
LTD.product = (function() {
//private functions
function somethingHandy() {
...
}
return {
//public functions...
@aokolish
aokolish / Gemfile
Created November 25, 2011 16:24
How to get tests running on an external site that uses HTTP authentication
# /Gemfile
source 'http://rubygems.org'
gem 'rspec'
gem 'capybara'
gem 'selenium-webdriver'
gem 'capybara-webkit'
@aokolish
aokolish / database.yml
Created November 27, 2011 23:26
how to get postgresql working locally with rails
development:
adapter: postgresql
database: <db_name>
encoding: utf8
username: <username>
password:
host: localhost
# ...
@aokolish
aokolish / .watchr
Created November 30, 2011 15:47
watch any file
watch(".*\..*") do |match|
puts `echo "hello"`
end
@aokolish
aokolish / .gvimrc
Created December 2, 2011 21:07
My mac vim settings
color railscasts
set guifont=Monaco:h16
set antialias
" Whitespace stuff
autocmd FileType javascript set tabstop=4
@aokolish
aokolish / Gemfile
Created January 27, 2012 02:53
testing elements that are revealed with css :hover
source 'http://rubygems.org'
gem 'rake'
gem 'rspec'
gem 'capybara'
gem 'selenium-webdriver'
gem 'capybara-webkit'
@aokolish
aokolish / gist:1695477
Created January 28, 2012 19:17
ruby one liner to return spork pid's
`ps aux | awk '/spork/&&!/awk/{print $2;}'`.split("\n").map { |pid| pid.to_i }
@aokolish
aokolish / gist:3061369
Created July 6, 2012 17:05
string interpolation in media queries
$large_display: '(min-width: 1200px)';
body {
@media #{$large_display} {
background: blue;
}
}
@aokolish
aokolish / required.scss
Created July 22, 2012 17:05
boostrap required input override to remove red
//make an 'invalid', required input look like a normal form field
//with plain bootstrap, this field shows up as red before the user has submitted the form
//ideally,it would not be considered :invalid until after the form has been submitted
//alas, this is not currently the case
input:focus:required:invalid, textarea:focus:required:invalid, select:focus:required:invalid {
color: #555;
border-color: $inputBorder;
&:focus {
border-color: rgba(82,168,236,.8);
@aokolish
aokolish / test_search_looping.rb
Created August 7, 2012 05:43
MiniTest test for binary search kata
require 'minitest/autorun'
require_relative '../search_looping'
class TestSearchLooping < MiniTest::Unit::TestCase
def test_chop
assert_equal -1, SearchLooping.chop(3, [])
assert_equal -1, SearchLooping.chop(3, [1])
assert_equal 0, SearchLooping.chop(1, [1])