Skip to content

Instantly share code, notes, and snippets.

View b-mandelbrot's full-sized avatar

b-mandelbrot

View GitHub Profile
@b-mandelbrot
b-mandelbrot / awesome-nginx.conf
Created October 13, 2015 23:00 — forked from vjt/awesome-nginx.conf
*AWESOME* nginx configuration for Ruby/Rack web applications
#
# mmm m m mmm mmm mmm mmmmm mmm
# " # "m m m" #" # # " #" "# # # # #" #
# m"""# #m#m# #"""" """m # # # # # #""""
# "mm"# # # "#mm" "mmm" "#m#" # # # "#mm"
#
# nginx configuration For Ruby/Rack web applications
#
# Cooked up with style, care and a bit of *secret*
# nerdy spice. :-)
@b-mandelbrot
b-mandelbrot / puma.sh
Last active August 29, 2015 14:10 — forked from ktaragorn/puma.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: pumacontrol
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Puma web server

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
libxml_ruby.bundle: dlsym(0x10fde1900, Init_libxml_ruby): symbol not found
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
# app/controllers/users/password_controller.rb
class Users::PasswordsController < Devise::PasswordsController
def resource_params
params.require(:user).permit(:email, :password, :password_confirmation)
end
private :resource_params
end
@b-mandelbrot
b-mandelbrot / geo_distance_filter_in_tire.rb
Created July 23, 2012 01:03 — forked from karmi/geo_distance_filter_in_tire.rb
Geo Distance Filter Support in Tire/ElasticSearch
require 'rubygems'
require 'tire'
Tire.index 'venues' do
delete
# 1) Create the index with proper mapping for the `location` property
create :mappings => { :venue => { :properties => { :location => { :type => 'geo_point' } } } }
# 2) Store some example documents of the `venue` type
@b-mandelbrot
b-mandelbrot / gist:2933626
Created June 14, 2012 23:22 — forked from spovich/gist:1848409
Installing ruby-debug with ruby-1.9.3-p125
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1848409)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p125 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@b-mandelbrot
b-mandelbrot / 0-readme.md
Created January 30, 2012 11:26 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.