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($) { | |
var KEY_ENTER = 13; | |
$.fn.onEnterKey = function(selector, fn) { | |
var handler = function(ev) { | |
if (ev.which === KEY_ENTER) { | |
return fn(ev); | |
} | |
}; |
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($) { | |
$('.dblog-event tr:eq(5) td').wrapInner('<pre></pre>'); | |
}(jQuery)); |
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($, author) { | |
$('.comment').each(function() { | |
var $avatar = $('.avatar', this); | |
var commentAuthor = $('.meta .author a', this).text(); | |
if (commentAuthor === author) { | |
$avatar.css({ | |
'background-image': 'url(http://media.uccdn.com/it/images/5/5/4/img_come_mascherarsi_dalla_figlia_dell_esorcista_455_orig.jpg)', | |
'background-size': '100%' | |
}); | |
} |
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/sh | |
# Usage: | |
# cat useful_script.js | bash bookmarketify.sh | |
# Uglify js needs to be available. If not, abort and write an error message to stderr. | |
uglify=$(which uglifyjs) | |
if [ "$uglify" == "" ]; then | |
echo "uglifyjs command not found. Install it via npm install -g uglify-js" 1>&2; | |
exit 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
-- Creates a Backup and Migrate destinaton which writes backups in <project>/database. | |
-- Inside document root (e.g <project>/webroot) run: drush bam-backup db database_folder. | |
-- Backup and Migrate 7.x-2.x | |
INSERT INTO `backup_migrate_destinations` (`destination_id`, `name`, `type`, `location`, `settings`) VALUES | |
('database_folder', 'Database Folder', 'file', '../database', 'a:2:{s:5:"chmod";s:0:"";s:5:"chgrp";s:0:"";}'); | |
-- Backup and Migrate 7.x-3.x | |
INSERT INTO `backup_migrate_destinations` (`machine_name`, `name`, `subtype`, `location`, `settings`) VALUES | |
('database_folder', 'Database Folder', 'file', '../database', 'a:2:{s:5:"chmod";s:0:"";s:5:"chgrp";s: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
## Print article date with a localized format. | |
############################################## | |
#set ($localeDefault = $localeUtil.getDefault()) | |
## Convert string (with a particular input format) to a Date object. | |
#set ($modifiedDate = $dateTool.toDate("EEE, dd MMM yyyy hh:mm:ss Z", $reserved-article-display-date.getData(), $localeDefault)) | |
## Get the localized format as a string. | |
#set ($dateFormat = "#language ('custom-medium-dateformat-pattern')") | |
$dateTool.format($dateFormat, $modifiedDate) | |
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
# Outlook conditional comments | |
http://templates.mailchimp.com/development/css/outlook-conditional-css/ | |
# Client-specific css | |
http://templates.mailchimp.com/development/css/client-specific-styles/ | |
# Email clients | |
http://templates.mailchimp.com/concepts/email-clients/ | |
# Backgrounds |
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
// Save as apache_modules.php | |
<?php print join("\n", apache_get_modules()); ?> | |
// Save as php_extensions.php | |
<?php print join("\n", get_loaded_extensions()); ?> |
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
# Crop video file via ffmpeg | |
ffmpeg -i in.mp4 -filter:v "crop=out_w:out_h:x:y" out.mp4 | |
# Crop video file via ffmpeg2theora | |
ffmpeg2theora in.mp4 --cropright 6 | |
# Video with image background (NOT TESTED) | |
http://stackoverflow.com/questions/7340149/how-do-i-make-a-video-with-a-static-image-background-in-ffmpeg |
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 | |
pageres_res="1024x768" | |
website=$1 | |
shift | |
while test $# -gt 0 | |
do | |
case "$1" in | |
--drupal) | |
w=294 |