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
NodeList.prototype.toArray = function () { | |
return Array.prototype.slice.call(this); | |
}; | |
[].concat.apply([], document.querySelectorAll("li.session").toArray().map(function(session){ | |
var sessionID = session.id.match(/^\d+/)[0]; | |
var title = session.querySelector(".title").innerText; | |
var track = session.querySelector(".track").innerText; | |
var date = session.querySelector(".date").innerText; | |
var allLinks = session.querySelectorAll("a[href^='http://devstreaming']").toArray(); |
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
#import <CouchbaseLite/CouchbaseLite.h> | |
@interface CBLQueryEnumerator (EnumeratorByBlock) | |
- (void)enumerateQueryRowsUsingBlock:(void (^)(id key,id value, NSUInteger idx, BOOL *stop))block; | |
@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
@symbols = ':' ','; | |
@start = expression; | |
expression = functionExpression | messageExpression; | |
funcName = Word; | |
selector = Word; | |
className = Word; | |
openSquareParen = '['; | |
closeSquareParen = ']'; | |
openParen = '('; |
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"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleDevelopmentRegion</key> | |
<string>English</string> | |
<key>CFBundleExecutable</key> | |
<string>libjli.dylib</string> | |
<key>CFBundleGetInfoString</key> | |
<string>Java SE 1.7.0_60</string> |
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
// slicing of array | |
let arr = [1,2,3,4] | |
arr[1..<arr.count] | |
arr[arr.startIndex.successor()..<arr.endIndex] | |
// typealias similar to typedef in C | |
// here we create a type for function | |
typealias OptionalIncrementor = Int? -> Int | |
// another shorthand for create dictionary |
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 light() { | |
if [ -z "$2" ] | |
then src="pbpaste" | |
else | |
src="cat $2" | |
fi | |
$src | highlight -O rtf --syntax $1 --font Inconsolata --style solarized-dark --font-size 24 | pbcopy | |
} |
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
class ChainExample { | |
static String callClosure(){ | |
def aClosure = { -> | |
{ -> | |
"this is second closure" | |
} | |
} | |
aClosure()() | |
} |
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
#!/bin/bash | |
# assuming brew installed, especially git | |
mkdir ~/.zsh-antigen | |
cd ~/.zsh-antigen | |
git init . | |
git submodule add https://github.com/zsh-users/antigen.git antigen | |
# should check zshrc already exists |
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 sh | |
# assumption: Xcode is always installed at /Applications | |
# STEPS: | |
# use plistbuddy to read $INFOPLIST_FILE::DVTPlugInCompatibilityUUIDs array | |
# get new DVTPlugInCompatibilityUUID [ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID ] | |
# check new DVTPlugInCompatibilityUUID already in the array | |
# YES: end | |
# NO: use plistbuddy to write the new DVTPlugInCompatibilityUUID into the array and write out to file |
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
func measure(title: String, block: (finish:()-> Void) -> Void) { | |
let startTime = CFAbsoluteTimeGetCurrent() | |
block { | |
let timeElapsed = CFAbsoluteTimeGetCurrent() - startTime | |
print("\(title):: Time: \(timeElapsed)") | |
} | |
} |
OlderNewer