Skip to content

Instantly share code, notes, and snippets.

@nickdunn
nickdunn / gist:974737
Created May 16, 2011 16:08
Grab repackage a zip from Github
<?php
require_once('pclzip.lib.php');
$name = 'publishfiltering';
$tmp_zip_path = $name . '-' . sha1(microtime());
$tmp_zip_name = $tmp_zip_path . '.zip';
file_put_contents($tmp_zip_name, file_get_contents('https://github.com/nickdunn/publishfiltering/zipball/1.6.0'));
@nickdunn
nickdunn / EventTutorial.md
Created May 17, 2011 08:29 — forked from brendo/EventTutorial.md
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 (input), the website will take 'action' and do something with the data (processing) and then provide a user with the result (output). 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 detai

@nickdunn
nickdunn / gist:1004597
Created June 2, 2011 14:57
Symphony 3 versioning ideas
===========================
tbl_entries
===========================
id				int (PK)
created_date	date
created_by		int (FK)
default_version	int
is_deleted		boolean

===========================
@nickdunn
nickdunn / extension.driver.php
Created June 13, 2011 15:58
Extension: Save And Close
<?php
Class Extension_Save_And_Close extends Extension {
public function about() {
return array(
'name' => 'Save And Close',
'version' => '1.0'
);
}
@nickdunn
nickdunn / gist:1031247
Created June 17, 2011 11:27
Symphony Textmate bundle

A Symphony Textmade bundle could include:

Templates (File > New from Template > Symphony)

  • Extension Driver
  • Data Source
  • Event
  • Field
  • JavaScript
  • README.markdown
@nickdunn
nickdunn / gist:1033239
Created June 18, 2011 16:21
wtf queries busting my balls
SELECT
`e`.id, `e`.section_id, e.`author_id`, UNIX_TIMESTAMP(e.`creation_date`) AS `creation_date`
FROM
`sym_entries` AS `e`
LEFT JOIN `sym_entries_data_10` AS `sbl` ON (`e`.`id` = `sbl`.`relation_id`)
LEFT JOIN `sym_member_replies` AS `replies` ON (`e`.`id` = `replies`.`entry_id` AND `replies`.`member_id` = 1)
WHERE
1 AND `e`.`section_id` = '1'
GROUP BY
`e`.`id`
@nickdunn
nickdunn / extension.about.xml
Created July 12, 2011 15:58
Symphony extension meta XML
<?xml version="1.0" encoding="UTF-8" ?>
<extension>
<name>Search Index</name>
<release>
<version>0.9.1</version>
<date>2011-07-08</date>
</release>
@nickdunn
nickdunn / extension.driver.php
Created July 27, 2011 08:31
Symphony RDF content negotiation (hacky as crap)
<?php
require_once(CORE . '/class.frontend.php');
Class extension_seme4_semantics extends Extension {
public function about() {
return array('name' => 'Seme4 Semantics',
'version' => '1.1',
'release-date' => '2010-03-01',
'author' => array('name' => 'Nick Dunn',
@nickdunn
nickdunn / extension.about.xml
Created July 29, 2011 15:44
Symphony extension meta XML
<?xml version="1.0" encoding="UTF-8" ?>
<extension id="search_index">
<!-- string, required -->
<name>Search Index</name>
<!-- string, required (@lang optional) -->
<description lang="en">Index text content of entries for efficient full-text search.</description>
/* Syntax Highlighting */
pre[class] {
margin-bottom: 1.5em;
border: 1px solid #393937;
overflow: hidden;
background-color: #191917;
white-space: normal;
font: inherit;
}
pre[class] code {