Skip to content

Instantly share code, notes, and snippets.

View bradfordcp's full-sized avatar

Christopher Bradford bradfordcp

View GitHub Profile
# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@lkarsten
lkarsten / default.vcl
Last active April 23, 2021 18:32
varnish vcl for ghost blogging platform
#
# Varnish VCL file for Ghost blogging platform.
# http://ghost.org/
#
# Written for Ghost v0.3.0.
#
# This is a low-hanging-fruit type of VCL. TTL of objects are overridden to 2
# minutes, and everything below /ghost/ is pass()-ed so the user sessions
# work.
#
@elmer-garduno
elmer-garduno / RMQReceiver.scala
Created September 6, 2013 03:01
RabbitMQ Actor with Receiver
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@olivierlacan
olivierlacan / assistive_devices.md
Created June 21, 2013 07:31
How to re-enable Divvy in OS X 10.9 Mavericks when it complains about needing to "enable access to assistive devices".

At the time of this writing Divvy hasn't been updated for OS X 10.9 so it tries to direct you to the Accessibility panel of the System Preferences. Actually the assistive device settings have been moved to the Security pane as shown below:

@Bren2010
Bren2010 / HearSay.md
Last active October 7, 2023 03:42
The HearSay P2P File Sharer

HearSay

The HearSay P2P File Sharer; a response to The Copyright Alert System, as well as several other internet regulation attempts. The goal of this project is to prove the viability of semi-anonymous and confidential file sharing. Consists of several proofs of concepts such as the formation of ad-hoc mix networks and routing throughout them while maintaining anonymity and semantic security.

However, lets be honest with ourselves for a second. Don't use this to fight an oppressive regime. I can not (and will not try) to 'prove' its security, and I

@doitian
doitian / Guardfile
Created April 11, 2012 06:29
Rails/Rack HTML exporter && jasmine jsconverage integration
guard 'development-export' do
watch(%r{^vendor/assets/javascripts/.+\.(?:coffee|eco|js)$}) {
[
'vendor/assets/javascripts/vendor.coffee',
'spec/javascripts/spec_helper.coffee'
]
}
watch(%r{^(?:assets|spec)/javascripts/.+\.(?:coffee|eco|js)$})
end
@nsfmc
nsfmc / junkify.js
Created March 14, 2012 18:11
Junkify an inline data series on your webpage
var junkify = function( someClass ){
// requires underscore.js
var sparks = document.getElementsByClassName( someClass );
_(sparks).each(function(e,i){
var range = 16;
var origContent = e.innerHTML;
e.title = "data: "+ origContent;
var d = origContent.split(","),
max = _.max(d), min = _.min(d),
dataRange = max-min;
@soopercorp
soopercorp / findbest.py
Created February 20, 2012 23:38
bestthing.info algorithm
#!/usr/bin/env python
import cPickle as pickle
import random
# things I beat
tIB = {}
# things beat me
tBM = {}
@sontek
sontek / snowjob.py
Created December 22, 2011 04:24
Make your terminal snow with python
#!/usr/bin/env python
import os
import random
import time
import platform
snowflakes = {}
try:
# Windows Support
@brikis98
brikis98 / BinaryModules.js
Created December 1, 2011 00:45
Node.js performance tips
// Use built in or binary modules
var crypto = require('crypto');
var hash = crypto.createHmac("sha1",key).update(signatureBase).digest("base64");