Skip to content

Instantly share code, notes, and snippets.

View cristianciofu's full-sized avatar

Cristian CIOFU cristianciofu

  • Strasbourg, France
View GitHub Profile
<?php
function import_csv_to_sqlite(&$pdo, $csv_path, $options = array())
{
extract($options);
if (($csv_handle = fopen($csv_path, "r")) === FALSE)
throw new Exception('Cannot open CSV file');
if(!$delimiter)
$delimiter = ',';
@cristianciofu
cristianciofu / divNoSplitOnPrint.css
Created April 9, 2014 12:43
Force the content of a div to stay on the same page when printing
@media print
{
div.className {
page-break-inside: avoid;
}
}
@cristianciofu
cristianciofu / tabsScreen
Created April 11, 2014 09:12
Use tabs in screen
Add this in .screenrc :
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
@cristianciofu
cristianciofu / EnableXDebugMAMP
Created April 28, 2014 09:39
Enable XDebug in MAMP
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
@cristianciofu
cristianciofu / gist:c94b0e0ab9358da42478
Created February 14, 2015 13:29
Display progress when copying a file (terminal)
rsync --progress /copy/from /copy/to
@cristianciofu
cristianciofu / .gitconfig
Created June 17, 2013 09:19
.gitconfig - proxy settings
[http]
proxy = http://PROXY_ADDRESS:PROXY_PORT
@cristianciofu
cristianciofu / twig_function_from_php.php
Created June 18, 2013 08:57
Add (and use) a custom php function in your twig template
<?php
// let's say we added in our project the "eatCandy" method
// that displays something onsilly the screen
// and now we want to call this method in our template
// NOTE : eatCandyNow will be the name of the twig function we'll create
$function = new Twig_SimpleFunction('eatCandyNow', function () {
return eatCandy(); // our php function
});
$twig->addFunction($function);
@cristianciofu
cristianciofu / jTableColumnEditorFix.css
Created June 19, 2013 13:46
Display the jTable add / edit form on multiple columns
#jtable-create-form, #jtable-edit-form {
display: block;
width: 550px;
-moz-column-gap:40px;
-webkit-column-gap:40px;
column-gap:40px;
-moz-column-count:2;
-webkit-column-count:2;
column-count:2;
}
@cristianciofu
cristianciofu / jTableCascade.js
Last active December 19, 2015 02:29
jTable Dropdowns in Cascade
<script>
// ...
id_famille: {
title: 'Family',
list: true,
create: true,
edit: true,
options: { '1': 'Fam_1', '2': 'Fam_2', '3': 'Fam_3' }
},
id_liste: {
@cristianciofu
cristianciofu / reset_auto_increment.sql
Created July 1, 2013 12:55
Reset AUTO_INCREMENT value in MySQL
ALTER TABLE tablename AUTO_INCREMENT = 1