Skip to content

Instantly share code, notes, and snippets.

/* * * * * * * * * * * * * * * * * * * * * * *
* Custom facebook share dialog
* Requires FB SDK & jQuery
* UNTESTED! Use with caution!
* * * * * * * * * * * * * * * * * * * * * * * */
// @ doc ready
jQuery(document).ready(function($){
// When user clicks #my_fb_share_button
@maxcal
maxcal / gist:1230720
Created September 20, 2011 23:20
Hacktastic Google Analyticts PDF tracking
// Catch present and future links
jQuery('a.pdf').live('click', function($){
var base_url, absolute_url;
// test for P3 env variable resources.baseurl
base_url = resources.baseurl || "http://www.greenpeace.org/international/";
// Self-Invoking Function - returns url with path
absolute_url = (function(url, base_url){
@maxcal
maxcal / gist:1230744
Created September 20, 2011 23:39
GAQ iframe hack
// Disable GAQ push in iframe
(function(){
// If in iframe
if ( window.location !== window.parent.location ){
// try to unset _gaq.push
try {
_gaq.push = function(){};
}
catch(err) {
}
@maxcal
maxcal / Google Analytics PDF tracking
Created September 21, 2011 09:35
PDF test regex
jQuery.ready(function($){
// Check for PDF links
$('a').each(function(){
var pdfExt = /\.pdf$/i;
var href = $(this).attr('href');
if ( pdfExt.test(href)) {
$(this).addClass('pdf');
}
@maxcal
maxcal / Form autofiller...
Created October 11, 2011 08:35
Autofill donation form.
var data = {
forename: "Test",
surname: "Testsson",
addressone: "Vintergatan 1",
postcode: 5555,
phone: "055-555555",
email: "[email protected]",
city: "Ingenstans"
};
@maxcal
maxcal / gist:1344820
Created November 7, 2011 12:31
guide to green electronics
<iframe id="iframe-player" src="http://www.greenpeace.org/international/global/international/code/2011/greener_guide/index.html" width="960" height="360" style="overflow:hidden;border:0;"></iframe>
@maxcal
maxcal / HTML
Created November 7, 2011 14:23
Guide to Greener Electronics
<ul class="companies no_bullits">
<li class="company">
<div class="left"><img src="/international/Global/international/artwork/climate/2011/Greener_Guide/hp_1.jpg" alt="#1 hp" width="104" height="104" /></div>
<div class="right">
<h2>HP <span class="score">5.9/10</span></h2>
<p>Up three places, HP is now the top scoring company - strongest on sustainable operations and energy criteria but could improve on green products criteria.&nbsp;<br /><strong><a class="pdf ga_trackpageview" href="/international/Global/international/publications/climate/2011/Cool%20IT/greener-guide-nov-2011/hp.pdf">Download HP report card</a></strong></p>
</div>
</li>
<li class="company">
<div class="left"><img src="/international/Global/international/artwork/climate/2011/Greener_Guide/dell_2.jpg" alt="#2 dell" width="104" height="104" /></div>
@maxcal
maxcal / index.html
Created November 7, 2011 14:23
Guide to Greener Electronics
<!--
* @ file index.html
* @ project Guide To Greener Electronics
* @ author Eoin Dubsky <[email protected]>
* @ edited [email protected]
-->
<ol class="ranking no_bullets">
<li class="company">
<div class="left"><img src="/international/Global/international/artwork/climate/2011/Greener_Guide/hp_1.jpg" alt="#1 hp" width="104" height="104" /></div>
<div class="right">
@maxcal
maxcal / pkv.log
Created November 7, 2011 15:25 — forked from vpranavkumar/pkv.log
--------- beginning of /dev/log/system
W/ActivityManager( 1365): Scheduling restart of crashed service com.lge.simcontacts/.SIMContactsService in 14539ms
I/ActivityManager( 1365): Start proc com.lge.android.bookmarks.widget for service com.lge.android.bookmarks.widget/.WidgetUpdateService: pid=17360 uid=10078 gids={3003}
I/ActivityManager( 1365): moveTaskToBack: 6
D/ConnectivityService( 1365): ConnectivityChange for mobile: CONNECTED/CONNECTED
D/ConnectivityService( 1365): adding dns **.**.**.** for mobile
D/ConnectivityService( 1365): adding dns **.**.**.** for mobile
I/ActivityManager( 1365): Start proc com.lge.simcontacts for service com.lge.simcontacts/.SIMContactsService: pid=17375 uid=1001 gids={3002, 3001, 3003, 4002, 1015}
I/ActivityManager( 1365): No longer want com.google.android.talk (pid 13058): hidden #26
I/ActivityManager( 1365): No longer want com.wise.movie_player (pid 14793): hidden #26
@maxcal
maxcal / demo.js
Created November 22, 2011 16:13
FB.init Event
/**
* Demo: Using the fb.ready event
* @author [email protected]
* @project Planet3
* @see https://gist.github.com/1386033
*/
// Listen for fb.ready event
jQuery(document).bind('fb.ready', function(){
// we can now safely use the FB SDK.