Skip to content

Instantly share code, notes, and snippets.

@knewter
knewter / tree_example.rb
Created February 24, 2013 21:12
Just toying with some trees / repository fun
# So say you want to deal with a tree structure in ruby
tree_data = [
{ name: 'root', childen: [
{ name: 'first' },
{ name: 'second' }
]
]
# That pretty much covers it. I would expect you'd want it to be wrapped in some kind of helper class
require 'pry'
require 'net/http'
#require 'rexml/document'
#include REXML
class SamlSend
def initialize
end
@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''
@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

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 / 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
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 / gist:5241722
Created March 25, 2013 23:06
BOSS Bugfixathon
http://issuetriage.herokuapp.com/
@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
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"]