This file contains hidden or 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
#! /bin/bash | |
git clone [email protected]:CSOBerkeley/cskit-rb.git | |
git clone [email protected]:CSOBerkeley/cskit-shkts-rb.git | |
git clone [email protected]:CSOBerkeley/cskit-biblekjv-rb.git | |
git clone [email protected]:CSOBerkeley/cskit-hymnal-rb.git |
This file contains hidden or 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
# clone twitter-cldr-rb, change to rbnf branch | |
# Note: There are probably bugs with this implementation, and the function names will | |
# likely change (underscores instead of camel case, for example). Use only with the | |
# understanding that you will probably have to change your code later. | |
# | |
# Any and all questions/comments always appreciated! | |
require 'twitter_cldr/formatters/numbers/rbnf/en' | |
puts TwitterCldr::Formatters::RuleBasedNumberFormatter::English.renderDigitsOrdinal(123) |
This file contains hidden or 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 DashboardTile | |
PARAMS = [ | |
:image, :name, :description, :count, | |
:count_suffix, :status, :url, :url_class | |
] | |
PARAMS.each do |param| | |
define_method(param) { raise NotImplementedError } | |
define_method(:"#{param}=") { raise NotImplementedError } | |
end |
This file contains hidden or 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
module BeforeMethodHook | |
def before(*names) | |
names.each do |name| | |
m = instance_method(name) | |
define_method(name) do |*args, &block| | |
yield self | |
m.bind(self).call(*args, &block) | |
end | |
end | |
end |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<title>CSKit HTML Example</title> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"> | |
<style> | |
.cskit-strongs-word { |
This file contains hidden or 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 Project < ActiveRecord::Base | |
has_and_belongs_to_many :phrases | |
end | |
class Phrase < ActiveRecord::Base | |
has_and_belongs_to_many :projects | |
end | |
join_dependency = ActiveRecord::Associations::JoinDependency.new(Project, [:phrases], []) |
This file contains hidden or 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
/ | |
/ | | |
/ | | |
116,435 / | | |
/ | 8,000 | |
/ x | | |
___________ | |
116,160 | |
soh cah toa |
This file contains hidden or 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
# protip: use Ruby 1.9 for block support with Enumerable#count | |
def count_ones(num) | |
return 0 if num == 0 | |
digits = Math.log2(num).floor + 1 | |
0.upto(digits).count do |i| | |
num & (2 ** i) == (2 ** i) | |
end | |
end |
This file contains hidden or 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
require 'twitter_cldr' | |
require 'fileutils' | |
require 'yaml' | |
OUTPUT_FILE = "/tmp/cldr/decomposition_map.yml" | |
CODE_POINT_MAX = 1114111 | |
decomps = {} | |
CODE_POINT_MAX.times do |i| | |
code_point = TwitterCldr::Shared::CodePoint.for_hex(i.to_s(16)) |
This file contains hidden or 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
require 'open-uri' | |
require 'fileutils' | |
require 'yaml' | |
PROPS_URL = "http://www.unicode.org/Public/6.1.0/ucd/DerivedNormalizationProps.txt" | |
OUTPUT_FILE = "/tmp/cldr/composition_exclusions.yml" | |
EXPECTED_TOTAL_POINTS = 1120 | |
data = open(PROPS_URL).read | |
start_pos = data.index("# Derived Property: Full_Composition_Exclusion") |