Attention: if you attempt to fork this gist, github will think that you are a spammer and you will have to confirm that you are human with them. Apparantly there are too many links in this list. Also I update it rather frequently (see revisions on the left), so it's probably wise to not fork it anyway.
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" |
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
#!/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
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
<?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
$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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sticky footer · Twitter Bootstrap</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<!-- CSS --> |
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 | |
# Bench functional programming | |
$start = microtime(true); | |
$fact = function($x, $y = 1) use (&$fact) { | |
if ($x == 0) { | |
return $y; | |
} | |
return $fact($x - 1, $y * $x); | |
}; | |
$fact(30000) . "\n"; |
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
{ | |
"close_windows_when_empty": false, | |
"default_line_ending": "unix", | |
"draw_white_spaces": "all", | |
"ensure_newline_at_eof_on_save": true, | |
"fallback_encoding": "UTF-8", | |
"fold_buttons": false, | |
"font_size": 14.0, | |
"highlight_line": true, | |
"highlight_modified_tabs": true, |
OlderNewer