Skip to content

Instantly share code, notes, and snippets.

@mileszs
mileszs / pre-commit
Created June 25, 2013 11:02
Git pre-commit hook for prompting to remove binding.pry and debugger lines lines. (Includes a commented example of adding a check for focus in spec files.)
#!/usr/bin/env ruby
hits = []
checks = {
#'_spec\.rb$' => ['focus:[:space:]*true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@mileszs
mileszs / fretless-dev.mkd
Last active January 27, 2018 22:51
Developer at Fretless

Developer at Fretless

Fretless was created so we could continue to hone our craft together, work on interesting projects with interesting people, and help others hone their craft, too. We’re senior developers and technical leaders. Sometimes we join an existing team to sling code and provide senior-level leadership. Other times we tackle a project that a client is unable to complete on their own. Sometimes our work is to teach others!

Geographically, sometimes we work together, sometimes we work remotely, and sometimes we work onsite with our client. We often write web and mobile applications in Ruby and JavaScript (including React, Angular, Ember, etc.). We’re down for other languages, but we’re known for those.

Community is important to us. We can often be found attending, presenting at, or organizing local meetups, such as Indy.rb, Btown.rb, and our High Fives Happy Hour. Several of us are heavily involved in Indy Hackers, too!

We believe strongly in the criteria a

@mileszs
mileszs / authorize_job_poster_1.ex
Last active April 21, 2017 14:48
Use new fun toys or not?
defmodule ElixirJobBoard.Plugs.AuthorizeJobPoster do
import Plug.Conn
import Phoenix.Controller, only: [put_flash: 3, redirect: 2]
alias ElixirJobBoard.Repo
alias ElixirJobBoard.User
alias ElixirJobBoard.Job
def init(opts), do: opts
@mileszs
mileszs / crude-blues.rb
Created September 25, 2014 18:34
Crude code for a blues song via Sonic Pi
# Welcome to Sonic Pi v2.0
def e7
play chord(:e4, :dom7), release: 0.40
sleep 0.5
play chord(:e4, :dom7), release: 0.25
sleep 0.25
end
def a7
@mileszs
mileszs / gist:5575333
Created May 14, 2013 11:43
This is a (living) list of resources recommended by the Indianapolis Ruby Brigade for beginners to Ruby.
@mileszs
mileszs / the-siths-prayer.mkd
Last active May 4, 2016 16:12
The Sith's Prayer

Our father, who art Sith

Hallowed be thy name

Thy kingdom come

Thy will be done

Throughout The Empire

class Phrase
def initialize(value)
@phrase = value
end
def word_count
Hash.new(0).tap do |count|
@phrase.split(/[^[:alnum:]]+/).each do |word|
count[word.downcase] += 1
end
class Phrase
def initialize(value)
@phrase = value
end
def word_count
Hash.new(0).tap do |count|
phrase_words.each do |word|
count[word.downcase] += 1
end
class Bob
def hey(input)
input = Input.new(input)
if input.blank?
'Fine. Be that way.'
elsif input.shouting?
'Woah, chill out!'
elsif input.question?
'Sure.'
else