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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
gem 'rack', github: 'rack/rack' | |
gem 'i18n', github: 'svenfuchs/i18n' | |
GEMFILE | |
system 'bundle' |
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
https://auctionet.com/de?gclid=CKK21fmSuLwCFSoEwwodOlkABg | |
http://auctionet.com/search?is=&q=???ldre+m???stare+-hundra&utf8=?&utm_medium=campaign&utm_source=campaign293&utm_campaign=Kampanj+293%3A+%C3%84ldre+m%C3%A4stare |
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 Connection | |
# .. rest of the class .. # | |
def accept_connection(io) | |
@io = io | |
# new connection code | |
end | |
def to_io |
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 PodiumPosition | |
# .. behavior .. # | |
def to_int | |
@race_position | |
end | |
end | |
position = PodiumPosition.new(1) | |
prizes = [ "orange", "apple", "corn" ] | |
puts "Congrats, you won #{prizes[position]}" |
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
static VALUE | |
rb_f_open(int argc, VALUE *argv) | |
{ | |
ID to_open = 0; | |
int redirect = FALSE; | |
if (argc >= 1) { | |
CONST_ID(to_open, "to_open"); | |
if (rb_respond_to(argv[0], to_open)) { | |
redirect = 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
class VimConfig | |
# ... behaviour ... # | |
def to_path | |
"~/.vimrc" | |
end | |
end | |
config = VimConfig.new | |
config_file = File.open config |
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 bash | |
sudo apt-get -y update | |
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libyaml-dev libreadline-gplv2-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p429.tar.bz2 | |
tar -xvf ruby-1.9.3-p429.tar.bz2 | |
cd ruby-1.9.3-p429/ | |
./configure --prefix=/usr/local | |
sudo make | |
sudo make install |
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.io.BufferedReader; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.Comparator; | |
import java.util.PriorityQueue; | |
import java.util.Scanner; | |
import java.util.Stack; | |
public class Main { |
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
function CoolCollisionSystem() { | |
this.currentTime = 0; | |
this.pq = new PriorityQueue(eventComparator); | |
//warmup happens only at startup (duh), to predict collisions between every particle | |
//this is the only n^2 loop | |
this.warmUp = function() { | |
for(var i = 0, length = this.circles.length; i < length; i++) { | |
this.predict(this.circles[i]); | |
} |
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
function SimpleCollisionSystem() { | |
this.update = function update() { | |
for(var a = 0; a < this.circles.length; a++) { | |
var circle1 = this.circles[a]; | |
//n * n/2 loop to check for collisions on every other particle | |
for(var b = a + 1; b < this.circles.length; b++) { | |
var circle2 = this.circles[b]; | |
circle1.checkCollisionOnAnotherCircle(circle2); |