Skip to content

Instantly share code, notes, and snippets.

View cristianciofu's full-sized avatar

Cristian CIOFU cristianciofu

  • Strasbourg, France
View GitHub Profile
@cristianciofu
cristianciofu / dialog.html
Created February 2, 2019 10:30 — forked from arthurattwell/dialog.html
Google Sheets script to allow multi-select in cells with data-validation (adapted from https://www.youtube.com/watch?v=dm4z9l26O0I)
<div style="font-family: sans-serif;">
<? var data = valid(); ?>
<form id="form" name="form">
<? if(Object.prototype.toString.call(data) === '[object Array]') { ?>
<? for (var i = 0; i < data.length; i++) { ?>
<? for (var j = 0; j < data[i].length; j++) { ?>
<input type="checkbox" id="ch<?= '' + i + j ?>" name="ch<?= '' + i + j ?>" value="<?= data[i][j] ?>"><?= data[i][j] ?><br>
<? } ?>
<? } ?>
<? } else { ?>
@cristianciofu
cristianciofu / leclerc_memory_de_noel_cheat.js
Last active December 6, 2016 10:32
JS + Bookmarklet - cheat Grand Jeu "Memory de Noël" - E.Leclerc
// More details + demo :
// *****************************************************************
// ===> http://cristianciofu.github.io/cheat-game-leclerc/
// *****************************************************************
// #1 : JS version :
var colors=["#0F5858","#F0A458","#50F1FF","#FF0000","#0062F6","#AF0F40","#FF00FF","#0FF4C6","#00CC00"],matches=[];$.each($("#game>div.card"),function(a,b){$.inArray($("#"+b.id).data("id"),matches)<0&&matches.push($("#"+b.id).data("id")),$("#"+b.id).css("border","8px solid "+colors[$.inArray($("#"+b.id).data("id"),matches)])}),$("#game>div.card").click(function(){$(this).css("border","0")});
@cristianciofu
cristianciofu / server.js
Created January 17, 2016 09:27
Express quick server
var express = require("express");
var app = express();
app
.use(express.static('./'))
.get('*', function(req, res) {
res.sendFile(__dirname + '/index.html');
})
.listen(3000);
@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 / 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 / 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 / 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;
}
}
<?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 / sl_snippet_654566.xml
Created December 11, 2013 09:07
Sublime Text : getters & setters snippet
<!--
Generate getters and setters for your php sources
usage : gs <tab>
(c) http://akrabat.com/software/improved-sublime-text-2-php-getter-and-setter-generation/
-->
@cristianciofu
cristianciofu / Default (Windows).json
Last active May 24, 2016 14:38
Sublime Text 2 - installed packages + different personal settings
[
{ "keys": ["ctrl+d"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["ctrl+shift+up"], "command": "duplicate_line" },
{ "keys": ["ctrl+shift+down"], "command": "duplicate_line" },
{ "keys": ["alt+up"], "command": "swap_line_up" },
{ "keys": ["alt+down"], "command": "swap_line_down" },
{ "keys": ["ctrl+shift+d"], "command": "find_under_expand" },