Skip to content

Instantly share code, notes, and snippets.

View chriswallace's full-sized avatar

Chris Wallace chriswallace

View GitHub Profile
@bjork
bjork / h1-move-script-to-bottom.php
Last active August 29, 2015 14:19
Helper functions to move scripts enqueued by WordPress or plugins to bottom
<?php
/**
* Move script(s) to bottom
*
* @param string|array $script_handles Script handles to be moved to bottom
* @param array $args Additional arguments. Defaults to array( 'move_deps' => false ). Set to true to also move scripts dependencies.
*/
function h1_move_script_to_bottom( $script_handles, $args = array() ) {
$defaults = array(
@markjaquith
markjaquith / aaa.nginxconf
Last active February 1, 2017 04:30
Grab non-locally-existing production images from Photon for your local WordPress dev environment
location ~* \.(jpe?g|gif|png)$ {
try_files $uri @photon;
}
location @photon {
rewrite ^(.*)-([0-9]+)x([0-9]+)\.(jpe?g|gif|png)$ http://i0.wp.com/$host$1.$4?resize=$2,$3;
rewrite . http://i0.wp.com/$host$request_uri;
}
@tomazzaman
tomazzaman / codeable.io.conf
Created February 26, 2015 21:38
Codeable.io Nginx config
server {
include /home/webmaster/www/codeable.io.conf;
server_name codeable.io;
listen 443 ssl spdy default_server;
root /home/webmaster/www/codeable.io;
index index.php index.html;
error_log /var/log/nginx/codeable.io.error.log warn;
@alexkingorg
alexkingorg / sass-selectors.scss
Last active June 3, 2016 18:30
Use SASS variables for selectors.
// Vars - note the quotes around comma separated selectors
$a-tags: 'a, a:active, a:hover, a:visited';
$a-tags-hover: 'a:active, a:hover';
// Usage
#{$a-tags} {
color: red;
font-size: 1em;
text-decoration: none;
}
@markjaquith
markjaquith / gist:6225805
Last active February 21, 2024 23:56
WordPress multi-tenant directory structure sharing core files for opcode awesomeness, fast deployments, and low disk usage. With inspiration from @weskoop. "=>" indicates a symlink.
sites
|__ ms.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
| |__ wp-config.php
|__ one.dev
| |__ content
| |__ index.php
| |__ wp => ../../wordpress/stable
@jptksc
jptksc / get_twitter_profile_image
Created August 9, 2013 15:07
Get and cache any Twitter profile image without the Twitter API.
function get_twitter_profile_img($username, $size = '') {
$api_call = 'https://twitter.com/users/'.$username.'.json';
$results = json_decode(file_get_contents($api_call));
$image_url = str_replace('_normal', $size, $results->profile_image_url);
// Replace with your cache directory.
$image_path = './cache/';
// Get the name of the file.
$exploded_image_url = explode("/",$image_url);