Skip to content

Instantly share code, notes, and snippets.

View fxn's full-sized avatar

Xavier Noria fxn

View GitHub Profile
{_, mfa} = :erlang.process_info(self(), :current_function)
IO.inspect(mfa) #=> {:elixir_compiler_0, :__FILE__, 1}
class EventsLoader
def initialize(...)
...
end
def load
load_job_creation_events +
load_drivers_on_duty_events +
load_drivers_off_duty_events +
load_drivers_rejected_events
@fxn
fxn / ex.erl
Last active February 26, 2017 21:50
Exercise 1.24 of the course "Functional Programming in Erlang", by Simon Thompson
-module(ex).
-export([perimeter/1, area/1, enclose/1, bitsR/1, bitsTR/1]).
% Shapes are represented with these tuples:
%
% {circle, {X, Y}, R}
% {rectangle, {X, Y}, H, W}
% {triangle, {X, Y}, A, B, C}
%
% These tuples are not able to express the orientation of the rectangles and
@fxn
fxn / .vimrc
Created September 22, 2016 10:42
function! s:EnableRelativeNumber()
set nonumber
set relativenumber
endfunction
function! s:DisableRelativeNumber()
set norelativenumber
set number
endfunction
@fxn
fxn / keybase.md
Created September 13, 2016 19:10

Keybase proof

I hereby claim:

  • I am fxn on github.
  • I am fxn (https://keybase.io/fxn) on keybase.
  • I have a public key whose fingerprint is E0AC 38BA AE8C BB3D D2B5 F95B 559D 9850 B333 F624

To claim this, I am signing this object:

Bisecting

First you start the bisect

git bisect start

Then you mark good and bad refs

git bisect good v2.6.18

git bisect bad master

I can treat the comment as a text object thanks to vim-textobj-comment, but gqic reformats the foo method definition.

@fxn
fxn / 1.rb
Last active June 13, 2016 07:29
load File.expand_path('2.rb') # decomposed in 2.3
@fxn
fxn / gist:306ac7adaa66019447a768d126c1bdad
Last active July 11, 2016 04:41
Rails initializers as of e007afd
ActionCable::Engine: set_load_path
Coffee::Rails::Engine: set_load_path
Jquery::Rails::Engine: set_load_path
Turbolinks::Engine: set_load_path
MyApp::Application: set_load_path
ActionCable::Railtie: set_autoload_paths
Coffee::Rails::Engine: set_autoload_paths
Jquery::Rails::Engine: set_autoload_paths
Turbolinks::Engine: set_autoload_paths
MyApp::Application: set_autoload_paths
@fxn
fxn / init.coffee
Created January 31, 2016 10:59
Easy pipeline entry in Atom (Elixir)
# ~/.atom/init.coffee
atom.commands.add 'atom-text-editor', 'elixir:pipeline': ->
editor = atom.workspace.getActiveTextEditor()
editor.moveToEndOfLine()
editor.insertNewline()
editor.insertText("|> ")