Skip to content

Instantly share code, notes, and snippets.

Otto Rask rask

Block or report user

Report or block rask

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View wp-transients-example.php
<?php
/**==================================================================================
* WordPress transients example.
*
* This file shows the normal usage for WordPress transients with beefy comments.
*
* @author Otto J. Rask
*/
@rask
rask / wxrsplitter.py
Created Mar 20, 2015
WordPress 4.* WXR Splitter Python Script
View wxrsplitter.py
#!/usr/bin/python
# Originally created by eerac (and ivalegre) at https://wordpress.org/support/topic/wxr-file-splitter
# Modified by Otto Rask to work with WordPress 4.* WXR files (<item>s are indented with a
# single \t instead of two).
# This script is designed to take a wordpress xml export file and split it into some
# number of chunks (2 by default). The number of lines per chunk is determined by counting
# the number of occurences of a particular line, '<item>\n' by default, and breaking up the
# such that each chunk has an equal number occurences of that line. The appropriate header
@rask
rask / example.py
Last active Apr 24, 2018
async compatible KeyedPool for Python
View example.py
#!/usr/bin/env python
import asyncio
from keyed_pool import KeyedPool
async def produce(pool):
await pool.put('foo', 'bar')
await pool.put('hello', 'world')
await asyncio.sleep(4)
await pool.put('foo', 'baz')
@rask
rask / README.md
Last active Mar 22, 2018
Modular Nginx configuration for PHP
View README.md

Modular PHP serving with Nginx

  • Simple maps for vhost locations and PHP versions
  • Still allows custom vhosts when added manually inside conf.d/

WARNING: I use this setup for local development, it is not meant to be used in production as is.

@rask
rask / wpgetridofubuntusystemfont.php
Last active May 2, 2017
Remove Ubuntu font from WP4.6 system font stack
View wpgetridofubuntusystemfont.php
<?php
/**
* Plugin name: Get rid of Ubuntu font
* Description: Attempt to override the 4.6 system font stack to get rid of Ubuntu font.
* Author: Otto Rask
* Author URI: https://github.com/rask
* License: MIT
*/
View keybase.md

Keybase proof

I hereby claim:

  • I am rask on github.
  • I am ojrask (https://keybase.io/ojrask) on keybase.
  • I have a public key whose fingerprint is D1F1 B1EC 2861 B7CE 37BE 4DAE CB4C E54A F8F3 5199

To claim this, I am signing this object:

@rask
rask / document-scrolltop-shim.js
Created Apr 26, 2016
A somewhat cross-browser implementation of getting the current `scrollTop` value of the body/document element.
View document-scrolltop-shim.js
/**
* document-scrolltop-shim.js
*
* Cross-browser adjustments for getting and setting the current scrollTop -value for
* the body/html element.
*
* @author Otto Rask
*/
/**
@rask
rask / cq-prolyfill-sass-escaper.js
Created Jan 19, 2016
ausi/cq-prolyfill classname escaper Sass function
View cq-prolyfill-sass-escaper.js
/**
* This node-sass function can be used to escape class names generated for ausi/cq-prolyfill.
* https://github.com/ausi/cq-prolyfill
*/
var nsass = require('node-sass');
var sassFunctions = {
/**
* Sass function to escape [!=><] characters with a
You can’t perform that action at this time.