This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) <year> <copyright holders> | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, | |
copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the | |
Software is furnished to do so, subject to the following | |
conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConvertWorkAddressToManyToMany < ActiveRecord::Migration | |
def self.up | |
# note that some fields have no "work_" prefix in newfields | |
oldfields = [:department, :title, :work_street, :work_city, :work_province, :work_postalcode, :work_country, :work_phone, :work_fax, :email] | |
newfields = [:department, :title, :street, :city, :province, :postalcode, :country, :phone, :fax, :email] | |
newfields.each do |field| | |
add_column :contact_organizations, field, String | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
$('.rotated').each(function(){ | |
var text = $("p", $(this)).html(); | |
$(this).html(""); | |
var size = text.length; | |
var pixels = Math.round(size * 8); | |
$(this).css('height',pixels); | |
var R = Raphael($(this).get(0), 30, pixels); | |
var attr = {"font": '13px "Helvetica"'}; | |
var txt = R.text(15, Math.round(pixels/2.0), text).attr(attr).attr("fill", "#fff"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="rotated"> | |
<p>I'm sideways!</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'digest/md5' | |
def find_match(a, b) | |
largest = 0 | |
current = 0 | |
(32-largest).times do |aix| | |
(32-largest).times do |bix| | |
offset = 0 | |
current = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> Grammar::parse("Three and a half hamburgers and a hotdog with ketchup and three pounds of relish") | |
=> [[3.5, Vocabulary::Serving, "hamburgers"], [1.0, Vocabulary::Serving, "hotdog"], [1.0, Vocabulary::Serving, "ketchup"], [1360.77711, Vocabulary::Gram, "relish"]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 | |
QED. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ % irb1.9 --simple-prompt burke@zaphod (17:35) | |
>> wd=->(dl){(1/30.0)*((80+dl)/100.0)} | |
=> #<Proc:0x0d3c98@(irb):1 (lambda)> | |
>> wd.(1) | |
=> 0.027 | |
>> wd.(5) | |
=> 0.0283333333333333 | |
>> wd.(40) | |
=> 0.04 | |
>> wd.(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#p-cactions li { | |
-webkit-border-top-left-radius: .5em; | |
-khtml-border-radius-topleft: .5em; | |
-moz-border-radius-topleft: .5em; | |
border-top-left-radius: .5em; | |
-webkit-border-top-right-radius: .5em; | |
-khtml-border-radius-topright: .5em; | |
-moz-border-radius-topright: .5em; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Question | |
attr_accessor :question, :answer, :weight | |
def initialize(question, answer) | |
@question = question | |
@answer = answer | |
@weight = 5 | |
end |