Skip to content

Instantly share code, notes, and snippets.

View aboutaaron's full-sized avatar

Aaron Williams aboutaaron

View GitHub Profile
@aboutaaron
aboutaaron / installing_gdal_mac
Created June 26, 2013 20:02
Getting past an error installing gdal and postgis in Mac OS X with Homebrew
`brew install postgis`
But you don't have gdal installed (a dependency) so brew trys to install gdal aaand...
Fails with: `'gcc-4.2' failed with exit status 1`
Solutuion: Run brew install in verbose mode
`brew install -vd postgis` or `brew install -vd gdal`
@aboutaaron
aboutaaron / challenge.html
Last active December 18, 2015 14:38
A div with an id of 'slideshow' contains five images, the first of which is shown and the others are hidden using a display style of none. Using Javascript, create a simple slideshow that cycles through the images, displaying each image for three seconds at a time, looping back to the first image when the end is reached. You cannot use jQuery or…
<div id="slideshow">
<img id="container" src="http://placekitten.com/400" alt="kitten" />
<img id="container" src="http://placekitten.com/250" style="display:none;" alt="kitten" />
<img id="container" src="http://placekitten.com/300" style="display:none;" alt="kitten" />
<img id="container" src="http://placekitten.com/200" style="display:none;" alt="kitten" />
<img id="container" src="http://placekitten.com/500" style="display:none;" alt="kitten" />
</div>
<script src="solution.js"></script>
@aboutaaron
aboutaaron / server.rb
Created June 5, 2013 19:15
Quick Ruby server for static assets
require 'webrick'
include WEBrick
s = HTTPServer.new(
:Port => 3000,
:DocumentRoot => Dir::pwd
)
trap("INT"){ s.shutdown }
# https://gist.github.com/1214011
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@aboutaaron
aboutaaron / homebrew.sh
Created February 25, 2013 22:24
How to fix homebrew every time it doesn't want to overwrite changes
# https://github.com/mxcl/homebrew/issues/13373
cd `brew --prefix`
rm Library/Formula/stunnel.rb
brew update -v
@aboutaaron
aboutaaron / routes.rb
Created January 22, 2013 18:16
Proper routes, my boy!
ChSound::Application.routes.draw do
#get "list/index"
resources :list
#get "gallery/index"
resources :gallery
# Set List/index as root
# app can now be accessed at 0.0.0.0:3000
# instead of 0.0.0.0:3000/list/index
@aboutaaron
aboutaaron / gist:3942170
Created October 23, 2012 22:34
Cooking...
https://gist.github.com/1951671
http://ejohn.org/projects/javascript-diff-algorithm/
https://github.com/aurelian/ruby-stemmer
http://www.propublica.org/nerds/item/when-are-190-emails-like-six-emails
@aboutaaron
aboutaaron / mail.rake
Created October 17, 2012 23:47
Ruby Mail auth
options = { :address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => user_name,
:password => password,
:authentication => 'plain',
:enable_starttls_auto => true }
Mail.defaults do
delivery_method :smtp, options
@aboutaaron
aboutaaron / index.html
Created October 17, 2012 23:36
YouTube player from Edmonton Journal
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
function onYouTubePlayerReady(playerId) {
ytplayer = document.getElementById("myytplayer");
setInterval(updateytplayerInfo, 250);
updateytplayerInfo();
ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer.addEventListener("onError", "onPlayerError");
}
@aboutaaron
aboutaaron / index.html.erb
Created October 4, 2012 20:55
Ruby highcharts erb
<script type="text/javascript">
$(function () {
// Creating styles here to keep boilerplate down
var chartStyles = {
fontSize: '14px',
fontWeight: 'normal',
color: '#231F20',
fontFamily: "Georgia, 'Times New Roman', Times, serif",
textTransform: 'uppercase'