Skip to content

Instantly share code, notes, and snippets.

View animaux's full-sized avatar

Alexander Rutz animaux

View GitHub Profile
@brendo
brendo / EventTutorial.md
Created April 4, 2011 11:06
Symphony Events: A Detailed Look

Forms have been an integral part of any interactive site since the dawn of time, they promote interactivity and are usually the most common way users interact with a site. It's commonplace that when a form is submitted, the website will take 'action' and do something with the data and then provide a user with the result. Symphony provides this logic layer via Events.

This tutorial assumes you have a basic understanding of how Events work in Symphony (if not, this may be a good introduction) and are semi comfortable writing some PHP code. I'll be showing you some of the lesser known features of Symphony Events, including event priority, event chaining and a brief demonstration of how to write a custom Event. The difficulty level progresses as we go through, but with any luck you'll be able to learn a thing or two :)

Getting Started

The Scenario

Our client requires a form that allows a user to submit some details about their new car purchase. Th

@jahfer
jahfer / arraynavigation.js
Created December 18, 2012 05:15
Sometimes you need to look ahead or behind the current element you're on when iterating through an array. This is a neat trick for doing that quickly, without stepping outside the bounds of your array.
var arr = ['a','b','c'];
// 1. LOOKING AHEAD
// -----------------------------
for (var i=0; i<arr.length; i++) {
var next = arr[ (i+1) % arr.length ]; // <= THE MAGIC
console.log(arr[i], "->", next);
}
@nathanhornby
nathanhornby / master.xsl
Last active July 11, 2022 20:06
An HTML5 master utility template for SymphonyCMS (XSLT).
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:text disable-output-escaping="yes">&lt;</xsl:text>!DOCTYPE html<xsl:text disable-output-escaping="yes">&gt;</xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[
<!--[if lt IE 7 ]> <html lang="en" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" class="no-js lt-ie9 lt-ie8"> <![endif]-->
// the location we want to GeoCode
var location = 'London';
// we are using MapQuest's Nominatim service
var geocode = 'http://open.mapquestapi.com/search?format=json&q=' + location;
// use jQuery to call the API and get the JSON results
$.getJSON(geocode, function(data) {
// get lat + lon from first match
var latlng = [data[0].lat, data[0].lon]
@joyrexus
joyrexus / README.md
Last active May 16, 2025 01:54 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@ijy
ijy / sym-custom-datasource.php
Created January 12, 2014 22:10
A bare-bones example of a custom datasource for use with Symphony 2.3.
<?php
/**
* Custom Datasource Skeleton
*
* A bare-bones example of a custom datasource for use with Symphony 2.3
*
* @author: Ian Young
* @email: [email protected]
* @date: 12.01.2014
@blackfalcon
blackfalcon / git-feature-workflow.md
Last active May 3, 2025 02:39
Git basics - a general workflow

Git-workflow vs feature branching

When working with Git, there are two prevailing workflows are Git workflow and feature branches. IMHO, being more of a subscriber to continuous integration, I feel that the feature branch workflow is better suited, and the focus of this article.

If you are new to Git and Git-workflows, I suggest reading the atlassian.com Git Workflow article in addition to this as there is more detail there than presented here.

I admit, using Bash in the command line with the standard configuration leaves a bit to be desired when it comes to awareness of state. A tool that I suggest using follows these instructions on setting up GIT Bash autocompletion. This tool will assist you to better visualize the state of a branc

@nitriques
nitriques / import.php
Created June 20, 2014 19:31
Importing data into Symphony-CMS from the command line
<?php
// You run it with php-cli
// i.e. php-cli import.php
// I usually run in on the server via ssh.
// I also usually put my scripts into manifest (to protect them from http access)
// This scripts imports data from a csv...
@mapmeld
mapmeld / mapboxgl.md
Last active March 4, 2019 15:12
Getting Started with MapBoxGL

Getting Started

I recently made my first map with MapBox's new WebGL+JavaScript API. There aren't many examples of how to do this yet, even on MapBox's API page, so I'll document my own experience here.

The Van Gogh Map

My map is made of several textures taken from Van Gogh paintings. The long-term goal is to allow a user to select which artworks they want to take textures from, but for now there is just one setting.

Why are we changing maps?

@peterkuiper
peterkuiper / gist:d4657a3c8c9b37a46656
Last active April 22, 2022 09:36
Permanently Disable Notification Center (thank you)
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall SystemUIServer