Skip to content

Instantly share code, notes, and snippets.

View JustinLove's full-sized avatar

Justin Love JustinLove

View GitHub Profile
@JustinLove
JustinLove / vimrc
Created November 23, 2020 16:57
My vimrc, used in gvim and macvim, with a bit of probably unused cruft
:scriptencoding utf-8
let mapleader=","
let maplocalleader=",,"
let g:ctrlp_map = '<leader>t'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = ''
"let g:ctrlp_max_height = 100
"
@JustinLove
JustinLove / documentation.json
Created June 12, 2018 11:56
elm-twitch-api documentation output
[
{
"name": "Twitch.ClipsV2.Decode",
"comment": " Decoders for the Clips API at `clips.twitch.tv/api/v2/clips/` Note that this is an unofficial API, requests should be made with Http.send rather than Twitch.Helix.send.\n\n@docs Clip, clip, sampleClip\n",
"aliases": [
{
"name": "Clip",
"comment": " Record for decoded clip data.\n",
"args": [],
"type": "{ broadcasterChannelUrl : String , broadcasterDisplayName : String , broadcasterId : String , broadcasterLogin : String , broadcasterLogo : String , broadcastId : String , curatorChannelUrl : String , curatorDisplayName : String , curatorId : String , curatorLogin : String , curatorLogo : String , previewImage : String , thumbnails : Dict.Dict String String , communities : List String , createdAt : Time.Time , title : String , language : String , infoUrl : String , statusUrl : String , editUrl : String , vodId : Maybe.Maybe String , vodUrl : Maybe.Maybe String , vodOffset : Maybe.Maybe Int , vodPreviewImageUrl
@JustinLove
JustinLove / obs-dump.lua
Created May 23, 2018 14:26
OBS Lua dump fields available on obslua table
obs = obslua
local function script_log(message)
obs.script_log(obs.LOG_INFO, message)
end
local function dump_obs()
local keys = {}
for key,_ in pairs(obs) do
keys[#keys+1] = key
@JustinLove
JustinLove / UserList.elm
Last active June 13, 2018 17:02
Snapshot of my hostable src/UserList.elm https://github.com/JustinLove/hostable
module UserList exposing (users)
users : List (String, List String)
users =
[ ("LacyRayAnne", ["4-6000kpbs"])
, ("RCJackman", [])
, ("BeebsTW", [])
, ("KnightJvor", [])
, ("FoxQueen", [])
, ("Grizzlybeer77", ["sometimes music"])
@JustinLove
JustinLove / timed_require.rb
Created February 10, 2013 23:30
Hack to see why your program is taking so long to load
require 'benchmark'
$require_depth = 0
module TimedRequire
LIMIT = 0.0
def require(path)
#puts " #{' '*$require_depth}>>#{path}"
begin
$require_depth += 1
t = 0.0
t = Benchmark.realtime {super}
@JustinLove
JustinLove / heroku_scaler.rb
Created September 28, 2012 01:17
Pieces of a Sidekiq Herkou autoscaler
require 'heroku'
module Background
class HerokuScaler
def initialize(
type = 'worker',
user = ENV['HEROKU_USER'],
pass = ENV['HEROKU_PASS'],
app = ENV['HEROKU_APP'])
@client = Heroku::Client.new(user, pass)
@JustinLove
JustinLove / migrate.rb
Created August 2, 2012 14:56
Migrate from Heroku shared database to new database plans (dev currently embedded)
# ruby migrate.rb <app-name>
app = ARGV[0]
require 'heroku'
hc = Heroku::Client.new(ENV['HEROKU_USER'], ENV['HEROKU_PASS'])
response = hc.install_addon(app, 'heroku-postgresql:dev')
puts response
db = response['message'][/HEROKU_POSTGRESQL_\w+/]
@JustinLove
JustinLove / server.rb
Created February 2, 2012 03:00
Trivial web server in Ruby
require 'socket'
s=TCPServer.new(8888)
loop {
c=s.accept
f = 'public' + c.gets.split[1]
c<<"HTTP/1.0 200 OK\r\n\r\n#{File.read(f)rescue nil}"
c.close
}