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
$('selector', context).bind("DOMSubtreeModified", function() { | |
// Do something. | |
}); |
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 | |
/** | |
* Note: If the image is still missing just rerun this script until the cached has been cleared. | |
* | |
* To use this script either you can run this via terminal or browser. | |
* To run this in a terminal: | |
* $ php facebook.util.php [URL] | |
* | |
* To use the browser just put the URL in the text field. | |
*/ |
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
/** | |
* Implements hook_menu(). | |
*/ | |
function my_custom_module_menu() { | |
$items = array(); | |
$items['admin/config/custom'] = array( | |
'title' => 'Custom Settings', | |
'description' => 'App custom settings.', | |
'weight' => -30, |
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
function about_us_fetch_image() { | |
$image_url = NULL; | |
$fid = variable_get('about_us_image', ''); | |
if (is_numeric($fid) && $fid > 0) { | |
$file = file_load($fid); | |
$dest_uri = 's3://about-us-resized.jpg'; | |
// Check if the target image exists. If not, build it. | |
if (!file_exists($dest_uri)) { | |
// Copy the image. | |
file_copy($file, $dest_uri, FILE_EXISTS_REPLACE); |
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
/** | |
* Helper function to send entities to ApacheSolr for immediate index. | |
*/ | |
function _custom_module_apachesolr_index_immediately($entity, $type) { | |
// Get default environment. | |
$env_id = apachesolr_default_environment(); | |
// Check that index isn't read only. | |
if (apachesolr_environment_variable_get($env_id, 'apachesolr_read_only', APACHESOLR_READ_WRITE) == APACHESOLR_READ_ONLY) { | |
return; |
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
// Generate a random numbers to use as url query parameter. This function | |
// will attempt to bypass Facebook share caching. | |
// See the performance test for more info. | |
// http://jsperf.com/random-characters-generator | |
function createCacheBuster () { | |
return Math.random(); | |
} |
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 | |
function tiny_url($url) { | |
$ch = curl_init(); | |
$timeout = 4; | |
curl_setopt($ch, CURLOPT_URL, 'http://tinyurl.com/api-create.php?url=' . $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
$data = curl_exec($ch); | |
curl_close($ch); | |
return $data; |
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
drush sql-dump --gzip --result-file=/PATH/TO/FILENAME.sql |
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
$ sudo a2enmod rewrite | |
$ sudo service apache2 reload |
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
$ sudo apt-get update | |
$ sudo apt-get install build-essential libssl-dev | |
# NOTE: The next command requires curl. | |
# The version number may be different (see https://github.com/creationix/nvm for latest version), | |
# but in general, you can download and install it with the following syntax: | |
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash | |
# Check the message in your screen. You should see something like this: | |
# "Appending source string to /home/gerald/.bashrc" | |
# or | |
# "Appending source string to /home/gerald/.profile". |