Skip to content

Instantly share code, notes, and snippets.

View ijcd's full-sized avatar

Ian Duggan ijcd

View GitHub Profile
@ijcd
ijcd / taggart_intro_6.ex
Last active November 23, 2017 10:52
taggart_intro_6.ex
defmodule TaggartDemo.PageView do
use TaggartDemoWeb, :view
use Taggart.HTML
def render("index.html", assigns) do
taggart do
render_header("My Fancy Title")
render_body
render_footer
end
@ijcd
ijcd / taggart_intro_5.txt
Last active October 27, 2017 09:08
taggart_intro_5.txt
% mix run bench/run.exs benchmark all
Operating System: macOS
CPU Information: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Number of Available Cores: 8
Available memory: 17.179869184 GB
Elixir 1.5.1
Erlang 20.1.2
Benchmark suite executing with the following configuration:
warmup: 2.00 s
time: 5.00 s
@ijcd
ijcd / taggart_intro_4.ex
Last active November 23, 2017 10:51
taggart_intro_4.ex
use Taggart.HTML
html do
body do
div do
h3 "Person"
p name, class: "name"
p 2 * 19, class: "age"
form_for(build_conn(), "/users", [as: :user], fn f ->
taggart do
@ijcd
ijcd / taggart_intro_3.ex
Last active November 23, 2017 10:52
taggart_intro_3.ex
use Taggart.HTML
form = form_for(conn, "/users", [as: :user], fn f ->
taggart do
label do
"Name:"
end
label do
"Age:"
end
@ijcd
ijcd / taggart_intro_2.ex
Last active November 23, 2017 10:52
taggart_intro_2.ex
use Taggart.HTML
name = "Susan"
age = 27
html do
body do
div do
h2 "Buyer"
p name, class: "name"
@ijcd
ijcd / taggart_intro_1.ex
Last active November 23, 2017 10:52
taggart_intro_1.ex
use Taggart.HTML
div("Name")
div("Name", class: "bold")
div(class: "bold", do: "Name")
div do
end

Keybase proof

I hereby claim:

  • I am ijcd on github.
  • I am ijcd (https://keybase.io/ijcd) on keybase.
  • I have a public key whose fingerprint is C86C 2AAF 1462 8B6D B926 F578 8E2E 6530 316C BAAC

To claim this, I am signing this object:

@ijcd
ijcd / custom_plan.rb
Last active August 29, 2015 14:03
Updated zeus custom_plan to defer actions in rails boot sequence
require 'zeus/parallel_tests'
class CustomPlan < Zeus::ParallelTests::Rails
def run_deferred_actions
ObjectSpace.each_object(::Rails::Application::RoutesReloader) do |rr|
rr.reload_without_zeus! rescue nil
end
end
@ijcd
ijcd / gist:4636849
Last active December 11, 2015 17:48
% diff -urN a b
diff -urN a/date.txt b/date.txt
--- a/date.txt 2013-01-25 10:50:11.000000000 -0800
+++ b/date.txt 2013-01-25 10:50:24.000000000 -0800
@@ -1 +1,3 @@
Thu Jan 24 02:58:13 PST 2013
+
+Some more
diff -urN a/foo.txt b/foo.txt
--- a/foo.txt 1969-12-31 16:00:00.000000000 -0800
+++ b/foo.txt 2013-01-25 10:50:36.000000000 -0800
######################
# KOALA (NEW FB STUFF)
######################
def fb_cookies
@fb_cookies ||= Koala::Facebook::OAuth.new(Settings.FACEBOOK_APPLICATION_ID, Settings.FACEBOOK_SECRET).get_user_info_from_cookie(cookies)
end
def fb_access_token
@fb_access_token ||= fb_cookies.try(:[], "access_token")