Skip to content

Instantly share code, notes, and snippets.

View wesbos's full-sized avatar
🔥
SLAYING BUGS

Wes Bos wesbos

🔥
SLAYING BUGS
View GitHub Profile
@wesbos
wesbos / gist:1885495
Created February 22, 2012 15:16
Facebook add application to a page 2012
Keep losing this snippet and facebook has taken away the buttons to do this so you must craft your own link
http://facebook.com/add.php?api_key=YOUR_APP_KEY&pages=1&page=YOUR_PAGE_ID
@wesbos
wesbos / gist:3744393
Created September 18, 2012 17:15
Use latest version of jquery in wordpress
/* pop me into your functions.php */
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://code.jquery.com/jquery-git.js"), false, '1.8.2');
wp_enqueue_script('jquery');
var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
exec("git pull", puts);
// put this in your /Packages/User/Preferences.sublime-settings
// if this isn't being recognized in all languages, check to see if you have /packages/User/[langauge].sublime-settings is overriding anything as those files take precedence over user settings
"tab_size": 4,
"translate_tabs_to_spaces": false,
JSON::ParserError - 795: unexpected token at 'WARNING: Missing required dependency to activate optional built-in extension coffeescripttransform.rb
cannot load such file -- coffee-script
{"/CNAME":"/CNAME","/docs/asciidoc-quick-reference.adoc":"/docs/asciidoc-quick-reference/index.html","/docs/asciidoc-quick-reference.pdf":"/docs/asciidoc-quick-reference.pdf","/docs/asciidoc-recommended-practices.adoc":"/docs/asciidoc-recommended-practices/index.html","/docs/asciidoc-syntax-quick-reference.redirect":"/docs/asciidoc-syntax-quick-reference.html","/docs/asciidoc-writers-guide.adoc":"/docs/asciidoc-writers-guide/index.html","/docs/editing-asciidoc-with-live-preview.adoc":"/docs/editing-asciidoc-with-live-preview/index.html","/docs/hack-asciidoctor-maven-plugin.adoc":"/docs/hack-asciidoctor-maven-plugin/index.html","/docs/index.adoc":"/docs/index.html","/docs/install-and-use-asciidoclet.adoc":"/docs/install-and-use-asciidoclet/index.html","/docs/install-and-use-asciidoctor-gradle-plugin.adoc":"/docs/install-and-
@wesbos
wesbos / gist:1760164
Created February 7, 2012 15:15
gsed wordpress DB to production
Simple little snippet that I always forget. I use this to quickly find/replace all references to any paths within a wordpress DB when migrating. Much faster than using a GUI
You must have gsed installed, used macports to do this. Native osx sed sucks.
usage: gsed -i 's/[old-url]/[new-url]/gi' database-name.sql
Example:
gsed -i 's/localhost\/wordpress-local\/subfolder/production.com/gi' livedb.sql
@wesbos
wesbos / gist:1476820
Created December 14, 2011 14:36
PhantomJS Screenshot
var page = new WebPage(),
address, output, size;
address = "http://www.metachunk.com/";
width = 1024; height = 600;
output = "./screenshots/wat-"+width+"X"+height+".png";
page.viewportSize = { width: width, height: height };
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") {
@wesbos
wesbos / toggle-debug.php
Created January 5, 2016 19:18 — forked from trepmal/toggle-debug.php
WordPress experiment. Toggle debug from admin bar
<?php
/*
Plugin Name: Toggle Debug
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love.
*/
/*
// In wp-config.php, wrap debug constants in a cookie conditional
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) {
define('WP_DEBUG', true);
}
@wesbos
wesbos / you-are-welcome.sh
Last active March 28, 2017 13:36
Listen to all the voices inside your Mac computer
# paste this into your console and hit enter
for voice in Agnes Kathy Princess Vicki Victoria Alex Bruce Fred Junior Ralph Albert Bad News Bahh Bells Boing Bubbles Cellos Deranged Good News Hysterical Pipe Organ Trinoids Whisper Zarvox; do say "Hi `whoami` my name is ${voice}" -v ${voice}; done
var gulp = require('gulp'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
imageMin = require('gulp-imagemin'),
minifyCSS = require('gulp-minify-css'),
notify = require('gulp-notify'),
plumber = require('gulp-plumber'),
sass = require('gulp-sass'),