Skip to content

Instantly share code, notes, and snippets.

# λ x. x
->(x){x}
# teams/new.html.haml
-form_for([@team]) do |f|
= link_to_function 'Add a Member' { |page| page.insert_html :bottom, :members, :partial => 'member', :object => Member.new }
= f.submit
# teams/_member.html.haml
- fields_for 'team[member_attributes][]', member do |f|
= f.datetime_select :arrival
# teams_controller.rb
## Error
Status: 500 Internal Server Error
Conflicting types for parameter containers. Expected an instance of Hash but found an instance of Array. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value. (The parameters received were [{"attribute"=>""}].)
# teams/new.html.haml
-form_for([@team]) do |f|
...
%p= link_to_function "Add a Member"; do |page|
page.insert_html :bottom, :members, :partial =>'member', :object => Member.new
= f.submit
# teams/_member.html.haml
if ( window.addEventListener ) {
var state = 0, konami = [38,38,40,40,37,39,37,39,66,65];
window.addEventListener("keydown", function(e) {
if ( e.keyCode == konami[state] ) state++;
else state = 0;
if ( state == 10 )
window.location = "http://example.com";
}, true);
}
---
53cr.com:
location: 53cr
redmine.53cr.com:
type: rails
railsenv: production
chromium53.com:
type: alias
redirect: 53cr.com
---
standard: |
<VirtualHost *>
ServerName #{@domain}
ServerAlias www.#{@domain}
DocumentRoot /srv/http#{@location}#{@domain}/htdocs
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\\.#{@domain.gsub('.','\.')}
RewriteRule (.*) http://#{@domain}$1 [R=301,L]
#{@custom}
class Vhost
def initialize(args)
args.each do |k,v|
instance_variable_set "@#{k}", v
end
@type ||= 'standard'
# We need to wrap @location in slashes, but if it's root,
# we get // or ///, so we collapse multiple /s to a single /
@location = "/#{@location}/"
class Tree
def initialize*d;@d,=d;end
def to_s;@l||@r?"<#{@d},<#{@l}>,<#{@r}>>":@d;end
def total;(@d.is_a?(Numeric)?@d:0)+(@l?@l.total: 0)+(@r?@r.total: 0);end
def insert d
alias g instance_variable_get
p=lambda{|s,o|d.to_s.send(o,@d.to_s)&&
(g(s).nil??instance_variable_set(s,Tree.new(d)):g(s).insert(d))}
@d?p[:@l,:<]||p[:@r,:>]:@d=d
end
#!/usr/bin/env ruby
$LOAD_PATH << "/home/student/umlibbey/lib"
ENV['GEM_HOME'] = "/home/student/umlibbey/gems"
require 'rubygems'
require 'rack'
require 'cloudkit'