Skip to content

Instantly share code, notes, and snippets.

@maxcal
maxcal / email-transfer.js
Created January 16, 2012 10:08
Rot13 email
/**
* @name Newletter transfer
* @package P3 / Main
* @author Max Calabrese <[email protected]>
* @copyright Greenpeace Nordic
*/
/**
* Used for transfering an email address via the url hash
*/
@maxcal
maxcal / gist:1683484
Created January 26, 2012 16:01
Action Tracker...
/**
*
* Some boilerplate code to explain tracking...
*
* @param jQuery $form - a form to bind the action against.
* @param string url - where to post tracking data
*/
function TrackActionForm($form, url){
$form.submit(function(e){
@maxcal
maxcal / gist:1722729
Created February 2, 2012 10:08
Actions Training
#main .breadcrumbs {
display:none;
}
@maxcal
maxcal / index.html
Created February 17, 2012 17:57
Progress Bar
<!DOCTYPE html>
<html>
<head>
<title>The progressive progressbar</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="progressbar.widget.js"></script>
<link href="progressbar.widget.css" rel="stylesheet"/>
</head>
<body>
(function(){
// Always Declare vars at top of function - good practice
var url, countries, defaultKey;
// Get data from here.
url = "http://www.example.com/ajax.do";
// Use this key per default (international)
defaultKey = "int";
// Object containing the countries.
countries = {
@maxcal
maxcal / javascript-countdown.js
Created March 1, 2012 10:46
javascript-countdown
/**
* @project: Countdown timer
* @author: Max Calabrese
* A eval free version of Dejan Jacimovic´s http://stuntsnippets.com/javascript-countdown/
*
* @licence:
* GNU / GPLv3
* You should have received a copy of the GNU General Public License
* If not, see <http://www.gnu.org/licenses/>.
*
@maxcal
maxcal / border-radius.scss
Created March 8, 2012 15:25 — forked from andrewrocco/border-radius.scss
Custom Font Mixin
@mixin border-radius ( $value: 3px ) {
-webkit-border-radius: $value;
-moz-border-radius: $value;
border-radius: $value;
// keeps background from busting out of border
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
}
@maxcal
maxcal / splitLabels.js
Created March 15, 2012 10:54
jQuery.splitLabels
/**
* @author [email protected]
* @deps jQuery 1.42+
**/
/***
* P3 Hack thats removes the combined FirstnameLastname label adds a forname / lastname label
* Call it on a newsletter signup widget.
* @param fields object
* @return jQuery
**/
@maxcal
maxcal / autocomplete.as3
Created May 31, 2012 09:23
Eniro autocomplete
import flash.events.Event;
import com.adobe.serialization.json.JSON;
var search_data:URLLoader = new URLLoader();
search_data.addEventListener(Event.COMPLETE, function(e:Event) :void {
var companies:Array = JSON.decode(e.target.data);
var i:Number;
@maxcal
maxcal / gist:2947417
Created June 18, 2012 08:08
Simple Curl web scraper
<?php
/**
* @param string $url - the url you wish to fetch.
* @return string - the raw html respose.
*/
function web_scrape($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($ch);