Skip to content

Instantly share code, notes, and snippets.

@abidibo
abidibo / res1
Created April 30, 2015 15:36
Webcomponents, mica pizza e fichi - res 1
<slideshow>
<img src="//lorempixel.com/670/401" alt="img-1" />
<img src="//lorempixel.com/670/400" alt="img-2" />
<img src="//lorempixel.com/670/399" alt="img-3" />
</slideshow>
@abidibo
abidibo / recreate_session.php
Created November 7, 2011 15:59
Recreate a php session
<?php
define('SESSION_TIMEOUT', '1800'); // 30 minutes
session_name('fuckIE');
session_start();
// ...bla bla
if (isset($_SESSION['last_activity']) && (time() - $_SESSION['last_activity'] > SESSION_TIMEOUT)) {
@abidibo
abidibo / fck_editor_chr_counter.js
Created November 9, 2011 14:42
A proof of character counter for fck editor 2.x
// requires mootools-core bind function
function FCKeditor_OnComplete(editorInstance){
editorInstance.EditorDocument.addEventListener('keypress', checkCharacters.bind(editorInstance));
}
function checkCharacters(e) {
@abidibo
abidibo / get_tree_from_table.php
Created November 10, 2011 16:03
Recursion to get a tree from a id-parent sql table
<?php
// I use here Jeff's db methods
public function getTree($registry, $parent=0) {
$child_rows = $registry->db->autoSelect("id", TABLE, "parent='$parent'", "name");
$children = array();
@abidibo
abidibo / fp_ipad_fix.js
Created March 19, 2012 16:13
Bug fix for flowplayer ipad
video.fp_setPlaylist = function(playlist) {
log("Setting playlist");
activeIndex = 0;
for ( var i = 0; i < playlist.length; i++ ) {
if(typeof playlist[i].url != 'undefined') playlist[i] = fixClip(playlist[i]);
}
activePlaylist = playlist;
// keep flowplayer.js in sync
"use strict";
var numberStringToText;
(function() {
var dict = {
'0': ' ',
'00': '0',
'1': '1',
'11': ',',
'111': '.',
'1111': ':',
@abidibo
abidibo / accessibilità
Created December 5, 2012 09:07
Accessibilità Gino solo testo/altocontrasto/grafica
**in topBar phpModuleView**
=================================
$encode = true;
if($_SERVER['REQUEST_URI'] == '/index.php') {
$ubase = $_SERVER['REQUEST_URI']."?textview=";
$encode = false;
}
elseif(substr($_SERVER['SCRIPT_URL'], -1) == '/') {
$ubase = $_SERVER['REQUEST_URI']."?";
}
@abidibo
abidibo / APE SERVER configuration
Last active December 11, 2015 07:18
Configuration of APE SERVER, 2 machines, 1 serevr and 1 client
GENERAL
=================
Two machines, 1 server and 1 client
The backoffice and frontend applications resides on the server
SERVER
=================
Suppose the server ip on the local netw is 192.168.0.74
ls -la /var/ape
@abidibo
abidibo / mootab.css
Last active December 11, 2015 22:58
A mootools class to create a tab structure. js and css included.
.mootab .tab_contents {
border: 1px solid #eee;
padding: 10px;
}
.mootab .tab_titles .link {
cursor: pointer;
display: inline-block;
border:1px solid #eee;
border-bottom-width: 0;
padding: 2px 5px;
@abidibo
abidibo / time_graph_canvas.js
Last active December 12, 2015 04:38
This is a mootools class which permits to draw a temporal graph over a canvas. Features: - grid system (different steps on tx and y axis) - scale factor different for both axis - x axis (time) discrete - y axis continuous - can't draw in the past, always growing x - maybe more...
// new namespace
var tcg = {};
// main graph controller
tcg.graph = new Class({
options: {
x_grid_step: 20, // grid step in px on x axis
y_grid_step: 40, // grid step in px on y axis
x_factor: 1, // multiplier factor of each grid step on x axis (value = m * grid-steps)