Skip to content

Instantly share code, notes, and snippets.

echo "alias brexit=exit" >> ~/.bashrc
source ~/.bashrc
def process_extra_commands(tier_item, rule_action)
if rule_action.send_email?
#
end
end
require 'em-websocket'
EventMachine.run {
EM::WebSocket.start(:host => "0.0.0.0", :port => 8080) do |ws|
ws.onopen { |handshake|
if @channel.nil? # Nobody joined yet
@channel = channel = EventMachine::Channel.new
sid = channel.subscribe { |msg| ws.send msg }
@AJFaraday
AJFaraday / _.rb
Last active October 26, 2016 13:55
here be dragons?
Array.new(6, 'eggs')
# => ["eggs", "eggs", "eggs", "eggs", "eggs", "eggs"]
#
# buuut
#
class Egg
attr_accessor :broken
end
def foo(n)
d1 = n - 1
d2 = 9 - (n - 1)
return (d1 * 10) + d2
end
@AJFaraday
AJFaraday / X.rb
Created October 17, 2016 14:45
indents and ruby keywords
class Foo
def indented_with_begin
begin
do_thing
rescue NoMethodError > er
puts "This is a 'begin' block within the method"
end
end
@AJFaraday
AJFaraday / ggv.md
Created October 16, 2016 15:26
The Grid Game vision

Grid Game is a spare-time project by Andrew Faraday.

You can see the current state of the project, with 4 different configurations at:

  • righttwix.com
  • lefttwix.com
  • right-twix.com
  • left-twix.com
@AJFaraday
AJFaraday / Patron.md
Last active September 13, 2016 12:17
A modern patronage model

disclaimer I am not considering taking either part of this.

Following a tweet from @jesslynnrose

"Could we bring back a patronage model?"

I'm guessing this is a model of sponsoring someone to ply their trade and improve their skills, hopefully leading to some future business or professional options which were not open to them at the start.

@AJFaraday
AJFaraday / contact-to-table.js
Created September 4, 2016 19:31 — forked from anonymous/contact-to-table.js
js data to table with jquery
contacts = [
{
firtst: 'joe',
last: 'bloggs',
address: '123 Fake St'
},
{
firtst: 'Penny',
last: 'Farthing',
address: '321 Fake St'
// I'm trying to hide most of the JS class and provide a public API in this style.
GridGame.classes.board = function () {
this.rows = [['1', '2'], ['3', '4']];
this.draw_row = function (row_index, row_tiles) {
//...
};
return {
draw: function () {