Skip to content

Instantly share code, notes, and snippets.

View eguven's full-sized avatar

Eren Güven eguven

View GitHub Profile
@eguven
eguven / gist:b8c6b1df85b06ca7bc52
Created September 25, 2014 15:48
gief_new_branch
# gief_new_branch <new_branch> [<start_point>]
# fetch 'upstream' named remote and branch out from 'upstream'/<start_point>
# git fetch upstream && git checkout -b <new_branch> upstream/[<start_point>]
function gief_new_branch()
{
local EFG="\033[0;31m"
local QFG="\033[32m"
local NC="\033[0m"
echo -e "${EFG}"
@eguven
eguven / gist:3801145
Created September 28, 2012 17:29
motor.DataServer suggestion
# related parts of motor.DataServer suggestion
# something along the lines of...
class DataServer(object):
@tornado.gen.engine
def stream(self, handler, file_id):
fs = yield motor.Op(motor.MotorGridFS(db).open)
try:
gridout = yield motor.Op(fs.get, file_id)
@eguven
eguven / gist:3187381
Created July 27, 2012 10:40
Twitter Bootstrap comma-separated typeahead
<script type="text/javascript">
jQuery(document).ready(function() {
$('#autocomplete').typeahead({
source: someDataSource
, matcher: function (item) {
queryItems = this.query.toLowerCase().split(/, */);
queryLast = queryItems[queryItems.length-1];
return ~item.toLowerCase().indexOf(queryLast)
}
@eguven
eguven / py2_py3.py
Created August 19, 2011 11:57
Some performance test Python2.6 vs Python3.1
# procrastination adventures
'''
RESULTS: (over 1m iterations)
Python 2.5 | Python2.6 | Python3.1
test1: ~17.5s | ~14.6s | ~22.1s
test2: ~10.6s | ~10.3s | ~16.2s
just_join: ~0.7s | ~0.66s | ~0.63s
just_sample: ~10.5s | ~9.75s | ~15.7s
just_str: ~3.45s | ~3.1s | ~3.4s
'''