Skip to content

Instantly share code, notes, and snippets.

Ryan Levick rylev

Block or report user

Report or block rylev

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
rylev / dot_strings_parser.rb
Created Nov 12, 2012
A simple ruby class that parses .strings files (used in OSX and iOS for translations) and coverts it to a Ruby hash.
View dot_strings_parser.rb
class DotStringsParser
REGEX_QUOTED = /\"((\\\"|[^\"])+)\"/
def initialize
@hash = {}
def convert_to_array(line)
rylev / gist:6685033
Created Sep 24, 2013
Enforcing arity like a boss
View gist:6685033
def foo(args)
raise ArgumentError unless args.count == 2 && args.keys.include? :bar
# your code goes here
rylev / sort.ex
Created Oct 9, 2013
Sort Algorithms in Elixir
View sort.ex
## Sort Algorithms in Elixir
# Selection Sort
defmodule Selection do
def sort(list) when is_list(list) do
do_selection(list, [])
def do_selection([head|[]], acc) do
rylev /
Last active Dec 25, 2015
Plan proposal for the next Elixir Users Group.

Intro to FP and Elixir

##Targeted Audience

The targeted audience are both beginners to functional programming who have experience in programming with at least one imperative style language. The content may also be appealing to those who have programmed in other functional programming languages (e.g. Haskell, Clojure, F#, etc.) or even Erlang programmers, but the content will not be specifically geared towards them.

rylev / gist:7725524
Created Nov 30, 2013
Binary Addition with logic gates
View gist:7725524
class Array
def second
class Integer
def one?
raise "Not Binary" unless self == 1 || self == 0
self == 1
rylev / calc.hs
Created Feb 24, 2014
Simple and Incredibly Naive Calculator
View calc.hs
module Main where
import System.Environment
import Text.ParserCombinators.Parsec
import Control.Monad
import Data.Char
main :: IO ()
main = do putStrLn "What would you like to calculate:"
input <- getLine
putStrLn $ readExpr input
rylev / stark_params.rb
Created Mar 11, 2014
Strong Parameters Wrapper
View stark_params.rb
def TasksController
def index
def create
View user.exs
defmodule User do
defstruct firstname: "Ryan", lastname: "Levick"
def full_name(user) do
user.firstname <> " " <> user.lastname
user = %User{}
User.full_name(user) =>
rylev / rgb.ex
Created Apr 8, 2014
Small Module For Parsing and Encoding RGB Values
View rgb.ex
defmodule RGB do
import Enum, only: [map: 2, join: 1, filter: 2, chunk: 2, count: 1]
def encode(rgb) when is_list rgb do
hex = rgb |>
map(&(integer_to_list &1, 16)) |>
map(fn [x] -> [x, x]; x -> x end) |>
map(&String.from_char_list!/1) |>
"#" <> hex
View gist:1da4bf6aeed4ca10141d
import Database.Redis
import Control.Monad.IO.Class
import Data.ByteString.Char8
main :: IO ()
main = do
conn <- connect defaultConnectInfo
runRedis conn $ do
set (pack "hello") (pack "hello")
hello <- get $ pack "hello"
You can’t perform that action at this time.