SimpleMarkup parses plain text documents and attempts to decompose them into their constituent parts. Some of these parts are high-level: paragraphs, chunks of verbatim text, list entries and the like. Other parts happen at the character level: a piece of bold text, a word in code font. This markup is similar in spirit to that used on WikiWiki webs, where folks create web pages using a simple set of formatting rules.
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
<?xml version="1.0" encoding="utf-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom" | |
xmlns:ac="http://purl.org/podcast/atomcast" | |
xml:base="http://www.example.com" | |
xml:lang="en-us"> | |
<id>http://example.com/myfeed.atom</id> | |
<updated>2008-06-05T14:39:57-08:00</updated> | |
<title type="text">All About Everything</title> | |
<subtitle type="html">A show about <em>everything</em></subtitle> | |
<ac:summary type="xhtml"> |
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 | |
# | |
# mqparse - Media Query parser | |
# Copyright 2008 Apple, Inc. All Rights Reserved. | |
# http://gist.github.com/6863 | |
# | |
# cf. http://www.w3.org/TR/css3-mediaqueries | |
require 'pp' | |
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
module Dispatch | |
# Wrapper around Dispatch::Group used to implement lazy Futures | |
class Future | |
# Create a future that asynchronously dispatches the block | |
# to a concurrent queue of the specified (optional) +priority+ | |
def initialize(priority=nil, &block) | |
@group = Group.new | |
@value = nil | |
Dispatch::Queue.concurrent(priority).async(@group) { @value = block.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
module Dispatch | |
class Actor | |
# Create an Actor that serializes or asynchronizes the given object | |
# Will invoke and call-back asynchronously if provide a block | |
# Note that this will NOT work for methods that themselves expect a block | |
def initialize(actee, callback=nil) | |
@actee = actee | |
@callback = callback || Dispatch::Queue.concurrent | |
@q = Dispatch::Queue.new("dispatch.actor.#{actee}.#{object_id}") | |
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
require 'dispatch' | |
T=1 | |
T0 = Time.now | |
def now | |
(Time.now - T0) | |
end | |
p "Call Dispatch.sync with delay #{T} @ #{now}" | |
Dispatch.sync {sleep T; p "Waited for me"} | |
p "Finished calling sync @ #{now}" |
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() { | |
// Do not use this library. This is just a fun example to prove a | |
// point. | |
var Bloop = window.Bloop = {}; | |
var mountId = 0; | |
function newMountId() { | |
return mountId++; | |
} |
Draft 3
cc: @jonathoda @jamiiecb @jeresig @twleung @lindsey @a_cowley @kmett @ezyang @lambda_calculus
Inspired by The Future Programming Manifesto
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
# As used in http://jsfiddle.net/DrErnie/p09bjgh3/ | |
# Preamble - may need to be in User Code | |
_.mixin(_.str.exports()) | |
bind = rx.bind | |
rxt.importTags() | |
# Create rxv Versions |
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
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys | |
func CSVToMap(reader io.Reader) []map[string]string { | |
r := csv.NewReader(reader) | |
rows := []map[string]string{} | |
var header []string | |
for { | |
record, err := r.Read() | |
if err == io.EOF { | |
break | |
} |