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 PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>Spying on objects created through Cortex and light-traits.js </title> | |
<!-- light-traits.js and cortex.js, twaked so that I don't need to use requireJS or similar libraries --> | |
<script type="text/javascript" src="https://gist.github.com/raw/946407/4bc11f02474bd466d768589fd0ffaf92195f19ff/light-traits.js"></script> | |
<script type="text/javascript" src="https://gist.github.com/raw/946411/a106ac47587356f6e235136f80692958b324bf8a/cortex.js"></script> | |
<script type="text/javascript" src="http://sinonjs.org/releases/sinon-1.0.0.js"></script> |
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 'rubygems' | |
require 'nokogiri' | |
module Helpers | |
def blog_excerpt(item, read_more='<!--READMORE-->') | |
post_dom = Nokogiri::HTML::DocumentFragment.parse(item.compiled_content) | |
more_tag_found = false | |
post_dom.css('*').each do |p, index| | |
if p.inner_html.match(read_more) | |
p.inner_html = p.inner_html.gsub(Regexp.new("#{read_more}.*"), " <a href=\"#{item.identifier}\" title=\"#{item[:title]}\" class=\"read-more\">Read more...</a>") |
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
<?php | |
function uniqueId(){ | |
static $id; | |
if (!isset($id)) { | |
$id=0; | |
} else { | |
$id++; | |
} | |
echo 'id_' . $id . "\n"; |
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
<!-- make sure to include this after jquery --> | |
<script type="text/javascript"> | |
jQuery(function ($) { | |
/** | |
* Populates a DOM element with Annotator data | |
* | |
* Params: | |
* | |
* annotations - The data fetched from the Annotator api endpoint. |
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
source 'http://rubygems.org' | |
gem 'grape' |
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
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+) | |
DEPRECATION WARNING: Rake tasks in vendor/plugins/action_mailer_cache_delivery/tasks, vendor/plugins/broccoli/tasks, vendor/plugins/browser_utils/tasks, vendor/plugins/engines/tasks, vendor/plugins/friendly_identifier/tasks, vendor/plugins/hoptoad_notifier/tasks, vendor/plugins/nature_support/tasks, vendor/plugins/restful_authentication/tasks, vendor/plugins/textile_editor_helper/tasks, and vendor/plugins/yaml_db/tasks are deprecated. Use lib/tasks instead. (called from /home/andrea/.rvm/gems/ree-1.8.7-2012.02@events/gems/rails-2.3.11/lib/tasks/rails.rb:10) | |
** Invoke db:migrate (first_time) | |
** Invoke environment (first_time) | |
** Execute environment | |
rake aborted! | |
private method `gsub' called for nil:NilClass | |
/home/andrea/.rvm/gems/ree-1.8.7-2012.02@events/gems/activesupport-2.3.11/lib/active_support/whiny_nil.rb:52:in `method_missing' | |
/home/andrea/.rvm/gems/ree-1.8.7-2012.02@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:77:in `require' | |
/hom |
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 'rubygems' | |
require 'sparql/client' | |
ENDPOINT_URL = "http://localhost:3030/data/query" | |
query = | |
SPARQL::Client.new(ENDPOINT_URL, :method => 'post') | |
.select(:person, :count => {:other_person => :count} ) | |
.where([:person, RDF::FOAF.knows, :other_person]) | |
.group(:person) |
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 'yaml' | |
require 'json' | |
require 'logger' | |
# Some useful, and often overlooked features of Rake, Ruby's build tool. | |
directory "logs" | |
desc "Log tasks execution to a file" | |
task "log" => ['logs'] do | |
MyLogger.instance |
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
import qualified Data.Map as DM | |
data Product = Product String Float deriving (Show) | |
type ProductMap = DM.Map String [Product] | |
type DiscountTimes = (ProductMap -> Int) | |
data Discount = Discount Float DiscountTimes | |
products :: [Product] | |
products = milk ++ marsBars | |
where milk = replicate 7 $ Product "milk" 1.30 |
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
(ns cascalog-tutorial.core | |
(:use cascalog.api | |
cascalog.playground | |
[clojure.string :only [split]] | |
[cheshire.core :only [parse-string generate-string]])) | |
(def input-tap | |
(hfs-tap (cascading.scheme.hadoop.TextLine.) | |
(str (System/getProperty "user.dir") | |
"/all.json"))) |