Skip to content

Instantly share code, notes, and snippets.

View AlexeyMK's full-sized avatar

Alexey Komissarouk AlexeyMK

View GitHub Profile
@AlexeyMK
AlexeyMK / .gitconfig
Last active April 27, 2020 06:06
Useful Git snippets from my time at Opendoor
# stick these in ~/.gitconfig
[alias]
bl = "!~/.bin/bl.sh"
# ensure you are on latest master before creating a PR
prep = "!git checkout master && git pull --rebase && git checkout - && git rebase master"
# commit, get the commit message, and then immediately start writing up the PR.
cmpr = "!git add . && git commit -a $1 && git push && open https://github.com/opendoor-labs/$(basename `pwd`)/compare/master...$(git rev-parse --abbrev-ref HEAD)"
@AlexeyMK
AlexeyMK / list_view.coffee
Created May 8, 2017 00:25
original implementation of exposing collections dynamically
# https://github.com/gterrono/houston/blob/4ec16866346abc1b08e761d62441a56fd93a7e99/server/list_view.coffee
Dummy = new Meteor.Collection("system.dummy") # hack.
collections = {}
Meteor.startup( ->
console.log collections
Dummy.findOne() # hack
Meteor._RemoteCollectionDriver.mongo.db.collections (meh, collections) ->
collection_names = (col.collectionName for col in collections \
when (col.collectionName.indexOf "system.") isnt 0)
@AlexeyMK
AlexeyMK / gist:5a94f6f8e5f1b10f0cde
Created June 26, 2015 15:47
Logos a la hackerparadise.org - not invented here but it works!
.logo {
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
opacity: 0.6;
transition-property: opacity,transform;
-webkit-trdansition-property: opacity,-webkit-transform;
transition-duration: .3s;
-webkit-transition-duration: .3s;
}
module Enumerable
def bag
# [1,1,1,1,2,2,3] => {1 => 4, 2 => 2, 3 => 1}
# similar to python's Counter
Hash[group_by { |x| x }.map {|k, v| [k, v.count] }]
end
end
def print(grid)
system('clear')
@AlexeyMK
AlexeyMK / talk
Created April 25, 2014 02:53
Houston April 2014 Update
Talk Links
Houston: http://github.com/gterrono/houston
Atmosphere: atmosphere.meteor.com/package/houston
Merging with Ogno-Admin!
Demo: http://houstondemo.meteor.com
Adding Custom Menu Code: http://imgur.com/qfJC3WF
@AlexeyMK
AlexeyMK / counter.js
Last active August 29, 2015 13:56
simply.js counter
var count = parseInt(localStorage.getItem('count')) || 0;
simply.on('singleClick', function(e) {
if (e.button === 'up') {
count+=1; simply.subtitle(count);
} else if (e.button === 'down') {
count-=1; simply.subtitle(count); }
localStorage.setItem('count', count);
});
@AlexeyMK
AlexeyMK / simply
Last active August 29, 2015 13:56
simply.title('Hello PennApps!');
@AlexeyMK
AlexeyMK / d.py
Last active January 3, 2022 22:01
A version of Coffeescript's {name, age, location} translating to {name: name, age: age, location: location} for Python, using ast.py
def d(*args):
d_name = 'd'
import inspect
cur = inspect.currentframe()
calling_frame = inspect.getouterframes(cur)[1]
frameinfo = inspect.getframeinfo(calling_frame[0])
string = frameinfo.code_context[0].strip()
import ast
ast_module = ast.parse(string)
@AlexeyMK
AlexeyMK / gist:5321752
Last active December 15, 2015 20:49
permute some letters
import string
from random import shuffle
alphabet = list(string.lowercase + string.digits)
shuffle(alphabet)
print "".join(alphabet)
@AlexeyMK
AlexeyMK / gist:1954251
Created March 2, 2012 00:27
PEP8 pre-commit hook in Python
#!/usr/bin/env python
from __future__ import with_statement
import os
import shutil
import subprocess
import sys
import tempfile
def system(*args, **kwargs):