Skip to content

Instantly share code, notes, and snippets.

def validate_messages(message)
message.split(' ').each do |msg|
if valid? msg
puts msg + " VALID"
else
puts msg + " INVALID"
end
end
end
require 'active_support/core_ext'
def dates_with_no_changes(employment_dates)
dates = []
employment_dates.each do |date|
dates << date[:start_at].to_date
if date[:end_at].nil?
dates << Date.current.next_year
else
dates << date[:end_at].to_date
@aokolish
aokolish / .simplecov
Last active December 13, 2015 22:08
how to get simplecov results when running specs from zeus.
require 'simplecov'
SimpleCov.configure do
SimpleCov.refuse_coverage_drop
add_filter "/spec/"
add_filter "scraper.rb" # don't care that this is spaghetti code
add_filter "error_messages_helper.rb"
add_filter "/config/"
add_filter "controller"
SimpleCov.minimum_coverage 93
end
@aokolish
aokolish / commands.sh
Created February 10, 2013 20:04
how to get spinach working with zeus
zeus init # => creates custom_plan.rb and zeus.json
@aokolish
aokolish / reveal-options.js
Created October 22, 2012 06:27
Foundation 3 Reveal Options
$('#myModal').reveal({
animation: 'fadeAndPop', // Possible options: fade, fadeAndPop, none
animationSpeed: 300, //Speed at which the reveal should show. How fast animtions are
closeOnBackgroundClick: true, //Should the modal close when the background is clicked?
dismissModalClass: 'close-reveal-modal', //Specify a class name for the 'close modal' element.
open: function(){}, //callback function that triggers 'before' the modal opens.
opened: function(){}, //callback function that triggers 'after' the modal is opened.
close: function(){}, //callback function that triggers 'before' the modal prepares to close.
closed: function(){} //callback function that triggers 'after' the modal is closed.
});
@aokolish
aokolish / tmux.md
Created October 13, 2012 16:47
quick way to kill all tmux sessions

This is the quickest way I've found to kill all tmux sessions

# detach from each session
<prefix>d

# kill tmux and all sessions
tmux kill-server
@aokolish
aokolish / anagrams.txt
Created September 22, 2012 21:16
list of anagrams
barrette batterer
barye beray yerba
basally salably
basaltic cabalist
base besa sabe
basion bonsai sabino
basketwork workbasket
bastille listable
bat tab
batcher brachet
require 'pry'
class SearchLoopingTwo
def self.chop(query, col)
left = 0
right = col.count - 1
middle = col.count / 2
#binding.pry if query == 5
while right >= left do
@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])
@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);