Skip to content

Instantly share code, notes, and snippets.

View alpacaaa's full-sized avatar
🎱
Testing in production

Marco Sampellegrini alpacaaa

🎱
Testing in production
View GitHub Profile
public function customDBMS($context)
{
$fieldName = 'changeMe'; // change this to your checkbox field name
$event = $context['event'];
$section = $event->getSource();
require_once(TOOLKIT . '/class.sectionmanager.php');
if (!$this->sectionManager)
$this->sectionManager = new SectionManager($context['parent']);
<?php
// put inside extensions/members_openid
class Extension_Members_Openid extends Extension{
public function about(){
return array('name' => 'Members with OpenID',
'version' => '0.1',
'release-date' => '2011-03-13',
'author' => array('name' => 'Marco Sampellegrini',
<?php
// file extensions/resave_entries/extension.driver.php
class extension_resave_entries extends Extension
{
public function about()
{
return array(
'name' => 'Resave entries',
'version' => '0.1',
<student_list>
<student>
<name>George Washington</name>
<major>Politics</major>
<phone>312-123-4567</phone>
<email>gw@example.edu</email>
</student>
<student>
<name>adabadaje Jones</name>
<major>Undeclared</major>
<data>
<upcoming-events>
<section id="15" handle="upcoming-events">Upcoming events</section>
<entry id="1037">
<title handle="brockwell-park-firework-display-saturday-5th-november">BROCKWELL PARK FIREWORK DISPLAY - Saturday 5th November</title>
<date time="18:12" weekday="6">2011-11-05</date>
<time handle="700-745pm">7.00-7.45pm</time>
<location handle="outside-brockwell-hall-brockwell-park">Outside Brockwell Hall, Brockwell Park</location>
<content>Due to our MASSIVE successes at the Lambeth Country Show and the car-free days, Lambeth Events team have asked us to sing before the Firework Display in Brockwell Park. Wrap up warm in your Popchoir Sweatshirt and come along with your family and friends to enjoy the funfair and the fireworks as well as our own performance! And yes - they've learned their lesson - there WILL be a PA system this time!!!</content>
<choirs>
<data>
<hello>paste your xml here</hello>
</data>
wwwww aaaaaaahh!!!
@alpacaaa
alpacaaa / mapping.php
Created May 10, 2012 14:52
Mapping of xslt Utilies imported in xpathr.com
<?php
array (
0 => array('gist' => '2653475', 'id' => '79266'),
1 => array('gist' => '2653476', 'id' => '78502'),
2 => array('gist' => '2653477', 'id' => '37740'),
3 => array('gist' => '2653478', 'id' => '38065'),
4 => array('gist' => '2653479', 'id' => '83467'),
5 => array('gist' => '2653481', 'id' => '20482'),
6 => array('gist' => '2653482', 'id' => '54294'),
7 => array('gist' => '2653484', 'id' => '76976'),
@alpacaaa
alpacaaa / README.markdown
Created July 29, 2012 09:01
Use mysql for authentication in ubuntu 12.04

Authenticating users against mysql

I couldn't find any relevant information for getting this to work on ubuntu precise, so I'm writing my founds here.
It's actually pretty simple, this approach doesn't involve PAM but just NSS. The implications are clearly explained in the FAQ of the nss-mysql module:

NSS stands for NameService Switch. NSS allows you to implement access to various data using any number of modules. This means that when the operating system wants to look up the user "cinergi", it doesn't have to know how - it calls upon the NSS system to perform the task. In turn, we can now configure NSS to look for users in traditional places like /etc/passwd, NIS, LDAP, and now (using this module), MySQL. The NSS

<?xml version="1.0" encoding="utf-8" ?>
<data>
<params>
<root>http://www.example.com</root>
<view />
</params>
<projectpreviews>
<section id="1" handle="projects">Projects</section>
<entry id="2">
<project-name handle="sample-project-2">Sample Project 2</project-name>