Skip to content

Instantly share code, notes, and snippets.

View mavimo's full-sized avatar
⌨️
coding

Marco Vito Moscaritolo mavimo

⌨️
coding
View GitHub Profile
marco@nebula ~ $ ping google.com
PING google.com (216.58.212.110): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
64 bytes from 216.58.212.110: icmp_seq=0 ttl=55 time=3247.303 ms
64 bytes from 216.58.212.110: icmp_seq=1 ttl=55 time=3249.586 ms
64 bytes from 216.58.212.110: icmp_seq=3 ttl=55 time=2876.964 ms
64 bytes from 216.58.212.110: icmp_seq=4 ttl=55 time=1980.436 ms
64 bytes from 216.58.212.110: icmp_seq=6 ttl=55 time=1248.177 ms
@mavimo
mavimo / schema.yml
Created October 29, 2010 15:32
Schema del DB (due entità, A e B)
# Entity A
A:
columns:
name: string(255)
relations:
Bs:
type: many
class: B
local: id
@mavimo
mavimo / create.sql
Created November 13, 2010 18:58
file di creazione della struttura
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
USE `mydb` ;
-- -----------------------------------------------------
-- Table `mydb`.`commento`
-- -----------------------------------------------------
@mavimo
mavimo / carl0s_webform.php
Created April 11, 2012 17:17
Add webform
<?php
// Create webform default element
if (!isset($node->webform)) {
$node->webform = webform_node_defaults();
}
// @todo: remove unused settings
$node->webform['confirmation'] = 'BLA BLA BLA';
$node->webform['confirmation_format'] = 'full_html';
$node->webform['redirect_url'] = '<confirmation>';
@mavimo
mavimo / gist:2376745
Created April 13, 2012 13:05
Set label as placeholder
<?php
hook_form_FORM_ID_alter(&$form, &$form_state, $form_id) {
set_label_as_placeholder($form);
}
function set_label_as_placeholder(&$form) {
foreach (element_children($form) as $name) {
element_children($form[$name]);
if ($form[$name]['#type'] == 'textfield') {
@mavimo
mavimo / convert_video.sh
Created June 9, 2012 14:47
Script di conversione video per HTML5
#!/bin/sh
VIDEO_NAME=$1
VIDEO_BASENAME=${VIDEO_NAME%%.*}
THUMB_FOLDER=thumbs
CONVERTED_FOLDER=converted
VIDEO_WIDTH=480
VIDEO_HEIGHT=640
echo "Conversion of $VIDEO_NAME started"
@mavimo
mavimo / ga_tracking_async.js
Created July 2, 2012 10:03
GA tracking async
Galleria.get()[0].bind('image', function(e) {
_gaq.push(['_setCustomVar', 1, 'Galleria', window.location.href, e.index]);
_gaq.push(['_trackPageview']);
});
@mavimo
mavimo / jsbehavior-demo.js
Created July 2, 2012 10:52
Drupal 7 JS behavior
(function ($) {
Drupal.behaviors.product_search = {
attach: function (context, settings) {
$('.ciripiri-element', context).click(function () {
alert('cliccato');
});
}
};
})(jQuery);
(function ($){
Drupal.behaviors.test_js = {
attach: function(context, settings) {
$('#edit-test-prova').change(function() {
console.log('cambiato');
})
}
}
})(jQuery);
- hosts: all
sudo: yes
vars_files:
- [ "vars/${inventory_hostname}/projects.yml", "vars/projects.yml" ]
tasks:
- include: tasks/projects.yml