Skip to content

Instantly share code, notes, and snippets.

@bjornjohansen
bjornjohansen / maintenance.php
Created August 31, 2017 11:57
Custom WordPress maintenance mode page
<?php
wp_load_translations_early();
$protocol = wp_get_server_protocol();
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 30' );
?>
<!DOCTYPE html>
<html>
@minikomi
minikomi / persona.go
Last active December 11, 2015 06:59
mozilla persona test
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/sessions"
"io/ioutil"
"log"
"net/http"
"net/url"
@oscarfroberg
oscarfroberg / .vimrc
Created March 3, 2012 03:32
vim configuration file
set encoding=utf-8
set fileencoding=utf-8
set softtabstop=4
set expandtab
set autoindent
set mouse=a
set ignorecase
set smartcase
set pastetoggle=<F9>
set showcmd
@aaronsw
aaronsw / browserid.py
Created August 14, 2011 21:37
basic browserid support for web.py
import urllib, json
class FalseStorage(web.storage):
def __nonzero__(self): return False
def browserid():
c = web.cookies()
if c.get('browserid_assertion'):
out = urllib.urlencode(dict(audience=web.ctx.host, assertion=c.browserid_assertion))
o = json.loads(urllib.urlopen('https://browserid.org/verify', out).read())
if o['status'] == 'failure':
@aaronsw
aaronsw / browserid.js
Created August 14, 2011 21:36
Basic browserid functions for serverside use
function setCookie(c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie = c_name + "=" + c_value;
}
function browserid_login_callback(assertion){
setCookie('browserid_assertion', assertion, 90);
window.location.reload();