Chord diagrams show directed relationships among a group of entities. This example also demonstrates simple interactivity by using mouseover filtering. Layout inspired by Martin Krzywinski's beautiful work on Circos.
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
def number_to_ordinal num | |
int = num.to_i | |
int.to_s + ((10...20) === int) ? "th" : (%w{th st nd rd}[int % 10] or "th") | |
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
def 'chef installed' do | |
requires 'chef', 'ohai' | |
define_var :server_name, :default => shell('hostname -f') | |
# this needs to go somewhere, like ~/solo.rb | |
solo_rb = %Q{ | |
file_cache_path "/tmp/chef-solo" | |
cookbook_path "/tmp/chef-solo/cookbooks" | |
recipe_url "http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz" | |
} |
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
irb(main):001:0> a = lambda { b.call } | |
=> #<Proc:0x00000001038c8af8@(irb):1> | |
irb(main):002:0> b = lambda { :foo } | |
=> #<Proc:0x00000001038c3b20@(irb):2> | |
irb(main):003:0> a.call | |
NameError: undefined local variable or method `b' for #<Object:0x103fac888> | |
from (irb):1 | |
from (irb):3:in `call' | |
from (irb):3 | |
irb(main):004:0> c = lambda { b.call } |
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
# Bad because the dependency on ModelClass and ApiClass are hard-coded | |
module HitTheApi | |
def self.go | |
ids_to_update = ModelClass.what_ids_should_I_update | |
ids_to_update.each do |id| | |
data = ApiClass.fetch_me_data(id) | |
ModelClass.persist_data(id, data) | |
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
html { | |
height: 100%; | |
} | |
body { | |
height: 100%; | |
border: solid 20px blue; | |
} | |
div.red { |
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 id="blog" ng-controller="FeedCtrl"> | |
<span ng-hide="posts">Loading</span> | |
<article ng-repeat="post in posts"> | |
<h1 class="title">{{ post.title }}</h1> | |
<time class="publishedDate">{{ post.publishedDate }}</time> | |
<div class="content">{{ post.content }}</div> | |
</article> | |
</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
RWAR = (inject...) -> inject | |
my.angular.directives.directive "mydirective", | |
RWAR "$http", "$lolwhut", ($http, $lolwhut) -> | |
scope: | |
here: "i" | |
bind: "=some" | |
things: "&away" | |
link: (scope, el, attrs) -> | |
"WOW I'M DIRECTING" |
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
(function () { | |
'use strict'; | |
var i, image, j, matches, rules, sheet; | |
for (i = 0; i < document.styleSheets.length; ++i) { | |
sheet = document.styleSheets[i]; | |
if (sheet.rules) { | |
for (j = 0; j < sheet.rules.length; ++j) { | |
rules = sheet.rules[j]; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
</head> | |
<body> | |
<script> | |
(function ( window, document ) { | |
// Pinched domready | |
// http://www.dustindiaz.com/smallest-domready-ever/ |
OlderNewer