Skip to content

Instantly share code, notes, and snippets.

@BinaryMuse
BinaryMuse / README.md
Last active April 20, 2022 21:45
Elixir Map/HashDict Performance on Erlang OTP R17 vs R18
@calavera
calavera / setup.sh
Last active September 4, 2016 08:16
From 0 to OMG my new laptop is almost ready for some coding!
#! /bin/sh
# Enable FileVault
if [[ `fdesetup status` != "FileVault is On." ]]; then
sudo fdesetup enable
fi
xcode-select --install
echo "###############################################################"
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ryandotsmith
ryandotsmith / hack-reactor.md
Last active November 24, 2022 07:01
Hack Reactor Talk

Tales From a Heroku User

Here are some things I have learned along the way.

Last Updated: 2013-02-08

Original Audience: Hack Reactor

About

Install MAMP Development stack on Mountain Lion using MacPorts

NOTE: I like to prepend some of the commands with time just for curiosity’s sake to see how long it takes.

Turn off the built-in Apache

Go to System Preferences -> Sharing -> uncheck the Personal Web sharing. You will never turn Apache on/off here again.

Install Xcode via Mac App Store

@henrik
henrik / rules.md
Last active May 23, 2022 12:31
Sandi Metz' four rules from Ruby Rogues episode 87. Listen or read the transcript: http://rubyrogues.com/087-rr-book-clubpractical-object-oriented-design-in-ruby-with-sandi-metz/
  1. Your class can be no longer than 100 lines of code.
  2. Your methods can be no longer than five lines of code.
  3. You can pass no more than four parameters and you can’t just make it one big hash.
  4. When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.

You can break these rules if you can talk your pair into agreeing with you.

@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@karmi
karmi / nginx-elasticsearch-proxy.conf
Created May 23, 2011 08:16
Route requests to ElasticSearch to authenticated user's own index with an Nginx reverse-proxy
# Run me with:
#
# $ nginx -p /path/to/this/file/ -c nginx.conf
#
# All requests are then routed to authenticated user's index, so
#
# GET http://user:password@localhost:8080/_search?q=*
#
# is rewritten to:
#
@jlindley
jlindley / config.ru
Created April 18, 2011 17:03
Rails 2.3.x config.ru (to allow using http://pow.cx/ )
require "./config/environment"
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')