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
$ ruby --version | |
ruby 1.8.7 (2009-06-08 patchlevel 173) [i686-linux] | |
>> Hash[[[1, 2], [3, 4]]] | |
=> {1=>2, 3=>4} | |
$ ruby --version | |
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux] | |
>> Hash[[[1, 2], [3, 4]]] | |
ArgumentError: odd number of arguments for Hash | |
from (irb):12:in `[]' |
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
$ dpkg-query -L bash | ./parg [ -e {} ] | |
/. | |
/bin | |
/bin/bash | |
/etc | |
/etc/skel | |
/etc/skel/.bashrc | |
/etc/skel/.profile | |
/etc/skel/.bash_logout |
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
# make tags | |
$ ./setup | |
$ ls | |
$ mkdir {a,b,c} | |
$ mkdir unexisting/path | |
mkdir: cannot create directory `unexisting/path': No such file or directory | |
$ ls | |
a b c | |
$ touch file-in-root | |
$ touch a/fa |
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
# Disable rails ./script/console completion | |
# to fix `no such file to load -- readline (LoadError)` | |
$ diff ~/ruby/gems/gems/rails-2.3.5/lib/commands/console.rb{~,} | |
14c14 | |
< libs = " -r irb/completion" | |
--- | |
> libs = " -r irb" |
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
class Object | |
def default(value) | |
self | |
end | |
end | |
class NilClass | |
def default(value) | |
value | |
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
low | |
high | |
__iterator__ |
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
Array.prototype.next = function() { | |
if (this.length == 0) { | |
throw StopIteration; | |
} | |
return this.shift(); | |
} |
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
(function($) { | |
$.PaginationCalculator = function(count) { | |
this.count = count; | |
} | |
$.extend($.PaginationCalculator.prototype, { | |
range: function(current) { | |
var result = []; | |
for(var i = current - 2; i <= current + 2; i++) { | |
if(i >= 1 && i <= this.count) { |
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
$.extend($.fn, { | |
// plugin constructor | |
livequery: function(params) { | |
// used to find or create livequery object | |
var q = q || new $.livequery(params); | |
} | |
}); | |
// constructor | |
$.livequery = function(params) { |
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
test=# create table nullorder (created_at timestamp); | |
CREATE TABLE | |
test=# insert into nullorder (created_at) values (null), (null), ('1999-01-08 04:05:06'), ('1999-11-08 04:05:06'), (null); | |
INSERT 0 5 | |
test=# select * from nullorder; | |
created_at | |
--------------------- | |
OlderNewer