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 | |
define('FRAMES_COUNT', 100); | |
define('FRAME_FORMAT', 'frames/frame%04s.jpg'); | |
define('CONTENT_TYPE', 'image/jpg'); | |
$base = dirname(__FILE__); | |
$next = (int) $_COOKIE['next_frame']; | |
$frame = $base . '/' . sprintf(FRAME_FORMAT, $next); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# "Development" variables. | |
drush vset cache 0; | |
drush vset block_cache 0; | |
drush vset cache_lifetime 0; | |
drush vset page_cache_maximum_age 0; | |
drush vset page_compression 0; | |
drush vset preprocess_css 0; | |
drush vset preprocess_js 0; | |
# Set a better default for registration setting. |
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 | |
// Usage: cd SRC; pbpaste | sort | php cpinput.php DEST. | |
$cwd = getcwd(); | |
$dest = $argv[1]; | |
$mode = 0777; | |
while (($f = trim(fgets(STDIN)))) { | |
if (is_dir("$cwd/$f")) { | |
mkdir("$dest/$f", $mode, 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
# Extract frames. One every 1 second(s) | |
ffmpeg -i video.mp4 -r 1 scenes/scene_%04d.png | |
# Convert png to png8 to decrease size. | |
for f in $(ls scenes | grep -i png); do convert "scenes/$f" "PNG8:scenes/$f"; done; | |
# Create animation | |
convert -delay 100 -loop 0 scenes/*.png animation.gif |
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 | |
// Inspired by: /sites/all/modules/views/plugins/views_plugin_query_default.inc | |
$view = views_get_view($view_name); | |
$view->build('default'); | |
$count_query = $view->build_info['count_query']; | |
$count_query->addMetaData('view', $view); | |
$base_table_data = views_fetch_data($view->base_table); | |
$access_tag = $base_table_data['table']['base']['access query 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
http://static.bouncingminds.com/ads/5secs/baileys_5sec.mp4 | |
http://static.bouncingminds.com/ads/5secs/dodson_5sec.mp4 | |
http://static.bouncingminds.com/ads/15secs/dogs_600.mp4 | |
http://static.bouncingminds.com/ads/15secs/dogs_600.flv | |
http://static.bouncingminds.com/ads/15secs/horse_how_to_600.mp4 |
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 | |
// Method 1: get both id key and id value. Verbose way. | |
$entity_wrapper = entity_metadata_wrapper($entity_type, $entity); | |
$pri = $entity_wrapper->entityKey('id'); | |
$entity_id = $entity_wrapper->$pri->value(); | |
// Method 2: get only id value. More succint way. | |
list($entity_id) = entity_extract_ids($entity_type, $entity); |
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
SELECT column_name,column_type | |
FROM information_schema.columns | |
WHERE table_schema = DATABASE() | |
AND table_name='table' | |
ORDER BY ordinal_position; |
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 | |
# Cleans directory from cvs dir/files. | |
# http://snippets.dzone.com/posts/show/934 | |
find "$1" -name 'CVS' -exec rm -rf '{}' \; -print | |
# Generate fake file with a specific size (useful for uploads) | |
head -c 3000000 /dev/urandom > upload_test_3MB.zip | |
# Extracts count per page name in an access_log Apache file |