Skip to content

Instantly share code, notes, and snippets.

@wacaw
wacaw / db_schema_load.cap
Last active January 2, 2019 17:49
Capistrano 3 Schema Load
namespace :deploy do
desc "Load the initial schema - it will WIPE your database, use with care"
task :db_schema_load do
on roles(:db) do
puts <<-EOF
************************** WARNING ***************************
If you type [yes], rake db:schema:load will WIPE your database
any other input will cancel the operation.
**************************************************************
@wacaw
wacaw / from_existing_model
Created October 16, 2014 13:18
Generate factories from existing model
#run in rails console and paste in comand line to generate
Rails.application.eager_load!
ActiveRecord::Base.descendants.map do |f|
columns = f.columns.collect{|c| "#{c.name}:#{c.type}" }.join(' ')
puts "rails g factory_girl:model #{f} #{columns}"
end
@wacaw
wacaw / robot.js
Created December 6, 2012 01:04 — forked from Shipow/robot.js
Shipow#001
var Robot = function(robot) {
robot.rotateCannon(-90);
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead();
//i'll add a clone but i need to refactor collision
//robot.clone();
};
@wacaw
wacaw / robot.js
Created December 4, 2012 14:37
lol
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@wacaw
wacaw / pird.rb
Created January 16, 2012 12:58
simple ruby sound visualization - with ruby processing
require 'ruby-processing'
# Pird
class Pird < Processing::App
load_library "minim"
import "ddf.minim"
import "ddf.minim.analysis"
load_library "control_panel"