Skip to content

Instantly share code, notes, and snippets.

View joemsak's full-sized avatar

Joe Sak joemsak

View GitHub Profile
(function() {
var surfBoardShark = {
surfButton: document.getElementById('surfbutton'),
sharkGif: document...,
init: function() {
this.surfButton.addEventListener('click', this.revealShark.bind(this));
},
class Mentor < Account
default_scope { joins(:mentor_profile) }
end
require 'active_record'
require 'minitest/autorun'
# connection setup
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :users, force: true do |t|
t.string :username

Master the lessons of your present circumstances.

We do not move forward by resisting what is undesirable in our life today. We move forward, we grow, we change by acceptance.

Avoidance is not the key; surrender opens the door.

Listen to this truth: We are each in our present circumstances for a reason. There is a lesson, a valuable lesson, that must be learned before we can move forward.

Something important is being worked out in us, and in those around us. We may not be able to identify it today, but we can know that it is important. We can know it is good.

shuffle = fn ->
suits = ~w{hearts diamonds clubs spades}a
ranks = ~w{ace two three four five six seven eight nine ten jack queen king}a
deck = for suit <- suits, rank <- ranks, do: {rank, suit}
deck |> Enum.shuffle
end
IO.write("\e[H\e[2J")
whichfizz = fn
(0, 0, _) -> "FizzBuzz"
(0, _, _) -> "Fizz"
(_, 0, _) -> "Buzz"
(_, _, n) -> n
end
fizzbuzz = fn (n) ->
whichfizz.(rem(n, 3), rem(n, 5), n)
end
defmodule FizzBuzz do
@initial 1
@limit 100
@sleep 250
@buzz_value 5
@fizz_value 3
@buzz "Buzz"
@fizz "Fizz"
class AddSomeData < ActiveRecord::Migration
def change
reversible do |dir|
dir.up { Something.create(stuff: 'here') }
dir.down { Something.find_by(stuff: 'here').destroy }
end
end
end
defmodule PingPong do
@finish_game 11
def ready do
receive do
{_sender, _action, @finish_game} ->
IO.puts "Game finished..."
ready
{sender, action, turn} ->
@joemsak
joemsak / gol.exs
Created June 3, 2016 04:30 — forked from avdi/gol.exs
Game of life in Elixir (take 1)
# Updated for 1.2.5
defmodule Life do
def run(board) when is_binary(board) do
board |> parse_board |> run
end
def run(board) do
IO.write("\e[H\e[2J")
Life.print_board board