Instantly share code, notes, and snippets.

View test.php
<?php
$method = new ReflectionMethod($someMock, 'someMethod');
$method->setAccessible(true);
$method->invoke($someMock, $someParam, $anotherParam);
View layout.html
<!--[if lte IE 9]>
<link rel="stylesheet" href="/ie.css">
<link rel="stylesheet" href="/ie_2.css">
<link rel="stylesheet" href="/ie_3.css">
<![endif]-->
<!--[if gt IE 9]><!-->
<link rel="stylesheet" href="/main.css">
<!--<![endif]-->
View ListingDecorator.php
<?php
// make this a service
class ListingDecorator
{
public function __construct($urlGenerator, $twig) {
$this->urlGenerator = $urlGenerator;
$this->twig = $twig;
}
View Presenter.php
<?php
abstract class Presenter implements ArrayAccess {
protected $data;
public function __construct($data)
{
$this->data = $data;
}
View zu_example.module
<?php
function zu_example_menu() {
$items = array();
$items['users/%'] = array(
'title' => "User",
'page callback' => 'user_view_callback',
'page arguments' => array('1'),
'access callback' => true,
'access arguments' => array('access content'),
View gist:8424608
var options = {
successClass: 'has-success',
errorClass: 'has-error',
errors: {
classHandler: function(el) {
return $(el).closest('.form-group');
},
container: function (el, isRadioOrCheckBox) {
if (isRadioOrCheckBox) {
var $formGroup = $(el).closest('.form-group');
View jquery.dotdotdot.js
(function($){
$.fn.dotdotdot = function(options) {
var options = options || {};
var label = options.label || 'Loading';
var max = options.max || 3;
var baseLength = label.length;
var speed = options.speed || 400;
$(this).each(function(i, el){
var $el = $(el);
View static.sh
#!/bin/bash
wget -P dist --directory-prefix=dist --mirror --page-requisites --html-extension --convert-links http://$1
View gist:6922205

CSS

Libraries

  • Reset: Normalize.css
  • Feature Detection: [Modernizr][modernizr]
  • Pre-processor: [SASS][sass]
    • Syntax: SCSS
  • Code organization: [SMACSS (Scalable and Modular Architecture for CSS)][smacss]
  • Framework: [Bootstrap 3][bootstrap] ([sass version][sass-bootstrap])
  • Responsive Images: [Picturefill][picturefill]