Skip to content

Instantly share code, notes, and snippets.

View engram-design's full-sized avatar

Josh Crawford engram-design

View GitHub Profile
@engram-design
engram-design / ext.moreevents.php
Last active August 29, 2015 14:14
Fixes for MoreEvents ExpressionEngine plugin
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Moreevents_ext {
var $name = 'moreEvents';
var $version = '1.2.5';
var $description = 'moreEvents system extensions';
var $settings_exist = 'n';
var $docs_url = ''; // 'http://expressionengine.com/user_guide/';
@engram-design
engram-design / _entry.html
Created May 29, 2015 05:31
SEO for Craft
{% extends "_layout" %}
{% set seo = {
title: "My New Title"
} %}
{% block content %}
{% endblock %}
@engram-design
engram-design / MyPluginNamePlugin.php
Last active August 29, 2015 14:22
Swap Structures and Channels
<?php
namespace Craft;
class MyPluginNamePlugin extends BasePlugin
{
/* --------------------------------------------------------------
* PLUGIN INFO
* ------------------------------------------------------------ */
public function getName()
var express = require('express'),
passport = require('passport'),
LocalStrategy = require('passport-local').Strategy;
var users = [
{ id: 1, username: 'bob', password: 'secret', email: 'bob@example.com' }
];
function findById(id, fn) {
var idx = id - 1;
@engram-design
engram-design / app.js
Last active December 17, 2015 02:58
A demonstration of using Handlebars with Backbone.Marionette. Utilizes Grunt.js task (grunt-contrib-handlebars) to pre-compile templates, and swaps Handlebars.runtime for further optimization. Feel free to comment if you have any suggestions or questions!
define([
'marionette',
'templates'
], function(Marionette, Templates) {
var app = new Marionette.Application({
root: '/',
templates: Templates
});
@engram-design
engram-design / FeedMeCustomSortPlugin.php
Created July 5, 2016 12:07
Custom sorting using `postForFeedMeFieldType` with Feed Me
<?php
namespace Craft;
class FeedMeCustomSortPlugin extends BasePlugin
{
// =========================================================================
// PLUGIN INFO
// =========================================================================
public function getName()
@engram-design
engram-design / en.php
Created September 25, 2016 07:31
Workflow static translation
<?php
return array(
"Workflow" => "Workflow",
"Entry submitted for approval." => "Entry submitted for approval.",
"Could not submit for approval." => "Could not submit for approval.",
"Submission revoked." => "Submission revoked.",
"Could not revoke submission." => "Could not revoke submission.",
"Entry approved and published." => "Entry approved and published.",
@engram-design
engram-design / index.twig
Created October 8, 2016 09:07
Macro to prevent upscaling - something Craft doesn't support just yet...
{# Usage #}
{% set transform = { width: 700, height: 247, mode: 'crop' } %}
<img class="banner" src="{{ _self.transform(entry.bannerImage.first, transform) }}">
{# Macro to prevent upscaling - something Craft doesn't support just yet... #}
{% macro transform(image, transform) %}
{% spaceless %}
{% set originalWidth = image.getWidth(false) %}
{% set transformedWidth = image.getWidth(transform) %}
@engram-design
engram-design / SmartMapPlugin.php
Last active February 27, 2017 11:33
SmartMap Feed Me 2
<?php
namespace Craft;
class SmartMapPlugin extends BasePlugin
{
public function init()
{
Craft::import('plugins.smartmap.integrations.feedme.fields.SmartMap_AddressFeedMeFieldType');
}
@engram-design
engram-design / data.php
Last active February 27, 2017 22:24
Property Feed
<?php
// Get all XML files in directory
$files = glob('data/*xml');
$jsons = array();
if (isset($_GET['start']) && isset($_GET['end'])) {
$start = $_GET['start'];
$end = $_GET['end'];