Skip to content

Instantly share code, notes, and snippets.

View RobinDaugherty's full-sized avatar

Robin Daugherty RobinDaugherty

View GitHub Profile
require 'rubygems'
require 'nokogiri'
require 'gollum'
wiki = Gollum::Wiki.new('auxwiki')
name = 'Ilja Krijger'
email = 'ilja@quittheprogram.org'
f = File.open("AuxiliumWiki-20110705103347.xml")
def normalized_content_from_content
if client
options = {
blacklisted_elements: client.article_blacklisted_elements,
whitelisted_tags: client.article_whitelisted_tags,
}
else
options = nil
end
ContentNormalization.new(content, options).normalized_content if content
@RobinDaugherty
RobinDaugherty / aperture-worker.conf
Created May 16, 2014 18:58
Upstart config for sidekiq workers
# /etc/init/sidekiq.conf - Sidekiq config
# This example config should work with Ubuntu 12.04+. It
# allows you to manage multiple Sidekiq instances with
# Upstart, Ubuntu's native service management tool.
#
# See aperture-workers.conf for how to manage all Sidekiq instances at once.
#
# Save this config as /etc/init/sidekiq.conf then mange sidekiq with:
# sudo start sidekiq index=0
@RobinDaugherty
RobinDaugherty / rails console.rb
Created July 21, 2014 14:34
Troubleshoot chromedriver with jruby
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome, :service_log_path => 'chromedriver.out')
end
Capybara.default_driver = :chrome
include Capybara::DSL
visit "https://google.com"
@echo off
cls
:start
echo.
echo 1 Fine Arts
echo 2 Classics
echo 3 Computer Science
echo 4 English
echo 5 Mathematics
echo 6 Modern World Languages and Culture
require 'time'
class ContentSourcesGenerator
HOUR = 3600
START_TS = Time.parse('2013-10-01 00:00:00 +00').utc
END_TS = Time.parse('2015-01-01 00:00:00 +00').utc
attr_accessor :values
def each_client
@RobinDaugherty
RobinDaugherty / thing.rb
Last active August 29, 2015 14:10
Pass and store procs
class Thing
attr_accessor :failure_proc
def when_it_fails(&block)
self.failure_proc = block
end
def do_the_thing(args)
rescue
failure_proc.call if failure_proc
@RobinDaugherty
RobinDaugherty / classes_of_service.js
Created February 13, 2015 03:00
TargetProcess Board Classes of Service
tau.mashups
.addModule('BoardClassOfServices.config', function() {
'use strict';
return {
// type of background; if 'single', first match rule color will be applied as background,
// if 'gradient', all colors from all found rules will be applied as gradient background */
colorType: 'gradient', // gradient | single
@RobinDaugherty
RobinDaugherty / promises.js
Created March 20, 2015 13:44
Robin messes with promises
return new RSVP.Promise(function(resolve, reject) {
var fileReaders = fileNames.map(function(filename) {
return readFile('dist/'+filename);
});
RSVP.all(fileReaders).then(function(fileContents) {
fileUploaders = fileContents.map(function(fileContents, fileIdx) {
return this._uploadIfNotAlreadyInUploadList(uploadName, fileNames[fileIdx], fileContents);
});
RSVP.all(fileUploaders).then(resolve).catch(reject);
});
@RobinDaugherty
RobinDaugherty / .hound.yml
Created March 23, 2015 17:36
Hound use .jshintrc
java_script:
config_file: .jshintrc