Skip to content

Instantly share code, notes, and snippets.

🔨
Building

John Hamelink johnhamelink

🔨
Building
Block or report user

Report or block johnhamelink

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
View ice_cube_test.rake
namespace :db do
task ice_cube_test: :environment do
CSV.open("out.csv", "wb") do |csv|
Event.all.each do |event|
repeatable = event.repeatables.first
if repeatable.nil?
puts "Bad Event: #{event.id}. No Repeatable."
csv << [event.id, nil, nil, nil]
View Form.js
<Field name="color" label="T-Shirt Color" component={renderSelectField}>
<option></option>
<option value="Black">Black</option>
<option value="Charcoal">Charcoal</option>
<option value="Chocolate Brown">Chocolate Brown</option>
<option value="Grey Heather">Grey Heather</option>
<option value="Maroon">Maroon</option>
<option value="Military Green">Military Green</option>
<option value="Natural">Natural</option>
<option value="Navy">Navy</option>
View skus.csv
We can make this file beautiful and searchable if this error is corrected: Illegal quoting in line 1.
["100K-12-GehyiL6OX2mA5As38U0ukA", "100K-7-dUNc97Qc2kyFQzFGooixlQ", "100K-35-yORzhzwckszdNVLTPX6qTQ", "100K-35-yORzhzwckszdNVLTPX6qTQ", "100K-7-dUNc97Qc2kyFQzFGooixlQ", "100K-12-1HB1gJb9832zY8rxBEltNQ", "100K-7-QMpmDZPypTb8UCwJDofDjQ", "100K-7-dUNc97Qc2kyFQzFGooixlQ", "100K-12-JGR7ZjBbW43Q9JqKQEVQkQ", "100K-12-EKEaIldF0EqIh4b3wMTLhw", "100K-12-Ho8FwMx0ps4qNjZFZaEMMA", "100K-12-N2pLZrXMErfLFnFcAtO5Cg", "100K-7-QMpmDZPypTb8UCwJDofDjQ", "100K-7-QMpmDZPypTb8UCwJDofDjQ", "100K-7-QMpmDZPypTb8UCwJDofDjQ", "100K-7-QMpmDZPypTb8UCwJDofDjQ", "100K-7-dUNc97Qc2kyFQzFGooixlQ", "100K-7-dUNc97Qc2kyFQzFGooixlQ", "100K-12-hQW2co3c0U1eA0xGi52MgA", "100K-12-hQW2co3c0U1eA0xGi52MgA", "100K-12-2XBchhlDGdjG3v6m4BKn7Q", "100K-12-Ho8FwMx0ps4qNjZFZaEMMA", "100K-12-1HB1gJb9832zY8rxBEltNQ", "100K-12-d087u5ecDFcWhv7ZJ9ylAA", "100K-12-d087u5ecDFcWhv7ZJ9ylAA", "100K-12-d087u5ecDFcWhv7ZJ9ylAA", "100K-12-7GtxXK0dIoGatN5iVtXrZQ", "100K-12-7GtxXK0dIoGatN5iVtXrZQ", "100K-12-n3WKmYMabvGAe5iULxhdPg", "100K-12-n3WKmYMabvGAe5iULxhdPg"]
@johnhamelink
johnhamelink / deck.ex
Created Dec 21, 2016
Love Letter game code
View deck.ex
defmodule LoveLetter.Deck do
def shuffle(deck) do
new_deck = Enum.shuffle(deck)
case deck == new_deck do
true -> shuffle(deck)
_ -> new_deck
end
end
end
View s3_service.rb
Base64.strict_encode64(
OpenSSL::HMAC.digest(
OpenSSL::Digest.new('sha1'),
@secret_access_key, policy)
).strip
View config.exs
use Mix.Releases.Config,
default_release: :api,
default_environment: Mix.env
environment :dev do
set dev_mode: true
set include_erts: false
set cookie: :"[Redacted]"
end
View mix.lock
%{"apns": {:hex, :apns, "0.9.2", "234378fea700f85c04147f6a229a264d74d448127797404cfb5b59bc065a9f7b", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:poison, "~> 2.1", [hex: :poison, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}]},
"base64url": {:hex, :base64url, "0.0.1", "36a90125f5948e3afd7be97662a1504b934dd5dac78451ca6e9abf85a10286be", [:rebar], []},
"bbmustache": {:hex, :bbmustache, "1.0.4", "7ba94f971c5afd7b6617918a4bb74705e36cab36eb84b19b6a1b7ee06427aa38", [:rebar], []},
"cache_tab": {:hex, :cache_tab, "1.0.3", "0e3c40dde2fe2a6a4db241d7583cea0cc1bcf29e546a0a22f15b75366b2f336e", [:rebar3], [{:p1_utils, "1.0.4", [hex: :p1_utils, optional: false]}]},
"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []},
"cf": {:hex, :cf, "0.2.1", "69d0b1349fd4d7d4dc55b7f407d29d7a840bf9a1ef5af529f1ebe0ce153fc2ab", [:rebar3], []},
"combine": {:hex, :combine, "0.9.2", "cd3c8721f378ebe032487d8a4f
View session.rb
def has_ios?
devices.exists?(device_type: :ios)
end
def has_android?
devices.exists?(device_type: :android)
end
View push_notification_service.rb
class PushNotificationService
IOS_NAME = 'ios'.freeze
ANDROID_NAME = 'android'.freeze
attr_accessor :gcm_notification, :apns_notification,
:ios_app, :android_app
def gcm_notification
@gcm_notification || Rpush::Gcm::Notification
end
View rpush.rb
SANDBOX_APN_CERT = File.read(Rails.root.join('db', 'fixtures', 'development', 'raw', 'ios_sandbox.pem'))
SANDBOX_GCM_KEY = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
def create_or_update_by_id(klass, id, params)
if config = klass.find(id) rescue nil
config.update_attributes(params)
else
klass.create!(params)
end
end
You can’t perform that action at this time.