Skip to content

Instantly share code, notes, and snippets.

var Base = {
_ops: {},
_privateFnc: function () {},
abstract: function () {},
init: function (ops) {
this._ops = ops || {};
// INIT
}
};
@doup
doup / Twig search page paginator
Created July 23, 2011 22:29
Example twig paginator in Symfony2
{#
Search Page paginator
---------------------
app.request.query.all returns the GET parameters, we merge them with the "params" so that we don't lose the search GET params.
#}
{% include "paginator.html.twig" with {"page": 2, "pages": 10, "route": 'controller_index', "params": {"some": "params"}} %}
{# paginator.html.twig #}
<ul class="paginator">
@doup
doup / PlaceAdmin.php
Created July 21, 2013 14:52
FormType to use with Sonata + KNP DoctrineBehaviours translatable trait
<?php
namespace App\PlaceBundle\Admin;
use App\PlaceBundle\Form;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Form\FormMapper;
@doup
doup / index.html
Created August 6, 2013 17:03
Example of AngularJS $http loading global variable
<!-- use $root.loading -->
<?php
namespace App\EventBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Illarra\ContentBundle\Entity\Image as BaseImage;
/**
* @ORM\Entity(repositoryClass="Illarra\ContentBundle\Repository\Image")
* @ORM\Table(name="event_image")
@doup
doup / 00-app.css
Last active December 21, 2015 18:22
Percolade Blog - "The future of javascript animation with Famo.us" on Famo.us 0.1.1
/*
* Percolade Blog - "The future of javascript animation with Famo.us"
* http://blog.percolatestudio.com/engineering/the-future-of-javascript-animation-with-famous/
* working code examples on Famo.us 0.1.1
*/
.test-surface {
background-color: #EBEBF1;
font-family: "Helvetica Neue", Helvetica, sans-serif;
font-weight: 300;
padding: 20px;
@doup
doup / app.js
Last active August 29, 2015 14:00
Answer to StackOverflow question: "SetInterval(), ClearInterval() timer questions for javascript" – http://stackoverflow.com/questions/23257873/setinterval-clearinterval-timer-questions-for-javascript/23258830#23258830
$(function () {
var rounds = 3;
var states = ['work', 'rest', 'wait'];
var lengths = [3, 1, 2]; // In seconds
var start = $('#start');
var stop = $('#stop');
var stats = $('#stats');
var roundEl = $('#round');
var stateEl = $('#state');
var cronoEl = $('#crono');
@doup
doup / todo.md
Last active October 27, 2016 21:54
Markdown TODO example

Example:

  • foo
  • bar
@doup
doup / inspect.html
Created October 24, 2016 18:47
Chrome/Firefox element inspects element detection & bounding box
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Inspector</title>
<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<style>
body {
width: 50%;
@doup
doup / keybase.md
Created January 12, 2017 18:43
keybase.md

Keybase proof

I hereby claim:

  • I am doup on github.
  • I am doup (https://keybase.io/doup) on keybase.
  • I have a public key ASBQesR9H0meF424Hll015NaP6uLGAJ__yAMISbgQoR7FQo

To claim this, I am signing this object: