Skip to content

Instantly share code, notes, and snippets.

@marcboivin
marcboivin / gist:649357
Created October 27, 2010 16:13
EasySlide1.7 with multiple control support
/*
* Easy Slider 1.7 - jQuery plugin
* written by Alen Grakalic
* http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
* Modified by Marc Boivin: added the controls option to have both numeric and prev, next
* buttons (set controls to false when using numeric for default behavior)
*
* Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
@marcboivin
marcboivin / gist:858502
Created March 7, 2011 13:26
Un example de modèle en WordPress
<?php
/* Registering taxonomie */
add_action( 'init', 'register_bai_taxonomies' );
function register_bai_taxonomies()
{
// Les idées sont un type de post.
register_post_type('idee', array(
'label' => __('Idées'),
'singular_label' => __('Idée'),
@marcboivin
marcboivin / gist:858535
Created March 7, 2011 14:01
Exemple de functions.php comme une étape entre le controlleur et la view
<?php
/**
* Methods used to build the theme's templates. These methods encapsulate the
* verifications and fallbacks that account for the availability of plugins,
* configuration options, or PHP/WordPress features.
*/
class Theme
{
/**
* Displays alternative search results, if available.
@marcboivin
marcboivin / Idée
Created March 8, 2011 15:14
Un example de controlleur
<?php
class Idee
{
/**
* Initializes this class.
*/
public static function static_init()
{
add_action(
'add_meta_boxes',
@marcboivin
marcboivin / Add Body Class Wordpress
Created July 29, 2011 14:12
Add a class to your body, the simple way
<?php
/*
WordPress now has a hook to add a body class. But it's kind of annoying
to deal with the add action and everything, so I made a little tiny wrapper
function that works only in php 5.3 + but still, makes my life easier when making
themes.
*/
function add_class_body($class){
add_filter('body_class', function($classes) use ($class){
@marcboivin
marcboivin / gist:1118413
Created August 1, 2011 15:58
Hacky way to make get_post_by_title work with qTranslate
<?
function qtrans_get_page_by_title($page_title, $output = OBJECT, $post_type = 'page' ){
global $wpdb;
// We append a < at the end of the like caus it's the ending charater
$page = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title LIKE '%". $page_title ."<%' AND post_type= '".$post_type."'" );
if ( $page )
@marcboivin
marcboivin / Simple HTML
Created August 4, 2011 14:04
Super simple way to add HTML to WordPress Post
<?php
/*
Usage: [html tag="div" class="calls1 calss2 class3" id="my_id"] ; This will create a <div class="calls1 calss2 class3" id="my_id"> to close use end=true to <div></div> use autoclose=true
[html tag="div" class="calls1 calss2 class3" id="my_id" end=true] ; Will do </div> keep the other param to make the code clearer
*/
add_shortcode( 'html', 'simple_html_tag' );
function simple_html_tag($atts){
@marcboivin
marcboivin / ripdvd.sh
Created November 19, 2012 23:47
Rip Seasons DVD with handbrake
#!/bin/bash
# copyrights this guy http://ubuntuforums.org/showthread.php?t=1544346
# ripdvd.sh
# input must be:
# - <devicename> (which can be anything lsdvd takes)
# - <outputfolder> where do you want the ripped series
# - <outputname> the base name of the output
# - <startsfrom> where to start counting if you use 0 it starts at 1
# (useful for seasons spanning over multiple disks)
@marcboivin
marcboivin / Configuration.h
Last active July 12, 2018 01:49
My ANET A8 Marling config. Tried to compile marlin with SkyNet's configs. Didn't work. Here is my config for ANET A8 with a fixed mounted sensor for auto leveling.
/**
WARNING : my Configuration_adv.h needed the heat protection for the bed adjusted :
#if ENABLED(THERMAL_PROTECTION_BED)
#define THERMAL_PROTECTION_BED_PERIOD 65 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
#endif

Keybase proof

I hereby claim:

  • I am marcboivin on github.
  • I am marcboi (https://keybase.io/marcboi) on keybase.
  • I have a public key ASBQftkjRqAoiLXL5AktouM5X-EjLi_nxmXcalYvBcZH2Ao

To claim this, I am signing this object: