Skip to content

Instantly share code, notes, and snippets.

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

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 compile.sh 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
0815.ru
0wnd.net
0wnd.org
10minutemail.co.za
10minutemail.com
123-m.com
1fsdfdsfsdf.tk
1pad.de
20minutemail.com
21cn.com
@vukicevic
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
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 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
acl localnet src 0.0.0.0/8 192.168.100.0/24 192.168.101.0/24
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
KartikTalwar / Documentation.md
Last active Jul 7, 2020
Rsync over SSH - (40MB/s over 1GB NICs)
View Documentation.md

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
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
WHERE pid IN (SELECT pid
FROM photo_tag
WHERE subject='243117879034102' )
OR
pid IN (SELECT pid
FROM photo
WHERE aid IN (SELECT aid
You can’t perform that action at this time.