Skip to content

Instantly share code, notes, and snippets.

View klederson's full-sized avatar

Klederson Bueno klederson

View GitHub Profile
@klederson
klederson / HTML5StorageMultidimensional.js
Created October 8, 2012 18:23
Adding Multidimensional Support for javascript / html5 sessionStorage , localStorage or just Storage object
/**
*
* MOVED TO: https://github.com/iFind/html5MultidimensionalStorage
*
* This methods extends the default HTML5 Storage object and add support
* to set and get multidimensional data
*
* @example Storage.setObj('users.albums.sexPistols',"blah");
* @example Storage.setObj('users.albums.sexPistols',{ sid : "My Way", nancy : "Bitch" });
* @example Storage.setObj('users.albums.sexPistols.sid',"Other songs");
@klederson
klederson / phpcs-mac-os-howto.md
Last active January 12, 2023 00:07
How to setup PHP CodeSniffer into PHP Storm with Mac OSX

Good Practices

PHP CodeSniffer into PHP Storm

Install PHPCS in mac

sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
@klederson
klederson / 0_reuse_code.js
Created December 12, 2013 13:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Klederson Bueno <klederson@phpburn.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@klederson
klederson / Gettext.js
Created April 23, 2013 22:19
support file for the tutorial on gist
/*
Pure Javascript implementation of Uniforum message translation.
Copyright (C) 2008 Joshua I. Miller <unrtst@cpan.org>, all rights reserved
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@klederson
klederson / AutomaticSiteTranslation.js
Last active December 16, 2015 14:19
This gist demonstrate how easly integrate Gettext.js + jQuery in a smart/automatized way to translate entire sites by using some ".po" file.
/**
* This is a experimental and fun script/tutorial that demonstrates how to translate sites USING Gettext
* without use _() stuff ( or others ) in your html just by parsing all your html visible text.
*
* @author Klederson Bueno <klederson@phpburn.com>
* @see http://jsgettext.berlios.de/doc/html/Gettext.html
* @see http://www.phpburn.com/
* @version 0.1a
*/
var iFindTranslator = {
@klederson
klederson / gist:3375072
Created August 17, 2012 01:12
Testing jquery.mentionsInput (elastic plugin forced)
lineHeight = 26//parseInt($textarea.css('line-height'),10) || parseInt($textarea.css('font-size'),'10'),
minheight = 32 //|| lineHeight*3,
maxheight = parseInt($textarea.css('max-height'),10) || Number.MAX_VALUE,
goalheight = 0;
@klederson
klederson / kbueno-js-url-detection.js
Created November 28, 2011 21:06
Nice way to dinamicaly identify current url ( or more closer ) into a menu using javascript
$(document).ready(function() {
var currentURL = metaphone(location.href);
var minPercent = 11.00;
var lastMatch = '';
$('#mymenu > ul > li > a').each(function() {
var url = $(this).attr('href');
var compare = metaphone(url);
var dist = levenshtein(currentURL,compare);
var percent = ( (dist/Math.max(currentURL.length,compare.length)) * 100 );
<?php
//Lendo o conteúdo oriundo do Banco de Dados
$data = $orderProduct->content;
//Criando uma imagem baseada em uma string
$dataImage = imagecreatefromstring($data);
//Se ocorreu tudo bem executar o processo de exibição da imagem
//Lembrar sempre que isso deve ser uma chamada a parte por ex: http://localhost/minhaImagem.php ou http://localhost/os/verImagem/1
<?php
$fileName = $pictures['name'][$index];
$tmpName = $pictures['tmp_name'][$index];
$fileSize =$pictures['size'][$index];
$fileType = $pictures['type'][$index];
//Abrindo o arquivo para leitura e conversão em STRING
$fp = fopen($tmpName, 'r'); //$tmpName é o nome e caminho completos para o arquivo em disco
//Lendo o arquivo carregado para uma STRING