Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
QUERY=${1:-h/1}
elixir -e "
import IEx.Helpers
Application.put_env(:iex, :colors, [width: 80, enabled: true])
h(${QUERY})
" \
| /usr/bin/less -R
#!/usr/bin/env elixir
# similar to `while gets`
defmodule Helpers do
def chomp(string) do
String.trim_trailing(string, "\n")
end
def p(arg) do
inspect(arg, pretty: true)
#!/usr/bin/env elixir
# similar to `while gets` and prints line
defmodule Helpers do
def chomp(string) do
String.trim_trailing(string, "\n")
end
def p(arg) do
inspect(arg, pretty: true)

Ruby Overview

IRB and Signals

  • CTRL-C sends INT ("interrupt") signal. Ignores input and creates a new prompt.
  • CTRL-D sends EOT ("end of transmission") signal. Exits.
  • CTRL-Z sends TSTP ("terminal stop") signal. Nothing.
#!/usr/bin/env ruby
# (The MIT License)
#
# Copyright (c) 2015 Michael V. O'Brien
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@michaelvobrien
michaelvobrien / gist:3910851
Created October 18, 2012 10:06
ember data error handling questions

Questions about Ember Data Error Handling

ember-data.js:https://github.com/emberjs/data/tree/0396411e39df96c8506de3182c81414c1d0eb981

In short, when there is an error, I want to display error messages in the view, and then the user can 1) cancel, which will rollback the transaction 2) correct the input errors and successfully commit the transaction, passing the validations on the server.

Where is the error callback?

 updateRecord: function(store, type, record) {
@michaelvobrien
michaelvobrien / .tmux.conf
Last active January 17, 2017 17:24
Tmux Remote
##################################################
# set-option (alias: set)
# set-window-option (alias: setw)
# bind-key (alias: bind)
# unbind-key (alias: unbind)
##################################################
# prefix
set -g prefix M-`
unbind C-b
@michaelvobrien
michaelvobrien / gist:2948233
Created June 18, 2012 12:50
Simple stack for the command-line using redis.
STACK_NAME='stack'
alias stack="redis-cli lrange ${STACK_NAME} 0 -1"
alias push="redis-cli lpush ${STACK_NAME}"
alias pop="redis-cli lpop ${STACK_NAME}"
alias empty="redis-cli del ${STACK_NAME}"
@michaelvobrien
michaelvobrien / bootstrap_chef.bash
Created May 26, 2011 16:43
Bootstrap Chef Solo on Ubuntu
#!/usr/bin/env bash
export CHEF_DIR="${HOME}/cheftest"
rm -rf $CHEF_DIR/*
rm -rf $CHEF_DIR/.git*
mkdir -p "$CHEF_DIR"
sudo apt-get install ruby ruby-dev libopenssl-ruby rdoc ri irb build-essential wget ssl-cert git
cd /tmp