Skip to content

Instantly share code, notes, and snippets.

View AlexeyMK's full-sized avatar

Alexey Komissarouk AlexeyMK

View GitHub Profile
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 / 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;
}
@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 / .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)"