Skip to content

Instantly share code, notes, and snippets.

View sveneisenschmidt's full-sized avatar
🚀

Sven Eisenschmidt sveneisenschmidt

🚀
View GitHub Profile
<?php
$request = new Flexo\Request();
$rq = $request->createRrequestBuilder();
$qb = $rq->createQueryBuilder();
$qb->add('match_all', $qb->expr()->matchAll());
$qb->add('bool', $qb->expr()->bool(
@sveneisenschmidt
sveneisenschmidt / init.pp
Created November 25, 2013 09:50
Simple module approach for ceating a user on a Ubuntu host with puppet * Tested with Ubuntu 12.04 LTS. * Does not need libshadow1.8 and ruby-shadow. * Creates home folder and adds groups
# moudles/user/init.pp
class user {
exec { 'Removing existing user':
command => "deluser $user_name",
cwd => "/tmp",
path => ["/usr/bin", "/usr/sbin", "/bin"],
before => Exec["Creating user"],
onlyif => "grep -c $user_name /etc/shadow"
@sveneisenschmidt
sveneisenschmidt / Interfaces.php
Created September 5, 2013 07:58
Forced and variable interface typehints
public function addClient(PublishInterface||ConsumeInterface $client)
{
}
public function addClient(PublishInterface + ConsumeInterface $client)
{
}
@sveneisenschmidt
sveneisenschmidt / list.md
Created January 18, 2013 09:33
JS libraries woth a look

Sparky.js

Sparky.js is a client-side application scaffold which helps those who want to have organized structure in their app, but don't want to subscribe to a particular client-side MVC framework.

http://forrst.com/posts/Sparky_js_A_client_side_Application_Scaffold-aE4

Mention.js

Lightweight wrapper for adding @user mention functionality to Twitter Bootstraps Typeahead plugin.

<?php
namespace Wildly\Bundle\ApiBundle\Features\Context;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser;
use Symfony\Component\Process\Process;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
RewriteEngine on
RewriteBase /
#RewriteOptions MaxRedirects=5
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
<?php
// ...
class UserController extends AbstractApiController
{
/**
*
* @Rest\View()
* @Rest\QueryParam(name="_token", description="The token for authentication.")
@sveneisenschmidt
sveneisenschmidt / gist:4232799
Created December 7, 2012 11:49
Jquery Form Warn
(function(js) {
js(document).ready(function() {
js('form[data-warn]').each(function(index, element) {
js(element).data('content', js(element).serialize());
});
js(window).on('beforeunload', function(){
var changed = false;
js('form[data-warn]').each(function(index, element) {
@sveneisenschmidt
sveneisenschmidt / dispatch.php
Created November 11, 2012 08:53
Messae Queue Syntax
$this->get('wildly.queue')->dispatch('upload.picture.amazons3', array(
'entity_id' => 14,
'entity_class' => '@WildlyCoreBundle:Modifier'
));
@sveneisenschmidt
sveneisenschmidt / DefaultController.php
Created October 26, 2012 08:09
Wildly\Bundle\BackendBundle\Controller\DefaultController
/**
*
* @Template()
*/
public function indexAction()
{
return array(
'creatures' => $this->getNewEntities('WildlyCoreBundle:Creature', 5),
'locations' => $this->getNewEntities('WildlyCoreBundle:Location', 5),
);