Skip to content

Instantly share code, notes, and snippets.

View pifantastic's full-sized avatar

Aaron Forsander pifantastic

  • Stripe
  • Austin, TX
View GitHub Profile
<?php
try {
$list = new ExactTarget_List();
$list->ListName = "Aaron's test list";
$list->Description = "Aaron is now testing the API!";
$exact_target = ExactTarget::instance('SOAP')->create($list);
}
catch (ExactTarget_Exception $e) {
var express = require('express'),
io = require('socket.io'),
// Map clients to sessions by IP
clients = {};
var app = express.createServer();
app.use(express.cookieParser());
app.use(express.session({ secret: "keyboard cat" }));
<?php
/**
* Escape special characters.
*
* See http://en.wikipedia.org/wiki/XML#Escaping
*/
function ec_dreammail_escape_xml($string) {
$search = array('<', '>', '&', '"', "'");
$replace = array('&lt;', '&gt;', '&amp;', '&quot;', '&apos;');
<?php
function ec_dreammail_escape_xml($string) {
return htmlentities($string, ENT_QUOTES, 'UTF-8');
}
function ec_dreammail_sanitize_xml($string) {
$ret = "";
$length = strlen($string);
for ($i = 0; $i < $length; $i++) {
function get(request, params, callback) {
// Do stuff
}
get.require_auth;
get.params = {
token: true,
};
<?php
/**
* Implementation of hook_block().
*/
function ec_channel_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
return array(
'products_and_events' => array(
$('#model-versions ul li a').click(function() {
$('section.left article').animate({opacity: 0 }, 1000).load(this.href + " section.left article");
});
var f;
Froogaloop( $('#player-player')[0] ).addEvent('ready', function() {
f = $f( $('#player-player')[0] );
f.addEvent('finish', function() {
alert('finished! do something...');
});
});
@pifantastic
pifantastic / env.js
Created April 2, 2011 23:06
A simple framework for managing device dependencies
;(function(global) {
var env = {
_deps: {},
_ready: function() {},
_change: function() {},
// Add dependencies.
deps: function() {
<?php
function down_for_everyone($url) {
if (strpos($url, '://') === FALSE) {
$url = "http://$url";
}
if (filter_var($url, FILTER_VALIDATE_URL)) {
$handle = curl_init($url);
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, TRUE);