Skip to content

Instantly share code, notes, and snippets.

View cannikin's full-sized avatar
🔨
Woodworking

Rob Cameron cannikin

🔨
Woodworking
View GitHub Profile
@cannikin
cannikin / gist:9242443
Created February 27, 2014 01:26
HAML filter example
%h1 Heading 2
:javascript
console.info
%h2 Heading 2
source :rubygems
gem 'linkedin'
gem 'vcr'
storm:macruby-0.10 rob$ rake
WARNING: Global access to Rake DSL methods is deprecated. Please include
... Rake::DSL into classes and modules which use the Rake DSL methods.
WARNING: DSL method Rake::UpstreamGitRepoTasks#namespace called at /Users/rob/Sites/macruby-0.10/rakelib/upstream_git_repo_tasks.rb:25:in `define'
WARNING: DSL method Rake::UpstreamGitRepoTasks#desc called at /Users/rob/Sites/macruby-0.10/rakelib/upstream_git_repo_tasks.rb:26:in `block in define'
WARNING: DSL method Rake::UpstreamGitRepoTasks#task called at /Users/rob/Sites/macruby-0.10/rakelib/upstream_git_repo_tasks.rb:27:in `block in define'
WARNING: DSL method Rake::UpstreamGitRepoTasks#desc called at /Users/rob/Sites/macruby-0.10/rakelib/upstream_git_repo_tasks.rb:37:in `block in define'
WARNING: DSL method Rake::UpstreamGitRepoTasks#task called at /Users/rob/Sites/macruby-0.10/rakelib/upstream_git_repo_tasks.rb:38:in `block in define'
WARNING: DSL method Rake::UpstreamGitRepoTasks#desc called at /Users/rob/Sites/macruby-0.10/ra
@cannikin
cannikin / bv_test.html
Created November 8, 2011 19:29
Badgeville styling
<html>
<head>
<style type="text/css">
#side {
width: 300px;
font-family: Helvetica;
}
.bv_leaderboard_wrapper {
background-color: #cccccc;
padding: 10px;
@cannikin
cannikin / lcd_and_temp.pde
Created October 20, 2011 21:14
Here is the code to get a SHT15 temperature sensor readings displayed on a SerLCD (see http://www.youtube.com/watch?v=gsrvT2odicI )
// Read temperature/humidity from sensor and display on LCD screen
#include <SoftwareSerial.h>
#include <Sensirion.h>
#define lcdTxPin 2
#define sensorDataPin 3
#define sensorClockPin 4
float temperature;
@cannikin
cannikin / deploy.rb
Created October 4, 2011 17:07
Trainer deploy
# This is the file that Capistrano uses to get our code onto the servers
# See http://capify.org for more info
require 'bundler/capistrano'
require 'delayed/recipes'
# require 'hoptoad_notifier/capistrano'
# capistrano-ext lets you configure for multiple environments, see config/deploy/qa.rb
set :stages, %w(qa staging production unicorn)
set :default_stage, 'qa'
static VALUE
rb_str_each_line(int argc, VALUE *argv, VALUE str)
{
rb_encoding *enc;
VALUE rs;
unsigned int newline;
const char *p, *pend, *s, *ptr;
long len, rslen;
VALUE line;
int n;
@cannikin
cannikin / active_search.rb
Created August 22, 2011 22:34
Basic command line search for the Active.com Search API
require 'json'
require 'httparty'
require 'cgi'
base_url = 'http://api.amp.active.com/search?f=activities&v=json&api_key=KEY_GOES_HERE'
sports = %w{Baseball Basketball Football Golf Outdoors Running Walking}
system('clear')
puts "------------------------------------------"
puts " Active.com Search"
@cannikin
cannikin / dark_feature.rb
Created August 16, 2011 22:14
Dark Feature
# application_helper.rb
def dark_feature(key, &block)
if dark_feature_enabled? key
content_tag('div', :class => "feature #{key}", &block)
end
end
def dark_feature_enabled?(key)
if feature = DarkFeature.find_by_key(key)
return feature.enabled?
def show
@event = Event.find(params[:id])
@details = JSON.parse(HTTParty.get("#{SEARCH_CONFIG[:url]}?v=json"))['_results'].first rescue nil if @event.asset?
Rails.logger.debug @details.inspect if @details
@page_title = @event.name
end