Skip to content

Instantly share code, notes, and snippets.

View leoj3n's full-sized avatar
:octocat:
Edit status

Joel Kuzmarski leoj3n

:octocat:
Edit status
  • Drinking coffee somewhere.
View GitHub Profile
@ruyadorno
ruyadorno / osx_setup.md
Last active March 12, 2024 03:23 — forked from millermedeiros/osx_setup.md
Guide for setting up a new osx

Setup Mac OS X

This is just a personal script to help me remember all the steps required to setup a new osx machine in their correct order. I do not advise you to follow this guide if you don't know what you're doing.

Setup

0. Setup iCloud

@szimmers
szimmers / Gruntfile.js
Created October 22, 2013 14:30
example grunt file for running tasks in subdirectories, each which have their own grunt file
module.exports = function(grunt) {
grunt.registerTask('buildapp', function(dir) {
var done = this.async();
grunt.log.writeln('processing ' + dir);
grunt.util.spawn({
grunt: true,
args:['jshint', 'build', 'test', 'deploy'],
@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
@markjaquith
markjaquith / wp-config.php
Created August 12, 2013 20:19
`wp-config.php` file to sit above a pristine WordPress directory, whereby the site can symlink their WP directory to a common one, and this file will make sure their `wp-config.php` is the one that gets called. Untested in production. Just an idea right now.
<?php
$path = str_replace( $_SERVER['DOCUMENT_ROOT'], '', dirname( $_SERVER['SCRIPT_FILENAME'] ) );
$path_parts = explode( '/', $path );
while ( count( $path_parts ) > 0 ) {
$path = $_SERVER['DOCUMENT_ROOT'] . implode( '/', $path_parts ) . '/wp-config.php';
if ( file_exists( $path ) ) {
include( $path );
break;
} else {
array_pop( $path_parts );
@swalkinshaw
swalkinshaw / wp.log
Last active December 20, 2015 21:18
WP Logger output
[2013-08-09 19:40:52] WP.INFO: Started GET /download/ for 192.168.50.1 at 2013-08-09 19:40:52 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'stylesheet_root' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT * FROM wp_users WHERE user_login = 'admin' [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1) [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_pages' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_calendar' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_tag_cloud' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_nav_menu' LIMIT 1 [] []
[2013-08-09 19:40:52] WP.INFO: SQL Quer
/*
* A vim insert mode foot pedal
*/
#include <Bounce.h>
int ledPin = 11;
int footPedalPin = 9;
// 10 = debounce time in ms
@Integralist
Integralist / Description.md
Last active April 25, 2020 16:20
This is how BBC News currently implements it's Image Enhancer for responsive images. Note: this is a completely rebuilt version of the code so the BBC's original source code doesn't actually look anything like the below example.

The BBC has a server-side image service which provides developers with multiple sized versions of any image they request. It works in a similar fashion to http://placehold.it/ but it also handles the image ratios returned (where as placehold.it doesn't).

The original BBC News process (and my re-working of the script) follows roughly these steps...

  • Create new instance of ImageEnhancer
  • Change any divs within the page (which have a class of delayed-image-load) into a transparent GIF using a Base64 encoded string.
    • We set the width & height HTML attributes of the image to the required size
    • We know what size the image needs to be because each div has custom data-attr set server-side to the size of the image
    • We then set a class of image-replace onto each newly created transparent image
  • We use a 250ms setTimeout to unblock the UI thread and which calls a function resizeImages which enhances the image-replace images so their source is now set to a URL whe
@brichards
brichards / async-upload.php
Last active December 20, 2015 09:39
Dynamically-named Filter
<?php
/**
* Return the ID of the uploaded attachment of a given type
*
* @since 2.5.0
*
* @param int $id The uploaded attachment ID
*/
echo apply_filters("async_upload_{$type}", $id);
@westonruter
westonruter / readme.md
Last active December 19, 2015 17:38
vassh: Vagrant Host-Guest SSH Command Wrapper/Proxy/Forwarder

THIS REPO HAS MOVED! It has graduated to a dedicated GitHub project: https://github.com/x-team/vassh

The big pain of doing vagrant ssh is that it doesn’t drop you into the corresponding working directory in the Vagrant guest’s synced_folder, so you have to cd to the dir and then run whatever you needed to do (e.g. wp core update). This is the problem that vassh solves: it will make sure you start out in the corresponding directory. So if you’re in your WordPress project on your host machine, all you need to do is:

$ vassh wp core update

There’s also a wrapper called vasshin which will shell you into Vagrant at the current directory, with a prompt for entering commands. This gets you colors and interactive TTY. You can also pass commands as arguments to vasshin to have them executed right away in the colorized TTY (with some additional Vagrant .bash_login echoes and SSH connection close):

@swalkinshaw
swalkinshaw / Gruntfile.coffee
Created July 8, 2013 20:36
Grunt connect-livereload with pushState rewrites
'use strict'
path = require 'path'
parse = require('url').parse;
module.exports = (grunt) ->
grunt.initConfig
qunit:
all: ['tests/**/*.html']
clean: