Skip to content

Instantly share code, notes, and snippets.

View sveneisenschmidt's full-sized avatar
🚀

Sven Eisenschmidt sveneisenschmidt

🚀
View GitHub Profile
@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) {
<?php
// ...
class UserController extends AbstractApiController
{
/**
*
* @Rest\View()
* @Rest\QueryParam(name="_token", description="The token for authentication.")
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
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;
@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.

@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 / 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"
<?php
$request = new Flexo\Request();
$rq = $request->createRrequestBuilder();
$qb = $rq->createQueryBuilder();
$qb->add('match_all', $qb->expr()->matchAll());
$qb->add('bool', $qb->expr()->bool(
<?php
namespace Nelmio\Alice\Util;
use \Nelmio\Alice\Instances\Processor\Processable;
use \Nelmio\Alice\Instances\Processor\Methods\Faker;
class FakerFacade
{
/**
@sveneisenschmidt
sveneisenschmidt / vagrant-up.sh
Created February 10, 2016 10:01
Fixes the NFS problem with Alpine Linux Box "maier/alpine-3.1.3-x86_64"
#!/bin/sh
echo "Removing old VM"
vagrant destroy
echo "Initilaizing VM"
vagrant up --no-provision
echo "Updating dependencies"
echo "* Fixes NFS error"