Instantly share code, notes, and snippets.

View .rb
def my_method
return alt_val unless some_statement
calc_return_val
end
View .rb
def some_method
if some_statement
calc_return_val
else
alt_return_val
end
end
View weird.rb
pry(main)> 2+2= 5
=> 5
View gist.js
function inputCheck (shitumon, outputNum) {
var condition = true;
var a = -1;
while(condition) {
console.log(a);
if (isNaN(a) || a <= -1) {
console.log("Invalid imput, please enter a number only!<br>");
a = 5;
} else {
View .esvmrc
{
"clusters": {
"destinations": {
"version": "0.90.10",
"config": {
"cluster": {
"name": "destinations_development"
},
"path": {
"data": "tmp/elasticsearch",
View word_count.exs
defmodule WordCount do
def run do
System.argv
|> path
|> file
|> size
|> count
|> IO.puts
end
View tech-podcast-ja.mkd
View gist:bb88522919a28190845a
defmodule Metex.Worker do
def loop do
receive do
{sender_pid, location} ->
send(sender_pid, {:ok, temperature_of(location)})
{sender_pid, _} -> # won't compile without knowing what the sender_pid is below
send(sender_pid, "Unknown message")
end
loop
end
View gist:164fb5e90dcde2ffb770
(add-to-list 'load-path "~/.emacs.d/community")
(add-to-list 'load-path "~/.emacs.d/community/powerline")
(add-to-list 'load-path "~/.emacs.d/community/tester.el")
;; Behavior
;; disable the splash screen
(setq inhibit-splash-screen t)
(when (not (display-graphic-p))
View gist:16da5462842af082fb8c
Interactive Elixir (1.1.0-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> list = [1, 2, 3]
[1, 2, 3]
iex(2)> new_list = [ 0 | list ]
[0, 1, 2, 3]
iex(3)> [ head | tail ] = new_list
[0, 1, 2, 3]
iex(4)> head
0