Skip to content

Instantly share code, notes, and snippets.

View revolunet's full-sized avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@revolunet
revolunet / redisfile.py
Created August 23, 2012 23:36
REDIS file caching
import hashlib
from redis import Redis
#
# automatically cache file access to a redis instance
# check if file changed via md5
#
class RedisFileManager(object):
""" cache file access to a redis instance """
@revolunet
revolunet / migrate.sh
Created November 8, 2012 10:55
Django DB migration
#
# Migration from some DB to Another (Sqlite->Mysql)
# The DB_NAMES are from the django settings.py
#
# if something goes wrong, change the log level to DEBUG for django.db in your settings.py logging conf
#
# first, remove useless tables from the existing DB
from django.db import connection
current_tables = connection.introspection.table_names()
@revolunet
revolunet / app.js
Created November 15, 2012 00:52
Angular focusMe directive, watch example
// copied from http://plnkr.co/edit/1LhUJ4?p=preview
angular.module('myApp', [])
.directive('focusMe', function () {
return {
restrict: 'A',
scope: {
focusMe: '='
},
link: function (scope, elt) {
scope.$watch('focusMe', function (val) {
@revolunet
revolunet / mailgun-test.py
Last active September 6, 2022 17:08
create and send a tracked message through the mailgun SMTP gateway
# -*- encoding: UTF-8 -*-
import smtplib
import json
from email.mime.text import MIMEText
MAILGUN_SMTP_LOGIN = "[email protected]"
MAILGUN_SMTP_PASSWORD = "secret"
def send_message_via_smtp(from_, to, mime_string):
@revolunet
revolunet / angularjs.md
Last active April 21, 2025 07:22
BeerJS + AngularJS Paris le 25/2

AngularJS best ressources

Following the AngularJS PARIS meetup (25/2 à 19h à Paris with @sampaccoud @dzen @_kemar @tchack13 @vinz et @revolunet)

Here's our best AngularJS ressources : twitter, github, articles & blogs. Please comment and add your good stuff !

@revolunet
revolunet / icon-packs.md
Last active December 28, 2019 16:36
List of free icon packs

Icon ressources collection

@revolunet
revolunet / demo.html
Last active May 21, 2020 11:13
AngularJS ngLoading directive. show a loader based on an attribute and restore content when ready.
<!DOCTYPE html>
<html ng-app >
<head lang="en">
<meta charset="utf-8">
<title>ngLoading demo</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<link rel="stylesheet" href="style.css">
<script src="ngLoading.js"></script>
</head>
@revolunet
revolunet / extjs-date-override.js
Created February 4, 2013 14:50
ExtJS date filter fix for Internet Explorer (IE8)
var originalFormat = Ext.util.Format.date;
Ext.override(Ext.util.Format, {
date: function(v, format) {
if (Ext.isIE && !Ext.isDate(v)) {
if (v && v.indexOf('T')>-1) {
// assume ISO format
v = Ext.Date.parse(v, 'Y-m-dTH:i:s.u');
}
}
return originalFormat(v, format);
@revolunet
revolunet / social.py
Last active January 14, 2021 05:58
Sample custom pipeline for django-social-auth and Facebook backend. Goal is to ask more info to the user before creating the account and the related Customer model.
# settings.py
FACEBOOK_EXTENDED_PERMISSIONS = ['email', 'user_birthday', 'user_location']
SOCIAL_AUTH_PIPELINE = (
'social_auth.backends.pipeline.social.social_auth_user',
'social_auth.backends.pipeline.user.get_username',
'social_auth.backends.pipeline.misc.save_status_to_session',
'web.facebook.check_registered',
'social_auth.backends.pipeline.user.create_user',
'web.facebook.check_profile',
'social_auth.backends.pipeline.social.associate_user',
@revolunet
revolunet / cleanup.sh
Last active December 15, 2015 00:19
rename all files/dir without special characters...
find . -name '*è*' | sed 'p;s/è/e/' | sed 's/.*/"&"/' | xargs -n2 mv
find . -name '*é*' | sed 'p;s/é/e/' | sed 's/.*/"&"/' | xargs -n2 mv
find . -name '*ê*' | sed 'p;s/ê/e/' | sed 's/.*/"&"/' | xargs -n2 mv