Skip to content

Instantly share code, notes, and snippets.

@maxbeizer
maxbeizer / gist:4253185
Created December 10, 2012 20:36
wp down for maintenance
// blog is down for maintenance code
// MUST BE REMOVED!
function cwc_maintenance_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
wp_die('Site is in progress; please come back soon.');
}
}
add_action('get_header', 'cwc_maintenance_mode');
@maxbeizer
maxbeizer / gist:5774396
Created June 13, 2013 15:00
command enter to send message
$(document).on "keydown", "#new_message textarea", (e) ->
$(this).parents("form").submit() if e.keyCode is 13 and (e.metaKey or e.ctrlKey)
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
UPDATE wp_options SET option_value = replace(option_value, 'OLD_SITE_URL', 'NEW_SITE_URL') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'OLD_SITE_URL','NEW_SITE_URL');
UPDATE wp_posts SET post_content = replace(post_content, 'OLD_SITE_URL', 'NEW_SITE_URL');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'OLD_SITE_URL', 'NEW_SITE_URL');
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*

With options -e, -n, -p, perl can do what grep/awk/sed can, what about ruby?

Let's take the result of ls -l as input and process it with ruby

grep with ruby

\ls -l | ruby -ne 'print if /^d/'

awk with ruby

\ls -l | ruby -ne 'puts split(/\s+/).last if /^d/'

Centresource Pattern Library Guide

Below are elements that are expected to be in a Photoshop pattern library file.

Typography

  • Headers (h1 - h5)
  • Paragraphs
  • Lead Copy
  • Unordered List
@maxbeizer
maxbeizer / ragtag-mappings
Created July 23, 2014 23:09
Mappings for Ragtag.vim ❤️ tpope
CTRL+X / Close the last open HTML tag
CTRL+X SPACE Create open/close HTML tags from the typed word
CTRL+X CR The same as CTRL+X SPACE but puts a new space in between
CTRL+X ! Insert HTML doctype
CTRL+X @ Insert CSS stylesheet
CTRL+X # Insert meta content-type meta tag
CTRL+X $ Load JavaScript document
For the following mappings, suppose that
you have typed "foo".
@maxbeizer
maxbeizer / keybase.md
Created February 22, 2015 03:54
Keybase verification

Keybase proof

I hereby claim:

  • I am maxbeizer on github.
  • I am maxbeizer (https://keybase.io/maxbeizer) on keybase.
  • I have a public key whose fingerprint is FA30 0630 BA8B D1E4 DBFB 8688 B5EF 09B0 BA34 2832

To claim this, I am signing this object:

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style