Skip to content

Instantly share code, notes, and snippets.

View AaronRutley's full-sized avatar

Aaron Rutley AaronRutley

  • Melbourne, Australia
View GitHub Profile
<?php // Function Partial : Custom Post Types
add_action('init', 'turbo_custom_post_types');
// Register Custom Post Type
function turbo_custom_post_types() {
$types = array(
array(
'the_type' => 'work',
'single' => 'Work Item',
'plural' => 'Work Items',
@AaronRutley
AaronRutley / ar_responsive_image.php
Created December 31, 2015 23:21
ar_responsive_image
<?php
function ar_responsive_image($image_id,$image_size,$max_width){
// check the image ID is not blank
if($image_id != '') {
// set the default src image size
$image_src = wp_get_attachment_image_url( $image_id, $image_size );
// set the src set with various image sizes
$image_srcset = wp_get_attachment_image_srcset( $image_id, $image_size );
// generate the markup for the responsive image
@AaronRutley
AaronRutley / right.sh
Created November 11, 2015 01:56
right.sh
## right time prompt
RPROMPT='[%t]'
@AaronRutley
AaronRutley / end.sh
Last active October 19, 2015 19:59
end.sh
# end.sh
blueutil on
echo "--- iMac Bluetooth on..."
sleep 5
echo "--- Target Display Mode command..."
osascript -e 'tell application "System Events" to key code 144 using command down'
echo "--- Target Display Mode Ended......."
exit
<?php
function ar_ig_get_photos() {
// set end point (json)
$endpoint = "https://api.instagram.com/v1/users/etc-json";
// Initiate curl
$ch = curl_init();
@AaronRutley
AaronRutley / wp-api-jquery-ajax.html
Created October 6, 2015 06:20 — forked from scottopolis/wp-api-jquery-ajax.html
Simple WP-API Ajax to get posts
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>My App</title>
<style type="text/css">
body {
@AaronRutley
AaronRutley / ar_user_login.php
Last active October 3, 2015 22:45
ar_user_login.php
<?php
// ar_user_login : on WordPress login, post a message to slack
function ar_user_login($user_login) {
// get the user info
$user = get_user_by('login',$user_login);
// get the user ID
$user_id = $user->ID;
# WP, ACF and PHP snippets
'.text.html.php:not(.source)':
'ACF Field':
'prefix': 'acf'
'body': '''
<?php the_field( '${1:field_name}' ); ?>
'''
'ACF Image':
#chassis
alias chassis='function _chassis(){
if [ $1 = "create" ]; then
cd ~/Vagrant-local;
git clone --recursive https://github.com/Chassis/Chassis $2;
rm -rf .git;
cd $2;
git clone https://aaronrutley@bitbucket.org/aaronrutley/turbo.git content;
cd content;
@AaronRutley
AaronRutley / shutdown.sh
Last active August 29, 2015 14:19
shutdown.sh
# shutdown.sh
echo "--- Remote iMac Shutting Down......";
osascript -e 'tell application "Finder" to shut down';