Skip to content

Instantly share code, notes, and snippets.

View imwithsam's full-sized avatar

Samson Brock imwithsam

View GitHub Profile
@imwithsam
imwithsam / keybase.md
Created January 3, 2017 21:15
keybase.md

Keybase proof

I hereby claim:

  • I am imwithsam on github.
  • I am imwithsam (https://keybase.io/imwithsam) on keybase.
  • I have a public key whose fingerprint is 9D3E 44A1 1378 DB29 BAB7 9CFE F381 5FCF 194F E30F

To claim this, I am signing this object:

@imwithsam
imwithsam / react.txt
Last active August 17, 2016 19:19
React Ecosystem and Best Practices
webpack
redux (flux)
redux-saga side effects processing middleware (ES6 generators)
or redux-observable (rxjs)
or redux-loop (elm)
webpack-dashboard
container component pattern
@imwithsam
imwithsam / ruby_brain_teasers.rb
Created March 16, 2016 17:36
Ruby brain teasers
@sentence = "This is a sentence."
@sentence = @sentence.split(' ').map!{|x| x = x[0..0].upcase + x[1..-1] }.join(' ')
@sentence = ["This", "is", "a", "sentence."].map!{|x| x = x[0..0].upcase + x[1..-1] }.join(' ')
@sentence = ["This", "Is", "A", "Sentence."].join(' ')
@sentence = "This Is A Sentence."
1987.to_s.reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse
"1987".reverse.scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse
"7891".scan(/(?:\d*\.)?\d{1,3}-?/).join(',').reverse
["789", "1"].join(',').reverse
@imwithsam
imwithsam / elixir-on-phoenix.md
Created November 10, 2015 22:03
Elixir on Phoenix Lightning Talk

Elixir on Phoenix

A very high level overview of Erlang, Elixir, and the Phoenix Framework.

Erlang

What

  • created by Joe Armstrong in 1986 (Ericsson, Swedish Space Agency)
  • open sourced in 1998
  • used at Ericsson for telephony applications
@imwithsam
imwithsam / rails-performance.md
Created November 8, 2015 18:16
Accumulated tips on increasing Rails performance

Use .size to get just the count from ActiveRecord. .length will return all the records.

- Mission

The purpose of this tutorial is to mimic setting up a DigitalOcean/AWS EC2/Linode server. The main advantages of having a virtual machine is that you can learn without worry of breaking things.

The first lesson will be all about getting familiar with a headless machine and getting a language we all know and love (ruby). Then we can mess around and try things out purely in the terminal.

The only three good options for a text editor are: emacs, vi, and vim. We will be using vim but vi itself is great and comes by default on Ubuntu 12.04.

Now you can practice getting used to ssh'ing into headless machines, using terminal based text editors, and using a terminal based window/session manager (tmux). The reason we have to use vim and tmux is that there is no X environment in a headless machine (the GUI, graphics, pretty things, etc..). The main reason for this is to save space on precious costly SSD data.

# ----- Classes -----
class Node
attr_accessor :data, :next_node
def initialize(data, next_node)
@data = data
@next_node = next_node
end
end
class List
@imwithsam
imwithsam / blink.js
Created October 19, 2015 14:53
Blink
function countdown(seconds, callback){
var i = setInterval(function() {
if (typeof callback === 'function') {
callback(seconds--);
} else {
console.log(seconds--);
}
if (seconds === -1) {
clearInterval(i);
function echo1(myArray) {
if (Array.isArray(myArray)) {
myArray.forEach(function(element) {
console.log(element);
});
}
}
function echo2() {
for(var i = 0; i < arguments.length; i++) {