Skip to content

Instantly share code, notes, and snippets.

@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: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
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: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
}
});
@stormsson
stormsson / tab
Created January 17, 2014 16:33
HTML - Bootstrap 2.3.2 Tabs
<ul class="nav nav-tabs" id="myTab">
<li class="active"><a href="#home">Home</a></li>
<li><a href="#profile">Profile</a></li>
<li><a href="#messages">Messages</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="home">...</div>
<div class="tab-pane" id="profile">...</div>
@stormsson
stormsson / pdoQuery.php
Created December 19, 2013 13:41
PDO Query using Propel
$sql = "[INSERT QUERY HERE]";
$stmt = Propel::getConnection()->prepare($sql);
$stmt->execute();
$res = $stmt->fetchAll(PDO::FETCH_BOTH);
foreach($res as $row)
{
// ... $pippo = $row['column_name']
// o
@stormsson
stormsson / updater.js
Last active December 23, 2015 19:19
JS - Jquery Ajax Updater
jQuery.ajax('http://url.com',{
dataType: 'html',
data: jQuery('#mainform').serialize(),// or array { data1 : 'value1',... }
success: function(data,textStatus,jqXHR)
{
jQuery('#container_to_update').html(data);
},
error: function (jqXHR,textStatus,errorThrown)
{
jQuery('#message_container').html('Si e\' verificato un errore...');
@stormsson
stormsson / typeahead.js
Created July 10, 2013 14:11
JS - Bootstrap Typeahead / autocomplete
$('.typeahead').typeahead({
source: function (query, process) {
return $.get('/typeahead', { query: query }, function (data) {
return process(data.options);
});
}
});
@stormsson
stormsson / gist:5955610
Last active December 19, 2015 12:29
JS - Refresh Bootstrap Modalbox
jQuery(function()
{
jQuery('body').on('hidden', '.modal', function () {
jQuery(this).removeData('modal');
});
}
@stormsson
stormsson / gist:5866007
Created June 26, 2013 09:18
HTML - Bootstrap Navbar
<div class="container">
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">GE.CO.</a>
<ul class="nav">
<li class="active"><a href="#">Gestione Pagine</a></li>
<li><a href="#">Utenti</a></li>
<li><a href="#">Gestione Sito</a></li>
<li><a href="#">Catalogo</a></li>
<li><a href="#">Area Riservata</a></li>