Skip to content

Instantly share code, notes, and snippets.

@jubianchi
jubianchi / sf2_standalone_form.php
Created August 25, 2011 07:31
How to use Symfony2 Form Component Standalone
<?php
namespace Standalone\Form;
use \Symfony\Component\HttpFoundation as SHttp;
use \Symfony\Component\Form as SForm;
use \Symfony\Component\DependencyInjection as SDI;
use \Symfony\Bridge as SBridge;
//Register all your autoload function here
//...
@ziadoz
ziadoz / app-silex.php
Last active April 26, 2020 12:37
Slim Framework Controller Strategies (Simple/Silex)
<?php
// Silex Style Controllers
class App extends \Slim\Slim
{
public function mount($controller)
{
if (! is_object($controller)) {
throw new \InvalidArgumentException('Controller must be an object.');
}
<?php
class Php53Traits {
public function __call($name, $params) {
if(!isset($this->{$name}) || !gettype($this->{$name}) == 'object') {
throw new Exception('not found');
}
$tmp = $this->{$name};
return call_user_func_array($tmp, $params);
}
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

#!/bin/sh
# WP-CLI Template
# @see http://wp-cli.org/
# install
curl http://wp-cli.org/installer.sh | bash
@simenbrekken
simenbrekken / gulpfile.js
Created March 14, 2014 08:54
React project gulpfile
var gulp = require('gulp'),
gutil = require('gulp-util')
// HTML
gulp.task('html', function() {
return gulp.src('src/index.html')
.pipe(gulp.dest('build'))
})
// Scripts
@matthewberryman
matthewberryman / osx-shellshock-patch.sh
Last active August 29, 2015 14:06
Patch OS X for shellshock
# I'm leaving this here for as a reference, but note the official patches are now out at
# http://support.apple.com/kb/DL1767?viewlocale=en_US&locale=en_US (Lion)
# http://support.apple.com/kb/DL1768?viewlocale=en_US&locale=en_US (Mountain Lion)
# http://support.apple.com/kb/DL1769?viewlocale=en_US&locale=en_US (Mavericks)
# Note they only seem to cover up to patch 53, following will get you to patch 54.
# Important: don't just download and run this. Read to the end first.
# Taken from http://apple.stackexchange.com/questions/146849/how-do-i-recompile-bash-to-avoid-shellshock-the-remote-exploit-cve-2014-6271-an
# but avoids symlinking to homebrew (as that may break things) and also added verification of patch file for good measure.
@tacone
tacone / rapyd-scratchpad.php
Created September 30, 2014 20:24
Rapyd scratchpad
<?php
function edit ()
{
$model = new Article();
$form = new DataForm($model); //--> $form->model
$form->text('title');
$form->text('author.name');
@zofe
zofe / routes.php
Last active August 29, 2015 14:07
Internal router for rapyd-laravel that match "uri" and/or "query string", it can run before Laravel to Fire widget events
<?php namespace Zofe\Rapyd;
/**
* Class Router
* the rapyd router, works "before" laravel router to check uri/query string
* it set widgets status / actions.
*
* @package Zofe\Rapyd
*
* @method public static get($uri=null, $query=null, Array $route)