Skip to content

Instantly share code, notes, and snippets.

View beamdec
#!/usr/bin/env escript
main([BeamFile]) ->
{ok, {_, [{abstract_code, {_, AC}}]}} = beam_lib:chunks(BeamFile, [abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
View yosemite_conf.sh
#Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
#Use current directory as default search scope in Finder
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
#Show Path bar in Finder
defaults write com.apple.finder ShowPathbar -bool true
#Show Status bar in Finder
View expr.erl
-module(expr).
-export([
parse/1,
test/0
]).
% ------------------------------------------------------
%
% Simple math-expressions parser
@artemeff
artemeff / fish_prompt
Last active Apr 29, 2017
My fish prompt
View fish_prompt
# ~/.config/fish/functions/fish_prompt.fish
# name: Robbyrussell edited
# author: Bruno Ferreira Pinto, edit by Yuri Artemev
function fish_prompt
if not set -q -g __fish_robbyrussell_art_functions_defined
set -g __fish_robbyrussell_art_functions_defined
function _git_branch_name
echo (git rev-parse --abbrev-ref HEAD ^/dev/null)
View gemfile_parser.rb
class GemfileParser
attr_reader :gemfile
EXCLUDED = ["rails"]
def self.gems_status gemfile
new(gemfile).gems_status
end
def initialize gemfile
View gist:6163880
class BaseWall
def self.Wall length, width, material
Module.new do
define_method(:length) { length }
define_method(:width) { width }
define_method(:material) { material }
def self.included clazz
private :length, :width, :material
end
@artemeff
artemeff / tip.rb
Last active Dec 19, 2015
Ruby tips
View tip.rb
# string merging
"asd" "qwe" "zxc"
# => "asdqwezxc"
# separators may be a space
% sometext .size
# => 8