This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo jruby -S bundle install | |
Could not find rake-0.9.2 in any of the sources | |
$ sudo jruby -S gem list | |
*** LOCAL GEMS *** | |
bundler (1.0.21) | |
rake (0.9.2) | |
rubygems-update (1.6.0) | |
sources (0.0.1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ErrorBehavior<T extends Exception> { | |
public abstract void handle(T e); | |
public class SilentErrorBehavior extends ErrorBehavior { | |
@Override | |
public void handle(T e) { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "Hello" + " world" | |
puts "What is your name?" | |
name = gets.chomp | |
def do_a_funny_cheer(probably_keith) | |
puts "laugh at #{probably_keith}" | |
# Give me a K! ad nauseum | |
end | |
do_a_funny_cheer(name) | |
# fizz buzz would be really cool here since they know % | |
# these are comments you don't have to type them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kill -9 `lsof -i :3000 -F p | cut -c 2-10` | |
alias gorailsgo='kill -9 `lsof -i :3000 -F p | cut -c 2-10` ; rails s' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It's sort of difficult to make a non-UTF-8 string in | |
# ruby that contains characters that aren't in UTF-8. | |
# Here's how I did it. | |
# 0x89 isn't allowed in UTF-8 | |
bad_chars = [0x89].pack("c*").force_encoding("ISO-8859-1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StudentController < ApplicationController | |
def show | |
existing_etag = request.headers["if-none-match"] | |
student = Student.where(id: params[:id]).first | |
if(existing_etag) | |
type, id, modified = existing_etag.split("_") | |
if(type == student && id == params[:id]) | |
if(student.updated_at == modified) | |
render :not_modified and return | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Xcode | |
2. xcode command line tools | |
3. git | |
4. brew install libksba autoconf automake apple-gcc42 qt imagemagick libxml2 postgres tmux macvim | |
5. fix imagemagick library names (see below) | |
6. x11 | |
7. rvm | |
8. dotmatrix | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<xs:element name="Status"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element name="Location"> | |
<xs:simpleType> | |
<xs:restriction base="xs:string"> | |
<xs:enumeration value="The Office" /> | |
<xs:enumeration value="Remote" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def weasel(opts={}) | |
true | |
end | |
def wrapper(target=self) | |
target.weasel(1) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::Base.connection.execute("SELECT relname, reltuples FROM pg_class where relname NOT LIKE 'pg_%' ORDER BY reltuples DESC LIMIT 10;").each { |row| puts row } |
OlderNewer