Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<title>Sir Trevor</title>
<link rel="stylesheet" type="text/css" href="sir-trevor.css">
<link rel="stylesheet" type="text/css" href="sir-trevor-icons.css">
</head>
<body>
<form>
<textarea class="js-st-instance">{
(defproject clojure-rest "0.1.0-SNAPSHOT"
:description "My First Clojure App"
:url "http://github.com/jhubert/clojure-app"
:dependencies [[org.clojure/clojure "1.5.1"]
[compojure "1.1.6"]
[ring/ring-json "0.1.2"]
[c3p0/c3p0 "0.9.1.2"]
[org.clojure/java.jdbc "0.2.3"]
[com.h2database/h2 "1.3.168"]
[cheshire "4.0.3"]]
@jhubert
jhubert / delete-hipchat-from-sender.js
Created February 18, 2014 23:39
Delete all the messages from the Hipchat message log that were sent from the expected sender
$('form').each(function(i, el){
var sender = $(this).parent().siblings('p').text().trim();
if (sender == 'Errbit') {
var data = 'action=delete';
data += '&message_id='+$(el).find('input[name="message_id"]').val();
data += '&xsrf_token='+$(el).find('input[name="xsrf_token"]').val();
data += '&message_index='+$(el).find('input[name="message_index"]').val();
$.ajax({
type: $(el).attr('method'),
url: $(el).attr('action'),
CookieBot = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cook as fast as possible!
$("#bigCookie").click();
}, 1);
this.goldenCookieInterval = setInterval(function(){
// Sometimes a golden cookie will appear to give you a bonus
// Click that a bunch of times!
$("#goldenCookie").click();
@jhubert
jhubert / api_base_controller.rb
Last active December 26, 2015 09:49
This is an abstraction of the error handling that I'm using on an API that I'm working on.
module Api
module V1
class BaseController < ActionController::Base
class ::BMP::CompanyNotFound < ActiveRecord::RecordNotFound; end
class ::BMP::Unauthenticated < StandardError; end
doorkeeper_for :all
respond_to :json
@jhubert
jhubert / circle.yml
Created September 30, 2013 00:38
Our circle.yml file for Continuous Integration with Heroku and CircleCI
deployment:
deploy_staging:
branch: staging
commands:
- heroku maintenance:on --app OUR_STAGING_APP
- git push [email protected]:OUR_STAGING_APP.git $CIRCLE_SHA1:refs/heads/master
- heroku run rake db:migrate --app OUR_STAGING_APP
- heroku restart --app OUR_STAGING_APP
- heroku maintenance:off --app OUR_STAGING_APP
deploy_production:
if (!state.initialized) {
state.cur = 0;
state.dir = 1;
state.initialized = true;
state.last_update = false;
state.val = 1;
state.chaser = false;
}
//1:1,2:1,3:1,4:1,4:2,4:3,4:4,4:3,4:2,4:1,3:1,2:1,2:2,2:3,3:3,3:2
@jhubert
jhubert / Gemfile
Last active December 19, 2015 06:59
Very simple little craigslist scraper for dumping into a CSV file. To run it, first run `bundle install` to make sure you have the right stuff installed. Then run: `ruby scraper.rb [url of the craigslist page]`
source 'https://rubygems.org'
gem 'nokogiri'
@jhubert
jhubert / rvm2rbenv.txt
Last active December 15, 2015 10:49 — forked from brentertz/rvm2rbenv.txt
## Prepare ###################################################################
# Remove RVM
rvm implode
# Remove the RVM stuff from your .profile - It probably looks like...
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Reload your profile
. ~/.profile
@jhubert
jhubert / colors.sh
Created February 24, 2013 17:53
Generates a table of the `tput setaf` and `tput setab` colors in bash. Based on Daniel Crisman's script from the Bash Prompt HOWTO on Colours: http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
#!/bin/bash
T='gYw' # The test text
for FGs in 0 1 2 3 4 5 6 7;
do FG=${FGs// /}
echo -en " $FGs $(tput setaf $FG) $T "
for BG in 0 1 2 3 4 5 6 7;
do echo -en "$EINS $(tput setaf $FG)$(tput setab $BG) $T $(tput sgr0)";
done