Skip to content

Instantly share code, notes, and snippets.

@strlcp
strlcp / feedback.xml
Last active December 23, 2015 07:39
xml defining form in symphony xslt to parse it
<!-- static xml use as static xml datasource to configure -->
<entry>
<name type="required">
<text size="40" />
</name>
</entry>
<entry>
<lastname type="optional">
@firegoby
firegoby / data.xml
Created September 11, 2013 19:50
Minimalist example for getting my fork of BBC News' Imager.js (https://github.com/firegoby/Imager.js) working with Symphony CMS
<images>
<file size="345 KB" path="/images" type="image/jpeg">
<filename>1z9x6l7.jpg</filename>
<meta creation="2013-09-11T13:39:53+01:00" width="2560" height="1440" />
</file>
<file size="367 KB" path="/images" type="image/jpeg">
<filename>adfp6hk.jpg</filename>
<meta creation="2013-09-11T13:40:30+01:00" width="1920" height="1280" />
</file>
<file size="4.15 MB" path="/images" type="image/jpeg">
// After making the required edits below, use something like http://daringfireball.net/2007/03/javascript_bookmarklet_builder to create the bookmarklet.
(function(){
var form=document.createElement("form");
// Edit the action value to match your domain and section names.
form.setAttribute("action","http://example.com/symphony/publish/entries/new/");
form.setAttribute("method","post");
// Edit the params to match your auth-token
// (found on the author page) and section fields.
@michael-e
michael-e / mysql-alter-tables.php
Last active July 11, 2020 09:59
Loop over all tables of a MySQL database and convert them to `utf8` character set. Also make them use `utf8_unicode_ci` collation. You are encouraged to use the PHP CLI (i.e. run the script from the command line), simply because it may take a while. (On the webserver the script may timeout.)
<?php
// configuration
mysql_connect("host","username","password");
mysql_select_db("database");
// do it
$resource = mysql_query("SHOW TABLES");
while ($row = mysql_fetch_array($resource)) {
$table = $row[0];
{
"require": {
"slim/slim": "2.*",
"illuminate/database": "*",
"dhorrigan/capsule": "*"
}
}
@designermonkey
designermonkey / somefile.conf
Created May 28, 2013 13:42
Set http auth per domain: Apache 2.2
# Check for the hostname here
SetEnvIfNoCase HOST ^(www\.)?website\.co\.uk$ PROTECTED_HOST
<Directory /path/to/htdocs>
AuthType Basic
AuthName "Authentication"
AuthUserFile /path/to/.htpasswd
Order Deny,Allow
Satisfy any
Deny from all
@brendo
brendo / class.mysql.php
Last active December 16, 2015 13:19
Improved Symphony MySQL Driver - Uses `mysqli` instead of `mysql`. - Supports a `master`, `slave` setup where the master accepts all writes, and the slaves processes reads To use, add an additional section to your config, `database_slave` which has the same details as `database`.
<?php
/**
* @package toolkit
*/
/**
* The DatabaseException class extends a normal Exception to add in
* debugging information when a SQL query fails such as the internal
* database error code and message in additional to the usual
<?xml version="1.0" encoding="UTF-8"?>
<data>
<site-basket-contents>
<group id="basket">
<item id="261" count="1">
<item id="price">135.00</item>
<item id="shipping">9.50</item>
</item>
<item id="57" count="1">
<item id="price">58.50</item>
@frimik
frimik / git-submodule-sync.rb
Created March 9, 2013 19:32
Make damn sure that git submodule sync is going to work.
#! /usr/bin/env ruby
submods = Hash.new
%x{git config -f .gitmodules --get-regexp '^submodule\..*\.(path|url)$'}.lines.each do |l|
submodule, key, value = l.match(/^submodule\.(.*)\.(path|url)\s+(.*)$/)[1..3]
submods[submodule] = Hash.new unless submods[submodule].is_a?(Hash)
submods[submodule][key] = value
end
@bzerangue
bzerangue / recursive-md.php
Last active July 24, 2020 17:39
Recursively search through a directory (and it's children directories) to find Markdown files and convert the list of files and their content and into an XML document.
<?php
#
# INSPIRATION FROM Nick Dunn (in the Symphony CMS forum)
# "Convert a Directory of Markdown Text Files for Dynamic XML Datasource Use"
# http://getsymphony.com/discuss/thread/60701/#position-2
#
# AND FROM Stack Overflow
# http://stackoverflow.com/questions/8545010/php-reading-first-2-lines-of-file-into-variable-and-cylce-through-subfolders/8545451#8545451
#