Skip to content

Instantly share code, notes, and snippets.

View RobinDaugherty's full-sized avatar

Robin Daugherty RobinDaugherty

View GitHub Profile
@RobinDaugherty
RobinDaugherty / app.controllers.projectname_page_controller.rb
Created December 22, 2015 18:54
ember_cli_deploy_redis_ruby v1.0.0 Rails controller implementation
class ProjectNamePageController < BaseEmberCliDeployController
def index
render_page('index.html')
end
# This is a page that is needed in our application for integration with PicMonkey.
# It is built in our ember-cli project and deployed alongside `index.html`.
def picmonkey_done
render_page('picmonkey-done.html')
end
# Opens each model file alongside its corresponding spec file, even if the spec file doesn't yet exist.
# Waits for you to close the files before loading the next pair.
for i in app/models/**.rb; do
mate -w $i ${${i/app/spec}/.rb/_spec.rb}
done
@RobinDaugherty
RobinDaugherty / founding_eu_partner.html
Created November 3, 2015 20:53
Ahalogy Partner Badges
<a href="https://www.ahalogy.com/publishers/"><img src="//badge.ahalogy.com/img/founding_eu_partner.png" title="Ahalogy Founding EU Partner" alt="Ahalogy Founding EU Partner"></a>
@RobinDaugherty
RobinDaugherty / .circleci-start-cassandra.sh
Created April 27, 2015 16:48
Cassandra timeout on CircleCI
#!/bin/bash
echo "describe cluster;" > /tmp/dc
for i in {1..5}; do
echo Attempt $i
if cassandra-cli -f /tmp/dc 2>&1 | grep "Cluster Information"; then
exit 0
else
sudo service cassandra stop; sudo service cassandra start
sleep 10
fi
@RobinDaugherty
RobinDaugherty / .hound.yml
Created March 23, 2015 17:36
Hound use .jshintrc
java_script:
config_file: .jshintrc
@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 / 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 / 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
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
@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