Skip to content

Instantly share code, notes, and snippets.

View aosteraas's full-sized avatar

Aaron Osteraas aosteraas

  • Melbourne, Australia
View GitHub Profile
@aosteraas
aosteraas / ex25.py
Created March 16, 2012 00:19
python
def break_words(stuff):
"""This function will break up words for us."""
words = stuff.split(' ')
return words
def sort_words(words):
"""Sort the words."""
return sorted(words)
def print_first_word(words):
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ex25
>>> sentence = "All good things come to those who wait."
>>> words = ex25.break_words(sentence)
>>> words
['All', 'good', 'things', 'come', 'to', 'those', 'who', 'wait.']
>>> sorted_words = ex25.sort_words(words)
>>> sorted_words
1.9.3p125 :001 > require './main'
LoadError: cannot load such file -- sinatra
from /Users/aosteraa/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/aosteraa/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/aosteraa/development/sinatra2/main.rb:1:in `<top (required)>'
from /Users/aosteraa/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/aosteraa/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from (irb):1
from /Users/aosteraa/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
@aosteraas
aosteraas / RubyKoans About Reg Exp
Created April 14, 2012 08:23
Part of the about_regular_expressions.rb in RubyKoans that I don't understand
# I don't understand this at all
def test_slash_w_is_a_shortcut_for_a_word_character_class
# NOTE: This is more like how a programmer might define a word.
assert_equal "variable_1", "variable_1 = 42"[/[a-zA-Z0-9_]+/]
assert_equal "variable_1", "variable_1 = 42"[/\w+/]
end
@aosteraas
aosteraas / reddit
Created April 24, 2012 23:50
reddit
html {
height:100%;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td,iframe {
margin:0;
padding:0;
}
table { border-collapse:collapse; }
fieldset,img { border:0; }
address,caption,cite,code,dfn,em,strong,th,var { font-style:normal; font-weight:normal; }
function localStorageSupported() {
try {
return "localStorage" in window && window["localStorage"] !== null;
} catch (e) {
return false;
}
}
<?php
$name = $_GET['name'];
echo 'Welcome to our website, ' .
htmlspecialchars($name, ENT_QUOTES, 'UTF-8') . '!';
?>
require 'spec_helper'
describe "Static pages" do
let(:base_title) { "Ruby on Rails Tutorial Sample App" }
describe "Home page" do
it "should have the h1 'Sample App'" do
visit '/static_pages/home'
@aosteraas
aosteraas / php-5.4.4 make test
Created June 15, 2012 16:26
I found a problem in php apparently
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it. You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: Y
@aosteraas
aosteraas / MacBook Air problems
Created June 23, 2012 08:17
MacBook Air problems
Interval Since Last Panic Report: 345546 sec
Panics Since Last Report: 1
Anonymous UUID: 7F8B9B54-B6CF-4EAF-9EAE-3722ABBE1022
Sat Jun 23 18:16:15 2012
panic(cpu 0 caller 0xffffff80002c4794): Kernel trap at 0xffffff7f816a7d22, type 14=page fault, registers:
CR0: 0x0000000080010033, CR2: 0x000000000000008c, CR3: 0x0000000161d18049, CR4: 0x00000000001606e0
RAX: 0x000000000000007c, RBX: 0xffffff806a5f2000, RCX: 0x00000000ffffffff, RDX: 0xffffff800bddea00
RSP: 0xffffff809296b970, RBP: 0xffffff809296b9b0, RSI: 0xffffff800c997200, RDI: 0xffffff800a3e7a50
R8: 0x000000004f800000, R9: 0xffffff800640fca8, R10: 0xffffff8016aaee50, R11: 0x0008000000137b5f