Skip to content

Instantly share code, notes, and snippets.

@danarnold
danarnold / cvimrc
Last active July 19, 2016 00:04
cvim configuration
set nosmoothscroll
let blacklists = ["https://coolwanglu.github.io/*","http://typing.lk/*","https://niche.herokuapp.com/*","http://touchpianist.com/*","http://www.igorski.nl/*","http://mdp.tylingsoft.com/*","http://play.typeracer.com/*"]
unmap B
unmap b
unmap J
unmap K
map J scrollFullPageDown
map K scrollFullPageUp
map b :buffer
map B :bookmarks
task :convert_textile_to_markdown => :environment do
require 'tempfile'
WikiContent.all.each do |wiki|
([wiki] + wiki.versions).each do |version|
textile = version.text
markdown = convert_to_markdown textile
puts "-- Changing the text of wiki ##{wiki.id} to:"
puts markdown
version.update_attribute(:text, markdown)
end
@danarnold
danarnold / class_id.rb
Last active December 8, 2015 00:45
Identify non-basic types in deep nested data structures by looking at their classes
def class_id(structure)
if !structure.is_a?(Hash) && !structure.is_a?(Array)
puts "#{structure}: #{structure.class}"
return
else
structure.each { |e| class_id(e) }
end
end
@danarnold
danarnold / skiq.rb
Last active May 3, 2018 20:01
Run sidekiq queues for a project, with optional 'only' and 'except' options, based off the project's Procfile
#!/usr/bin/env ruby
abort('Procfile not found!') unless File.exists? 'Procfile'
if ARGV.select { |a| a == 'only' || a == 'except' }.size > 1
abort('Invalid arguments')
end
if ARGV.first == 'only'
@only = ARGV[1..-1]
elsif ARGV.first == 'except'