Skip to content

Instantly share code, notes, and snippets.

View madeingnecca's full-sized avatar
🏠
Working from home

Damiano Seno madeingnecca

🏠
Working from home
  • Venice - Italy
View GitHub Profile
@madeingnecca
madeingnecca / jquery.onenterkey.js
Created September 29, 2014 21:41
JS - jQuery onEnterKey
(function($) {
var KEY_ENTER = 13;
$.fn.onEnterKey = function(selector, fn) {
var handler = function(ev) {
if (ev.which === KEY_ENTER) {
return fn(ev);
}
};
@madeingnecca
madeingnecca / gist:ee3de799e16f068a255a
Last active August 29, 2015 14:06
DRUPAL - better watchdog detail
(function($) {
$('.dblog-event tr:eq(5) td').wrapInner('<pre></pre>');
}(jQuery));
@madeingnecca
madeingnecca / gist:96c7dea5381c870bbcef
Created September 16, 2014 16:26
ACTIVE COLLAB - funny avatars
(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%'
});
}
@madeingnecca
madeingnecca / bookmarkletify.sh
Last active August 29, 2015 14:05
JS - BOOKMARKLETIFY
#!/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
@madeingnecca
madeingnecca / gist:80d4992baca9b9527236
Last active August 29, 2015 14:02
DRUPAL 7 - DB UTILS
-- 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:"";}');
@madeingnecca
madeingnecca / gist:9f7bcabc00dd2b1d91e7
Last active March 11, 2016 10:01
LIFERAY VELOCITY utils
## 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)
@madeingnecca
madeingnecca / gist:11328933
Last active August 29, 2015 14:00
HTML EMAIL UTILS | useful links
# 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
@madeingnecca
madeingnecca / gist:10505490
Created April 11, 2014 22:07
HOSTING utils
// Save as apache_modules.php
<?php print join("\n", apache_get_modules()); ?>
// Save as php_extensions.php
<?php print join("\n", get_loaded_extensions()); ?>
@madeingnecca
madeingnecca / gist:9545101
Last active August 29, 2015 13:57
MULTIMEDIA - video utils
# 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
@madeingnecca
madeingnecca / theme_screenshot.sh
Last active August 29, 2015 13:56
BASH - create screenshots for cms themes
#!/bin/bash
pageres_res="1024x768"
website=$1
shift
while test $# -gt 0
do
case "$1" in
--drupal)
w=294