Skip to content

Instantly share code, notes, and snippets.

View adipasquale's full-sized avatar

Adrien Di Pasquale adipasquale

View GitHub Profile
@adipasquale
adipasquale / jquery.ui.selectmenu.wrapperelement.destroy.bug.html
Created June 29, 2011 07:23
jquery.ui.selectmenu - issue - Destroy method doesn't work when using 'wrapperElement' - DEMO
<html>
<head>
<!-- same config than http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html -->
<!--
<link rel="Stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-darkness/jquery-ui.css" type="text/css" />
<link rel="Stylesheet" href="jquery.ui.selectmenu.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery.ui.selectmenu-old.js"></script>
@adipasquale
adipasquale / facebook_download_photos.pl
Created March 27, 2012 16:14
perl script to download photos from facebook. input file should be the source copied from your browser. then write the output of the script in a file and execute it
#!/usr/bin/perl;
@ARGV = ("temp_fb_profile.html");
while (<>) {
while (/(http[a-z\-\.0-9:\/]*\w*)_a.jpg/g) {
print "wget $1_n.jpg\n";
}
}
@adipasquale
adipasquale / gist:3451850
Created August 24, 2012 15:09
test grid has unique numbers
var grid = [
[9, 13, 43, 65, 67],
[61, 19, 54, 34, 24],
[23, 32, 55, 90, 26],
[33, 25, 15, 46, 12],
[14, 27, 17, 46, 22] ];
var balls = [];
_.each(grid, function(line){_.each(line, function(ball){balls.push(ball);}) });
_.uniq(balls).length == balls.length
var ddm = twisterController.twisterModel.viewHandle.dimensionDisplayMap;
var dimvals = twisterController.twisterVariationsData.dimensionValuesDisplay[twisterController.twisterModel.twisterState.currentASIN];
var mmap = "";
for (var i=0;i<ddm.length;i++){
mmap += (" " + ddm[i]+": "+dimvals[i]+"\n");
};
mmap += "\n";
var x=window.prompt("Selected product variant is\n"+mmap+"Use this ASIN to order via Zinc:",twisterController.twisterModel.twisterState.currentASIN);%
[{"name": "Shanghai", "country": "CN", "population": 22315474.0, "latitude": 31.22222, "longitude": 121.45806}, {"name": "Istanbul", "country": "TR", "population": 14804116.0, "latitude": 41.01384, "longitude": 28.94966}, {"name": "Buenos Aires", "country": "AR", "population": 13076300.0, "latitude": -34.61315, "longitude": -58.37723}, {"name": "Mumbai", "country": "IN", "population": 12691836.0, "latitude": 19.07283, "longitude": 72.88261}, {"name": "Mexico City", "country": "MX", "population": 12294193.0, "latitude": 19.42847, "longitude": -99.12766}, {"name": "Beijing", "country": "CN", "population": 11716620.0, "latitude": 39.9075, "longitude": 116.39723}, {"name": "Karachi", "country": "PK", "population": 11624219.0, "latitude": 24.8608, "longitude": 67.0104}, {"name": "Tianjin", "country": "CN", "population": 11090314.0, "latitude": 39.14222, "longitude": 117.17667}, {"name": "Guangzhou", "country": "CN", "population": 11071424.0, "latitude": 23.11667, "longitude": 113.25}, {"name": "Delhi", "country":
@adipasquale
adipasquale / revenus disponibles france metropolitaine - deciles.ipynb
Created December 1, 2018 15:44
iPython Notebook revenus disponibles France Métropolitaine - deciles
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adipasquale
adipasquale / install_caddy.sh
Last active February 28, 2024 10:37
bash script to install and set up Caddy web server with a static website hosted on a GitHub repository
# Install script for Ubuntu server 16.0+.
# Installs and sets up Caddy web server with a static website hosted on a GitHub repository.
# Used in https://blog.dipasquale.fr/en/2018/12/27/build-and-deploy-huge-static-websites-with-caddy/
# This script is a condensed version of https://blog.digitalocean.com/deploying-a-fully-automated-git-based-static-website-in-under-5-minutes/
# Download and extract Caddy :
wget -O caddy.tar.gz "https://caddyserver.com/download/linux/amd64?plugins=http.git&license=personal"
mkdir caddy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Adds parent_conteneur_id and parent_texte_id to
tetiers, textes, sections and articles
pip3 install psycopg2-binary
"""
from argparse import ArgumentParser
import psycopg2
import psycopg2.extras
[{"id":"KALICONT000036745579","titre":"Accord du 15 décembre 2017 relatif à l'évolution des droits familiaux","etat":"VIGUEUR_NON_ETEN","nature":"TI","num":null,"date_publi":"2018-12-31T23:00:00.000Z","mtime":1523036650},{"id":"KALICONT000005635220","titre":"Nouvelle convention collective nationale des ouvriers employés par les entreprises du bâtiment non visées par le décret du 1er mars 1962 (c'est-à-dire occupant plus de 10 salariés) du 7 mars 2018 (Avenant du 7 mars 2018)","etat":"VIGUEUR_NON_ETEN","nature":"IDCC","num":"1597","date_publi":"2018-06-30T22:00:00.000Z","mtime":1548795126},{"id":"KALICONT000005635221","titre":"Nouvelle convention collective nationale des ouvriers employés par les entreprises du bâtiment visées par le décret du 1er mars 1962 (c'est-à-dire occupant jusqu'à 10 salariés) du 7 mars 2018 (Avenant du 7 mars 2018) ","etat":"VIGUEUR_NON_ETEN","nature":"IDCC","num":"1596","date_publi":"2018-06-30T22:00:00.000Z","mtime":1548795126},{"id":"KALICONT000005635186","titre":"Nouvelle conventio