Skip to content

Instantly share code, notes, and snippets.

View wbrady's full-sized avatar

Will Brady wbrady

  • Palantir
  • Washington, D.C.
View GitHub Profile
@wbrady
wbrady / jekyll-monkey-patch.rb
Created August 15, 2012 14:10
Monkey patch of Jekyll to better handle Liquid errors
module Jekyll
module Convertible
def do_layout(payload, layouts)
info = { :filters => [Jekyll::Filters], :registers => { :site => self.site } }
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
begin
@wbrady
wbrady / one-div-logo.html
Last active December 11, 2015 06:48
Near Infinity logo using a single div and radial gradients
<style type="text/css">
#logo {
font-size: 60px;
width: 4em;
height: 2em;
background: -webkit-radial-gradient(center, ellipse, rgba(255, 255, 255, 1) 40%,transparent 41%,transparent 100%),
-webkit-radial-gradient(center, ellipse, rgba(0, 0, 0, 1) 40%,transparent 41%,transparent 100%),
-webkit-radial-gradient(center, ellipse, rgba(255, 255, 255, 1) 40%,transparent 41%,transparent 100%),
-webkit-radial-gradient(center, ellipse, rgba(237, 128, 39, 1) 40%,transparent 41%,transparent 100%);
background-position: 0.3em 0.75em, -0.6em 0.35em, 1.4em 0.6em, 1.05em 0.15em;
@wbrady
wbrady / border-radius-logo.html
Last active December 11, 2015 06:48
Near Infinity logo using nested elements with border-radius
<style type="text/css">
#logo {
font-size: 60px;
width: 3.5em;
height: 2em;
}
#logo .leaf {
width: 1.7em;
height: 1em;
@wbrady
wbrady / canvas-logo.html
Last active December 11, 2015 06:48
Near Infinity logo using HTML5 canvas
<canvas id='logo' width="250" height="100">
</canvas>
<script>
var canvas = document.getElementById('logo');
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
// Draw black oval
ctx.save();
@wbrady
wbrady / post-merge
Last active December 11, 2015 18:09
NIC+ post-merge git hook
#!/bin/sh
diff=`git diff --name-only HEAD@{1} HEAD`
packages=`expr "$diff" : ".*package.json.*"`
if [ ! "$packages" -eq 0 ]
then
echo "Installing new packages"
npm install
fi
@wbrady
wbrady / post-merge
Created March 12, 2013 14:34
Website (rails) post-merge hook
#!/bin/sh
diff=`git diff --name-only HEAD@{1} HEAD`
gemfile=`expr "$diff" : ".*Gemfile.*"`
if [ ! "$gemfile" -eq 0 ]
then
echo "Running bundle install"
bundle install
fi
@wbrady
wbrady / create-confluence-spaces.rb
Created March 29, 2013 18:54
Ruby script to create Confluence personal spaces for users who don't have one
#!/usr/bin/env ruby
require 'xmlrpc/client'
puts "Please enter your Confluence base URL:"
base = STDIN.gets.chomp
puts "Please enter your username:"
user_name = STDIN.gets.chomp
@wbrady
wbrady / fix-confluence-spaces.rb
Created April 3, 2013 13:02
Fix confluence space names
#!/usr/bin/env ruby
require 'xmlrpc/client'
puts "Please enter your Confluence base URL:"
base = STDIN.gets.chomp
puts "Please enter your username:"
user_name = STDIN.gets.chomp
@wbrady
wbrady / gemfile_spec.rb
Last active December 22, 2015 20:19
Spec to test that your Gemfile locks all of its gems
# In your Gemfile:
#
# group :test do
# gem 'gemnasium-parser', '0.1.9'
# end
#
require 'spec_helper'
describe 'Gemfile' do
@wbrady
wbrady / problem.coffee
Created October 24, 2013 14:47
Why I hate coffeescript
featureMap = this.model.get('provider_feature_map')
$('.feature-row').each(->
featureCode = $(this).data('code')
$('input', this).each(->
bookingMapCode = $(this).data('code')
featureMap[featureCode][bookingMapCode] = $(this).is(':checked') # this loop will only run until this call returns false because of the implicit return and "eventedness" of javascript
)
)