Skip to content

Instantly share code, notes, and snippets.

View zhuravel's full-sized avatar
🇺🇦

Bohdan Zhuravel zhuravel

🇺🇦
View GitHub Profile
@zhuravel
zhuravel / gist:5887703
Created June 28, 2013 20:10
Shorten URLs from command line
#!/usr/bin/env sh
# Create a git.io short URL
function gitio() {
if [ $# -eq 2 ]; then
curl -i http://git.io/ -F "url=${1}" -F "code=${2}"
elif [ ! -z $1 ]; then
curl -i http://git.io/ -F "url=${1}"
else
echo 'Usage: gitio http://github.com/link [custom-name]'
# Hash with getters and setters #
#################################
Hash.class_eval do
def method_missing(m, *a)
m.to_s =~ /=$/ ? self[$`] = a[0] : a == [] ? self[m.to_s] : super
end
end
hsh = {}
hsh.test1 = "one"
###*
* PHP functions in CoffeeScript
* Author: Bohdan Zhuravel <bohdan@zhuravel.biz>
*
* And do not forget to include jQuery.
* Because everything requires jQuery.
###
url_decode = (string) ->
decodeURIComponent "#{string}".replace /\+/g, '%20'