Skip to content

Instantly share code, notes, and snippets.

View leevigraham's full-sized avatar
🍹

Leevi Graham leevigraham

🍹
View GitHub Profile
/**
* Google Maps for ExpressionEngine v3
*
* @package Google Maps for ExpressionEngine
* @subpackage Javascript
* @category Fieldtype
* @author Justin Kimbrell
* @copyright Copyright (c) 2012, Objective HTML
* @link http://www.objectivehtml.com/google-maps
* @version 3.3.0
From 8921f5b7da6be46d7c1949c424a0d1210fac3d9e Mon Sep 17 00:00:00 2001
From: Iain Saxon <iain.saxon@newism.com.au>
Date: Thu, 26 May 2016 18:45:37 +1000
Subject: [PATCH] Fixed the gmapStringifyReplacer function to work with
pre-flattened JSON
---
.../gmap/javascript/gmap_field.js | 46 ++++++++++++++++++----
1 file changed, 38 insertions(+), 8 deletions(-)
@leevigraham
leevigraham / gist:d1f5a4e7572d1249e89b
Last active April 8, 2018 01:49
Assets 2.5 patch to add :revved_url manipulation
diff -ENwbur /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php
--- /Users/leevigraham/Downloads/Assets2.5/ee2/third_party/assets/ft.assets.php 2014-11-11 10:30:36.000000000 +1100
+++ /Volumes/Sites/Work/Internal/example.com/app/third_party/assets/ft.assets.php 2015-03-13 14:26:27.000000000 +1100
@@ -1900,6 +1900,14 @@
}
/**
+ * Replace Revved URL
+ */
+ function replace_revved_url($data, $params)
'articles/details/:url_title' => function (\rsanchez\ResourceRouter\Router $router, $wildcard) {
$ee = ee();
$ee->load->helper('date');
$query = $ee->db->select('edit_date')
->from('channel_titles')
->join('channels', 'channel_titles.channel_id = channels.channel_id')
->where('url_title', (string) $wildcard)
->where('channel_name', 'articles')
@leevigraham
leevigraham / gist:b48ed5382e497a6497ac
Created November 26, 2014 12:01
Asset renaming with [gulp|grunt]-rev and git history
Given unicorn.css
When we first run gulp-rev the filename is unicorn-098f6bcd.css
If we check this into git then unicorn-098f6bcd.css is added to the index
If we change unicorn.css and run gulp-rev the filename changes to unicorn-xxxxxxxx.css
Committing this to git means unicorn-098f6bcd.css is deleted and unicorn-xxxxxxxx.css is added.
This breaks the file history of the revved file.
You still have a full history of the original unicorn.css which still counts and is super important.
@leevigraham
leevigraham / gist:922bcd86ebd30dd861d0
Last active July 21, 2018 03:59
OSX install Script
# Ask for the administrator password upfront
sudo -v
mkdir -p /Volumes/Sites/Work/Clients
mkdir -p /Volumes/Sites/Work/Internal
mkdir -p /Volumes/Sites/Personal
mkdir -p ~/Downloads/Torrents
xcode-select --install
{% macro form_fields(form) %}
{% for field in form %}
{% if field.vars.block_prefixes[0] != 'button' %}
{{ form_row(field) }}
{% endif %}
{% endfor %}
{% endmacro %}
{% import _self as macros %}
@leevigraham
leevigraham / gist:10001829
Created April 6, 2014 05:22
Simple Node script to launch a Telnet connection and control my Pioneer Receiver.
var net = require('net');
connection = net.connect(23, '192.168.2.5')
connection.setEncoding('utf8');
connection.on('connect', function(){
console.log('connected');
connection.on('data', function(data){
console.log(data);
});
{exp:nsm_category_heading
cat_url_title="{segment_2}"
channel="news"
}
{if no_results}{redirect="404"}{/if}
{if not_ajax}
{embed="site/_header"
title="{category_name_path}"
description="{category_description}"
<?php
namespace Nsm\Bundle\ApiBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Hateoas\Configuration\Annotation as Hateoas;
use JMS\Serializer\Annotation as Serializer;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;