Skip to content

Instantly share code, notes, and snippets.

grav / render.js
Created Jun 25, 2017
Save a dynamically rendered page with Chrome Headless browser
View render.js
// Needs a running Chrome Headless, eg:
// /Applications/Google\ Chrome\\ Chrome\ Canary --headless --remote-debugging-port=9222
// Run with node, eg `node render.js output.html`
const CDP = require('chrome-remote-interface');
const fs = require('fs')
CDP((client) => {
// Extract used DevTools domains.
const {Page, Runtime} = client;
joepie91 /
Last active Mar 23, 2021
Rendering pages server-side with Express (and Pug)


  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
#!/usr/bin/sudo sh
## -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings`:
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
## Well, good, as long as its not intended to discourage *me* from doing this!
kesor / Gemfile
Last active Sep 30, 2019
Vagrantfile to create a chef-server (11.x) and a client box that uses it.
View Gemfile
source :rubygems
gem 'json', '= 1.5.4' # knife/chef 11.0 and 11.20 is broken with json 1.5.5/1.7.7
gem 'vagrant'
gem 'vagrant-hostmaster'
smougenot / A_Logstash.conf
Created Jul 26, 2012
Logstash Multiline Filter for Java Stacktrace (tested on field)
View A_Logstash.conf
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
yumike /
Created Dec 8, 2011
Thoughts about RSpec for Python
# codec: blocks
context('when user has permissions'):
it('should add new article'):
# some code
it('should delete existing article'):