Skip to content

Instantly share code, notes, and snippets.

Lucky to be here

Steve Grossi stevegrossi

Lucky to be here
Block or report user

Report or block stevegrossi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
stevegrossi / command_parsing.ex
Created Feb 8, 2018
Elixir command parsing
View command_parsing.ex
# I've been wondering about a pattern-matching-driven approach to what we've been talking about, e.g.
def parse_command(input) do
|> String.strip
|> match_command
def match_command("north"), do: {Player, :move, [:north, player, world]}
def match_command("east"), do: {Player, :move, [:east, player, world]}
stevegrossi / string_to_integer_bench.exs
Last active Jul 21, 2017
Elixir parsing stringy integers: rescue vs. regex
View string_to_integer_bench.exs
defmodule StringToIntegerBench do
use Benchfella
@word "string"
@integer "1234"
bench "regex for word" do
if numeric_string?(@word) do
@word |> String.to_integer
View gist:a8a90f5db83c8a00e06e527da996ace2
Name,Email,Role,Group: Test Group 1,Group: Test Group 2,Group: Test Group 3,Custom: Test Custom Field
Test User 1,,learner,yes,yes,yes,oranges
Test User 2,,learner,yes,yes,yes,oranges
Test User 3,,learner,yes,yes,yes,oranges
Test User 4,,learner,yes,yes,yes,oranges
Test User 5,,learner,yes,yes,yes,oranges
Test User 6,,learner,yes,yes,yes,oranges
Test User 7,,learner,yes,yes,yes,oranges
Test User 8,,learner,yes,yes,yes,oranges
Test User 9,,learner,yes,yes,yes,oranges
stevegrossi / jmeter.rb
Last active Mar 19, 2018
Sample JMeter test plan using the ruby-jmeter gem
View jmeter.rb
#!/usr/bin/env ruby
require 'ruby-jmeter'
test do
defaults domain: ''
cookies clear_each_iteration: true
stevegrossi / post-commit
Created Jan 10, 2014
When using git on a mac, this hook will speak your commit messages in a robot voice each time you commit. Just save this file within a git repository at .git/hooks/post-commit
View post-commit
MESSAGE=$(git log -1 HEAD --pretty=format:%s)
say -v "Zarvox" "$MESSAGE"
stevegrossi / image.rb
Created Dec 21, 2013
How to rename a Paperclip attachment when an interpolated attribute in the Filename changes
View image.rb
class Image < ActiveRecord::Base
attr_accessible :custom_file_name
has_attached_file :attachment
after_save :rename_attached_file, if: :rename_necessary?
def rename_attached_file
(attachment.styles.keys).each do |style|
You can’t perform that action at this time.