Skip to content

Instantly share code, notes, and snippets.

@jamiew
jamiew / google_twunter_lol
Created July 28, 2011 20:34
All the dirty words from Google's "what do you love" project: http://www.wdyl.com/
easterEgg.BadWorder.list={
"4r5e":1,
"5h1t":1,
"5hit":1,
a55:1,
anal:1,
anus:1,
ar5e:1,
arrse:1,
arse:1,
@paulirish
paulirish / rAF.js
Last active July 19, 2024 19:50
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@mlawrie
mlawrie / ssl_setup_example.sh
Last active October 18, 2018 12:49
Create an SSL Certificate Signing Request on OSX with wildcard and alternate names
# First, generate the key. You will be prompted to enter a password, but we will strip it out in the next step:
openssl genrsa -des3 -out server.orig.key 2048
# Then, stip out the password:
openssl rsa -in server.orig.key -out server.key
# Edit the OSX openssl config file to include your alternate names.
# Edit the 'subjectAltName' field. E.g.:
@rozd
rozd / Export Layers To Files.jsx
Last active November 1, 2022 23:07
Modified Photoshop's "Export Layers To Files" script.
// Copyright 2007. Adobe Systems, Incorporated. All rights reserved.
// This script will export each layer in the document to a separate file.
// Written by Naoki Hada
// ZStrings and auto layout by Tom Ruark
/*
@@@BUILDINFO@@@ Export Layers To Files.jsx 1.0.0.16
*/
/*
@tybenz
tybenz / lenovo-mute-tut.md
Last active July 29, 2021 06:34
Enabling mic mute button and light on Lenovo Thinkpads

#####Copied from askubuntu's Enabling mic mute button and light on Lenovo Thinkpad

There are two possible "hardware" indicators (to show that mute is on or off):

The Power button light (green) will blink to show when mute is on The Mic mute button light (orange) will be on or off to show mute status (just like in Windows)

Solution 2 requires a patched thinkpad_acpi kernel module, and is only recommended for advanced users who know what they are doing. This is because the patch is not included by the thinkpad_acpi developers by default, (See this discussion for more details).

###Common Steps

@kendellfab
kendellfab / golang-json-marshall
Created August 16, 2013 22:35
Handling custom Json marshalling in golang.
type Whatever struct {
someField int
}
func (w Whatever) MarshalJSON() ([]byte, error) {
return json.Marshal(struct{
SomeField int `json:"some_field"`
}{
SomeField: w.someField,
})
@elandau
elandau / StateMachine
Created October 30, 2014 23:22
Rx based state machine
package com.netflix.experiments.rx;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;
import rx.Observable.OnSubscribe;
@lgladdy
lgladdy / hello-taylor.php
Last active August 29, 2016 18:15
A WordPress plugin to replace Hello Dolly lyrics with the infinitely better Taylor Swift.
<?php
/*
Plugin Name: Hello Taylor
Plugin URI: https://gist.github.com/lgladdy/9e1a7303c6a6bf43b9b1
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in <strike>two</strike> words sung most famously by <strike>Louis Armstrong: Hello, Dolly.</strike>Taylor Swift. When activated you will randomly see a lyric from <strike><cite>Hello, Dolly</cite></strike><cite>Taylor Swift</cite> in the upper right of your admin screen on every page.
Author: Liam Gladdy (based on Hello Dolly by Matt Mullenweg)
Version: 1.1
Author URI: http://www.twitter.com/lgladdy & http://ma.tt/
*/
<?php
/**
* Plugin Name: Multisite Network Upgrade WP-CLI Command
* Plugin URI: https://gist.github.com/westonruter/beb6120e61e9691e88ac
* Author: Weston Ruter, Mo Jangda
* Description: From command line run <code>wp multisite-network-upgrade</code>. Script converted into WP-CLI command from Mo's <a href="https://gist.github.com/mjangda/986838">CLI script</a>.
* License: GPL2
*/
if ( ! defined( 'WP_CLI' ) || ! WP_CLI ) {