Skip to content

Instantly share code, notes, and snippets.

View juanda99's full-sized avatar

juanda juanda99

View GitHub Profile
webaware / force-ssl-url-scheme.php
Last active September 3, 2023 00:05
For WordPress, force the protocol scheme to be HTTPS when is_ssl() doesn't work, e.g. on a load-balanced server where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't indicate that SSL is being used. NB: may not be needed now, see SSL Insecure Content Fixer and HTTP Detection:
Plugin Name: Force SSL URL Scheme
Plugin URI:
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI:
atmoz / suspend-to-hibernate.service
Last active December 14, 2022 13:48
Systemd services to hibernate after 2 hours of suspend. This is to increase security and battery usage while preserving a fast resume in working hours. Put files in /etc/systemd/system/
Description=Delayed hibernation trigger
clauda / pagine.js
Last active November 21, 2017 11:51
Mongoose Pagination #NodeJS #Express #MongoDB
var mongoose = require('mongoose');
mongoose.Query.prototype.paginate = function(page, limit, callback) {
var query = this
, page = page || 1
, limit = limit || 10
, offset = (limit * page) - limit;
query = query.skip(offset).limit(limit);