Skip to content

Instantly share code, notes, and snippets.

View pugsley's full-sized avatar

Tama Pugsley pugsley

  • Wellington, New Zealand
View GitHub Profile
@pugsley
pugsley / dump.twig
Created May 20, 2014 22:23
Slightly more readable twig dump (without writing an extension)
<pre style='font-size: 12px;font-family: monospace;'>
{{ dump()|
replace({
"=>\n": ":",
"[\"": "",
"\"]": ""
})|
replace({
": ": ": "
})|
// vanilla jQuery.one
document.addEventListener("click", function h(e) {
// do stuff, then remove listener
document.removeEventListener("click", h);
});
// Based on: http://unscriptable.com/2009/03/20/debouncing-javascript-methods/
function debounce(callback, wait, immediate) {
var timeout;
return function() {
var self = this,
args = arguments;
if (timeout) {
clearTimeout(timeout);
} else if (immediate) {
callback.apply(self, args);
@pugsley
pugsley / mysql-backup.md
Last active July 30, 2022 22:36
MySQL dump > compress > encrypt

Generate openssl keys:

openssl req -x509 -nodes -newkey rsa:2048 -keyout mysqldump-key.priv.pem -out mysqldump-key.pub.pem

Create a mysql default file:

# ~/.mysqldump
[mysqldump]
host = host.here.com