Skip to content

Instantly share code, notes, and snippets.

@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">
var Base = {
_ops: {},
_privateFnc: function () {},
abstract: function () {},
init: function (ops) {
this._ops = ops || {};
// INIT
}
};
@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');