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
mike@rbci:~$ psql -U postgres | |
psql (9.0.3) | |
Type "help" for help. | |
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0'; | |
UPDATE 1 | |
postgres=# \c template0 | |
You are now connected to database "template0". | |
template0=# update pg_database set datistemplate = FALSE where datname = 'template1'; | |
UPDATE 1 |
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
for X in *.{jpg,png}; do convert "$X" -resize 602x400 -strip -quality 86 "$X"; done |
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 MyEnum | |
def initialize fiber | |
@f = fiber | |
end | |
def next | |
@f.resume | |
end | |
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
RSpec::Matchers.define :have_more_numbers_than do |arg| | |
match do |obj| | |
obj.scan(/\d/).length > arg.scan(/\d/).length | |
end | |
end | |
describe "my matching" do | |
it { "555555foo9".should have_more_numbers_than "jk444" } | |
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
Tourney = window.Tourney or {} | |
# Views | |
Tourney.AppView = Backbone.View.extend | |
el: "#app" | |
initialize : -> | |
Groups.on "reset", @buildTables, this | |
Groups.on "reset", @buildFixtures, this |
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 "socket" | |
puts 'QuickDirty web server (v0.0.0 codename Mire)' | |
puts 'Listening on 0.0.0.0:7776, CTRL+C to stop' | |
Socket.tcp_server_loop(7776) do |conn| | |
puts "Successfully connected" | |
req = conn.gets("\r\n\r\n") | |
puts req |
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
fs = require 'fs' | |
{print} = require 'util' | |
{spawn} = require 'child_process' | |
build = (callback) -> | |
coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src'] | |
coffee.stderr.on 'data', (data) -> | |
process.stderr.write data.toString() |
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
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>index.html</title> | |
<style type="text/css"> | |
input[type="radio"] { | |
margin: 0; | |
} | |
.switcher-wrap{ |
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 ang2(ang1, n1, n2){ | |
return rad_to_deg(Math.asin(Math.sin(deg_to_rad(ang1)) * n1 / n2)) | |
} | |
function n2(ang1, ang2, n1){ | |
return n1 * Math.sin(ang1) / Math.sin(ang2) | |
} | |
function deg_to_rad(ang){ | |
return ang * 22 / 7.0 / 180 |
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
def ang2(ang1, n1, n2) | |
rad_to_deg Math.asin(Math.sin(deg_to_rad(ang1)) * n1 / n2.to_f) | |
end | |
def deg_to_rad(ang) | |
ang * 22 / 7.0 / 180 | |
end | |
def rad_to_deg(ang) | |
ang * 180 * 7.0 / 22 |