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
development: | |
adapter: mysql2 | |
encoding: utf8 | |
reconnect: false | |
database: mysql_read_timeout_development | |
pool: 5 | |
username: root | |
password: | |
socket: /tmp/mysql.sock |
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
require 'rubygems' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection('host' => 'localhost', | |
'user' => 'root', | |
'adapter' => 'mysql2', | |
'read_timeout' => 1) | |
begin | |
result = ActiveRecord::Base.connection.execute('select sleep(2)') | |
result.each { |r| p r } |
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
#!/usr/bin/env ruby | |
$0 = 'daemon-env' | |
loop {} |
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
require 'rubygems' | |
require 'bundler/setup' | |
require 'mysql2' | |
require 'active_record' | |
require 'logger' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.establish_connection(:adapter => 'mysql2', |
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
require 'eventmachine' | |
require 'ruote/worker' | |
module Ruote | |
class EMWorker < Worker | |
def run | |
EM.add_periodic_timer(1) do | |
step | |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Hello, Processing.js.</title> | |
<script type="application/javascript" src="processing-1.2.3.min.js"> | |
</script> | |
<script type="application/javascript"> | |
/* | |
* This code searches for all the <script type="application/processing" target="canvasid"> |
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
package app; | |
import static org.hamcrest.CoreMatchers.*; | |
import static org.junit.Assert.*; | |
import static org.junit.Assume.*; | |
import org.junit.experimental.theories.DataPoints; | |
import org.junit.experimental.theories.Theories; | |
import org.junit.experimental.theories.Theory; | |
import org.junit.runner.RunWith; |
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
# -*- mode: ruby; coding: utf-8-unix -*- | |
require 'active_model' | |
class User | |
include ActiveModel::Validations | |
attr_accessor :email | |
attr_accessor :password |
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 Array | |
def odd | |
select {|f| f % 2 == 0} | |
end | |
end | |
p [].to_a.odd |
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
package app; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
public class UnsafeCounter { | |
private int nextValue = 0; | |
public int getNextValue() { |