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 / toast.py
Created November 16, 2012 21:50
Testing a bug with webassets
"""
Usage with the following directory structure : ::
sources/
js/
css/
images/
_build/
static/
css/
@sveetch
sveetch / snapshot-responsive-models.js
Created November 26, 2012 21:34
A NodeJS script using PhantomJs to render some various screen resolution
/*
* A NodeJS script using PhantomJs to render some various screen resolution for a
* web page
*
* Developped with PhantomJs 1.7.0
*
* Script require two arguments :
*
* * The URL to snapshot;
* * The name of the snapshot, it will be suffixed with the used resolution and used as
@sveetch
sveetch / fittext.scss
Last active December 12, 2015 04:18
A simple SCSS mixin to compute font size for each breakpoint.
// Strip unit from a number value
// Usage :
// strip-units(16px);
// Will return "16" (as a number)
@function strip-units($number) {
@return $number / ($number * 0 + 1);
}
// Write font-size rules for each given breakpoint, the font-size is calculated for each
// breakpoint
@sveetch
sveetch / oukilai.sh
Created March 14, 2013 15:24
Alias shell pour faire une recherche rapide avec grep sous le nom de commande "oukilai". Usage : $> oukilai monmotif
# Recherche d'un motif dans tout les fichiers *.py ou *.html récursivement à
# partir de l'emplacement courant
alias oukilai='find . \( -name \*.py -o -name \*.html -o -name \*.css -o -name \*.scss -o -name \*.sass \) -type f | xargs grep $1 -I --color=auto -n -o'
@sveetch
sveetch / urlmap.py
Created March 15, 2013 21:52
A simple command line tool for Django to browse the full url map. You have to put this file in the "management/commands/" directory of an app.
# -*- coding: utf-8 -*-
"""
Command line tool to browse the full url map
"""
from optparse import make_option
from django.utils.termcolors import colorize
from django.conf import settings
from django.core.management.base import CommandError, BaseCommand
@sveetch
sveetch / trunc.py
Created March 27, 2013 12:53
Filtre pour tronquer sur les caractères, utile pour les django <= 1.4 qui ne disposent pas du filtre truncatechars
# -*- coding: utf-8 -*-
from django.template import Library
register = Library()
@register.filter
def truncatestring(value, limit=125):
"""
Coupe une chaine après un certains nombre de caractères
@sveetch
sveetch / xmp_parser.py
Last active December 26, 2015 11:49
Command line tool to extract text layer strings from a Photoshop XMP file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple strings extractor from a Photoshop XMP file
It extract all <photoshop:LayerText/> text from the document then output it in a file.
"""
import os
from xml.etree.ElementTree import ElementTree as ET
@sveetch
sveetch / add_ckeditor_to_form.patch
Created October 25, 2013 14:37
Patch for Zinnia to use the Ckeditor in zinnia entry admin. Depend on djangocms-text-ckeditor that depend on DjangoCMS. Tested with : * django-cms = 2.4.2 * djangocms-text-ckeditor = 1.0.10 * django-blog-zinnia = 0.12.3
diff -U 4 -N -r zinnia/admin/entry.py zinnia_patch/admin/entry.py
--- zinnia/admin/entry.py 2013-09-10 22:19:42.897479915 +0200
+++ zinnia/admin/entry.py 2013-09-10 21:48:27.336230712 +0200
@@ -323,8 +323,11 @@
'',
url(r'^autocomplete_tags/$',
self.admin_site.admin_view(self.autocomplete_tags),
name='zinnia_entry_autocomplete_tags'),
+ url(r'^ckeditor/$',
+ self.admin_site.admin_view(self.ckeditor),
@sveetch
sveetch / content_switcher.js
Created November 7, 2013 07:45
jQuery Plugin to change various content (images, text, css) on various element from a menu
/*
* jQuery Plugin to change various content (images, text, css) on various
* element from a menu
*
* by default the loading spinner usage needs to hide the menu and display the spinner,
* this is at your responsability in your CSS, also it's yours to provide the
* spinner (as an image, background CSS, etc.. as you like)
*
* Usage sample :
*
@sveetch
sveetch / foundation5.3_bugfixes_backport_for_5.2.3.patch
Created June 17, 2014 21:13
Foundation 5.3 bugfixes backported to 5.2.3
--- foundation5/bower_components/foundation/scss/foundation/components/_global.scss
+++ foundation5/bower_components/foundation/scss/foundation/components/_global.scss.patch
@@ -11,8 +11,8 @@
// styles get applied to [data-mysite-plugin], etc
$namespace: false !default;
-// Control the inclusion of experimental properties
-$experimental: true !default;
+/*// Control the inclusion of experimental properties
+$experimental: true !default;*/