Skip to content

Instantly share code, notes, and snippets.

View somebox's full-sized avatar
⌨️
coding nights

Jeremy Seitz somebox

⌨️
coding nights
View GitHub Profile
@somebox
somebox / mysql_install.md
Created August 17, 2010 14:23 — forked from anonymous/snippet.txt
Installing the mysql gem on OSX

Mysql gem under OSX:

Install:

option 1:

Try to use existing mysql under OSX.

$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
@mxriverlynn
mxriverlynn / 1-theproblem.js
Created June 16, 2011 01:20
solving this.model.view with underscore.js
var Credentials = Backbone.Model.extend({
// ... code for a validated event here
});
var LoginView = Backbone.View.extend({
initialize: function(){
this.loginButton = $("#login");
// tight coupling and leaky code...
this.model.view = this;
@kathgironpe
kathgironpe / precompile_assets.textile
Created July 7, 2011 16:55
Rails 3.1: Precompile Assets for Cloudfront/CDN support

Naming files and using asset_path

application.scss.erb
- use <%= asset_path 'background.jpg' %>

on config/environments/production.rb

@ksarna
ksarna / profiling_tool.rb
Created November 23, 2011 20:10
Profiling rails requests with ruby-prof
# You can use this class in your console. For example
# p = ProfilingTools.new
# p.profiled_request(:controller => :welcome, :action => :index)
# this will profile whole application stack and save file in your tmp/profiler folder
# You can also use +request+ method just to see the output for example:
#
# p.request(:controller => :offers, :action => :index)
#
# p.response.body
# p.response.cookies # and so on
# Make sure you do this from time to time:
sudo apt-get update && sudo apt-get upgrade -y
# Here are the actual packages (feel free to contribute):
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev nodejs libssl-dev libreadline6-dev libreadline-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev ncurses-term automake libtool bison subversion libcurl4-openssl-dev mysql-client mysql-server postgresql postgresql-contrib imagemagick libmagickwand-dev apache2-mpm-prefork apache2-prefork-dev libapr1-dev libaprutil1-dev redis-server vim -y
# Make default editor vim :)
echo "export EDITOR=vim" >> ~/.bashrc
# Install RVM
module System
extend self
def cpu_count
return Java::Java.lang.Runtime.getRuntime.availableProcessors if defined? Java::Java
return File.read('/proc/cpuinfo').scan(/^processor\s*:/).size if File.exist? '/proc/cpuinfo'
require 'win32ole'
WIN32OLE.connect("winmgmts://").ExecQuery("select * from Win32_ComputerSystem").NumberOfProcessors
rescue LoadError
Integer `sysctl -n hw.ncpu 2>/dev/null` rescue 1
end
@ernie
ernie / GoDaddy CLI
Created April 6, 2011 15:45
If GoDaddy did CLI domain registration...
$ godaddy buy wynn.fm
-- Reading CC Info from .godaddy...
-- THANK YOU FOR PURCHASING YOUR DOMAIN WITH GODADDY!
-- WHILE OUR SERVERS THINK ABOUT REGISTERING YOUR DOMAIN
-- NAME, PLEASE GIVE CAREFUL CONSIDERATION TO THE
-- FOLLOWING SPECIAL OFFERS!!!
Would you like to also register the following and SAVE 64%?
wynn.net
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@somebox
somebox / osx-setup.sh
Last active December 11, 2021 13:05 — forked from foz/osx-setup.sh.md
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@brentd
brentd / parallel_asset_compiler.rb
Created July 31, 2012 23:11
Parallelize assets:precompile
require 'parallel' # gem install parallel (https://github.com/grosser/parallel)
# Monkey patch to Sprockets::StaticCompiler, a class provided by actionpack
# that's used by the assets:precompile task. This patch uses the Parallel gem
# to parallelize asset compilation in the simplest way possible.
#
# Parallel wraps Process.fork to handle things like inter-process communication
# via pipes and determining the maximum number of processes to run based on
# your system's total logical processors. So far only tested on MRI 1.9.3 on OS X.
module Sprockets