Skip to content

Instantly share code, notes, and snippets.

@knewter
knewter / client.rb
Created April 24, 2013 22:14
websocket mtgox celluloid example
require 'celluloid/websocket/client'
class MozWeb
include Celluloid
include Celluloid::Logger
def initialize
@client = Celluloid::WebSocket::Client.new("ws://websocket.mtgox.com/mtgox?Currency=USD", current_actor)
@counter = 0
end
require 'benchmark'
counter = 0
bm = Benchmark.measure do
500_000_000.times do
counter += 1
end
end
mRubyContainer.runScriptlet("$LOAD_PATH");
(org.jruby.RubyArray) [".", "/data/data/com.isotope11.ledclicker/cache/lib/ruby/1.9/site_ruby", "/data/data/com.isotope11.ledclicker/cache/lib/ruby/shared", "/data/data/com.isotope11.ledclicker/cache/lib/ruby/1.9"]
@knewter
knewter / release.rb
Created March 28, 2013 18:49
Just a lil' release.rb script I have for a project I work on
#!/usr/bin/env ruby
begin
class VersionAlreadyTaggedError < StandardError; end
class UncommittedFilesError < StandardError; end
class UnstagedFilesError < StandardError; end
# Get VERSION file contents
version = File.read('VERSION').chomp
@knewter
knewter / gist:5241722
Created March 25, 2013 23:06
BOSS Bugfixathon
http://issuetriage.herokuapp.com/
require 'entities/pages/page'
require_relative '../../presenters/abc/page_presenter' # Need to do load path manip?
module Abc
module Conductors
module Pages
class FetchesPages # This can be extracted into a parent "BasicListConductor"
def call
presenters
end
@knewter
knewter / test.rb
Created March 21, 2013 02:38
totes runs
require 'spec_helper'
describe "Pages Interface" do
describe "GET /backend/pages" do
it "shows a list of pages" do
# create some pages
visit abc_backend.pages_path
within('h2') do
page.should have_content("Pages")
end
class EmailSignupsController
# jQuery style:
def create
AcceptsEmailSignupForm.call(params).then(method(:successful_signup)).fail(method(:failed_signup))
end
protected
def successful_signup
render 'email_signups/thank_you' and return
end
@knewter
knewter / living-off-the-rails.md
Created March 1, 2013 14:45
Extraction of a post on ruby rogues parley

So there was a really good post on parley, here it is. Lots of links to different research materials re: 'living off the rails' or whatever we're calling it :)

I've been playing with this idea too lately. Unfortunately can't spend too much time on it so I didn't get very far. There are however a few links that might help you:

These are related to Micah Martin's talk, "a sequel" to Uncle Bob's architecture one: https://github.com/slagyr/cleantracker https://github.com/slagyr/cleananalytics_rb

@knewter
knewter / gist:5057931
Created February 28, 2013 16:22
mysql alter default enum error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ALTER TABLE gallery ALTER COLUMN permission SET DEFAULT 'friends''