Skip to content

Instantly share code, notes, and snippets.

View Darklg's full-sized avatar
👀
¯\_(ツ)_/¯

Kévin Rocher / @Darklg Darklg

👀
¯\_(ツ)_/¯
View GitHub Profile
@Darklg
Darklg / boot.php
Created August 9, 2017 13:13
Bootstrapping WordPress
<?php
/* Start in the correct directory */
chdir(dirname(__FILE__));
$bootstrap = 'wp-load.php';
while (!is_file($bootstrap))
/* If there is a parent directory and we are not in the root dir */
if (is_dir('..') && getcwd() != '/') {
chdir('..');
} else {
<?php
$address = '31 rue du 2 chat, 75011 Paris';
function extract_address_fr($address) {
$address_parts = array();
// Remove all punctuation
$address_clean = str_replace(array(',', ';'), ' ', $address);
@Darklg
Darklg / gist:8680b4f6befd5f440d22
Last active November 4, 2015 09:44
Text Expander - Translate FR to EN
#!/usr/bin/php
<?php
$fromLang = 'fr';
$toLang = 'en';
$text = <<<'CLIP'
%clipboard
CLIP;
function wd_remove_accents($str, $charset = 'utf-8') {
@Darklg
Darklg / gist:049914a2330d2f7b8d2f
Last active October 23, 2015 14:07
Disable iTunes launch at every media key press
# Disable iTunes launch at every media key press
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist
# Enable
launchctl load -w /System/Library/LaunchAgents/com.apple.rcd.plist
@Darklg
Darklg / Change Your Password.md
Last active August 29, 2015 14:00
Change Your Password links
@Darklg
Darklg / gist:8195666
Last active January 1, 2016 20:09
Extract WordPress functions from reference http://codex.wordpress.org/Function_Reference
var archive = [];
jQuery('#bodyContent').find('table[cellspacing]').find('tt a').each(function() {
archive.push(jQuery(this).text().trim())
});
console.log(JSON.stringify(archive));
@Darklg
Darklg / todo.md
Last active December 30, 2015 06:19
Test todo
  • Dolor

  • Ipsum

  • Ipsum

  • Ipsum

  • Dolor

  • Facto

  • Facto

@Darklg
Darklg / gist:6218696
Last active December 21, 2015 00:18
Pull all your git repositories in a single command
#!/bin/bash
function pullall {
# Go to folder
cd $1;
# Check if it's a git repository
if test -d ".git/"; then
# Display repository name
echo -e "\033[33m "$1" \033[0m";
# Check repository status
@Darklg
Darklg / new_gist_file
Created May 23, 2013 09:02
HTML tag with conditional comments
<!--[if lt IE 8 ]><html lang="fr-FR" class="no-js is_ie7 lt_ie8 lt_ie9 lt_ie10"><![endif]-->
<!--[if IE 8 ]><html lang="fr-FR" class="no-js is_ie8 lt_ie9 lt_ie10"><![endif]-->
<!--[if IE 9 ]><html lang="fr-FR" class="no-js is_ie9 lt_ie10"><![endif]-->
<!--[if gt IE 9]><html lang="fr-FR" class="no-js is_ie10"><![endif]-->
<!--[if !IE]><!--> <html lang="fr-FR" class="no-js"><!--<![endif]-->
@Darklg
Darklg / gist:5386786
Last active December 16, 2015 05:48
Installation Jekyll Mac OS X
# Install Command Line Tools from Xcode
# Install RVM
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled
# http://stackoverflow.com/questions/15324590/rvm-install-ruby-1-9-3-missing-required-packages
rvm requirements
brew install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite