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 User < Sequel::Model | |
one_to_many :posts | |
def tags_dataset | |
posts.join(Tag, :post_id => :id) | |
end | |
def tags | |
tags_dataset.all | |
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
numbers = 3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99 | |
set_count = 0 | |
numbers.each_with_index do |number, i| | |
numbers.combination(i).each do |combination| | |
set_count += 1 and puts combination.inspect if combination[0..-2].sum == combination[-1] | |
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
s = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedea |
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"> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> | |
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
swfobject.registerObject("swfobject_static", "9.0.115", "expressInstall.swf"); | |
</script> | |
</head> |
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
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 2) |
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
<html> | |
<head> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
$(function() { | |
$.fn.myWidget = function(params) { | |
(function(console){ | |
if (!params.debug) console = { log: function(){} }; | |
console.log("Logging enabled!"); | |
})(console); |
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
From 95badf3776ce6a69bdff356649c7f345567c148c Mon Sep 17 00:00:00 2001 | |
From: David Kelso <david@kelso.id.au> | |
Date: Tue, 26 Apr 2011 14:44:09 -0700 | |
Subject: [PATCH] Update for 10.6. | |
--- | |
TerminalTabSwitching.xcodeproj/project.pbxproj | 4 ++-- | |
1 files changed, 2 insertions(+), 2 deletions(-) | |
diff --git a/TerminalTabSwitching.xcodeproj/project.pbxproj b/TerminalTabSwitching.xcodeproj/project.pbxproj |
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
# Allow open-uri to follow unsafe redirects (i.e. https to http). | |
# Relevant issue: | |
# http://redmine.ruby-lang.org/issues/3719 | |
# Source here: | |
# https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb | |
module OpenURI | |
class <<self | |
alias_method :open_uri_original, :open_uri | |
alias_method :redirectable_cautious?, :redirectable? |
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
location / { | |
if ($uri ~* "/assets/.*-(.*)\..*") { | |
expires max; | |
add_header Cache-Control public | |
add_header Etag $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
#!/bin/zsh | |
function actual_path() { | |
if [ [ -z "$1" ] -a [ -d $1 ] ]; then | |
echo $(cd $1 && test `pwd` = `pwd -P`) | |
return 0 | |
else | |
return 1 | |
fi | |
} |
OlderNewer