Skip to content

Instantly share code, notes, and snippets.

View leewillis77's full-sized avatar

Lee Willis leewillis77

View GitHub Profile
@JoelEadeDesign
JoelEadeDesign / SassMeister-input.scss
Created June 1, 2015 11:15
Generated by SassMeister.com.
// ----
// libsass (v3.2.4)
// ----
.woo_sc_links {
margin: 0 0 30px;
}
.woo_sc_link {
width: auto!important;
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
shuffle = (a) ->
# From the end of the list to the beginning, pick element `i`.
for i in [a.length-1..1]
# Choose random element `j` to the front of `i` to swap with.
j = Math.floor Math.random() * (i + 1)
# Swap `j` with `i`, using destructured assignment
[a[i], a[j]] = [a[j], a[i]]
# Return the shuffled array.
a[0]
@tomjn
tomjn / custom_page.php
Last active July 3, 2018 11:50
A base class used to create arbitrary content at arbitrary URLs in WordPress without needing a post or listing/archive to host it
<?php
/**
* A helper class to implement arbitrary content at arbitrary URLs without a supporting post or page.
* Inherit from this class and implement the render_page method
*
* @author: Tom J Nowell ww.tomjn.com
* @License: GPL 2+
*/
abstract class Tomjn_Custom_Page {
@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.