View this code at http://livecoding.io/5814072
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> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/> | |
<script src="http://cmx.io/v/0.1/cmx.js"></script> | |
<body> | |
<scene id="scene1"> | |
<label t="translate(0,346)"> | |
<tspan x="0" y="0em">How Simpleton Works</tspan> | |
</label> | |
<actor t="translate(76,42)" pose="-11,9|-4,117|-11,99|-13,87|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59"> |
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
# An experiment in higher-order (?) messages in Ruby. | |
class Message | |
attr_reader :name | |
attr_reader :arguments | |
def initialize(name, *arguments) | |
@name = name | |
@arguments = arguments | |
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
# prerequisites: Ruby 1.9.3, Rails 3.2.something recent | |
### | |
### Setup rails app w/haml and opal | |
### | |
# create app | |
rails new opal_test | |
# add to Gemfile below rails |
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
/* | |
Newtonian collision checking (draft) | |
based on the paper: http://www.vobarian.com/collisions/2dcollisions2.pdf | |
[email protected] | |
*/ | |
if (typeof d3.z != "object") d3.z = {}; | |
(function() { |
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
// Inspired by http://dmitry.baranovskiy.com/work/github/ | |
d3.chart.impact = function() { | |
var width = 1, | |
height = 1, | |
duration = 0, | |
domain = null, | |
values = Object, | |
key = d3_chart_impactKey, | |
value = d3_chart_impactValue, | |
sort = null, |
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
ctrl-z | |
bg | |
touch /tmp/stdout | |
touch /tmp/stderr | |
gdb -p $! | |
# In GDB | |
p dup2(open("/tmp/stdout", 1), 1) | |
p dup2(open("/tmp/stderr", 1), 2) |
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
1 class Report < ActiveRecord::Base¬ | |
2 attr_accessible :user_id, :evidence, :location, :time, :perpetrator_id, :new_perpetrator, :bounty, :active¬ | |
3 attr_accessor :new_perpetrator¬ | |
4 ¬ | |
5 before_validation :create_new_perpetrator¬ | |
6 ¬ | |
7 belongs_to :perpetrator¬ | |
8 belongs_to :user¬ | |
9 ¬ | |
10 scope :active, where(active: true)¬ |
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 TasksController < ApplicationController | |
def update | |
if @task.update_attributes(params[:task]) | |
tracker = TaskTracker.new(@task.previous_changes) | |
TaskPusher.new(tracker, socket_id).push_changes | |
TaskMailSender.new(tracker, current_user).deliver_email | |
# success response | |
else | |
# failure respond | |
end |