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
/** | |
* Imports translations from a .po file into the local database. | |
* | |
* @param string $filepath | |
* Full filepath to a .po translations file. | |
*/ | |
function maya_updates_api_import_translations($filepath, $langcode) { | |
_maya_updates_api_load_locale(); | |
drupal_load('module', 'file'); | |
watchdog(__FUNCTION__, 'Importing @file string translations.', array('@file' => $filepath), WATCHDOG_NOTICE); |
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 | |
/** | |
* Implements hook_menu(). | |
*/ | |
function mymodule_menu() { | |
$items['user/%user/bb_licenses/%'] = array( | |
'title' => 'Saludar', | |
'page callback' => 'gestionar_licencia', | |
'page arguments' => array(1,3), | |
'type' => MENU_CALLBACK, |
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 | |
/** | |
* Implements hook_preprocess_html(). | |
*/ | |
function nes_preprocess_html(&$variables) { | |
// Add some special classes to the HTML tag, so that we can style on a per-view basis. | |
// Get the current function handling the page. | |
$variables['menu_item'] = menu_get_item(); | |
// If it is a views.module provided page, add some classes to the html tag. |
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
$view = new view(); | |
$view->name = 'user_content_friend'; | |
$view->description = ''; | |
$view->tag = 'default'; | |
$view->base_table = 'users'; | |
$view->human_name = 'User content friend'; | |
$view->core = 7; | |
$view->api_version = '3.0'; | |
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ |
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
#!/bin/bash | |
$ pear install Net_SmartIRC | |
downloading Net_SmartIRC-1.0.2.tgz ... | |
Starting to download Net_SmartIRC-1.0.2.tgz (184,705 bytes) | |
........................................done: 184,705 bytes | |
install ok: channel://pear.php.net/Net_SmartIRC-1.0.2 | |
# Now the class is downloaded to my local include path. |
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
#!/bin/bash | |
TMP="/tmp" | |
DB_USER="root" | |
DB_PASSWD="password" | |
SITES_DIR="/var/www" | |
S3_BUCKET="s3://bucket-name" | |
DATE=$(date +%Y-%m-%d) | |
# Backup all databases to S3 | |
for DB in $(mysql --user=$DB_USER --password=$DB_PASSWD -e 'show databases' -s --skip-column-names|grep -Ev "^(information_schema|performance_schema|mysql)$"); |
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
#!/bin/bash | |
brew install python | |
pip install http://googlecl.googlecode.com/svn/trunk/ | |
google docs list | |
# Then this will happen: | |
# Please specify user: me@email.com | |
# Please log in and/or grant access at https://www.google.com/accounts/OAuthAuthorizeToken?oauth_token=NYAN-NYAN-NYAN&hd=email.com | |
# *your browser opens, you grant access, it gives you a token, you paste it in next* | |
# Please enter the verification code on the success page: |
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
$ grep --version | |
grep (BSD grep) 2.5.1-FreeBSD | |
$ ggrep --version | |
ggrep (GNU grep) 2.14 | |
# Here it goes | |
$ time cat varnish_log_200_only.txt | ggrep -F 'www.some.url.gov' | wc -l | |
957979 |
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 | |
/** | |
* Implements hook_scheduler_api(). | |
* | |
* @param $node | |
* The node object being acted upon. | |
* @param $action | |
* Action being performed. Either 'publish' or 'unpublish'. | |
* | |
* @see _scheduler_publish() |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<package xmlns="http://apple.com/itunes/importer" version="film4.5"> | |
<provider>Paramount</provider> | |
<language>en-US</language> | |
<video> | |
<type>film</type> | |
<subtype>feature</subtype> | |
<vendor_id>09736156444</vendor_id> | |
<isan>0000-0000-03B6-0000-O-0000-0000-2</isan> | |
<upc>09736156444</upc> |