This file contains hidden or 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
require 'open-uri' | |
# == Feed me with: | |
# | |
# Filename:: and I'll give you the file! | |
# URL:: and I'll give you the content! | |
# Any string:: and I'll give you a StringIO! | |
# An integer:: and I'll give you the stream for | |
# the given integer file descriptor! | |
# Any IO:: and I'll give you the same IO! |
This file contains hidden or 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
--- | |
extension: xml | |
layout: nil | |
filter: | |
- erb | |
--- | |
<% pages = @pages.find(:limit => 10, | |
:in_directory => 'posts', | |
:sort_by => 'created_at', | |
:reverse => true) -%> |
This file contains hidden or 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
(defun scheme-run-outline (arg) | |
(interactive "p") | |
(save-excursion | |
(outline-previous-visible-heading arg) | |
(setq before (point)) | |
(outline-next-visible-heading arg) | |
(scheme-send-region before (point)))) | |
(define-key scheme-mode-map (kbd "C-c C-o") 'scheme-run-outline) |
This file contains hidden or 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
# Mixin to scan an array for objects that respond to a given method | |
module WithMethod | |
# Iterates through the array and returns a list of items that | |
# respond to method | |
def with_method(method) | |
self.select do |item| | |
item.respond_to(method) | |
end | |
end |
This file contains hidden or 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-US'> | |
<head> | |
<title>Hampton Catlin Is Totally Awesome</title> | |
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' /> | |
</head> | |
<body> | |
<!-- You're In my house now! --> | |
<div class='header'> | |
Yes, ladies and gentileman. He is just that egotistical. |
This file contains hidden or 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
Author.new do | |
name "Magnus Holm" | |
location :norway | |
nickname :judofyr | |
blog judofyr.net | |
twitter @judofyr | |
github / judofyr | |
end |
This file contains hidden or 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
// This would be sweet Miko: | |
// Go Object.property! | |
Speck.describe("your mother") { | |
it.should("be true") { | |
true.should = true | |
} | |
it.should("not be false") { | |
false.should_not = true | |
} |
This file contains hidden or 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
Objects | |
======= | |
Here's an object: | |
+------------+ | |
| Object | | |
+------------+ | |
If we expand it we can see it contains three parts: |
This file contains hidden or 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
$:.unshift 'lib' | |
require 'rubygems' | |
require 'camping' | |
require 'parkaby' | |
Camping.goes :App | |
module App | |
include Parkaby::Frameworks::Camping | |
This file contains hidden or 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
## There's more than one way to do it. | |
# 0 | |
thing = [1, 2, 3] | |
# 1 | |
thing.each { } | |
# 2 (raggi) | |
thing.each() { } |
OlderNewer