Skip to content

Instantly share code, notes, and snippets.

View brookr's full-sized avatar
💭
🚀

Brook Riggio brookr

💭
🚀
View GitHub Profile
@vasanthk
vasanthk / System Design.md
Last active May 4, 2024 16:39
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@paulallies
paulallies / gist:0052fab554b14bbfa3ef
Last active November 12, 2023 23:00
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin <branch-name>
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@dtakahas
dtakahas / babby.rb
Last active December 28, 2021 03:56
How is babby formed in Rails?
class Babby < PragnentGirl::GetPragnent
attr_accessible :name, :mother, :location, :pragnent_girl_id
belongs_to :pragnent_girl
before_save :destroy_instain_mothers
after_save :pary_for_father
#How is babby formed?
@brookr
brookr / Google Apps Standard DNS Settings
Last active May 25, 2017 16:11
All the DNS records for a new Google Apps account, as entered in AWS:Route53
A: # If using naked domain redirects via Google
216.239.32.21
216.239.34.21
216.239.36.21
216.239.38.21
MX: # If using Google Mail
1 ASPMX.L.GOOGLE.COM.
5 ALT1.ASPMX.L.GOOGLE.COM.
5 ALT2.ASPMX.L.GOOGLE.COM.
@davidmfoley
davidmfoley / restore_db_from_heroku_backup.sh
Created May 2, 2012 16:09
Heroku/Rails: restore local development db from heroku
#! /bin/bash
# First you need to have the "pgbackups" addon in your heroku app, for example:
# $ heroku addons:add pgbackups:auto-week
# your database name here
DB_NAME='foobar_development'
# grab the data directory for postgres from the running process
DATA_DIR=`ps ax |grep [/]post | sed "s/^.*\-D //" | sed "s/ .*$//"`
@HenrikJoreteg
HenrikJoreteg / ajaxfileupload.js
Created April 26, 2012 19:47
AJAX file uploading using jQuery and XMLHttpRequest 2.0 and adding listener for progress updates
// grab your file object from a file input
$('#fileInput').change(function () {
sendFile(this.files[0]);
});
// can also be from a drag-from-desktop drop
$('dropZone')[0].ondrop = function (e) {
e.preventDefault();
sendFile(e.dataTransfer.files[0]);
};
@ingeniarius
ingeniarius / rails_guides_to_epub.rb
Created October 26, 2011 15:41 — forked from spap/rails_guides_to_epub.rb
Ruby on Rails Guides ePub convert ruby script
require 'rubygems'
require 'nokogiri'
require 'eeepub'
DOC_TITLE = 'Ruby on Rails Guides'
def get_pages(src_dir)
index_file = File.join(src_dir, 'index.html')
section = nil
pages = [{ :section => section, :title => DOC_TITLE, :path => index_file }]
@the-architect
the-architect / contact.rb
Created September 15, 2011 16:09
Automatically create scopes for all available state_machine states in Rails 3.1
class Contact < ActiveRecord::Base
state_machine :state, :initial => :imported do
state :imported
state :contacted
state :verified
state :prospect
state :deleted
end
@tonywok
tonywok / results.md
Created September 15, 2011 01:33
Rails 3.1 Callbacks
s = Test.new(:name => "foo")

# ActiveRecord::Test after_initialize
# ActiveRecord::Test after_initialize, :on => :update
# ActiveRecord::Test after_initialize, :on => :create
# ActiveRecord::TestObserver after_initialize

# ===> #<Test id: nil, name: "foo", created_at: nil, updated_at: nil>