Skip to content

Instantly share code, notes, and snippets.

Avatar

juanda juanda99

  • Zaragoza, Spain
View GitHub Profile
@atmoz
atmoz / suspend-to-hibernate.service
Last active Aug 24, 2017
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/
View suspend-to-hibernate.service
[Unit]
Description=Delayed hibernation trigger
Documentation=https://bbs.archlinux.org/viewtopic.php?pid=1420279#p1420279
Documentation=https://wiki.archlinux.org/index.php/Power_management
Conflicts=hibernate.target hybrid-suspend.target
Before=sleep.target
StopWhenUnneeded=true
[Service]
Type=oneshot
@clauda
clauda / pagine.js
Last active Nov 21, 2017
Mongoose Pagination #NodeJS #Express #MongoDB
View pagine.js
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);
@webaware
webaware / force-ssl-url-scheme.php
Last active Nov 9, 2022
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: https://ssl.webaware.net.au/https-detection/
View force-ssl-url-scheme.php
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/webaware/4688802
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI: http://webaware.com.au/
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility