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
let URLCache = NSURLCache(memoryCapacity: 4 * 1024 * 1024, diskCapacity: 25 * 1024 * 1024, diskPath: nil) | |
NSURLCache.setSharedURLCache(URLCache) |
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/osascript | |
do shell script "open -a /Applications/Evernote.app" | |
delay 10 # Evernote is slooooooow | |
with timeout of (10 * 60) seconds | |
tell application "Evernote" | |
set allnotebooks to notebooks | |
repeat with anotebook in allnotebooks | |
set aname to name of anotebook |
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
var HEADER_NAME = 'MyApp-Handle-Errors-Generically'; | |
var specificallyHandleInProgress = false; | |
angular.module('myApp').factory('RequestsErrorHandler', ['$q', function($q) { | |
return { | |
// --- The user's API for claiming responsiblity for requests --- | |
specificallyHandled: function(specificallyHandledBlock) { | |
specificallyHandleInProgress = true; | |
try { | |
return specificallyHandledBlock(); |
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
Board = class() | |
CELL_SIZE = 30 | |
function Board:init(size) | |
self.grid = {} | |
for i = 1, size do | |
self.grid[i] = {} | |
for j = 1, size do | |
self.grid[i][j] = false |
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
public void betterTest() throws Exception { | |
// Do some setup | |
// ... | |
final Exchanger<Exception> exchanger = new Exchanger<Exception>(); | |
new Thread() { | |
@Override | |
public void run() { | |
Exception thrown = null; |
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
<target name="compile" depends="compile-grammar"> | |
<javac srcdir="${src}" destdir="${build}"> | |
<classpath refid="classpath.base"/> | |
</javac> | |
</target> | |
<target name="compile-grammar" depends="-check_grammar_needs_compile" | |
if="grammarBuildRequired"> | |
<java classname="org.antlr.Tool" failonerror="true"> | |
<arg value="${grammar-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
commentor.should_receive(:add).with(anonymous_comment) |
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 Board | |
def initialize | |
@living = [] | |
end | |
def evolve_dead_cells | |
end | |
def add_living_cell(location) |
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
# When doing this: | |
class SomeError < Exception | |
def initialize(some, args); end | |
end | |
describe 'bad message' do | |
it 'raises an exception' do | |
obj = stub | |
obj.should_receive(:dude!).and_raise(SomeError) |
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
Object.const_defined? :Integer | |
#=> true |
NewerOlder