(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
#!/usr/bin/env ruby | |
# git-show-merged: a simple script to show you which topic branches the | |
# current branch has been merged into, and which it hasn't. | |
# | |
# git-show-merged Copyright 2010 Birkir A. Barkarson <birkirb@stoicviking.net>. | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or (at | |
# your option) any later version. |
// REFERENCE UNICODE TABLES: | |
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml | |
// http://www.tamasoft.co.jp/en/general-info/unicode.html | |
// | |
// TEST EDITOR: | |
// http://www.gethifi.com/tools/regex | |
// | |
// UNICODE RANGE : DESCRIPTION | |
// | |
// 3000-303F : punctuation |
escaped = CGI.unescape(query) | |
return escaped if escaped.valid_encoding? | |
%w[EUC-JP Shift_JIS].each do |encoding| | |
s = escaped.force_encoding(encoding) | |
return s.encode("UTF-8") if s.valid_encoding? | |
end | |
escaped |
// make sure we're using the right db; this is the same as "use aggdb;" in shell | |
db = db.getSiblingDB("aggdb"); | |
// simple projection | |
var p1 = db.runCommand( | |
{ aggregate : "article", pipeline : [ | |
{ $project : { | |
tags : 1, | |
pageViews : 1 | |
}} |
tell application "BBEdit" to set theFile to file of document 1 | |
tell application "Finder" to set theFolder to (container of file theFile) as alias | |
set theUnixPath to POSIX path of theFolder | |
set output to return & "cd '" & theUnixPath & "'; pwd" | |
tell application "BBEdit" | |
set uws to Unix worksheet window | |
tell uws | |
select insertion point after last character | |
set selection to output |
-- PostgreSQL 9.2 beta (for the new JSON datatype) | |
-- You can actually use an earlier version and a TEXT type too | |
-- PL/V8 http://code.google.com/p/plv8js/wiki/PLV8 | |
-- Inspired by | |
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html | |
-- http://ssql-pgaustin.herokuapp.com/#1 | |
-- JSON Types need to be mapped into corresponding PG types | |
-- |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
extension String { | |
var composedCount : Int { | |
var count = 0 | |
enumerateSubstringsInRange(startIndex..<endIndex, options: .ByComposedCharacterSequences) {_ in count++} | |
return count | |
} | |
} |
#!/usr/bin/env ruby | |
#------------------------------------------------------------------------------- | |
# Toggle Parentheses | |
#------------------------------------------------------------------------------- | |
# Jason Sims <jason@symmetriq.com> | |
#------------------------------------------------------------------------------- | |
# | |
# For languages with optional parentheses, such as Ruby and CoffeeScript. | |
# |