Skip to content

Instantly share code, notes, and snippets.

View sveetch's full-sized avatar
🥝
I'm a kiwi

David THENON sveetch

🥝
I'm a kiwi
View GitHub Profile
@sveetch
sveetch / html_listing.py
Created August 23, 2017 14:23
Batch image optimisation, resizing for thumb and html listing
# -*- coding: utf-8 -*-
import os, io
# Some HTML template to produce for Django to list images
ALBUM_TPL = u"""<div class="item">
<img src="{{% static 'images/album/{thumb}' %}}"
alt="{name}">
</div>
"""
@sveetch
sveetch / _spinner.scss
Created August 23, 2017 09:53
Sass spinner mixin sample
/*
* Pure CSS spinner, taken from:
* https://stephanwagner.me/only-css-loading-spinner
*
* You may also see:
* https://github.com/loadingio/loading.css
*/
@keyframes spinner {
to {transform: rotate(360deg);}
}
@sveetch
sveetch / jquery.sampleplugin.js
Created May 23, 2017 15:49
jQuery plugin basic sample
/*
* jQuery plugin basic sample
*
* Usage exemple:
*
* $('.something').sampleplugin();
* $('.something').sampleplugin('destroy');
*
*/
(function ( $ ) {
@sveetch
sveetch / jquery.fpoimg.js
Created May 5, 2017 09:07
jQuery plugin to transform every <img> source to a fpoimg url with original natural image dimensions
/*
* jQuery plugin to transform every <img> source to a fpoimg url with original
* natural image dimensions, this won't work with SVG images nor background
* images.
*
* You should instanciate this plugin before everything else that manipulate
* images.
*
* Usage exemple:
*
@sveetch
sveetch / .bowerrc
Last active March 2, 2017 10:27
Deploying Foundation6 sources
{
"directory": "../../foundation-sites-6.3.1/vendor"
}
@sveetch
sveetch / round-font-icon-mixin.scss
Last active August 25, 2017 23:39
Mixin to make generic rounded border on font icon
/*
* Mixin for generic rounded webfont icon
*
*/
@mixin -emencia-round-font-icon(
$inner-padding: 1rem,
$font-size: 2rem,
$color: $black,
$border-width: 0.1rem,
$border-color: null
@sveetch
sveetch / codemirror_datas_extract.py
Created August 31, 2016 22:52
Some datas about CodeMirror components used for djangocodemirror dev
# -*- coding: utf-8 -*-
"""
Some tools to extract datas about codemirror components (modes, themes)
This is only designed to developers. You will have to use it like so: ::
python extract.py
"""
import os, json
@sveetch
sveetch / fabfile.py
Last active July 10, 2016 20:35
Fabric tasks basic sample
# -*- coding: utf-8 -*-
"""
Some ssh script stuff using 'fabric'
My personnal environment use ssh keys with passphrase
(some empty, some other not) to connect to knowed hosts.
Install requires:
* Needed C build toolchain to compile C modules;
@sveetch
sveetch / quassel_logs.py
Last active June 28, 2016 22:22
Some very basic code to search for a content in Quassel logs
# -*- coding: utf-8 -*-
"""
Very basic code to search within logs from Quassel IRC client
Tested on Quassel v0.10.0 (dist-575f27e)
"""
import sqlite3
import os
import json
@sveetch
sveetch / casperjs_authenticator.js
Created January 19, 2016 23:28
CasperJS script to authenticate and store persistent cookie through profile for SlimerJS
/*
*
* This is a CasperJS script.
*
* It try to authenticate so the session cookie can be stored in current profile
* and then BackstopJS+CasperJS+SlimerJS can use the same cookie during tests.
*
* Scenario
* ========
*