This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct()
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () { | |
var Storage = function (type) { | |
function createCookie(name, value, days) { | |
var date, expires; | |
if (days) { | |
date = new Date(); | |
date.setTime(date.getTime()+(days*24*60*60*1000)); | |
expires = "; expires="+date.toGMTString(); |
<?php | |
class JsonpFilter extends sfFilter | |
{ | |
public function execute($filterChain) | |
{ | |
// nothing to do before the action is called | |
$filterChain->execute(); | |
if (($response = $this->getContext()->getResponse()) instanceof sfWebResponse and ($request = $this->getContext()->getRequest()) instanceof sfWebRequest) |
// MIT http://rem.mit-license.org | |
function trim(c) { | |
var ctx = c.getContext('2d'), | |
copy = document.createElement('canvas').getContext('2d'), | |
pixels = ctx.getImageData(0, 0, c.width, c.height), | |
l = pixels.data.length, | |
i, | |
bound = { | |
top: null, |
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |
// Provides a mixin to define hyphenation | |
// | |
// Requires Compass | |
// | |
// (http://blog.fontdeck.com/post/9037028497/hyphens) | |
// (http://www.w3.org/TR/css3-text/#hyphenation) | |
// | |
// $value - The hyphenation property value. One of "none", "manual", "auto" or "all" | |
// | |
// Example .scss: |
This is about getting rid of Dependency Injection Container and DI practices taken from Java. Good bye Java, viva la PHP!
We start with common example. Session.
<?php
class SessionStorage {
function __construct()
// Placeholder @mixin for Sass | |
// | |
// A mixin to style placeholders in HTML5 form elements. | |
// Includes also a .placeholder class to be used with a polyfill e.g. | |
// https://github.com/mathiasbynens/jquery-placeholder | |
// Requires Sass 3.2. | |
// | |
// Example usage (.scss): | |
// | |
// input { |
@mixin box-sizing ($box) { | |
-webkit-box-sizing: $box; | |
-moz-box-sizing: $box; | |
box-sizing: $box; | |
} | |
@mixin border-radius ($val) { | |
-webkit-border-radius: $val; | |
-moz-border-radius: $val; | |
border-radius: $val; |
@mixin vendor-prefix($name, $argument) { | |
-webkit-#{$name}: $argument; | |
-ms-#{$name}: $argument; | |
-moz-#{$name}: $argument; | |
-o-#{$name}: $argument; | |
#{$name}: $argument; | |
} | |
@mixin border-radius($argument) { | |
@include vendor-prefix(border-radius, $argument); |
@mixin double-prefix ($prop, $val...) { | |
-webkit-#{$prop}:-webkit-#{$val}; | |
-moz-#{$prop}: -moz-#{$val}; | |
#{$prop}: #{$val}; | |
} |