Skip to content

Instantly share code, notes, and snippets.

View nlemoine's full-sized avatar

Nicolas Lemoine nlemoine

View GitHub Profile
@sunny
sunny / liste-de-departements-limitrophes-francais.txt
Last active March 20, 2024 09:47
Liste de départements limitrophes français
01:38,39,69,71,73,74
02:08,51,59,60,77,80
03:18,23,42,58,63,71
04:05,06,26,83,84
05:04,26,38,73
06:04,83
07:26,30,38,42,43,48,84
08:02,51,55
09:11,31,66
10:21,51,52,77,89
@nclavaud
nclavaud / sf2_form.php
Created November 22, 2011 21:16
Symfony2 standalone Form component example
<?php
/**
* @author Nicolas Clavaud <nclavaud@gmail.com>
* http://n.clavaud.free.fr/blog/index.php?article31/symfony2-standalone-form-component-tutorial
*/
namespace Me\MyApp;
use Symfony\Component\ClassLoader\UniversalClassLoader;
@mrinterweb
mrinterweb / deploy.rb
Created July 25, 2012 02:46
Wordpress site deployment using capistrano
set :application, 'www.mysite.com'
set :deploy_to, "/srv/www.mysite.com"
set :domain, "www.mysite.com"
set :user, "deploymentuser"
set :scm, :git
set :repository, "git@github.com:myusername/myproject.git"
set :branch, :master
set :deploy_via, :remote_cache
set :copy_exclude, ['.git']
ssh_options[:forward_agent] = true
@webmozart
webmozart / composer.json
Created August 4, 2012 11:51
DON'T USE THIS GIST! Please clone https://github.com/bschussek/standalone-forms instead.
{
"require": {
"symfony/form": "2.1.*",
"symfony/validator": "2.1.*",
"symfony/templating": "2.1.*",
"symfony/framework-bundle": "2.1.*"
},
"minimum-stability": "dev"
}
@harikt
harikt / index.html.php
Created August 4, 2012 14:50 — forked from webmozart/composer.json
Symfony 2.1 stand-alone form usage with PHP templates
<html>
<head>
<title>Standalone Form Component</title>
</head>
<body>
<form action="#" method="post">
<?php echo $view['form']->widget($form); ?>
<input type="submit" />
</form>
</body>
@BFTrick
BFTrick / sql-command.sql
Last active April 25, 2022 14:31
A SQL command to delete all orphaned post meta data
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@kwylez
kwylez / gist:5337918
Last active March 2, 2020 06:09
Example implementation of listening for iTunes/Spotify track changes and displaying information in the NotificationCenter. Article reference: http://blog.corywiles.com/now-playing-with-spotify-and-itunes
//
// AppDelegate.m
//
//
// Created by Cory D. Wiles on 10/8/12.
// Copyright (c) 2013 Cory D. Wiles. All rights reserved.
//
#import "AppDelegate.h"
#import "iTunes.h"
@jgalea
jgalea / microtime.php
Last active December 7, 2022 01:30
Test execution time of WordPress PHP function
<?php
function my_function() {
$start = microtime(true);
// function code here
$time_taken = microtime(true) - $start;
wp_die( $time_taken ); // in seconds
}
@tomjn
tomjn / custom_page.php
Last active July 3, 2018 11:50
A base class used to create arbitrary content at arbitrary URLs in WordPress without needing a post or listing/archive to host it
<?php
/**
* A helper class to implement arbitrary content at arbitrary URLs without a supporting post or page.
* Inherit from this class and implement the render_page method
*
* @author: Tom J Nowell ww.tomjn.com
* @License: GPL 2+
*/
abstract class Tomjn_Custom_Page {
@sscovil
sscovil / plugin-class-autoloader.php
Last active December 20, 2015 08:09
This class autoloader function eliminates the need to include_once every class file in your WordPress plugin. It adheres to WordPress file naming conventions, so instantiating a class named MyClass would attempt to include_once a file called inc/class-myclass.php.
<?php
/**
* Plugin Name: My Plugin
* Description: A sample plugin with class autoloader, for object-oriented programming.
* Version: 0.1
* Plugin URI: http://shaunscovil.com/
* Author: Shaun Scovil
* Author URI: http://shaunscovil.com/
* License: GPL2
*/