Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mykebates on github.
  • I am mykebates (https://keybase.io/mykebates) on keybase.
  • I have a public key ASB_nkUainUuvKwCh-4bN7MUyMq3ztgHjga6oUuxNlt_Jwo

To claim this, I am signing this object:

@mykebates
mykebates / redirect.xml
Last active August 29, 2015 14:25 — forked from uniquelau/redirect.xml
Quick Redirect to Production Media, for Media Heavy Sites
<!-- IIS URL Rewrite, this can be placed in the web.config -->
<!-- Handle Missing Media on Development Environment -->
<rule name="Handle missing media" stopProcessing="true">
<match url="^media/(.*)" />
<conditions logicalGrouping="MatchAll">
<!-- Add Conditions, so local only -->
<add input="{REMOTE_HOST}" pattern="localhost" />
<!-- Handle Files and Folders -->
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
require 'formula'
class Mpd < Formula
homepage "http://www.musicpd.org/"
stable do
url "http://www.musicpd.org/download/mpd/0.19/mpd-0.19.4.tar.xz"
sha1 "f0397d7e923cd11fef8dae238efe9ae9ff12120f"
end
require 'formula'
class Mpd < Formula
homepage "http://www.musicpd.org/"
stable do
url "http://www.musicpd.org/download/mpd/0.19/mpd-0.19.4.tar.xz"
sha1 "f0397d7e923cd11fef8dae238efe9ae9ff12120f"
end
@mykebates
mykebates / 0_reuse_code.js
Created June 13, 2014 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@mykebates
mykebates / gist:6450126
Created September 5, 2013 13:32
Composer Install Globally
$ curl -sS https://getcomposer.org/installer | php
$ (sudo) mv composer.phar /usr/local/bin/composer
If you can run the following command in terminal it will tell you who the manufacturer is:
ioreg -lw0 | grep \"EDID\" | sed "/[^<]*</s///" | xxd -p -r | strings -6
Following is an interpretation of the string that is returned telling you who the manufacturer is.
LPXXXX = LG
LSNXXXX = Samsung
// Pass in a post id and optionally a thumbnail string name and receive the image path
function getImgUrl($size, $id){
$src;
if(!$id){
$id = $post->ID;
}
if($size){
$src = wp_get_attachment_image_src( get_post_thumbnail_id($id), array( 150,150 ), false, '' );
}
else{
@mykebates
mykebates / ExcerptTrimmer
Created April 22, 2012 02:34
Trim excerpt without incomplete words
function excerpt_char($text, $lim, $delim="&hellip;")
{
$len = strlen($text);
if ($len <= $lim) return $text;
// split at first word boundary after $lim chars
preg_match('/(.{' . $lim . '}.*?)\b/', $text, $matches);
$text = preg_replace("'(&[a-zA-Z0-9#]+)$'", '$1;', $matches[1]);
$text .= $delim;