ruby-install -p https://gist.githubusercontent.com/judofyr/11175629/raw/2f22144e3ca261e9e989fcb9a205b473c208007f/patch.diff ruby 2.1.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
def extract_session | |
envs = ObjectSpace.each_object(Hash).lazy.select { |env| env.key?("rack.version") && env.key?("rack.session") } | |
before = envs.to_a | |
GC.disable | |
yield | |
after = (envs.to_a - before) | |
raise "Could not extract session" unless after.size == 1 | |
after.first['rack.session'] | |
ensure | |
GC.enable |
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
type Foo = distinct int | |
template `&`(a: Foo, b: Foo): expr = | |
debugEcho "anding" | |
const x = a | |
Foo(int(a) + int(b)) | |
echo int(Foo(1) & Foo(2) & Foo(3) & Foo(4) & Foo(5)) | |
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
set -e | |
DIR="docs" | |
BRANCH="gh-pages" | |
# Stage all files in the directory | |
find "$DIR" -type f | xargs git update-index --add | |
# Write the sub-tree | |
TREE=$(git write-tree --prefix="$DIR") |
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
--- | |
extension: xml | |
layout: nil | |
filter: | |
- erb | |
--- | |
<% pages = @pages.find(:limit => 10, | |
:in_directory => 'posts', | |
:sort_by => 'created_at', | |
:reverse => true) -%> |
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
(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 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 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 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 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 | |
} |
OlderNewer