Skip to content

Instantly share code, notes, and snippets.

@jdwfly
jdwfly / http_client_with_cache.coffee
Created June 7, 2011 20:44 — forked from johnthethird/http_client_with_cache.coffee
HTTPClientWithCache for Titanium in CoffeeScript
###
------> HTTPClientWithCache <------
This class is a wrapper around the standard Titanium.Network.HTTPClient(), but it adds a
few nice features:
* A cache backed by a SQLite database. All HTTPClientWithCache instances use the same database table, with
the primary cache key being a hash of the full URL (and any data parameters in a POST)
* The cache is automatically pruned before each query
* A retry mechanism, so that you can retry a particular query a number of times before failing.
@jdwfly
jdwfly / module.php
Last active October 12, 2015 22:28
<?php
function custommodulename_node_view($node, $view_node, $langcode) {
if ($node->type == 'webform') {
drupal_add_js(drupal_get_path('module', 'custommodulename'). '/garlic.js');
}
}
<?php
function customtheme_form($variables) {
$element = $variables['element'];
if (strpos($element['#id'], 'webform') == FALSE) {
$element['#attributes'] = array('data-persist' => 'garlic');
}
if (isset($element['#action'])) {
$element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
}
element_set_attributes($element, array('method', 'id'));
@jdwfly
jdwfly / getURLs.py
Created November 30, 2012 00:04
Using Rackspace Cloudfiles API to get CDN urls
#!/usr/bin/python
import cloudfiles
cloud_username = "your_username"
cloud_api = "your_cloud_api_key"
cloud_container = "your_container"
conn = cloudfiles.get_connection(cloud_username, cloud_api)
sessions = conn.get_container(cloud_container)
module.exports = {
proxies: null,
paths: {
html : {
src: ['app/**/*.html'],
dest: "www/build"
},
sass: {
src: ['app/theme/app.+(ios|md).scss'],