Skip to content

Instantly share code, notes, and snippets.

@gabrielstuff
gabrielstuff / Akismet for all your previous contact form 7.md
Created February 6, 2013 22:15
Prevent bad robot cat spamer from using your amazing contact form

#Akismet is great and you already should use it.

Well, guess what you didn't and you have lots of contact for on this latest website. Use this simple sql query to replace and add akismet support to your contact form :

update wp_postmeta set meta_value = replace(meta_value,
'[text* your-name]',
'[text* your-name akismet:author]');
update wp_posts set post_content = replace(post_content,
@gabrielstuff
gabrielstuff / helper.js
Created January 9, 2013 14:29
Helper object
var Helper = {
slugify : function(text) {
text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, '');
text = text.replace(/-/gi, "_");
text = text.replace(/\s/gi, "-");
return text;
},
injectCSS: function(css) {
if ('\v' == 'v') /* ie only */ {
document.createStyleSheet().cssText = css;
@gabrielstuff
gabrielstuff / app.js
Last active December 10, 2015 15:18
a try on angularjs
'use strict';
var easyCvApp = angular.module('easyCvApp', [])
.config(['$routeProvider', function($routeProvider) {
$routeProvider
.when('/', {
templateUrl: 'views/main.html',
controller: 'MainCtrl'
})
.otherwise({
@gabrielstuff
gabrielstuff / localupdate.sh
Created October 17, 2012 23:30
Wordpress Mac updates locally
$ cd /Users/<username>/Sites
$ sudo chown -R _www wordpress
$ sudo chmod -R g+w wordpress
@gabrielstuff
gabrielstuff / random_file_size.md
Created October 16, 2012 21:09
Random file size creation

#Random file size

###Command line to create a custom file size :

dd if=/dev/zero of=testfile.txt bs=100k count=1

@gabrielstuff
gabrielstuff / invite.js
Created October 11, 2012 10:46
Invite all friends
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
if(!document.forms[FormName])
return;
var objCheckBoxes = document.forms[FormName].elements[FieldName];
if(!objCheckBoxes)
return;
var countCheckBoxes = objCheckBoxes.length;
if(!countCheckBoxes)
objCheckBoxes.checked = CheckValue;
@gabrielstuff
gabrielstuff / wp._wp_menu_item_classes_by_context.php
Created September 20, 2012 19:02
overiding wordpress function to handle query + parameters
if(! function_exists("_wp_menu_item_classes_by_context")){
function _wp_menu_item_classes_by_context( &$menu_items ) {
echo "WAP" ;
global $wp_query;
$queried_object = $wp_query->get_queried_object();
$queried_object_id = (int) $wp_query->queried_object_id;
@gabrielstuff
gabrielstuff / societe.com.js
Created September 12, 2012 17:08
Scrapper for the website societe.com
var nodeio = require('node.io');
var main_url = 'http://www.societe.com';
var options = {
max: 20,
timeout: 20,
jsdom: true
};
exports.job = new nodeio.Job(options, {
input: [{
@gabrielstuff
gabrielstuff / Gist history back
Created September 9, 2012 21:56
Gist for removing files, infos from a commit
# Change commit history in git
```
git-checkout 0f0d8a27622e7bf7f008983c4b8ee23bfb9843ab
editor path/to/file
git-add path/to/file
git-commit --amend -v
git-rebase --onto HEAD 0f0d8a27622e7bf7f008983c4b8ee23bfb9843ab master
```
@gabrielstuff
gabrielstuff / php5-fpm.howto.md
Created August 26, 2012 21:03
How to install php5-fpm

#Install php5-fpm on Debian Squeeze

Add the repo to you .list

vi /etc/apt/sources.list

and add :