Skip to content

Instantly share code, notes, and snippets.

View smileart's full-sized avatar
:octocat:
Work In Progress

Serge Bedzhyk smileart

:octocat:
Work In Progress
View GitHub Profile
require 'em-http'
EM.run do
def dispatch(uri, retries = 0)
h = EM::HttpRequest.new(uri).get
h.callback { |rep| [:success, rep.response]; EM.stop }
h.errback do |rep|
p [:fail, rep]
@nicklasos
nicklasos / gist:3702393
Created September 11, 2012 21:55
Moving lines up or down
nnoremap <C-k> mz:m-2<CR>`z==
inoremap <C-j> <Esc>:m+<CR>==gi
inoremap <C-k> <Esc>:m-2<CR>==gi
vnoremap <C-j> :m'>+<CR>gv=`<my`>mzgv`yo`z
nnoremap <C-j> mz:m+<CR>`z==
vnoremap <C-k> :m'<-2<CR>gv=`>my`<mzgv`yo`z
@bgadoci
bgadoci / coffeescript_bundle_for_sublime.sh
Last active December 12, 2015 04:08 — forked from zeke/coffeescript_bundle_for_sublime.sh
Adding coffee-script to sublime text 3.
mkdir -p ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/CoffeeScript
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/CoffeeScript
curl -O https://raw.github.com/jashkenas/coffee-script-tmbundle/master/Syntaxes/CoffeeScript.tmLanguage
curl -O https://raw.github.com/jashkenas/coffee-script-tmbundle/master/Preferences/CoffeeScript.tmPreferences
@douglasrodrigo
douglasrodrigo / lambda_calculus.rb
Created May 28, 2011 03:26
ruby lambda calculus
#base
First = lambda {|a, b| a}
Last = lambda {|a, b| b}
#conditional
True = First
False = Last
Not = lambda {|boolean| boolean[False, True]}
And = lambda {|boolean_a, boolean_b| boolean_a[boolean_b, False]}
Or = lambda {|boolean_a, boolean_b| boolean_a[True, boolean_b]}
@kenzie
kenzie / .profile
Created June 6, 2012 13:14
Start MongoDB and Redis daemons from the command line (OS X)
# add these aliases to your BASH profile ~/.profile
alias mongodb-start="mongod run --config /usr/local/etc/mongod.conf"
alias redis-start="redis-server /usr/local/etc/redis.conf"
# TODO add stop commands
@dalibor
dalibor / gist:1534053
Created December 29, 2011 13:11
Stop words
a
about
above
across
after
afterwards
again
against
all
almost
@re5et
re5et / dig.rb
Created March 2, 2012 01:29
ruby hash dig
class Hash
def dig(*path)
path.inject(self) do |location, key|
location.is_a?(Hash) ? location[key] : nil
end
end
end
@kharrison
kharrison / .gitignore
Created February 29, 2012 22:44
OS X gitignore file
# Global GIT ignored files
# Ignore X-code files
build/
*~.nib
*.so
*.pbxuser
*.mode*
*.perspective*
# Xcode 4
@mrinalwadhwa
mrinalwadhwa / utc_iso8601_milli.rb
Last active October 21, 2019 11:37
Ruby: Convert to UTC time in ISO 8601 format with millisecond precision, padding of 3.
def utc_iso8601_milli(time)
time.utc.strftime '%FT%T.%LZ'
end
utc_iso8601_milli Time.now
# => "2016-09-02T07:06:18.134Z"
utc_iso8601_milli Time.new(2002, 10, 31, 2, 2, 2, "+05:00")
# => "2002-10-30T21:02:02.000Z"
@inscapist
inscapist / Dockerfile
Last active April 11, 2020 08:32
Docker + Rails configuration + Docker Sync
# This Dockerfile is intended to build a production-ready app image.
#
# This is not required for development environments
FROM sagittaros/rails-base:latest
MAINTAINER Felix Tioh <felix.tioh@crowdo.com>
COPY . /app
WORKDIR /app
EXPOSE 5000