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 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 ApplicationHelper | |
# Access Levels | |
ACCESS_LEVELS = { :private => 0, :friends => 1, :public => 2 } | |
# Access levels i18n translation | |
def access_levels | |
ACCESS_LEVELS.collect{|k,v| [I18n.t("access." + k.to_s), v]} | |
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
# modules work! :) If we define_method on a module and include it, it works the same. | |
class A | |
include World | |
end | |
module World | |
def hello | |
puts "World" | |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
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
# Original blog post about Rubinius performance on the alioth mandelbrot benchmark: | |
# http://rfc2616.wordpress.com/2010/10/16/rubinius-vs-the-benchmark-from-hell/ | |
# | |
# Problems with assumptions in the blog post: | |
# * The C <-> Ruby comparison is apples to oranges because the Ruby code | |
# is written to use blocks rather than loops. That imposes the overhead | |
# of additional execution contexts per pixel. | |
# * The output is written a byte at a time, which requires a fairly deep | |
# chain of methods before the byte is handed off to the OS. | |
# * The work is done in the script body. Unless the implementation has |
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
// $('img.photo',this).imagesLoaded(myFunction) | |
// execute a callback when all images have loaded. | |
// needed because .load() doesn't work on cached images | |
// Modified with a two-pass approach to changing image | |
// src. First, the proxy imagedata is set, which leads | |
// to the first callback being triggered, which resets | |
// imagedata to the original src, which fires the final, | |
// user defined callback. |
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
$ rvm 1.8.7,1.9.2,ree,rbx,macruby-0.8,jruby benchmark_haversine.rb | |
## 1.8.7-p330 | |
Rehearsal --------------------------------------------------- | |
ruby-1.8.7-p330 11.870000 0.030000 11.900000 ( 12.120409) | |
----------------------------------------- total: 11.900000sec | |
user system total real | |
ruby-1.8.7-p330 12.020000 0.040000 12.060000 ( 12.556268) |
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
#!/usr/bin/env ruby | |
# Print the complexity over time for a Ruby method in a | |
# git repository. | |
# | |
# Requires: >= bash ?.? | |
# >= git 1.7.1 | |
# >= ruby 1.9.2 | |
# >= flog 2.5.0 | |
# |
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
import java.awt.*; | |
import javax.swing.*; | |
public class AnimatedScreenCapture extends JFrame { | |
JLabel label; | |
Robot robot; | |
Rectangle screenRect; | |
int scaleX; |
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 Where | |
class <<self | |
attr_accessor :editor | |
def is_proc(proc) | |
source_location(proc) | |
end | |
def is_method(klass, method_name) | |
source_location(klass.method(method_name)) |
OlderNewer