Skip to content

Instantly share code, notes, and snippets.

View openmailbox's full-sized avatar

openmailbox

View GitHub Profile
@openmailbox
openmailbox / twitch_bot.rb
Last active September 21, 2021 14:45
A quick example of a Twitch chat bot using Ruby.
# A quick example of a Twitch chat bot in Ruby.
# No third party libraries. Just Ruby standard lib.
#
# See the tutorial video: https://www.youtube.com/watch?v=_FbRcZNdNjQ
#
# You can fill in creds here or use environment variables if you choose.
TWITCH_CHAT_TOKEN = ENV['TWITCH_CHAT_TOKEN']
TWITCH_USER = ENV['TWITCH_USER']
@openmailbox
openmailbox / my_server.rb
Last active July 27, 2018 03:57
Introductory Rack-compliant web server
require 'socket'
require 'rack'
require 'sinatra'
# Simple, rack-compliant web server
class MyServer
STATUS_CODES = {
200 => 'OK',
500 => 'Internal Server Error'
}
@openmailbox
openmailbox / method_tracing.rb
Created November 28, 2014 04:09
Experimenting with method tracing via metaprogramming in Ruby.
module MethodTracing
class Tracer
class << self
attr_reader :tracers
end
@tracers = {}
attr_accessor :count
attr_reader :target
@openmailbox
openmailbox / .vimrc
Last active August 29, 2015 14:06
If you're sick of syntastic taking forever to check your dart files, make sure you have vim-dispatch (https://github.com/tpope/vim-dispatch) installed and stick this in your vimrc. Doesn't help the startup time of dartanalyzer, but at least your main thread won't block.
" dart setup
autocmd FileType dart set errorformat+=%.%#\\\|%.%#\\\|%.%#\\\|%f\\\|%l\\\|%c\\\|%.%#\\\|%m
autocmd FileType dart set makeprg=dartanalyzer\ --machine\ %
autocmd BufWritePre *.dart Make
let g:syntastic_mode_map = { "mode": "active",
\ "passive_filetypes": ["dart"] }