Skip to content

Instantly share code, notes, and snippets.

$items[variable_get('file_public_path', conf_path() . '/files') . '/pdf/%'] = array(
'page callback' => '...',
'page arguments' => array(1),
'access callback' => TRUE,
);
<?php
_refresh_and_assign_country_to_node($nid, $country, $region) {
if (empty($nid) || empty($country) || empty($region)) {
return FALSE;
}
// Some pseudo-constants for config
$VOCABULARY_COUNTRIES = 0;
Use requirements.txt to install all requirements.
pip install -r requirements.txt
Then start simple the small server with the fellowing command
python detect_language.py
To try the web service you can use curl
@yvmarques
yvmarques / gist:2894294
Created June 8, 2012 07:50
Tweet stats from your server
#!/usr/bin/env python
import tweepy
import commands
import time
# Fill these informations from you Twitter App Admin
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
module ActiveRecord::ConnectionAdapters
class Mysql2Adapter
alias_method :execute_without_retry, :execute
def execute(*args)
execute_without_retry(*args)
rescue Mysql2::Error => e
if e.message =~ /server has gone away/i
warn "Server timed out, retrying"
reconnect!
@yvmarques
yvmarques / fabfile.py
Created December 23, 2011 10:58 — forked from onyxfish/fabfile.py
Chicago Tribune News Applications fabric deployment script
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"