Skip to content

Instantly share code, notes, and snippets.

View aosteraas's full-sized avatar

Aaron Osteraas aosteraas

  • Melbourne, Australia
View GitHub Profile
<?php
function public_taxonomy() {
register_taxonomy( 'jobs', 'alljobs', //changed genre to jobs
array(
'label' => __( 'Public Jobs' ),
'rewrite' => array( 'slug' => 'public_jobs' ),
'hierarchical' => true,
)
);
IP Tried to log in as
178.137.134.224 aosteraas (2 lockouts)
184.82.92.72 admin (1 lockout)
78.39.25.163 aosteraas (1 lockout)
188.230.17.123 aosteraas (1 lockout)
117.217.173.229 aosteraas (1 lockout)
176.102.37.92 admin (1 lockout)
46.250.98.113 aosteraas (1 lockout)
178.89.122.22 aosteraas (1 lockout)
109.63.110.144 aosteraas (3 lockouts)
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
@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):
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; }
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'
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') . '!';
?>