Skip to content

Instantly share code, notes, and snippets.

View manpages's full-sized avatar

Jonn Mostovoy manpages

View GitHub Profile
@manpages
manpages / git-root.sh
Created April 2, 2013 03:28
cd into git root
if [ "`git rev-parse --show-cdup`" != "" ]; then cd `git rev-parse --show-cdup`; fi && pwd
@manpages
manpages / lz.rb
Last active December 15, 2015 09:28
Bit masks with leading zeros in Ruby
def lz(number, symbols=90, arity=2)
unpadded = number.to_s arity
padded = '0' * (symbols - unpadded.length) + unpadded
end
@manpages
manpages / gist:5109261
Created March 7, 2013 16:22
/tmp/qdb.txt
16:21 < dobby156> I think if you want here to get into prog, you
don't need 40th anniversary boxset you need a
big bag of buds and maybe some LSD
16:21 < MagBo> a-a-a-a-and that goes straight to my quote
database!
@manpages
manpages / update-elixir.sh
Last active December 13, 2015 20:29
Updates Elixir-lang to the master version.
#!/bin/bash
GITHUB_RO_DIRECTORY="$HOME/github/others"
BIN_DIRECTORY="/usr/local/bin"
GITHUB_URL="git://github.com/elixir-lang/elixir.git"
mkdir -p $GITHUB_RO_DIRECTORY > /dev/null
mkdir -p $BIN_DIRECTORY > /dev/null
cd $GITHUB_RO_DIRECTORY
[[ ! -d ./elixir ]] && git clone $GITHUB_URL
@manpages
manpages / rc.lua
Created February 12, 2013 01:10
new rc.lua
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
awful.rules = require("awful.rules")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
@manpages
manpages / tuda.sh
Created February 5, 2013 21:35
Export redmine2 MySQL databases
for pfx in {"","_development","_production","_test"}
do mysqldump -u root -p'123qwezzz' redmine2${pfx} | gzip > /tmp/redmine2${pfx}.dump.gz
done
@manpages
manpages / elixir-newbie-digest-002.md
Last active December 11, 2015 22:39
Elixir Newbie Digest, Issue 2

Intro

Today I'll cover three basic topics:

  • Mistakes and misuses every Erlanger does when he starts to write in Elixir

  • Dependencies and Mix

  • Writing OTP-enabled Elixir applications

@manpages
manpages / elixir-newbie-digest-001.md
Last active March 13, 2016 17:47
Elixir Newbie Digest, Issue #1

Intro

I have finally decided to start "Elixir newbie digest" and put here stuff that would be nice for me to understand before I have started my first Elixir production project.

Some of those will be hints, some of those will be in depth analysis of how Elixir language deals with stuff, but I plan to focus on the very basic things and keep those digests as much practical as possible.

Don't know whether those digests will be periodic, but I sincerely hope so.

Dotted function invocation

@manpages
manpages / i.ex
Created January 20, 2013 21:47
Let's talk about Elixir
iex(14)> f = function do
...(14)> (do: anything) -> anything
...(14)> (_) -> :nothing
...(14)> end
#Fun<erl_eval.6.82930912>
iex(15)> f.(do: 42)
42
iex(16)> f.(do
...(16)> answer = 42
...(16)> answer
@manpages
manpages / ycombinator.ex
Last active December 11, 2015 08:48
Neat fixed point combinator implementation in Elixir
y = fn(f) ->
g = fn(g) -> f.((g.(g)).(&1)) end
g.(g)
end