Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@partageit
partageit / reset-websql-database.js
Last active March 11, 2021 14:15
Reset WebSQL database dropping every tables
var db = openDatabase('myDatabase', '', 'My database description', 5 * 1024 * 1024);
if (reinitDb) {
db.changeVersion(db.version, '', function(t) {
t.executeSql("SELECT name FROM sqlite_master WHERE type='table' and name not like '__Webkit%'", [], function(sqlTransaction, sqlResultSet) {
var table, tablesNumber = sqlResultSet.rows.length;
console.log('DATABASE RESET MODE ENABLED');
for (var i = 0; i < tablesNumber; i++) {
table = sqlResultSet.rows.item(i);
console.log('Removing table: ' + table.name);
@partageit
partageit / slideshow.css
Created March 12, 2015 12:38
Partage-it.com : transition entre les slides pour remark.js
.remark-fading {
z-index: 9;
}
.remark-slide-container {
transition: opacity 1s linear, right 1s ease-in-out;
opacity: 0;
right: 1000px;
}
.remark-visible {
transition: opacity 1s linear, right 1s ease-in-out;
@partageit
partageit / sentora-ssl.conf
Created October 26, 2015 15:08
Enable SSL for Sentora panel
# <virtualhost *:80> already open
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</virtualhost>
<VirtualHost *:443>
ServerAdmin zadmin@localhost
DocumentRoot "/etc/sentora/panel/"
ServerName your-server-address
@partageit
partageit / .bashrc
Created October 31, 2017 16:54
My bash-git-prompt configuration
# git prompt, for ~/.bashrc
GIT_PROMPT_ONLY_IN_REPO=1
GIT_PROMPT_START_USER="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]"
GIT_PROMPT_START_ROOT="${BoldRed}\u@\h${ResetColor}:${BoldBlue}\w${ResetColor}"
GIT_PROMPT_END_USER="\n$ "
GIT_PROMPT_END_ROOT="\n# "
source ~/.bash-git-prompt/gitprompt.sh
@partageit
partageit / aliases
Created November 20, 2014 10:00
My cmder aliases
ll=ls -l --color $*
phpdoc=php "C:\Program Files\phpDocumentor\bin\phpdoc.php"
vi=vim $*
md2html=markdown-html -s "~\Documents\md.css" -w $1 -o $1.html
composer=php "~\Documents\composer.phar" $*
@partageit
partageit / functions.php
Created May 3, 2016 21:56
WooCommerce: enable locale delivery only when minimum amount is reached
<?php
/**
* Disable local delivery when a minimum amount is not reached.
* The minimum amount is the free shipping one.
*/
function setMinimumAmountForLocalDelivery($isAvailable) {
// get cart amount :
if (WC()->cart->prices_include_tax) {
$cartAmount = WC()->cart->cart_contents_total + array_sum(WC()->cart->taxes);
} else {
@partageit
partageit / markdown.css
Created January 15, 2016 11:03
CSS for markdown-html
/* This CSS is for markdown-html */
/* markdown-html -s "/path/to/markdown.css" -w "file.md" -o "file.html" */
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@partageit
partageit / functions-gallery.php
Last active October 14, 2015 04:13
Partage-it.com : changer l'apparence des galeries
@partageit
partageit / functions-bootstrap-carousel-shortcode.php
Last active September 4, 2015 12:25
Partage-it.com : Carrousel d'articles pour WordPress avec Twitter Bootstrap
@partageit
partageit / CodeIndentationShifter.php
Created January 26, 2015 16:55
Code indentation shifter : Shift code to the left, preserving indentation
<?php
/**
* Shift code to the left, preserving indentation.
*
* This is useful when reading code extract in a not-displayed nested structures.
* There is no use of closure here in order to remain compatible with older versions of PHP.
* This method is code agnostic.
* @example
* $code = "";
* $code .= " while ($a) {";