Skip to content

Instantly share code, notes, and snippets.

roytanck / autoautoptimize.php
Last active Sep 21, 2019
Auto-configure Autoptimize across a WordPress network
View autoautoptimize.php
* Plugin Name: RT Autoautoptimize
* Plugin URI:
* Description: Automatically configures default settings for the Autoptimize plugin across a WordPress network
* Version: 0.9
* Author: Roy Tanck
* Author URI:
* License: GPL2
domenic /
Last active Jun 23, 2020
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this for our purposes, but for your project it might be npm build or gulp make-docs or make or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

View count.js
var actionUtil = require('sails/lib/hooks/blueprints/actionUtil');
module.exports = function getCount (req, res) {
var Model = actionUtil.parseModel(req)
, criteria = actionUtil.parseCriteria(req);
Model.count(criteria, function(error, response) {
if (error) {
return res.serverError('database_error', error);
View disposable-email-provider-domains
vukicevic / Draw Bitmap From Int Array
Last active Nov 17, 2019
Generate a monochrome bitmap image in JavaScript using a byte-array. The image is generated such that every bit in the array is shown as either a black (1) or white (0) pixel.
View Draw Bitmap From Int Array
* depth: 1 - monochrome
* 4 - 4-bit grayscale
* 8 - 8-bit grayscale
* 16 - 16-bit colour
* 32 - 32-bit colour
function drawArray(arr, depth) {
var offset, height, data, image;
hpcorona / squid.conf
Created Mar 1, 2013
simple squid3 configuration to allow all to connect to all
View squid.conf
#Recommended minimum configuration:
acl manager proto cache_object
acl localhost src
acl to_localhost dst
acl localnet src
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
KartikTalwar /
Last active Jul 7, 2020
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
mrbongiolo / fql_query_page_photos.fql
Last active Jun 22, 2016
Query for FQL to get all photos from a Facebook Page albums and all photos tagged with that Facebook Page
View fql_query_page_photos.fql
# Formatted for readability
SELECT src, src_height, src_width, src_small, src_small_height, src_small_width
FROM photo
FROM photo_tag
WHERE subject='243117879034102' )
pid IN (SELECT pid
FROM photo
You can’t perform that action at this time.