Skip to content

Instantly share code, notes, and snippets.

@fofr
fofr / start.html
Created July 27, 2013 16:23
HTML starting point, hooked up to a TextExpander expansion with the keyword ",html"
<!DOCTYPE html>
<!--[if lt IE 7 ]><html lang="en" class="no-js ie ie6"><![endif]-->
<!--[if IE 7 ]><html lang="en" class="no-js ie ie7"><![endif]-->
<!--[if IE 8 ]><html lang="en" class="no-js ie ie8"><![endif]-->
<!--[if IE 9 ]><html lang="en" class="no-js ie ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en" class="no-js"><!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
@media (min--moz-device-pixel-ratio: 1.5),
(-o-min-device-pixel-ratio: 3/2),
(-webkit-min-device-pixel-ratio: 1.5),
(min-device-pixel-ratio: 1.5),
(min-resolution: 1.5dppx) {
/* "retina" styles */
}
scope :errors, -> { where(http_status: 404) }
scope :archives, -> { where(http_status: 410) }
scope :redirects, -> { where(http_status: 301) }
scope :other, -> { where('http_status NOT IN (?)', [404, 410, 301]) }
def self.aggregated
scoped.select('hits.path, sum(hits.count) as count, hits.http_status, hits.host_id').group(:path_hash, :http_status)
end
@fofr
fofr / gist:7154210
Created October 25, 2013 12:52
Cucumber feature for Google chart
@wip @javascript
Scenario: Hits exist and can be filtered by error
And I click the link "Errors"
And I wait until a graph is visible
Then I should see all hits with an error status for the Attorney General's office in descending count order
And an errors graph showing two dates and a red trend line
When /^I wait until a graph is visible$/ do
find('.js-hits-graph svg')
end
@fofr
fofr / sifttter.rb
Last active November 8, 2015 14:19 — forked from craigeley/sifttter.rb
Format sifttter logs into daily markdown files
#!/usr/bin/ruby
# Convert Sifttter logs into markdown files, one per day <http://paulrhayes.com>
# Based on Sifttter: An IFTTT-to-Day One Logger by Craig Eley 2014 <http://craigeley.com>
# Based on tp-dailylog.rb by Brett Terpstra 2012 <http://brettterpstra.com>
#
# Notes:
# * Uses `mdfind` to locate a specific folder of IFTTT-generated text files
# * The location of your folder should be hardcoded in line 23
# * Scans leading timestamps in each line matching formatted_date's date
# * Does not alter text files in any way
@fofr
fofr / sifttter_tweet_formatter.rb
Last active January 16, 2023 17:34
Convert an exported CSV of tweets into a SIFTTTER format
#!/usr/bin/ruby
# Convert an exported CSV of tweets into a SIFTTTER format
# Export from https://twitter.com/settings/account
# SIFTTTER: http://craigeley.com/post/72565974459/sifttter-an-ifttt-to-day-one-logger
require 'time'
require 'erb'
require 'date'
require 'csv'
@fofr
fofr / sifttter_scrobble_formatter.rb
Created February 23, 2014 09:50
Convert an exported TSV of scrobbles into a SIFTTTER format
#!/usr/bin/ruby
# Convert an exported TSV of scrobbles into a SIFTTTER format
# Export from http://www.last.fm/settings/dataexporter
# SIFTTTER: http://craigeley.com/post/72565974459/sifttter-an-ifttt-to-day-one-logger
require 'time'
require 'erb'
require 'date'
require 'csv'
@fofr
fofr / sifttter_formatter_foursquare.rb
Created February 23, 2014 09:57
Convert an RSS of Foursquare checkins into a SIFTTTER format
#!/usr/bin/ruby
# Convert an RSS of Foursquare checkins into a SIFTTTER format
# Find feed at https://foursquare.com/feeds/
# eg https://feeds.foursquare.com/history/YOUR_FEED_HERE.rss?count=COUNT
# SIFTTTER: http://craigeley.com/post/72565974459/sifttter-an-ifttt-to-day-one-logger
require 'rubygems'
require 'simple-rss'
require 'open-uri'
@fofr
fofr / vagrantfile
Last active August 29, 2015 14:01
Enable NFS in Vagrant
# Static IP for NFS and DNS
config.vm.network :private_network, :ip => "10.1.1.250"
config.vm.provider :virtualbox do |vm, override|
override.vm.synced_folder "~/some/directory", "/some/directory/on/vm", :nfs => true
end
# Replace any brackets with real values
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal
ssh [user]@[host]
cd ~
mkdir [mydomain_com].git
cd [mydomain_com].git
git init --bare
vi hooks/post-receive
# Enter the code from the "post-receive" file (in this gist); save + quit