Skip to content

Instantly share code, notes, and snippets.

View guilhermesimoes's full-sized avatar
😎

Guilherme Simoes guilhermesimoes

😎
View GitHub Profile
@guilhermesimoes
guilhermesimoes / authentication.md
Last active October 15, 2016 23:26
How authentication should work (in my mind)
Page / User State Logged Out Logged In
/public-page Go to /public-page Go to /public-page
/page-requiring-auth
  1. Redirect to /login
  2. After successful login redirect to /page-requiring-auth
Go to /page-requiring-auth
/login
  1. Go to /login
  2. After successful login redirect to /
Redirect to /
/logout Redirect to /
  1. Log out the user
  2. Redirect to /
@guilhermesimoes
guilhermesimoes / .block
Last active September 2, 2022 05:21 — forked from mbostock/.block
D3.js: Automatic text sizing using em units
height: 760
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / .block
Last active April 6, 2020 01:01
D3.js: Encoding values as circles
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / last_uri_path_benchmark.rb
Last active November 30, 2016 00:28
Ruby Benchmark: Determining the last part of a URI
# gem install benchmark-ips
require "benchmark/ips"
uri = "http://twitter.com/user/statuses/1234567891011121314"
Benchmark.ips do |x|
x.report("file.basename") { File.basename(uri) }
x.report("split('/').last") { uri.split("/").last }
@guilhermesimoes
guilhermesimoes / .block
Last active February 8, 2017 00:52
D3.js: Animating a pie chart
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / loop_starting_at_index_one_benchmark.rb
Created April 7, 2017 14:29
Ruby Benchmark: Starting a loop at index 1
# gem install benchmark-ips
require "benchmark/ips"
Benchmark.ips do |x|
x.report("range") { (1..100).each { |i| i } }
x.report("upto") { 1.upto(100).each { |i| i } }
x.report("times plus one") { 100.times { |i| i + 1 } }
@guilhermesimoes
guilhermesimoes / .block
Last active April 19, 2017 15:58 — forked from mbostock/.block
D3 V3 join & enter
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / .block
Last active August 14, 2017 14:51
D3 V4 join & enter
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / .block
Last active November 12, 2017 22:06 — forked from HarryStevens/.block
Box and Whisker
license: gpl-3.0
@guilhermesimoes
guilhermesimoes / README.md
Last active April 12, 2020 16:22
Animated NBC Peacock Logo

My attempt at animating NBC's peacock showing-off.

If you're interested in NBC's past, check out the history of NBC's logo and chime.