Skip to content

Instantly share code, notes, and snippets.

View paulmwatson's full-sized avatar

Paul M. Watson paulmwatson

View GitHub Profile
@paulmwatson
paulmwatson / ds_to_gft.rb
Created November 23, 2011 17:49
Records DataSift Twitter interaction stream to Google Fusion Table
# Description: Consume a DataSift stream and save Twitter interactions to a Google Fusion Table
# Author: Paul M. Watson <paul.watson@storyful.com>
# Date: 2011/11/28
# Usage:
# ruby ds_to_gft.rb <DataSift stream id hash>
# config.yml should contain;
# datasift:
# username: datasift username
# api_key: datasift api key
# googlefusiontables:
@paulmwatson
paulmwatson / huffpomastheadcount.js
Created February 22, 2012 23:01
Count departments, positions and names in HuffPo masthead
jQuery('.grid.two_thirds.flush_top.secondary_page.no_bg center').text().replace(/;/gm, ':').replace(/(\r\n|\n|\r)/gm, ':').split(':').length
@paulmwatson
paulmwatson / collusionnews37export.js
Created April 16, 2012 12:30
Collusion results for 37 News Sites
[
{
"url": "*",
"collusion": {
"storyful.com": {
"referrers": {},
"visited": true
},
"quantserve.com": {
"referrers": {
@paulmwatson
paulmwatson / maps.google.com.new.lat.lng.js
Created May 17, 2013 09:28
Bookmarklet for getting the latitude and longitude of the center of the map in new Google Maps (which has lost the What's Here? feature which got the lat/lng easily.)
javascript:var d=document,w=window,l=d.location.href;lats=l.indexOf('!2d')+3;late=l.indexOf('!3d',lats);lat=l.substring(lats,late);lngs=l.indexOf('!3d')+3;lnge=l.indexOf('!',lngs);lnge==-1?lnge=l.length:lnge=lnge;lng=l.substring(lngs,lnge);w.location='http://maps.google.com?q='+lng+','+lat;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
...
"content_security_policy": "script-src 'self' https://cdn.mxpnl.com
https://ssl.google-analytics.com;
object-src 'self'",
"permissions": [
"tabs",
"http://*/*/",
"https://*/*/"
]
@paulmwatson
paulmwatson / 0_reuse_code.js
Created October 3, 2013 18:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Verifying that +paulmwatson is my Bitcoin username. You can send me #bitcoin here: https://onename.io/paulmwatson
@paulmwatson
paulmwatson / config.yml
Created August 1, 2017 11:08
A CircleCI 2.0 configuration for getting code coverage from PHPUnit to Code Climate
version: 2
jobs:
build:
environment:
CC_TEST_REPORTER_ID: YOUR_CODE_CLIMATE_REPORTER_ID
docker:
- image: notnoopci/php:7.1.5-browsers
working_directory: ~/repo
steps:
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1501586079">
<project timestamp="1501586079">
<package name="Ejcnet\Sourcebot">
<file name="/sourcebot/src/Sourcebot.php">
<class name="Sourcebot" namespace="Ejcnet\Sourcebot">
<metrics complexity="1" methods="1" coveredmethods="1" conditionals="0" coveredconditionals="0" statements="2" coveredstatements="2" elements="3" coveredelements="3"/>
</class>
<line num="5" type="method" name="helloWorld" visibility="public" complexity="1" crap="1" count="1"/>
<line num="7" type="stmt" count="1"/>