Skip to content

Instantly share code, notes, and snippets.

View originalpete's full-sized avatar
🌴
still codin' after all of these years

Peter MacRobert originalpete

🌴
still codin' after all of these years
View GitHub Profile
@originalpete
originalpete / smooth-scroll.js
Last active October 11, 2016 17:36
Click handler for smoothly scrolling to an element in Unbounced.com
// Load this after the document has loaded.
$(function () {
// Bind a click handler to the element.
// Note this element needs to exist in both
// mobile and tablet views, with the same ID.
$("#lp-pom-image-114").click(function (){
// Extract the absolute pixel location of the top of the element
// that you want to scroll to.
@originalpete
originalpete / gist:6172964
Last active December 20, 2015 17:59
Safegas page fixtures: find Comfy CMS pages that have a missing page title
Dir["db/cms_fixtures/safegas/pages/**/*"].map{|d| d if File.directory?(d) && !Dir[d+"/*"].map{|f| File.basename(f)}.include?("title.html")}
require 'open-uri'
r = Random.new(Time.now.to_i)
exit if r.rand < 0.90
url = "https://gist.github.com/originalpete/5715627/raw/sayings.txt"
sayings = open(url).read
text = sayings.split("\n").sort_by{r.rand}.first
`say "#{text}"`
@originalpete
originalpete / application.js
Last active December 16, 2015 14:49
Railsgirls javascript submit
jQuery(document).ready(function() {
$('.update-done :checkbox').on('change', function () {
var checkbox = $(this);
var form = checkbox.parent('form');
$.ajax(form.attr('action'), {type: 'PUT', data: form.serialize()});
});
});
@originalpete
originalpete / graph.json
Created April 18, 2012 22:45
Collusion force directed layout
{"nodes":[{"name":"aboutads.info","group":1},{"name":"addthis.com","group":2},{"name":"admeld.com","group":2},{"name":"adnxs.com","group":2},{"name":"adtech.de","group":2},{"name":"answers.com","group":1},{"name":"baronsoffers.com","group":1},{"name":"blogspot.co.uk","group":1},{"name":"blogspot.com","group":1},{"name":"criteo.com","group":1},{"name":"dailymail.co.uk","group":1},{"name":"digitalspy.co.uk","group":1},{"name":"doubleclick.net","group":2},{"name":"facebook.com","group":2},{"name":"foxnews.com","group":1},{"name":"google.com","group":2},{"name":"guardian.co.uk","group":1},{"name":"imrworldwide.com","group":2},{"name":"mookie1.com","group":2},{"name":"msn.com","group":1},{"name":"news.com.au","group":1},{"name":"pubmatic.com","group":2},{"name":"quality-channel.de","group":1},{"name":"quantserve.com","group":2},{"name":"reuters.com","group":1},{"name":"rubiconproject.com","group":1},{"name":"scorecardresearch.com","group":2},{"name":"smh.com.au","group":1},{"name":"spiegel.de","group":1},{"name":"