Skip to content

Instantly share code, notes, and snippets.

@soyuka
soyuka / gradient.jquery.js
Last active December 16, 2015 16:19
JQuery 1.9.1 basic gradient generator plugin which avoids browser prefixes thanks to jQuery !
/**
* Usage
*
$('.gradient').gradientGenerator({colors : ['green', 'yellow', 'red']});
$('.change-color').on('click', function(e) {
e.preventDefault();
$('.gradient').gradientGenerator({
colors : ['red', 'yellow', 'black'],
@soyuka
soyuka / smoothScrollTo.jquery.js
Last active December 17, 2015 08:49
Smooth Scroll To from link hash in a defined container especially done for OnePage websites.
/*
Use example :
$('a[href^="#"]').SmoothScrollTo('slow', 'container');
or
$('a[href^="#"]').SmoothScrollTo();
A margin is automaticaly taken from the container padding-top.
*/
(function($) {
@soyuka
soyuka / icon.css
Created May 20, 2013 20:23
Entypo css font-face
[class^="icon"] {
position: relative;
display: inline-block;
margin-right: .1em;
text-align: center;
font-family: 'EntypoRegular';
font-weight: normal;
font-style: normal;
}
@soyuka
soyuka / TodatabaseKey.php
Last active December 18, 2015 02:58
Small gist to transform a var to non utf-8 caracters
$_normalizeChars = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u',
'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b', 'ÿ'=>'y', 'ƒ'=>'f'
);
/**
@soyuka
soyuka / packer.isotope.js
Last active December 19, 2015 08:29
Bin-Packing adaptation for isotope. This plugin also resize images container to fit the given grid, see comments. It performs a perfect-masonry like, by sorting elements through height.
/*!
* Bin-Packing by jakesgordon
* https://github.com/jakesgordon/bin-packing/
* Demo : http://codeincomplete.com/posts/2011/5/7/bin_packing/example/
* Licence : https://github.com/jakesgordon/bin-packing/blob/master/LICENSE
*/
Packer = function(w, h) {
this.init(w, h);
};
@soyuka
soyuka / HtmlToBBCode.js
Created August 8, 2013 11:50
Html To BBCode javascript function
//Adapted from http://skeena.net/htmltobb/
var htmlToBBCode = function(html) {
html = html.replace(/<pre(.*?)>(.*?)<\/pre>/gmi, "[code]$2[/code]");
html = html.replace(/<h[1-7](.*?)>(.*?)<\/h[1-7]>/, "\n[h]$2[/h]\n");
//paragraph handling:
//- if a paragraph opens on the same line as another one closes, insert an extra blank line
@soyuka
soyuka / install.sh
Last active December 22, 2015 00:29 — forked from clemherreman/install.sh
sudo apt-get update && sudo apt-get install git-core curl build-essential openssl libssl-dev
git clone https://github.com/joyent/node.git
cd node
# 'git tag' shows all available versions: select the latest stable.
git checkout 0.10.17
# Configure seems not to find libssl by default so we give it an explicit pointer.
# Optionally: you can isolate node by adding --prefix=/opt/node
@soyuka
soyuka / Joomfish Database update
Created September 23, 2013 15:20
Update Joomfish 1.5 datas to Jommfish 2.5 datas, previous update done with JUpgrade, just launch this script by providing the prefix of the old DB and the new one.
<?php
//Script founded here :
//http://joomlastuffs.blogspot.fr/2013/03/how-to-migrate-joomfish-menu-from.html
$prefix_15 = 'ass_';
$prefix_25 = 'aas_2';
$dbname = 'mondassu_insurance';
/*NOTE*/
/*----*/
@soyuka
soyuka / csvToSQL.php
Last active December 28, 2016 11:36
CSV to SQL database Create a table according to the csv keys and put the csv content in it To be improved !
<?php
set_time_limit(0);
private $_normalizeChars = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
@soyuka
soyuka / gist:6701088
Last active December 23, 2015 22:09
UTF8 SQL Dump
http://makandracards.com/makandra/595-dumping-and-importing-from-to-mysql-in-an-utf-8-safe-way
Cygwin + WAMP example :
$ /cygdrive/c/wamp/bin/mysql/mysql5.6.12/bin/mysqldump.exe -v -u root [-p pw] database -r dump.sql