Skip to content

Instantly share code, notes, and snippets.

View JonathanMH's full-sized avatar
🐙

Jonathan M. Hethey JonathanMH

🐙
View GitHub Profile
<?php
/**
** A base module for [text], [text*], [email], and [email*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'text', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'text*', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'email', 'wpcf7_text_shortcode_handler', true );
@JonathanMH
JonathanMH / less_watch.sh
Created July 8, 2012 12:38
temporary less_watch script
#!/bin/bash
LESSFILE=$1
CSSFILE=`basename $1 .less`.css
while true; do
inotifywait -e modify -e move -e close $LESSFILE && \
date && echo "compiling LESS" && \
lessc $LESSFILE> $CSSFILE
done
@JonathanMH
JonathanMH / resizer.js
Created August 21, 2012 14:54
quick image resizer for node
var fs = require('fs');
var im = require('imagemagick');
// define source of pictures:
var source_dir = '/source'
// define output of resized pictures:
var output_dir = '/output'
//define image sizes
var fs = require('fs');
var im = require('imagemagick');
var async = require('async');
var widths = ['270', '590', '910', '1230'];
var source_dir = process.cwd()+'/source/';
var output_dir = process.cwd()+'/output/';
fs.readdir(source_dir, function(err, files){
if (err) throw err;
@JonathanMH
JonathanMH / all.js
Created September 24, 2012 23:30
all.js from locomotive-passport-boilerplate
var express = require('express');
var passport = require('passport');
var mongoose = require('mongoose');
var mongoStore = require('connect-mongodb');
module.exports = function() {
this.set('views', __dirname + '/../../app/views');
this.set('view engine', 'jade');
this.use(express.logger());
@JonathanMH
JonathanMH / wc.sh
Created November 18, 2012 12:03
Count your characters from the Terminal
#!/bin/bash
pages_requested=10
characters_per_page=2400
files=( "code.md" "interface_design.md" "project_management.md" )
function countcompare {
images=`grep -c '.png' $1`
chars=`wc -c $1 | awk '{split($0,array," ")} END{print array[1]}'`
chars_with_images=$((chars+images*700))
@JonathanMH
JonathanMH / gist:5369411
Created April 12, 2013 04:41
Build your pdf report from markdown
#!/bin/bash
# dependencies:
#
# http://johnmacfarlane.net/pandoc/installing.html
# variables:
mainfont="Helvetica"
sansfont="Helvetica"
@JonathanMH
JonathanMH / git-ssh-debug.sh
Last active December 16, 2015 15:59
short test if your ssh key file is added for use with git
#!/bin/bash
# to automatically add a key you can use the following:
mac_key_path='/Users/hb/.ssh/foobar'
linux_key_path='/home/username/.ssh/foobar'
# uncommend below
# ssh-add $mac_key_path
# ssh-add $linux_key_path
@JonathanMH
JonathanMH / morse-node.js
Created May 3, 2013 21:34
make node.js blink your keyboard backlight in morse code (tested with speedlink illuminator)
var morse = require('morse');
var childProcess = require('child_process');
var async = require('async');
var encoded = morse.encode('SOS');
function onoff (duration, callback) {
childProcess.exec('xset led 3',function (error, stdout, stderr){
});
@JonathanMH
JonathanMH / float.html
Created August 14, 2013 08:40
simple html float example with cat content
<!DOCTYPE html>
<html>
<head>
<title>Float</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<style>
.left {
width: 300px;
float: left;