Skip to content

Instantly share code, notes, and snippets.

Ranger Keybindings

Search for a File / Directory

Key Binding Description
f search for file / directory

Copy, Rename/Move or Delete

@rockwood
rockwood / rps.ex
Created January 17, 2018 12:28
Rock Paper Scissors
defmodule Rps do
def run(input) do
player1 = String.split(input, "")
player2 = Enum.shuffle(["r", "p", "s"])
result =
[player1, player2]
|> Enum.zip()
|> Enum.map(&result/1)
|> Enum.sum()
|> case do
@rockwood
rockwood / split_csv.bash
Last active June 29, 2018 00:08
Split CSV Files
#!/usr/bin/env bash
input_file=$1
header_file=./output/headers.csv
rows_file=./output/rows.csv
mkdir -p ./output
head -1 $input_file > $header_file
tail -n +2 $input_file > $rows_file
@rockwood
rockwood / archive_post_scenario.ex
Last active November 27, 2018 07:24
Ecto Soft-Delete Pattern
defmodule MyApp.ArchivePostScenario do
alias MyApp.Repo
alias Ecto.Multi
alias __MODULE__.Query
def run(options) do
post = Keyword.fetch!(options, :post)
archive_and_delete([
comments: Query.comments(post),