Skip to content

Instantly share code, notes, and snippets.

(function () {
var vars = [];
var reserved = [
'$',
'jQuery',
'History',
'Ext',
'CKEDITOR',
'applicationCache',
'caches',
<?php
use Imagine\Image\ImageInterface;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
set_time_limit(60*10);
require 'vendor/autoload.php';
// layout for only 2 columns
function layout (container, selector) {
var ct = container.jquery ? container : $(container);
var themes = ct.find(selector);
var colLeft = 0;
var colRight = 0;
// resize and position `.theme` elements
themes.each (function (idx) {
var elm = $(this);
$('.img-responsive').wrap('<div style="display: table-cell" />').parent().wrap('<div style=" display: table;table-layout: fixed;width: 100%;" />');
var div = document.createElement('div');
function escapeHtml(unsafe) {
div.innerText = unsafe;
return div.innerHTML;
}
<?php
/**
* Based on https://gist.github.com/tovic/d7b310dea3b33e4732c0
*/
class Minify
{
public function minifyHtml($html, $processJs = true, $processCss = true)
{
$html = trim($html);
var maxId = setTimeout(function(){}, 0);
for(var i=0; i < maxId; i+=1) {
clearTimeout(i);
}
@clemgrim
clemgrim / SerializerServiceProvider.php
Last active December 1, 2015 10:14
JMSSerializer provider for Silex
<?php
namespace App\Providers;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use JMS\Serializer\SerializerBuilder;
use Doctrine\Common\Annotations\AnnotationRegistry;
use JMS\Serializer\SerializationContext;
<?php
namespace App\Providers;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
use Doctrine\Common\Annotations\AnnotationReader;
gulp.task('js', function () {
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
return browserify('./public/js/app.js').bundle()
.pipe(source('app.js'))
.pipe(buffer())
.pipe($.ngAnnotate({single_quotes: true, add: true}))
.pipe($.if(argv.min, $.uglify()))