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
<% | |
# Oh no! | |
# I have to do this: | |
%> | |
<h1><% if @title.nil? %>Attack of the parisian bouncy castles! No title!<% else %><%=h @title %><% end %></h1> | |
<% | |
# instead of this: | |
%> |
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
# ***** BEGIN LICENSE BLOCK ***** | |
# Version: MPL 1.1 | |
# | |
# The contents of this file are subject to the Mozilla Public License Version | |
# 1.1 (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# http://www.mozilla.org/MPL/ | |
# | |
# Software distributed under the License is distributed on an "AS IS" basis, | |
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
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
# Getting a list of reverse zones needed to fully | |
# delegate a prefix: | |
>> IPAddr.new("2001:db8::/33").reverses | |
=> ["0.8.b.d.0.1.0.0.2.ip6.arpa", "1.8.b.d.0.1.0.0.2.ip6.arpa", "2.8.b.d.0.1.0.0.2.ip6.arpa", "3.8.b.d.0.1.0.0.2.ip6.arpa", "4.8.b.d.0.1.0.0.2.ip6.arpa", "5.8.b.d.0.1.0.0.2.ip6.arpa", "6.8.b.d.0.1.0.0.2.ip6.arpa", "7.8.b.d.0.1.0.0.2.ip6.arpa"] | |
>> IPAddr.new("130.216.32.0/20").reverses | |
=> ["130.216.32.in-addr.arpa", "130.216.33.in-addr.arpa", "130.216.34.in-addr.arpa", "130.216.35.in-addr.arpa", "130.216.36.in-addr.arpa", "130.216.37.in-addr.arpa", "130.216.38.in-addr.arpa", "130.216.39.in-addr.arpa", "130.216.40.in-addr.arpa", "130.216.41.in-addr.arpa", "130.216.42.in-addr.arpa", "130.216.43.in-addr.arpa", "130.216.44.in-addr.arpa", "130.216.45.in-addr.arpa", "130.216.46.in-addr.arpa", "130.216.47.in-addr.arpa"] |
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
# Prefix scoping: | |
>> IPAddr.new("2001:db8::/32").scope | |
=> "DOCUMENTATION" | |
>> IPAddr.new("2000::/3").scope | |
=> "GLOBAL UNICAST" | |
>> IPAddr.new("fe80::/64").scope | |
=> "LINK LOCAL UNICAST" |
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
[13:31][jnh@marvin]~$ macgem install threadify | |
/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/time.rb:351: too short escaped multibyte character: /\A\s* | |
(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\x20 | |
(\d{2})\x20 | |
(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\x20 | |
(\d{4})\x20 | |
(\d{2}):(\d{2}):(\d{2})\x20 | |
GMT | |
\s*\z/ix | |
/Library/Frameworks/MacRuby.framework/Versions/0.5/usr/lib/ruby/1.9.0/time.rb:358: too short escaped multibyte character: /\A\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
#!/bin/sh | |
# Need to copy data from your SQLite development environment | |
# to your Postgres production environment? No problem. | |
set -e | |
SOURCE="db/development.sqlite3" | |
DESTINATION="mashd_production" | |
echo Starting migration from $SOURCE to $DESTINATION |
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
%table#login | |
= form_for(@user_session, :method => :put, :remote => true) do |f| | |
%tr | |
%td{:colspan => '2'} | |
- if @user_session.errors.any? | |
.flash | |
.warning | |
%h2 | |
= pluralize(@user_session.errors.count, "error") | |
when logging in. |
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
$ gem install rails --version=3.0.0 | |
$ rails new ArelBug | |
$ cd ArelBug | |
$ rails generate model post text:string type:string | |
$ rails generate model mention post_id:integer user_id:integer | |
$ rake db:create db:migrate | |
$ rails console | |
> pt = Post.arel_table | |
> mt = Mention.arel_table | |
# SELECT "posts"."id" FROM "mentions" INNER JOIN "posts" ON "posts"."id" = "mentions"."post_id" WHERE "mentions"."user_id" = 14 AND "posts"."type" != 'ReTweet' |
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 Personal < Cluster | |
def posts | |
begin | |
if UserSession.find && UserSession.find.record == creator | |
# It's our favourite user: | |
# Show the posts in clusters they follow, | |
# posts that mention their nickname | |
# and posts in their own timeline. | |
pt = Post.arel_table |
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 AuthlogicModel | |
def self.included(model) | |
model.class_eval do | |
extend ClassMethods | |
include InstanceMethods | |
include ProtectedAttributes | |
field :username | |
field :email | |
field :crypted_password |
OlderNewer