Skip to content

Instantly share code, notes, and snippets.

View rramsden's full-sized avatar
♨️
Keep On Keeping On

Richard Ramsden rramsden

♨️
Keep On Keeping On
View GitHub Profile
other_arr = ["four"]
["one","two","four"].reject {|element| other_arr.include?(element) }
=> ["four"]
% Symmetric Push-Sum Protocol
loop(#node{name=Name, value=Value, weight=Weight} = State) ->
receive
{push, From, {V0, W0}} ->
V1 = Value/2,
W1 = Weight/2,
From ! {symmetric_push, self(), {V1, W1}},
loop(update(V0 + V1 , W0 + W1, State));
{symmetric_push, {V0, W0}} ->
-module(spsp).
-export([sum/0, average/0, add_peers/2]).
-record(node, {
value,
weight,
peers = []
}).
sum() ->
require "annoystream/version"
module Annoystream
## syncronous panes
# open up multiple panes and hit Ctrl-B a then start typing :O !!!
bind a set-window-option synchronize-panes
@rramsden
rramsden / gist:4333596
Created December 19, 2012 01:10
quick benchmark of ets:lookup_element
% bench:start().
% {result1,57663,result2,43880}
-module(bench).
-export([start/0]).
-record(record, {
key,
one = 1.0,
nnoremap <buffer> <localleader>s :rightbelow vsplit<CR>:execute 'normal! /^' . expand('<cword>') . "\<cr>"<cr>:nohlsearch<cr>
@rramsden
rramsden / gist:4377517
Created December 26, 2012 03:00
brew formula output brew install -vd --with-wxgtk erlang
λ (rramsden@richard) gdk-pixbuf-2.26.2 brew install -vd --with-wxgtk erlang
/usr/local/bin/brew: loading /usr/local/Library/Formula/erlang.rb
Warning: Your Xcode (4.4) is outdated
Please install Xcode 4.4.1.
/usr/local/bin/brew: loading /usr/local/Library/Formula/automake.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/autoconf.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/libtool.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/wxgtk.rb
/usr/local/bin/brew: loading /usr/local/Library/Formula/gtk+.rb
class UsersController < ApplicationController
requires_authentication [:index, :show]
def index
@users = User.order(:id)
respond_to do |format|
format.html
format.csv { send_data @users.to_csv }
format.xls # { send_data @users.to_csv(col_sep: "\t") }
end
Compiled lib/elixir/lib/stream.ex
Compiled lib/elixir/lib/string/chars.ex
Compiled lib/elixir/lib/supervisor/behaviour.ex
Compiled lib/elixir/lib/string.ex
Compiled lib/elixir/lib/system.ex
Compiled lib/elixir/lib/tuple.ex
Compiled lib/elixir/lib/uri.ex
Compiled lib/elixir/lib/version.ex
make[1]: Entering directory `/opt/erlang/elixir'
==> unicode (compile)