Skip to content

Instantly share code, notes, and snippets.

View awilkening's full-sized avatar

Avery Wilkening awilkening

View GitHub Profile
def smush(array, container = [])
array.each do |element|
if element.is_a? Array
smush element, container
else
container << element
end
end
container
I would like to locate a partial in the app/views dir to be shared by two name spaces. How can I link the missing partials, (lostees or others)/trees/tree.html.haml to trees/tree.html.haml?
# config/routes.rb
namespace :lostees do
resources :islands
end
namespace :others do
namespace :users do
resources :clients do
scope 'applications', as: 'applications', klass: Application do
resources :submit_applications, only: [:update]
end
resources :applications
end
end
= form_for application, url: users_client_application_submit_application_path(client, application) do |f|
class Person < ActiveRecord::Base
attr_accessor :dont_set_name
def name
@name
end
def name=(attr)
@name = attr unless dont_set_name
end
@awilkening
awilkening / morse code converter
Created January 11, 2011 05:38
converts english into morse code
str = ''
counter = 1
ARGV.each do |a|
counter = counter + 1
a.each_char do |char|
char = char.to_s.downcase
case char
when 'a'
str += '.-'
when 'b'