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
/* | |
* Copyright Noel Cower 2014. | |
* | |
* Distributed under the Boost Software License, Version 1.0. | |
* (See accompanying file LICENSE_1_0.txt or copy at | |
* http://www.boost.org/LICENSE_1_0.txt) | |
*/ | |
#ifndef __PARSE_HH__ | |
#define __PARSE_HH__ |
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
template <typename T, typename Q> | |
struct function_ptr_type_t__ | |
{ | |
}; | |
template <typename T> | |
struct function_ptr_type_t__<T, std::false_type> | |
{ | |
using type = decltype(&T::operator()); |
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 sublime, sublime_plugin | |
from sublime import Region | |
def column_for(view, region): | |
return view.rowcol(region.begin())[1] | |
def next_indentation(col, tab_size): | |
size_delta = col % tab_size | |
return ' ' * (tab_size - size_delta) |
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
||facebook.com/plugins/$third-party,media,subdocument,object,image,script,stylesheet,xmlhttprequest,popup | |
||facebook.com | |
www.huffingtonpost.com##SECTION[class="rail"] | |
www.huffingtonpost.com##SECTION[id="carousel"] | |
www.huffingtonpost.com##NAV[class="main group"] | |
www.huffingtonpost.com##SECTION[class="rail"] | |
www.huffingtonpost.com##SECTION[class="rail fix"] | |
www.huffingtonpost.com##SECTION[class="header"] | |
www.huffingtonpost.com##SECTION[class="rail pin"] | |
www.huffingtonpost.com##IFRAME[class="fb_ltr"] |
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
#pragma once | |
#include <memory> | |
template <typename FN> | |
class deferred_t | |
{ | |
std::unique_ptr<FN> _block; |
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
package main | |
import ( | |
"errors" | |
"fmt" | |
"strconv" | |
"strings" | |
"unicode/utf8" | |
) |
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 Foundation | |
func first<S: Sequence, T where T == S.GeneratorType.Element>(seq: S, pred: (T) -> Bool = {(_) in true}) -> T? { | |
for x: T in seq { | |
if pred(x) { | |
return x | |
} | |
} | |
return nil | |
} |
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 Foundation | |
/// Gets a list of properties' names held by the object. | |
func getPropertyList(obj: AnyObject) -> [String]? { | |
let klass: AnyClass = object_getClass(obj) | |
var count: UInt32 = 0 | |
let list = class_copyPropertyList(klass, &count) | |
if list == nil { |
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 Cocoa | |
let baseFoo = NSObject() | |
let baseBar = NSObject() | |
weak var weakFoo: NSObject? = baseFoo | |
weak var weakBar: NSObject? = baseBar | |
let autoFoo: NSObject! = weakFoo |
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
#!bash | |
# Set to 0 to enable Mercurial prompts. Disabled because Mercurial is slow. | |
export DISABLE_HG_PROMPT=1 | |
function n__get-vcs-relpath { | |
local P='' | |
P="$(git rev-parse --show-toplevel 2> /dev/null)" | |
if [[ -z "$P" ]] ; then |