Skip to content

Instantly share code, notes, and snippets.

View jimmycuadra's full-sized avatar
☠️
GitHub profits from the separation of families and the deaths of children.

jimmycuadra

☠️
GitHub profits from the separation of families and the deaths of children.
View GitHub Profile
@jimmycuadra
jimmycuadra / gist:9953205
Last active August 29, 2015 13:58
Gitter integrations 500 error
GET /settings/integrations/jimmycuadra/lita HTTP/1.1
Host: gitter.im
Connection: keep-alive
Cache-Control: no-cache
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Pragma: no-cache
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36
DNT: 1
Referer: https://gitter.im/jimmycuadra/lita/~chat
Accept-Encoding: gzip,deflate,sdch
@jimmycuadra
jimmycuadra / ifconfig_n1.txt
Created April 10, 2014 23:12
Serf Vagrant cluster
eth0 Link encap:Ethernet HWaddr 00:0c:29:8f:e8:b3
inet addr:192.168.124.234 Bcast:192.168.124.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe8f:e8b3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5059 errors:0 dropped:0 overruns:0 frame:0
TX packets:3219 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3814968 (3.8 MB) TX bytes:322441 (322.4 KB)
eth1 Link encap:Ethernet HWaddr 00:0c:29:8f:e8:bd
@jimmycuadra
jimmycuadra / startup_message.rb
Created June 7, 2014 19:17
Lita startup message
class StartupMessage < Lita::Handler
on :connected, :startup_message
def startup_message(payload)
Lita.log.debug("Sending startup message.")
target = Lita::Source.new(room: '#general')
robot.send_message(target, "Lita started up!")
end
end
@jimmycuadra
jimmycuadra / gist:87265a596439e9e9f7a1
Created August 20, 2014 09:53
Integration tests are a scam
Top left: Do I ask the interface the right questions?
Top right: Do I try to answer the questions asked?
Bottom right: Do I do the right thing for each question asked?
Bottom left: Do I handle all the possible responses?
Top half: question: expectation --> action
Bottom half: answer: value <-- assertion
Left side: collaboration tests
Right side: contract tests
@jimmycuadra
jimmycuadra / return_value_function_names.py
Created August 22, 2014 23:52
Possible alternate names for and_return and and_return_result_of
## and_return
expect(obj).method.and_return(value) # current syntax
expect(obj).method.returning(value)
expect(obj).method.returns(value)
expect(obj).method.to_return(value)
## and_return_result_of
expect(obj).method.and_return_result_of(function) # current syntax
@jimmycuadra
jimmycuadra / fuzzimals.md
Last active August 29, 2015 14:06
Fuzzimals!
  • Weasel - Cat
  • Dashiell - Dachshund
  • Carl - Pug
  • Armando - Cat
  • Peter - Basset Hound
  • Bradley - English Bulldog
  • Wesley - Flemish Giant Rabbit
@jimmycuadra
jimmycuadra / restrict_channel.rb
Last active August 29, 2015 14:07
Restrict a handler route to a specific channel
class MyHandler < Lita::Handler
route /foo/, :bar
def bar(response)
return unless response.message.source.room == "#correctchannel"
response.reply("Correct channel!")
end
end
@jimmycuadra
jimmycuadra / things_you_shouldnt_use.md
Created January 8, 2015 07:06
Things You Shouldn't Use
  • Microsoft Windows
  • Phabricator
  • Language-specific build tools (Rake, Grunt, etc.)
  • Angular.js
  • Solano CI (formerly TDDium)
@jimmycuadra
jimmycuadra / jenkins_shim.rb
Created January 19, 2015 15:04
Creating an "alias route" for another Lita handler
Lita.register_handler(:jenkins_shim) do
route(/deploy to production/i, :deploy, command: true)
def deploy(response)
message = Lita::Message.new(
robot,
"jenkins build deploy-to-prod",
response.message.source.clone
)
message.command!
@jimmycuadra
jimmycuadra / Vagrantfile
Created February 5, 2015 22:53
CoreOS Vagrant etcd static bootstrapping failure
# -*- mode: ruby -*-
# # vi: set ft=ruby :
require 'fileutils'
Vagrant.require_version ">= 1.6.0"
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")