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
ConnectionHandler.prototype.getConnectionForFolder = function(folder, action) { | |
var conn = this.searchConnection(), | |
deferred = Q.defer(); | |
conn.waitUntilUnlocked() | |
.then(function() { | |
return conn.lock(); | |
}) | |
.then(function() { |
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/sh | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' |
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/sh | |
# Setup some variables needed for bootstrapping the environment | |
ROOT=/home/vrde/projectz/myproject | |
REPOS=${ROOT}/repos | |
export PYTHONPATH=${REPOS} | |
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 p(msg, meta, formatArgs, args) { | |
var arg = args.shift(); | |
if (arg) { | |
if (typeof(arg) !== 'object') | |
formatArgs.push(arg); | |
else | |
meta = arg; | |
p(msg, meta, formatArgs, args); | |
} else | |
self._logger[level].apply(self._logger, [].concat.apply([], [meta, msg, formatArgs])); |
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
define(['common', 'async'], function(common, async) { | |
'use strict'; | |
function Emitter() { | |
this.events = {}; | |
} |
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 apocalypse(exitOnError) { | |
process.on('uncaughtException', function(err) { | |
process.removeListener('uncaughtException', arguments.callee); | |
logger.fatal(err); | |
if (exitOnError) { | |
var s = logger.streams[0]; |
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 threadsToLoad = [], | |
// _thread; | |
// restrict number of threads to load | |
var threadsToLoad = (function _getThreads(loadThreads, allThreads) { | |
var thread = allThreads.shift(); | |
if (thread && loadThreads.length < settings.maxSourceListItemsToCache) { | |
loadThreads.push(thread); | |
return _getThreads(loadThreads, allThreads); | |
} else return loadThreads; |
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
defmodule ExList do | |
def span(from, to) when from < to do | |
_span([], from, to) | |
end | |
defp _span(list, from, to) when from > to do | |
list | |
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
require 'sinatra/base' | |
require 'memcached' | |
module Sinatra | |
module Memcacher | |
module Helpers | |
def cache(key, &block) | |
return block.call unless options.memcacher_enabled | |
begin |
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 Hash | |
def deep_merge(other_hash) | |
Hash.new.replace(self).tap do |new_hash| | |
new_hash.deep_merge!(other_hash) | |
end | |
end | |
def deep_merge!(other_hash) | |
each do |key, val| |