Skip to content

Instantly share code, notes, and snippets.

View simoneeconomo's full-sized avatar

Simone Economo simoneeconomo

View GitHub Profile
// everyone's new favorite closure pattern:
(function(window,document,undefined){ ... })(this,this.document);
// when minified:
(function(w,d,u){ ... })(this,this.document);
// which means all uses of window/document/undefined inside the closure
// will be single-lettered, so big gains in minification.
// it also will speed up scope chain traversal a tiny tiny little bit.
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@brendo
brendo / Symphony Developer Notes.md
Created January 9, 2011 06:06
A short note about `$this->_Parent`, `Administration::instance()`, `Frontend:instance` and the new `Symphony::Engine()`

Overview

The inner workings of the magical $this->_Parent have always been a bit of an unknown to Symphony developers and therefore, several ways have cropped up of doing the same things. Starting with Symphony 2.2, there is now a recommendation of how extensions should correctly use this variable.

In the early Symphony 2 days, $this->_Parent was used to manage a catalogue of all the available Managers and other objects such as Configuration and Database so extensions could use these instead of creating their own. Efforts were made in Symphony 2.0.6 to help cleanup this catalogue structure (which is memory intensive) by introducing static accessors to Symphony::Database() and Symphony::Configuration(). These allow extensions to reference these objects regardless of the instance Symphony is operating in (Frontend or Administration).

A typical Field extension works in both instances, functions such as displayPublishPanel work in Administration, others, such as `appendFormattedElement

@nilshoerrmann
nilshoerrmann / sym_userinterfaceupdates.markdown
Created June 2, 2011 11:40
Symphony 2.3 User Interface
@tuxology
tuxology / sym2addr-dwarf.c
Created August 2, 2013 23:05
Gives address of a symbol from a binary (using libdwarf)
/*
* Get address from symbol (libdwarf version)
* Based on code by : Eli Bendersky (http://eli.thegreenplace.net)
*
*/
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
@aras-p
aras-p / preprocessor_fun.h
Last active April 29, 2025 01:49
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,