Skip to content

Instantly share code, notes, and snippets.

View geoffalday's full-sized avatar

Geoff Alday geoffalday

View GitHub Profile
{
"ignored_packages":
[
"Vintage"
],
"trim_trailing_white_space_on_save": true,
"tab_size": 4,
"translate_tabs_to_spaces": true,
"detect_indentation": false,
"use_tab_stops": true
@geoffalday
geoffalday / geoff.txt
Created April 29, 2014 15:12
A few ways my name has been pronounced.
gee-off
geff
goff
george
jiff
joff
greg
@geoffalday
geoffalday / words.txt
Last active August 29, 2015 14:00
Words that should be used more often.
aluminium
kerfuffle
shenanigans
@geoffalday
geoffalday / gist:1322089
Created October 28, 2011 11:22 — forked from trvsdnn/gist:1321710
twitter_link
def twitter_link(handle)
avatars_path = 'public/img/avatars/'
avatar = handle + '.jpg'
avatar_path = avatars_path + avatar
img_tag = "<img src='#{avatar_path.sub(/^public/, '')}' />"
# Check and see if there's already an avatar.
unless File.exists?(avatar_path)
# We don't have it. Let's try to get it from Twitter.
begin
@geoffalday
geoffalday / get_sentiment.rb
Created November 1, 2011 14:09
Ruby function for accessing the Viralheat sentiment API
require 'rubygems'
require 'sentiment_analysis'
def get_sentiment(text)
sa = SentimentAnalysis::Client.new(:api_key => 'YOUR_API_KEY')
sentiment = sa.review(:text => text, :format => :json)
# The limit on the text is 360 characters.
return sentiment
end
@geoffalday
geoffalday / admin.py
Created January 29, 2012 05:04
Two Methods per Alex
@app.route('/edit/<int:page_id>', methods=['GET'])
def edit(page_id):
context = "Edit"
page = Page.query.get(page_id)
title = page.title
text = page.text
return render_template('edit.html', title=title, text=text, context=context)
@app.route('/edit/<int:page_id>', methods=['POST'])
@geoffalday
geoffalday / files.py
Created May 3, 2012 10:28
Get files from directory
#via http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
import fnmatch
import os
matches = []
for root, dirnames, filenames in os.walk('src'):
for filename in fnmatch.filter(filenames, '*.c'):
matches.append(os.path.join(root, filename))
@geoffalday
geoffalday / weather.r
Created June 15, 2012 15:58
Displays hottest days using R
# Nashville's hottest days in 2011
weather2011 <- read.csv('wunder-data-2011.txt', sep=',', header=TRUE)
fill_colors <- c()
for (i in 1:length(weather2011$tmax)) {
if (weather2011$tmax[i] > 80) {
fill_colors <- c(fill_colors, '#CC0000')
} else {
fill_colors <- c(fill_colors, '#CCCCCC')
@geoffalday
geoffalday / nashville-weather-1981.r
Created June 21, 2012 12:32
Display a year's weather using R
#Nashville Weather in 1981
weather1981 <- read.csv('wunder-data-1981.txt', sep=',', header=TRUE)
high_colors <- c()
for (i in 1:length(weather1981$tmax)) {
if (weather1981$tmax[i] > 80) {
high_colors <- c(high_colors, '#CC0000')
} else {
high_colors <- c(high_colors, '#9ACC78')
@geoffalday
geoffalday / index.html
Created November 14, 2012 16:37
A CodePen by Geoff Alday. - All graphical elements created with CSS.
<div class="box">
<div class="box-top"></div>
<div class="box-body">
<div class="heading">
<h1>Introduction</h1>
</div>
<div class="content">
<p>The passion for play is probably as old, and will be as enduring, as the race of man. Some of us are too timid to risk a dollar, but the percentage of people in this feverish nation who would not enjoy winning one is very small. The passion culminates in the professional. He would rather play than eat. Winning is not his sole delight. Some one has remarked that there is but one pleasure in life greater than winning, that is, in making the hazard.</p>
</div>
</div>