Skip to content

Instantly share code, notes, and snippets.

A livable codebase

Some context, my journey

Two Concerns:

  1. Almost all codebases become a royal pain to work with overtime
  2. We don't come close to agreeing on the solution

To avoid some assumptions

@ecuageo
ecuageo / js-topics.md
Created April 3, 2017 18:16
JS topics

Javascript Mastery

Basic Language Features

conditionals, looping, comparison operators, object, arrays, etc

Except Arrays

  • attribute selector (dot or array syntax)
  • in operator
class Movie
CHILDRENS = 2
REGULAR = 0
NEW_RELEASE = 1
attr_reader :title
attr_accessor :price_code
def initialize(title, price_code)
@title = title
class Movie
CHILDRENS = 2
REGULAR = 0
NEW_RELEASE = 1
attr_reader :title
attr_accessor :price_code
def initialize(title, price_code)
@title = title
@ecuageo
ecuageo / gist:9a5ce56b3504483a0d7d
Created May 14, 2015 15:16
use builtin conversion protocols
class MyBadd
RANDOM_SECRET_IN_YOUR_CODE = rand
end
raise RuntimeError, MyBadd.new
@ecuageo
ecuageo / gist:7f7b12b2b03acb49d5ab
Created May 14, 2015 15:15
use builtin conversion protocols 3
class Meals
def initialize
@breakfeast = "Cereal"
@lunch = "Sandwich"
@dinner = "Steamed Veggies"
end
def yield_meals
yield @breakfeast
yield @lunch
@ecuageo
ecuageo / gist:174e161728032a194e16
Created May 14, 2015 15:15
use builtin conversion protocols 2
class HeartSaver
def initialize(you)
@you = you
end
def perform_heart_surgery_from_form_input(form_input)
cut_this_much_away_from_main_artery(form_input.to_i)
end
private
@ecuageo
ecuageo / gist:0750fba992fb2c94ad3f
Created May 14, 2015 15:13
use builtin conversion protocols 1
class GreekAlphabetArray
def initialize
@alpha = 'ἄ'
@beta = 'β'
@gamma = 'γ'
@delta = 'δ'
end
def to_a
[@alpha, @beta, @gamma, @delta]
@ecuageo
ecuageo / LICENSE.txt
Created January 27, 2012 21:36 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ecuageo
ecuageo / Gemfile
Created June 29, 2011 19:42 — forked from tinomen/Gemfile
goliath demo
source 'http://rubygems.org'
gem 'goliath', :git => 'https://github.com/postrank-labs/goliath.git'
gem 'yajl-ruby'
gem 'eventmachine', :git => 'git://github.com/eventmachine/eventmachine.git', :require => 'eventmachine'
gem 'em-http-request', :git => 'https://github.com/igrigorik/em-http-request.git'
gem "em-synchrony", :git => 'https://github.com/igrigorik/em-synchrony.git'