Skip to content

Instantly share code, notes, and snippets.

View dpobel's full-sized avatar

Damien Pobel dpobel

View GitHub Profile
@ebidel
ebidel / coverage.js
Last active April 27, 2024 04:13
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
function classListShim(view) {
"use strict";
if (!('HTMLElement' in view) && !('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = (view.HTMLElement || view.Element)[protoProp]
@naholyr
naholyr / 1-useless-stack.js
Last active June 8, 2021 08:29
Make stack traces useful again
var fs = require('fs');
// Here is a simple function that reads a file and makes something with its content
function readLog1 (cb) {
// Notice how I even gave a name to my callback, this is useful for stack traces, everyone says…
fs.readFile('file-not-found.log', function onRead1 (err, content) {
// Usual error handling
if (err) return cb(err);
@dspe
dspe / navigator.html.twig
Created March 4, 2013 15:54
navigator for ezpublish5
{% if total > limit %}
{% set total_pages = (total / limit)|number_format() %}
{% set current = (offset / limit)|number_format() + 1 %}
{% set next_offset = offset + limit %}
{% set prev_offset = offset - limit %}
{% set left = 6 %}
{% set right = 6 %}
{% set url = url == "/" ? "" : url %}
@shimondoodkin
shimondoodkin / APPNAME
Created July 2, 2011 17:33 — forked from peterhost/node_debian_init.sh
init.d script for node.js for debian
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@tdd
tdd / gitconfig.ini
Last active April 17, 2024 10:04
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases