Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
@machouinard
machouinard / Contract Killer 3.md
Last active August 29, 2015 14:27
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@machouinard
machouinard / fib.php
Created January 21, 2016 19:33
Fibonacci generator
function fib( $num ) {
$last = 0;
$current = 1;
yield $current;
while ($current < $num ) {
$current = $last + $current;
$last = $current - $last;
yield $current;
}
}
// Move Footer widgets and Footer outside Site Container
// Reposition the footer widgets
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
add_action( 'genesis_after', 'genesis_footer_widget_areas' );
// Reposition the footer
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
@machouinard
machouinard / facetwp-infinite-scroll.js
Created March 10, 2016 09:49
FacetWP inifinite scroll using button click
(function ( $ ) {
window.fwp_is_paging = false;
$( document ).on( 'facetwp-refresh', function () {
if ( !window.fwp_is_paging ) {
window.fwp_page = 1;
FWP.extras.per_page = 'default';
}
window.fwp_is_paging = false;
<?php
//* Do NOT include the opening php tag
//* Enqueue Animate.CSS and WOW.js
add_action( 'wp_enqueue_scripts', 'sk_enqueue_scripts' );
function sk_enqueue_scripts() {
wp_enqueue_style( 'animate', get_stylesheet_directory_uri() . '/css/animate.min.css' );
wp_enqueue_script( 'wow', get_stylesheet_directory_uri() . '/js/wow.min.js', array(), '', true );
<?php
/**
* Includes a few useful predicates in the bootstrapped `infiniteScroll` JS object
* that is served along with the rest of the document upon initial page request.
*/
add_filter( 'infinite_scroll_js_settings', 'mcsf_extra_js_settings' );
function mcsf_extra_js_settings( $js_settings ) {
$js_settings['query_args']['extra'] = array(
'is_home' => is_home(),

Last updated: 2015-08-11

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@machouinard
machouinard / functions.php
Created May 19, 2016 18:21
Add ACF settings page under existing custom menu item.
/**
* Add ACF settings page under Cooked CPT Menu
*/
if ( function_exists( 'acf_add_options_sub_page' ) ){
acf_add_options_sub_page(array(
'title' => 'Custom Recipe Settings',
'parent' => 'edit.php?post_type=cp_recipe',
'capability' => 'manage_options'
));
}