Skip to content

Instantly share code, notes, and snippets.

View superscott's full-sized avatar
👺
щ(ಠ益ಠщ) (✖╭╮✖) ᕦ(ò_óˇ)ᕤ

superscott superscott

👺
щ(ಠ益ಠщ) (✖╭╮✖) ᕦ(ò_óˇ)ᕤ
View GitHub Profile
@wok
wok / multi_statements_mysql2.rb
Created November 15, 2011 19:02
ActiveRecord MULTI_STATEMENTS with mysql2
# place in config/initalizers
module ActiveRecord
class Base
# Establishes a connection to the database that's used by all Active Record objects.
def self.mysql2_connection(config)
config[:username] = 'root' if config[:username].nil?
if Mysql2::Client.const_defined? :FOUND_ROWS
config[:flags] = Mysql2::Client::FOUND_ROWS | Mysql2::Client::MULTI_STATEMENTS
@myobie
myobie / mountain-lion-brew-setup.markdown
Created February 18, 2012 20:14
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

Hi David,
My name is Jeff Morse. I'm a Recruiter at a super-charged start-up called Mixbook www.mixbook.com I came across your profile on workingwithrails and have a full-time Sr. Ruby on Rails opening working onsite in our Palo Alto, California office that is a great match for your background/experience. Would you be ready to make the move to Silicon Valley, the most innovative place for web start ups which offers superior growth opportunities for talented ruby developers like yourself? Mixbook will pay for all relocation costs.
Would you be open to taking a phone/Sykpe call from our CTO, Aryk Grosz (see attached LinkedIn profile) to discuss the position further? If interested, email me your Skype ID and I’ll coordinate the call with Aryk.
Cheers,
Jeff Morse
Sr. Recruiter
@phred
phred / pedantically_commented_playbook.yml
Last active June 27, 2024 13:39
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@ConradIrwin
ConradIrwin / -
Created November 15, 2013 21:37
# Show red environment name in pry prompt for non development environments
old_prompt = Pry.config.prompt
Pry.config.prompt = [
proc {|a,b,c| "\001\e[31m\002#{(Rails.env.upcase)}\001\e[0m\002 #{old_prompt.first.call(a,b,c)}"},
proc {|a,b,c| "\001\e[31m\002#{(Rails.env.upcase)}\001\e[0m\002 #{old_prompt.second.call(a,b,c)}"},
] unless Rails.env.development?
@superscott
superscott / pi.rb
Last active January 4, 2016 01:59
pi / malloc / ubuntu
#
# ruby pi - how to calculate pi with ruby.
# proving that pi is the limit of this series:
# 4/1 - 4/3 + 4/5 - 4/7 + 4/9 ...
#
num = 4.0
pi = 0
plus = true
den = 1
BEFORE:
sam@ubuntu discourse % rm -fr tmp/cache
sam@ubuntu discourse % rm -fr public/assets
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile
58.55s user 1.79s system 100% cpu 1:00.02 total
AFTER:
@mlanett
mlanett / rails http status codes
Last active November 4, 2024 18:04
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@calumhalcrow
calumhalcrow / hivekind_engineer_skills_test.md
Last active March 10, 2022 22:49 — forked from nickmarden/senior_eng_skills_test.md
Hivekind Engineer skills test

NOTE: Please send your answers to [email protected] rather than post them publicly in another Gist or in comments on this Gist.

1. Voting

Each voter can vote in zero or more referenda. Each referendum has one or more questions, and each question is a yes/no vote. Write the simplest normalized schema to describe this in generic SQL statements or as an entity-relationship diagram. Point out where the indexes would be if you want to quickly know the results of a given referendum question, but you never expect to query a single voter's voting record.

2. Availability on AWS

Your client plans to host their web application on AWS. When would you advise (a) deployment in a single availability zone, (b) deployment in multiple availability zones in a single region (c) deployment in multiple regions? What operational difficulty or complexity, if any, is added as you go from (a) to (b) to (c)?