This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$items[variable_get('file_public_path', conf_path() . '/files') . '/pdf/%'] = array( | |
'page callback' => '...', | |
'page arguments' => array(1), | |
'access callback' => TRUE, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
NewerOlder