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
grammar PB::Grammar { | |
token TOP { ^ <.ws> <proto> <.ws> $ <.ws> } | |
token proto { [<message> | <package> | <import> | <option> | <enum> | <extend> | <service> | ';']* } | |
# comments and whitespace | |
token nl { \xA | "\r" \xA | "\r" | "\f" } | |
regex comment { '//' [.]*? <.nl> $ } | |
token ws { <!ww> [ \s | <.comment> ]* } | |
# import |
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 | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
/* | |
Licensed under the MIT License | |
Copyright (c) 2011 Cédric Luthi | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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
@interface NSString (WordTruncation) | |
- (NSString *)substringOfHTMLToWordIndex:(NSUInteger)to appendOnTruncate:(NSString *)append softLimit:(int)leSoftLimit; | |
- (NSString *)substringToWordIndex:(NSUInteger)to; | |
@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
class AbstractMixin(object): | |
_classcache = {} | |
@classmethod | |
def contribute(cls): | |
return {} | |
@classmethod | |
def construct(cls, *args, **kwargs): | |
attrs = cls.contribute(*args, **kwargs) |
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
""" | |
My dependency injection framework for Python. Using a context manager it allows | |
you to rewrite globals (such as imports, top-level classes and functions, whatever | |
you want) in a module and have them replaced at the end of the with block. This is | |
usually enough. `proxy` is just a dict-wrapping type class which will create a | |
type with "class variables" for every key you give it. | |
Usage: | |
from di import * | |
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
// | |
// FlickDynamics.h | |
// (c) 2009 Dave Peck <davepeck [at] davepeck [dot] org> | |
// http://davepeck.org/ | |
// | |
// This code is released under the BSD license. If you use my code in your product, | |
// please put my name somewhere in the credits and let me know about it! | |
// | |
// This code mimics the scroll/flick dynamics of the iPhone UIScrollView. | |
// What's cool about this code is that it is entirely independent of any iPhone |