Skip to content

Instantly share code, notes, and snippets.

View ootoovak's full-sized avatar

Juna Ootoovak ootoovak

View GitHub Profile
@ootoovak
ootoovak / example_usage.rb
Created May 21, 2013 00:02
Helper methods to load as few files as possible to get tests to run. Some create require paths to load files and others to init required constants.
require 'fast_spec_helper'
require 'date'
require_model 'generate_required_daily_lists'
required_constants %w(Distributor PackingList DeliveryList)
---- OR ----
require 'fast_spec_helper'
require_model 'exporter', sub_dir: 'sales_csv'
require_model 'delivery_exporter', sub_dir: 'sales_csv'
@ootoovak
ootoovak / fast_spec_helper.rb
Last active December 13, 2015 17:48
Something I'm working with at the moment. WIP
require 'active_attr'
RELATIVE_APP_PATH = File.expand_path("../../app", __FILE__)
def construct_require_path(middle_path, name)
"#{RELATIVE_APP_PATH}/#{middle_path}/#{name}.rb"
end
def require_model(name)
require construct_require_path('models', name)
@ootoovak
ootoovak / tb_fluid_inside_static.haml
Created September 1, 2012 07:11
Twitter Bootstrap Fluid Inside Static
%body
.container
.row
.span2
.span10
.container-fluid
.row-fluid
.span3
.span3
.row-fluid
@ootoovak
ootoovak / buckybackup
Created June 6, 2012 23:04
backup bucky
#!/bin/sh
BACKUPDIR=/Users/developer/backup/bucky/production/
DAYSTAMP=`date "+%d"`
HOURSTAMP=`date "+%H"`
DAYFILE="daily_$DAYSTAMP.dump"
HOURFILE="hourly_$HOURSTAMP.dump"
DAYPATH=$BACKUPDIR$DAYFILE
HOURPATH=$BACKUPDIR$HOURFILE
@ootoovak
ootoovak / carousel.rb
Created May 17, 2012 23:08
1D Packing Problem - Recursive Solution
@ootoovak
ootoovak / gem_leaderboard.rb
Created November 23, 2011 04:04
Place in your a directory with Bundler projects and run to create a leaderboard of your Gems.
#!/usr/bin/ruby -w
puts "Counting your gems ..."
gems = {}
project_folders = Dir.entries(".").select{ |d| d !~ /^\..*/ && !File.file?(d) }
project_folders.each do |folder|
Dir.chdir(folder) do
if File.exists?('Gemfile') && File.file?('Gemfile')