Skip to content

Instantly share code, notes, and snippets.

View justinribeiro's full-sized avatar
🌞
Web Performance Tracing: because we can have nice things if you work for it.

Justin Ribeiro justinribeiro

🌞
Web Performance Tracing: because we can have nice things if you work for it.
View GitHub Profile
@justinribeiro
justinribeiro / #jqcon 2011 session slides
Created April 18, 2011 15:35
Exported from Session Buddy; use "Import Session..." in Session Buddy to open all
http://events.jquery.org/2011/sf-bay-area/schedule/
http://danheberden.com/presentations/deferreds-putting-laziness-to-work/#1
http://boazsender.com/understanding-jquery-events.html
http://standardista.com/jquery/
http://www.slideshare.net/darcyclarke/mind-blowingux
http://demo.creative-area.net/jqcon2011/#1
http://www.slideshare.net/nzakas/progressive-enhancement-20
http://filamentgroup.com/lab/slides_from_our_jquery_conference_presentation_on_jquery_mobile/
http://www.coldfusionjedi.com/index.cfm/2011/4/16/Slides-code-from-my-jQuery-Mobile-presentation
http://code.bocoup.com/popcorn.js/jqcon/#landing-slide
@justinribeiro
justinribeiro / getGooglePlus.php
Created November 16, 2011 01:56
Get's a Google Plus stream in JSON and caches locally for display elsewhere
// JDR: who you are, and how many results you want
$myGooglePlusUser = "{YOUR_GOOGLE_PLUS_ID_NUMBER_HERE}";
$myGooglePlusMaxResults = 20;
// JDR: get your Google API key from the APIs Console: https://code.google.com/apis/console#access
$myGoogleAPIkey = "{YOUR_API_KEY_HERE}";
$myGooglePlusQuery = "https://www.googleapis.com/plus/v1/people/" . $myGooglePlusUser . "/activities/public?alt=json&maxResults=" . $myGooglePlusMaxResults . "&fields=items(object(attachments(categories%2Ccontentsource%2CdisplayName%2CobjectType%2Curl)%2Curl))&pp=1&key=" . $myGoogleAPIkey;
$myCacheFile = "me.json"; // JDR: name the cache file whatever you like
$myCacheCycle = "600"; // JDR: in seconds
@justinribeiro
justinribeiro / jqueryConverterGooglePlus.js
Created November 16, 2011 01:59
jQuery AJAX converter for getGooglePlus.php example JSON
$.ajax({
url: "getGooglePlus.php",
dataType: "jsong",
converters: {
"json jsong": function( msg ) {
var retData = new Array();
for (var i = 0; i < msg.items.length; i++) {
if ( msg.items[i].object.hasOwnProperty( "attachments" ) && msg.items[i].object.attachments.length >= 1)
{
for (var j = 0; j < msg.items[i].object.attachments.length; j++)
@justinribeiro
justinribeiro / detect-tuio.js
Created April 10, 2012 22:46
Modernizr test for npTuioClient
//
// Fast test for npTuioClient plugin https://github.com/fajran/npTuioClient
// Tested with PQ Labs touch overlay devices
//
// Chances are good if you use this, you'll want the Boris' MagicTouch
// touch api polyfill: https://github.com/borismus/MagicTouch
//
Modernizr.addTest('tuio', function () {
return ((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Tuio Client browser plugin"] == "object"));
@justinribeiro
justinribeiro / dd-wrt-connect-ping-glass-test
Created July 25, 2013 02:36
This is startup script that runs on dd-wrt, pings my local api end point, which bridges out to Mirror API and sends things to Glass. This is actually a really old script (I used to have this script doing other things), but it's basically a proximity hack (without the GPS). The Mirror API hook basically does location based things (house M2M tasks…
#
# Ping me when Glass connects / DD-WRT start up script
#
# Pings service on connect based on MAC, then pings endpoint which handles Glass talking
#
# Based on some older scripts that I was pretty sure used to be at http://www.dd-wrt.com/wiki/index.php/Script_Examples
# but for the life of me, I can't recall which ones
#
# Setup some devices based on MAC address
@justinribeiro
justinribeiro / gist:9262457
Last active August 29, 2015 13:56
Get a list of permalinks from Wordpress 3.8 via MySQL
SELECT
wpp.post_title,
wpp.guid,
wpp.post_date,
CONCAT(wpo_su.option_value, REPLACE(REPLACE(REPLACE(REPLACE(wpo.option_value, '%year%', DATE_FORMAT(wpp.post_date, '%Y')), '%monthnum%', DATE_FORMAT(wpp.post_date, '%m')), '%day%', DATE_FORMAT(wpp.post_date, '%d')), '%postname%', wpp.post_name)) AS permalink
FROM wp_posts wpp
INNER JOIN wp_options wpo
ON wpo.option_name = 'permalink_structure'
INNER JOIN wp_options wpo_su
ON wpo_su.option_name = 'siteurl'
@justinribeiro
justinribeiro / wp2redirect.sql
Last active August 29, 2015 13:56
Creates a column full of 301 redirects from published Wordpress post based on permalink.
--
-- Wordpress perma to 301 redirect
--
-- This script will output a column called rewrite_rule with a set of 301 redirect rules for an .htaccess file.
--
SET @table_prefix = "wp_";
SET @url_base_target = "http://www.soemthing.new/blog";
SET @generateSql = CONCAT("
@justinribeiro
justinribeiro / glass_wsh.py
Created March 20, 2014 17:21
Simple pywebsocket setup for listening to MQTT broker.
_OPEN_ = 1
_CLOSING_ = 2
_CLOSE_ = 3
_status_ = _CONNECTING_
# broker information for mqtt
_BROKER_URL = "localhost"
_BROKER_PORT = 1883
_TOPIC_BASE = "justin/glass"
@justinribeiro
justinribeiro / sub-to-glass.ru
Last active August 29, 2015 14:01
Really fast testing subscription for Glass w/Ruby
require 'omniauth'
require 'google/omniauth'
require 'google/api_client/client_secrets'
CLIENT_SECRETS = Google::APIClient::ClientSecrets.load
client = Google::APIClient.new(:application_name => 'Ruby Mirror test',
:application_version => '1.0.0')
mirror = Google::APIClient.new.discovered_api('mirror', 'v1')
### Keybase proof
I hereby claim:
* I am justinribeiro on github.
* I am justinribeiro (https://keybase.io/justinribeiro) on keybase.
* I have a public key whose fingerprint is 6D2D 7831 934B 7FCF 97F8 EF1E 8852 BB43 E48B 9932
To claim this, I am signing this object: