Skip to content

Instantly share code, notes, and snippets.

View lucprincen's full-sized avatar

Luc Princen lucprincen

View GitHub Profile
#!/bin/sh
cd DEV_DIRECTORY_HERE
wget http://wordpress.org/latest.tar.gz
tar -zvxf latest.tar.gz
printf "What would you like to name your new WordPress directory (i.e. mywpdir)? "
read NEWDIR
mv -f wordpress $NEWDIR
cd $NEWDIR
cd wp-content
mkdir upgrade
#!/bin/sh
cd [YOUR-INSTALL-DIR]
wget http://wordpress.org/latest.tar.gz
tar -zvxf latest.tar.gz
printf "What's the name of the install? "
read NEWDIR
mv -f wordpress $NEWDIR
cd $NEWDIR
cd wp-content
@lucprincen
lucprincen / save-canvas-thumb.js
Last active December 21, 2020 03:10
Save a copy of the canvas as a thumnail. Requires EaselJS and returns a base64 string.
function saveCanvasThumbnail( scale ){
if( scale === undefined ) scale = .3;
var canvas = getElementById( 'canvas' );
var bitmap = new createjs.Bitmap( canvas );
bitmap.cache( 0, 0, canvas.width, canvas.height, scale );
var base64 = bitmap.getCacheDataURL();
@lucprincen
lucprincen / Chef-Portfolio
Last active December 18, 2015 23:29
Preview of a simple Portfolio-plugin for Cuisine...
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
* init the plugin:
*/
add_action( 'init', 'chef_portfolio_init', 10 );
function chef_portfolio_init(){
add_filter('pre_get_posts', 'diiish_build_attachment_query');
function diiish_build_attachment_query( $query ){
if( !is_admin() ){
global $wp;
if( preg_match( '/^media\/(.*)/', $wp->request ) ) {
$req = explode( '/', $wp->request );
<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml text/css application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
</ifModule>
//js:
$(window).scroll(function(){
var scrollPos = $(window).scrollTop();
if( scrollPos >= 200 && $(header).hasClass('scrolled') === false ){
$('header').addClass('scrolled')
}
/|"{'\\//;-'[=\{p;'-[\\'"]\=\=||/'\'\];;;'''=]p0]]=]=[-[[=]]]]]\]']\'
#!/bin/sh
cd ../your/staging/location
echo -e "\033[32m Downloading WordPress... "
echo -e "\033[0m"
printf "De url van deze site is: your/staging/location/..."
read NEWDIR
mkdir $NEWDIR
@lucprincen
lucprincen / gist:39c5fc3b877cf41cb559
Created December 22, 2014 10:24
Simple placeholder fallback for gravity forms
var inputs = {};
jQuery('.gfield input, .gfield textarea' ).each( function(){
var _id = jQuery( this ).attr('id');
var _string = jQuery( this ).val();
inputs[_id] = _string;