Skip to content

Instantly share code, notes, and snippets.

adaniele@nutcracker:~/ironruby$ mono bin/ir.exe
IronRuby 1.0.0.1 on .NET 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
Note that local variables do not work today in the console.
As a workaround, use globals instead (eg $x = 42 instead of x = 42).
>>> puts 'hello'
hello
=> nil
@tarchan
tarchan / AddressLink.js
Created July 26, 2008 07:54
Open Google Maps for Japanese Address
class Problem
attr_reader :x, :y, :op
def initialize(op, x, y)
@op = op
@x = x
@y = y
end
MODE_EASY = 1
MODE_DIFFICULT = 2
OP_ADD = 0
OP_SUB = 1
OP_MULTI = 2
OP_DIV = 3
QUESTIONS = 100
## /users/edit.html.erb
<% form_for [:cp, @user], :url => { :action => 'update', :id => @user.id } do |f| %>
...
<%= collection_select :users, :show_id, Show.find(:all), :id, :name, { :prompt => true } %>
## users_controller.rb
@user.shows << Show.find(params[:users][:show_id])
## error
ActiveRecord::AssociationTypeMismatch in Cp/usersController#update
@tarchan
tarchan / 住所をリンク
Created July 26, 2008 08:38
Webページに書かれた住所をリンクに変換します。
javascript:(function(){%09var%20s=document.createElement('script');%09s.charset='UTF-8';%09s.language='javascript';%09s.type='text/javascript';%09var%20d=new%20Date;%09s.src='http://gist.github.com/raw/2618/128a57e50252e49e6bd1d417e94bbfcff4af7913?'+d.getMilliseconds();%09document.body.appendChild(s);})()
/* ========================================================================
Flip
======================================================================== */
.dashcode-transition-flip-container {
-webkit-perspective: 800; /* subviews should have the same perspective during flip */
-webkit-animation-name: "dashcode-transition-flip-container";
}
/* This works great for ease-in-out but not for other timing. */
@-webkit-keyframes dashcode-transition-flip-container {
{ :one => "Weee", :two => { :three => "" }, :four => "" }.delete_if { |k,v| v.class == Hash ? v.delete_if { |k2,v2| v2.blank? } : v.blank? }
<% for color in colors %>
<%= color %>
<% end %>
package com.ontometrics;
/**
* A singleton class, that has external properties injected by spring and be
* used by all
*
* @author Noura
*
*/
public class ApplicationConfigurations {