Schon mal gefragt, welche globalen Variablen in der Twig-Extension eines Symfony 2 (Standard Distri)-Projektes zur Verfügung stehen? Continue reading “[Symfony 2] Twig – Global Variables”
install silverstripe with some modules from GIT
This is a small shell script to set up silverstripe CMS
along with some modules i often use (as seen in ivo’s post)
The script has two parameters:
– the folder to clone the whole thing into
– the branch/tag to checkout afterwards
# install silverstripe + common modules from github # usage sh install_silverstripe.sh <folder_name> <tag/branch> # examples: # sh install_silverstripe.sh some_folder tags/2.4.5 # sh install_silverstripe.sh some_folder master
Continue reading “install silverstripe with some modules from GIT”
[Symfony 2] AsseticBundle, Less CSS & YUI Compressor unter OSX installieren
Das AsseticBundle ist ein Wrapper um Assetic, ein geniales Tool, um statische Assets für Webprojekte zu verwalten. AsseticBundle ist extrem einfach zu verwenden, einfach die entsprechende Filter-Chain via yaml konfigurieren, um mehr muss man sich nicht kümmern. Natürlich allerdings müssen die zugrundeliegenden Abhängigkeiten im Vorfeld installiert sein. In unserem Falle benötigen wir den Yui-Compressor als jar-File und Less CSS. Less ist ein node.js Modul, was bedingt, dass wir zuvor node.js installieren müssen.
Continue reading “[Symfony 2] AsseticBundle, Less CSS & YUI Compressor unter OSX installieren”
PHP odds! today: pass by reference traps
This is dangerous:
//example array
$array = array('a' => array(array(243,453,435,232)));
foreach ($array['a'] as &$value) {
$value[3] = $newvalue;
}
This works, but now the $value var is in the array by reference which can lateron lead to:
Notice: Array to string conversion
EDIT:
see below in the comments for when…
This works better:
[Symfony 2] Security Bundle: Set User Locale on Form Login
[UPDATE]
A recent update to this article may be found here: https://nerdpress.org/symfony-2-set-default-locale-on-form-login-2/
Das Security Bundle ist ein wenig magisch. Da muss man eine HTML-Form definieren, der Rest wird irgendwie konfiguriert (Namen der Post-Parameter wie “_username”, “_password” etc., den Redirect zum Referrer, Remember-Me Funktion und so weiter, das alles wird von der Firewall intern geregelt. Man muss nur eine Login-Route definieren, einen Stub-Controller + Action-Callable (der aber nie ausgeführt wird, weil die Firefall sich davorhängt), fertig.
Das ist angenehm einfach, solange man keine Fragen stellt. Aber wie führe ich zusätzliche Aktionen direkt nach erfolgtem Login aus, ohne Einfuss auf den Code des Security Bundles zu haben?
Continue reading “[Symfony 2] Security Bundle: Set User Locale on Form Login”
[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.
Augenscheinlich unterstützt das Security-Module nur die Authentifizierung via Benutzername und Password. Wie man sich mit einem Benutzernamen ODER der E-Mail-Adresse und einem Password authentifiziert, ist ein wenig versteckt. So gehts:
Continue reading “[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.”
obsvr.net
Just wanted to mention it here: http://obsvr.net
A media search aggregator build by Me and Max, as the wonderfulwebsolutions.
Its a luckily distributed wolpertinger of symfony, silex, node.js, jquery, isotope, apache and lighty, more to come.
install ant ftp task on ubuntu
Tired of manually uploading your changes via FTP?
And no shell because your client cant/wont buy a hosting package for real men?
Then go for ant and its ftp task!
Install it on ubuntu like so (given you have ant and java already):
jquery pump effect
some new loader effect?
this is a small jquery plugin that renders something like a pump or glow effect by switching two css classes with jquery UI transitions in an endless loop.
the loop can be stopped by applying a stop class to the element.
watch the demo on this almost autogenerated github page:
Demo
Synchronous http request in node.js, that you dont want, probably
Achtung dummy code!
…and so it goes Asynchronous:
for(var i = 0; i < loop.length; i++)
{
var proxy = http.createClient(PORT,SERVER);
var request = proxy.request('GET', url,
{
"host": SERVER
});
request.end();
...
}
fire, fire, fire, fire
… and so it dont, Synchronous then:
var proxy = http.createClient(PORT,SERVER);
for(var i = 0; i < loop.length; i++)
{
var request = proxy.request('GET', url,
{
"host": SERVER
});
request.end();
...
}
point – shoot, point – shoot, point – shoot
well i didnt know that :)