Skip to content

Instantly share code, notes, and snippets.

Avatar

Guillaume Bartolini guizmo

View GitHub Profile
@guizmo
guizmo / nc_list.php
Created Jan 17, 2013
List commune New Caledonia
View nc_list.php
function nc_opt_list_communes() {
$options = array(
'98812' => 'Boulouparis',
'98870' => 'Bourail',
'98813' => 'Canala',
'98830' => 'Dumbéa',
'98881' => 'Farino',
'98815' => 'Hienghène',
'98816' => 'Houaïlou',
'98811' => 'îles Belep',
View resize.js
//http://wp.tutsplus.com/tutorials/theme-development/creating-a-wordpress-post-text-size-changer-using-jquery/
// This prevents the execution of the code before the document is finished loading.
jQuery(document).ready(function() {
    // The 'A+' element  in the page is associated with the jQuery click() event.
    jQuery('#increase-font').click(function(event) {
        // This prevents the default action of the click() event from being triggered.
        event.preventDefault();
        // The jQuery each() event interates over each elements belonging to the 'resize' class
        jQuery('.resize').each(function() {
            // Call to a custom function to increase the text size
View delete.sh
# Remove all files and directories (recursive removal)
rm -rf path/to/folder
# Remove / Delete directory called /tmp/foo
rmdir /tmp/foo
@guizmo
guizmo / upload_file.sh
Created Aug 16, 2012
Upload file via ssh
View upload_file.sh
scp someFile someUser@someServer:/somePath/someFile
@guizmo
guizmo / Asset.sh
Created Aug 16, 2012
Merge 2 movie files
View Asset.sh
cat video1.avi video2.avi videon.avi > output.avi (this merges them but only playes length of 1st mov)
mencoder -forceidx -oac copy -ovc copy output.avi -o output_final.avi (this commands rebuilds the header file. One unqiue point about this commands is that it only copies the frames and audio across, it doesn’t re-encode them )
View dabblet.html
<h1>Split view feature box with CSS skew transform and transitions</h1>
<div class="box sunrise"><a href="#box2"></a></div>
<div class="slider">
<div class="box sunset"><a href="#box1"></a></div>
</div>
<footer>
<p>Handcrafted by <a href="http://www.twitter.com/dstorey">@dstorey</a> for
<a href="http://www.generatedcontent.org/123456/split-feature">GeneratedContent.org</a>. Sunset image, <a href="http://creativecommons.org/licenses/by-nc-sa/2.0/">Some rights reserved</a> by <a href="http://www.flickr.com/photos/42429527@N03/">najeebkhan2009</a>. Sunrise image, <a href="http://creativecommons.org/licenses/by-nd/2.0/">Some rights reserved</a> by <a href="http://www.flickr.com/photos/petehogan/">3dpete</a>.</p>
</footer>
@guizmo
guizmo / disable-plugins-when-doing-local-dev.php
Created Jul 17, 2012 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
View disable-plugins-when-doing-local-dev.php
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@guizmo
guizmo / Asset.php
Created Jul 6, 2012
Creating ZIP File with PHP
View Asset.php
<?php
// source http://www.catswhocode.com/blog/snippets/creating-zip-file-with-php
$error = ""; //error holder
if(isset($_POST['createpdf'])){
$post = $_POST;
$file_folder = "files/"; // folder to load files
if(extension_loaded('zip')){ // Checking ZIP extension is available
if(isset($post['files']) and count($post['files']) > 0){ // Checking files are selected
$zip = new ZipArchive(); // Load zip library
$zip_name = time().".zip"; // Zip name
@guizmo
guizmo / Asset.php
Created Jul 5, 2012
Openlayers showPopup()
View Asset.php
Drupal.settings.nid = Drupal.settings.nid || [];
Drupal.settings.getAllFeature;
function my_map() {
var all_layers = Drupal.openlayers.popup.popupSelect.layers;
for(var key1 in all_layers) {
var current_layer = all_layers[key1];
var all_features_in_layer = current_layer.features;
for(var key2 in all_features_in_layer) {
@guizmo
guizmo / Asset.php
Created Jun 30, 2012
Print category tree
View Asset.php
foreach( get_categories('hide_empty=1') as $cat ) :
if( !$cat->parent ) {
echo '<ul><li><strong>' . $cat->name . '</strong></li>';
process_cat_tree( $cat->term_id );
}
endforeach;
wp_reset_query(); //to reset all trouble done to the original query
//
function process_cat_tree( $cat ) {
You can’t perform that action at this time.