Skip to content

Instantly share code, notes, and snippets.

View olebedev's full-sized avatar
🏄‍♂️
🌊 🌊 🌊

Oleg Lebedev olebedev

🏄‍♂️
🌊 🌊 🌊
View GitHub Profile
@olebedev
olebedev / hn_seach.js
Created November 2, 2015 16:59 — forked from meiamsome/hn_search.js
hn job query search
// takes arguments and produces an array of functions that accept context
function handle_args() {
var args = Array.prototype.slice.call(arguments);
return args.map(function(arg) {
if(arg instanceof Function) return arg; // Presumably already a contex-accepting function.
if(arg instanceof Array) return and.apply(this, arg); // make arrays behave as and.
// Presuming a string, build a function to check.
var my_regex = new RegExp(arg.toString(), 'i');
return function(context) {
return context.search(my_regex) > -1;

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
((root, Library)->
if typeof! define is \Function && typeof! define[\amd] is "Object" && define[\amd]?
define <[ exports ]>, Library
else
Library = Library(typeof exports is "object" and exports or (root["Library"] = do
noConflict: ((original) ->
noConflict = ->
root["Libraby"] = original
delete! Library.noConflict
Library
@olebedev
olebedev / wercker-dokku-deploy.yml
Created February 18, 2016 10:31 — forked from ademuk/wercker-dokku-deploy.yml
Wercker Dokku deploy
deploy:
steps:
- add-to-known_hosts:
hostname: $HOSTNAME
- add-ssh-key:
keyname: KEY
- script:
name: Push to dokku
code: |
git remote add dokku dokku@$HOSTNAME:$APP
@olebedev
olebedev / Makefile
Last active April 1, 2016 13:50
Makefile rule to extract gettetx/ngettext calls from Golang templates and source files
XGETTEXT_FLAGS = --no-wrap --language=c --from-code=UTF-8 --output=- -
$(POT_FILE): $(TEMPLATES) $(filter-out $(BINDATA), $(GO_FILES))
@cat $? \
| grep -i gettext \
| sed -e "s/ngettext \"\([^\"]*\)\".\"\([^\"]*\)\".\(.*\) }}/ngettext(\"\1\", \"\2\", \3) }}/g" \
| sed -e "s/[^n]gettext \"\(.*\)\"/ gettext(\"\1\")/g" \
| sed -e "s/NGetText(\([^\)]*\))/ ngettext(\1) /g" \
| sed -e "s/GetText(\([^\)]*\))/ gettext(\1) /g" \
| xgettext $(XGETTEXT_FLAGS) \
| sed -e '1,20d' \
//usr/bin/env go run $0 $@; exit
### My publicly-auditable identity:
https://keybase.io/olebedev
### From the command line:
Consider the [keybase command line program](https://keybase.io/download).
```bash
# look me up
MAIN_GOPATH=/usr/local/Cellar/go/1.2/workspace
export GOPATH=$MAIN_GOPATH
MAIN_PATH=$PATH:$GOPATH/bin
export PATH=$MAIN_PATH
# goenv functions
activate(){
export GOPATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)"
export OLDPS1=$PS1
export PS1="(go:$(basename $GOPATH)) $PS1"
@olebedev
olebedev / README.md
Created December 30, 2016 06:31 — forked from rjeczalik/README.md
Go, multiple packages and coveralls.io

Go, multiple packages and coveralls.io

Single profile for single Go package

For Go projects that consist of only one package, the following Travis configuration is enough to get started with coveralls.io. You may want to encrypt your $COVERALLS_TOKEN via Travis encryption keys though.

language: go
go:
 - 1.3.1
@olebedev
olebedev / ffmpeg-compress-mp4
Created January 28, 2017 19:10 — forked from lukehedger/ffmpeg-compress-mp4
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4