Skip to content

Instantly share code, notes, and snippets.

View nicholasklick's full-sized avatar

nicholasklick

View GitHub Profile
@nicholasklick
nicholasklick / System Design.md
Created May 19, 2021 03:24 — forked from vasanthk/System Design.md
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?

Keybase proof

I hereby claim:

  • I am nicholasklick on github.
  • I am nicholasklick (https://keybase.io/nicholasklick) on keybase.
  • I have a public key ASDkj-EhJftSCVxJmGF6UILetdY-JY7zyJvgP1XF9WDuXwo

To claim this, I am signing this object:

@nicholasklick
nicholasklick / gist:67101d48a15de4a69fc3b12f4439a472
Created December 1, 2016 02:59 — forked from afilhodaniel/gist:09a1df8eafeabe1584c6
Upload photos to Instagram via private API with Ruby
# 'direct_v2/threads/broadcast/text/'
class InstagramPrivateController < ApplicationController
def initialize(username, password, photo, caption)
@username = username
@password = password
@photo = photo
@caption = caption
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<title>Estimize Screener</title>
<meta content='width=device-width' name='viewport'>
<link rel="stylesheet" media="screen" href="/assets/application-2f24cb8405dcd79bb2b4219b527e9cc0.css" />
<!--[if IE 8]>
<link rel="stylesheet" media="screen" href="/assets/ie8-592b4f7c79840aa8093694c64ca1f73b.css" />
@nicholasklick
nicholasklick / spec_helper.rb
Created December 14, 2015 15:34 — forked from andreypronin/spec_helper.rb
RSpec hooks I use with DatabaseCleaner. We can't use transactional fixtures with Selenium/Poltergeist, but it's an overkill to truncate/delete for non-JS specs. Thus this optimization here. Read more at http://railscasts.com/episodes/257-request-specs-and-capybara. Assumption (just in case): only javascript_driver is set to Poltergeist/Selenium …
config.use_transactional_fixtures = false
config.before(:suite) do
# Do truncation once per suite to vacuum for Postgres
DatabaseCleaner.clean_with :truncation
# Normally do transactions-based cleanup
DatabaseCleaner.strategy = :transaction
end
config.around(:each) do |spec|
@nicholasklick
nicholasklick / chef-solo-vagrant-berkshelf.sh
Last active August 29, 2015 14:04
Sets up a basic install of Chef solo, vagrant and berkshelf
# =====================
# INITIAL PROJECT SETUP
# =====================
#
# Create basic project directory
mkdir try-chef
cd try-chef
#
#
# = ostruct.rb: OpenStruct implementation
#
# Author:: Yukihiro Matsumoto
# Documentation:: Gavin Sinclair
#
# OpenStruct allows the creation of data objects with arbitrary attributes.
# See OpenStruct for an example.
#
# /etc/init/project-web-reload.conf
pre-start script
initctl restart project-web
sleep 15
end script
exec /usr/local/rvm/bin/default_bluepill restart
#!/bin/bash
if [ -z "$1" ]; then
wdir="."
else
wdir=$1
fi
for f in $( find . -name '*erb' ); do
out="${f%.erb}.haml"
if [ -e $out ]; then
# Here's a sequence of numbers where each line is
# generated by semantically counting and printing the numbers
# in the previous line:
#
# 1
# 11
# 21
# 1211
# 111221
# 312211