Skip to content

Instantly share code, notes, and snippets.

View mdarse's full-sized avatar

Mathieu Darse mdarse

  • Paris
View GitHub Profile
@mdarse
mdarse / MIT-LICENSE.txt
Created July 19, 2012 15:37 — forked from jgarber/MIT-LICENSE.txt
Responsive video
Copyright (c) 2011 ZURB, http://www.zurb.com/
@mdarse
mdarse / reset.sh
Created August 3, 2012 12:43
Symfony 2 reset
#!/bin/bash
read -p "The database and all data associated will be deleted, press any key to continue... (Ctrl+C to abort)"
echo "=== Installing dependencies (will warm-up cache too)"
composer install
echo "=== Suppression de la base de donnée actuelle"
app/console doctrine:database:drop --force
echo "=== Création d'une nouvelle base de donnée"
@mdarse
mdarse / gist:3421633
Created August 22, 2012 02:29 — forked from maximevalette/gist:3307568
Supprimer .DS_Store
find . -name .DS_Store -type f -exec rm -v {} \;
@mdarse
mdarse / junkmail.php
Created August 22, 2012 02:51 — forked from maximevalette/junkmail.php
Détecter les adresses junkmail
<?php
function junkMail($mail) {
$domains = array('pjjkp.com', 'ephemail.com', 'ephemail.org', 'ephemail.net', 'jetable.org', 'jetable.net', 'jetable.com', 'yopmail.com', 'haltospam.com', 'tempinbox.com', 'brefemail.com', '0-mail.com', 'link2mail.net', 'mailexpire.com', 'kasmail.com', 'spambox.info', 'mytrashmail.com', 'mailinator.com', 'dontreg.com', 'maileater.com', 'brefemail.com', 'yopmail.com', '0-mail.com', 'brefemail.com', 'ephemail.net', 'guerrillamail.com', 'guerrillamail.info', 'haltospam.com', 'iximail.com', 'jetable.net', 'jetable.org', 'kasmail.com', 'klassmaster.com', 'kleemail.com', 'link2mail.net', 'mailin8r.com', 'mailinator.com', 'mailinator.net', 'mailinator2.com', 'myamail.com', 'mytrashmail.com', 'nyms.net', 'shortmail.net', 'sogetthis.com', 'spambox.us', 'spamday.com', 'Spamfr.com', 'spamgourmet.com', 'spammotel.com', 'tempinbox.com', 'yopmail.com', 'yopmail.fr', 'guerrillamail.org', 'temporaryinbox.com', 'spamcorptastic.com', 'filzmail.com', 'lifebyfood.com', 'tempemail.net', 'spamfr
@mdarse
mdarse / handlebars-helpers.js
Created November 15, 2012 00:05 — forked from elidupuis/handlebars-helpers.js
Simple Handlebars.js helpers
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
console.log("====================");
jasmine.Matchers.prototype.toBePromise = ->
this.actual.done && !this.actual.resolve
jasmine.Matchers.prototype.toBeRejected = -> this.actual.isRejected()
jasmine.Matchers.prototype.toBeResolved = -> this.actual.isResolved()
jasmine.Matchers.prototype.toBeResolvedWith = ->
expectedArgs = jasmine.util.argsToArray(arguments);
unless this.actual.done
throw new Error('Expected a promise, but got ' + jasmine.pp(this.actual) + '.');
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
function cloneObject(object) {
return extendObject({}, object);
}
function extendObject(base, object) {
var visited = [object];
// http://en.wikipedia.org/wiki/Adjacency_list_model
var set = [{value: base}];
@mdarse
mdarse / clone.js
Created August 2, 2013 10:13 — forked from Raynos/clone.js
function clone(o) {
return Object.create(
Object.getPrototypeOf(o),
Object.getOwnPropertyDescriptors(o)
);
}
@mdarse
mdarse / query.pp
Last active August 29, 2015 14:08
IN syntax grammar
%skip space \s
%token in IN
%token word \S+
#query:
in_expression() | text() | unrestricted_text()
#in_expression:
text() ::in:: field()