Skip to content

Instantly share code, notes, and snippets.

@stormsson
stormsson / gist:8537132
Created January 21, 2014 09:36 — forked from FestivalBobcats/gist:1319903
JS - Backbone File uploader
(function($){
//
//-------------------------------------- Model : Image
//
Image = Backbone.Model.extend({
defaults: {
'delete' : false
}
});
Original source: http://andreafrancia.it/2010/03/understanding-the-output-of-rsync-itemize-changes.html
YXcstpoguax path/to/file
|||||||||||
`----------- the type of update being done::
|||||||||| <: file is being transferred to the remote host (sent).
|||||||||| >: file is being transferred to the local host (received).
|||||||||| c: local change/creation for the item, such as:
|||||||||| - the creation of a directory
|||||||||| - the changing of a symlink,
@stormsson
stormsson / gist:6d680e4161bdf9268bc3
Last active August 29, 2015 14:01
SH - Batch resize (Mogrify-imagemagick)
mogrify -path ../resized -resize '1280x1200>' -quality 90 *.jpg
ridimensiona
find . -type f -name "*.jpg" -print0 | xargs -0 mogrify -resize '1280x1200>' -quality 90
ridimensiona jpg in tutte le sottocartelle
find . -type f -name "*.jpg" -print0 | xargs -0 mogrify -resize '1280x1200>' -quality 80
ridimensiona e croppa al centro
@stormsson
stormsson / gist:5a50c4e5e65f3eb36157
Last active August 29, 2015 14:02
JS - Angular jQueryui datepicker directive
//Template:
//<input type="text" id="from" ng-model="filter.from" ng-change="getPage(1)" limitMinTo="to" jqdatepicker />
//<input type="text" id="to" ng-model="filter.to" ng-change="getPage(1)" limitMaxTo="from" jqdatepicker />
.directive('jqdatepicker', function () {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModelCtrl) {
@stormsson
stormsson / gist:28559cf08e4dcca5c6ba
Last active May 19, 2020 12:55
PHP - Imagick resize/crop gif
$imagick = new \Imagine\Imagick\Imagine();
$image = $imagick->open($image_path);
$image = $image->getImagick()->coalesceImages();
foreach ($image as $frame)
{
$frame->cropImage($crop_w,$crop_h,0,0);
$frame->thumbnailImage($resize_w,$resize_h);
@stormsson
stormsson / gist:84bdc86fbe055a824993
Created June 17, 2014 15:52
JS - Google Universal Analyiics virtual pageview
ga('send','pageview', 'path_of_the_fake_page');
@stormsson
stormsson / devify
Last active August 29, 2015 14:06 — forked from mrosati84/devify
#!/bin/bash
# create Dev Machine structure
function createStructure {
# TODO
# 1- check existing folders
# 2- ask user for overwriting
if [ -d manifests ] ||
[ -d modules ] ||
[ -d xdebug ] ||
@stormsson
stormsson / wp_domain_replacement.sql
Last active August 29, 2015 14:14
Wordpress Sostituzione dominio
update wp_options set option_value = REPLACE(option_value,'www.old_site.com','www.new_site.com');
update wp_postmeta set meta_value = REPLACE(meta_value,'www.old_site.com','www.new_site.com');
update wp_posts set guid = REPLACE(guid,'www.old_site.com','www.new_site.com'), post_content = REPLACE(post_content,'www.old_site.com','www.new_site.com');
@stormsson
stormsson / config_with_memcache_sesssion.yml
Last active April 5, 2017 05:04
Symfony2 Session management
# app/config.yml
framework:
...
session:
handler_id: %session_handler_id% # read from parameters.yml
#handler_id: session.handler.memcache # use service defined later
services:
# MEMCACHE SESSION MANAGEMENT SERVICE CONFIGURATION
@stormsson
stormsson / protract.sh
Created November 10, 2015 16:36
protract folder
#!/bin/bash
function createStructure {
if [ -f default_conf.js ]; then
echo -ne 'Structure already found, aborting'
else
echo 'Structure not found, creating...'
wget https://github.com/stormsson/protractor_scaffolding/archive/master.zip &&
unzip master &&
rm master.zip &&