Skip to content

Instantly share code, notes, and snippets.

View pifantastic's full-sized avatar

Aaron Forsander pifantastic

  • Stripe
  • Austin, TX
View GitHub Profile
@pifantastic
pifantastic / index.html
Created January 26, 2011 00:03
A simple todo list I'm using for an Intro to jQuery talk.
<!DOCTYPE hmtl>
<html>
<head><title>My todo list</title></head>
<body>
<h1>My todo list:</h1>
<form>
<input type="text" id="item" />
<input type="submit" id="save" value="Save" />
</form>
<ul id="list"></ul>
<?php
function whatever_init() {
pubsub_pub('cron.do.something', $arbitrary, $arguments, $here);
}
function whatever_pubsub_do_something($arbitrary, $arguments, $here) {
// This gets run when cron runs
}
<!DOCTYPE html>
<head>
<title>TEST!</title>
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
</body>
register({
name: "Drupal.org",
domains: [ 'drupal.org' ],
sessionCookieNames: [ 'SESS797294cd3a93256631fb852630ae867a' ],
identifyUser: function () {
var resp = this.httpGet(this.siteUrl);
this.userName = resp.body.querySelector('#userinfo a').textContent.replace('Logged in as ', '');
}
});
Drupal.attachBehaviors = function(context) {
context = context || document;
if (Drupal.jsEnabled) {
// Execute all of them.
jQuery.each(Drupal.behaviors, function(callback) {
if (!$(context).is(callback + "-processed")) {
this(context);
$(context).addClass(callback + "-processed");
}
});
// <a href="" class="make-dialog" dialog-width="100" dialog-height="100" title="Testing a popup">Test</a>
$("a.make-dialog").badAssDialog();
$.fn.badAssDialog = function() {
this.each(function() {
var $this = $(this);
$this.click(function() {
$('<div></div>').load(this.href).dialog({
<?php
/**
* Clones a node by directly saving it.
*/
function clone_node_save($nid) {
if (is_numeric($nid)) {
global $user;
$node = node_load($nid);
<?php
/**
* Erase a CCK text field from a node.
*/
function el_commons_wipe_cck_text_field(&$node, $field_name) {
if (!isset($node->$field_name)) {
return;
<?php
function createCookie($name, $value = '', $maxage = 0, $path = '', $domain = '', $secure = false, $HTTPOnly = false) {
$ob = ini_get('output_buffering');
// Abort the method if headers have already been sent, except when output buffering has been enabled
if (headers_sent() && (bool) $ob === false || strtolower($ob) == 'off') {
return false;
}
=== modified file 'evented-daemon.php' (properties changed: -x to +x)
--- evented-daemon.php 2010-07-13 08:01:54 +0000
+++ evented-daemon.php 2010-07-16 19:41:54 +0000
@@ -18,13 +18,20 @@
}
/**
+ * Generate an HTTP error
+ */
+function daemon_error($evhttp_request, $code, $message) {