Skip to content

Instantly share code, notes, and snippets.

View st23am's full-sized avatar

James Smith st23am

  • Adobe / Frame.io
  • Cincinnati
  • X @st23am
View GitHub Profile
// Brunch automatically concatenates all files in your
// watched paths. Those paths can be configured at
// config.paths.watched in "brunch-config.js".
//
// However, those files will only be executed if
// explicitly imported. The only exception are files
// in vendor, which are never wrapped in imports and
// therefore are always executed.
// Import dependencies
@st23am
st23am / fizzbuzz.exs
Last active December 31, 2015 01:38
Fizzbuzz in Elixir
#FizzBuzz with module, named functions, and no conditional
defmodule Kata do
def fizzbuzz( 0, 0, _ ), do: "FizzBuzz"
def fizzbuzz( 0, _, _ ), do: "Fizz"
def fizzbuzz( _, 0, _ ), do: "Buzz"
def fizzbuzz( _, _, x ), do: "#{ x }"
def fizzbuzz(n) do
fizzbuzz(rem(n, 3), rem(n, 5), n)
end
end
p {
padding-bottom: 5px;
border-bottom: 1px solid #000;
}
" Thanks to Ben Orenstein
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Test-running stuff
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! RunCurrentTest()
let in_test_file = match(expand("%"), '\(.feature\|_spec.rb\|_test.rb\)$') != -1
if in_test_file
call SetTestFile()
@st23am
st23am / robot3.rb
Created November 20, 2012 23:13
BaselineBot
require 'rrobots'
class Robot3
include Robot
def tick events
@rapid_fire = 0 if @rapid_fire.nil?
@last_seen = 0 if @last_seen.nil?
@turn_speed = 3 if @turn_speed.nil?
if time - @last_seen > 200
@st23am
st23am / urinal.rb
Created October 4, 2012 21:45 — forked from jimweirich/urinal.rb
Test Problem
class Urinal
def initialize(occupied, line)
@occupied = occupied
@line = line
end
def select
scores = stalls.map { |n| [score(n), n] }
best = scores.sort.last
best.first < 0 ? nil : best.last
@st23am
st23am / 0-readme.md
Created September 11, 2012 00:34 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@st23am
st23am / gist:2937073
Created June 15, 2012 15:35
Git branch parsing
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
@st23am
st23am / Turtle Commands
Created May 2, 2012 16:09
Turtle Commands
def I[ forward 30
pen
turn 180
forward 15
pen
turn 90
forward 30
turn 90
forward 15
turn 180
@st23am
st23am / cukeit
Created April 18, 2012 20:52
Cukeit
alias cukeit='rm -f tmp/capybara/* && cucumber -p wip'
alias pukeit='rm -f tmp/capybara/* && cucumber -p wip && open tmp/capybara/*'