Skip to content

Instantly share code, notes, and snippets.

# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress
@gmurphey
gmurphey / routes.application.js
Last active August 29, 2015 14:25
New Twiddle
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return Ember.A([
{ title: 'hello' },
{ title: 'world' }
]);
}
});
@gmurphey
gmurphey / seeds.rb
Created February 21, 2011 00:38
Rails US state seeder
State.create([
{ :name => 'Alabama', :abbr => 'AL' },
{ :name => 'Alaska', :abbr => 'AK' },
{ :name => 'Arizona', :abbr => 'AZ' },
{ :name => 'Arkansas', :abbr => 'AR' },
{ :name => 'California', :abbr => 'CA' },
{ :name => 'Colorado', :abbr => 'CO' },
{ :name => 'Connecticut', :abbr => 'CT' },
{ :name => 'Delaware', :abbr => 'DE' },
{ :name => 'Florida', :abbr => 'FL' },
@gmurphey
gmurphey / mac.md
Created June 4, 2012 22:20
New System Checklist

System

  • brew
  • dotfiles
  • rvm
  • update rubygems
  • git (brew install git)
  • node (brew install node)
  • bundler (gem install bundler)
  • hitch (gem install hitch)
  • grunt.js (npm install -g grunt)
@gmurphey
gmurphey / outbound-tracking.js
Created June 7, 2012 16:27
Outbound link tracking with GA and jQuery
(function ($) {
$(function () {
$('a[href^="https?:"]:not(a[href^="https?://' + document.location.hostname + '"])').click(function () {
try { _gat._getTrackerByName()._trackEvent('Outbound Links', $(this).attr('href')); } catch (e) {}
});
});
}) (jQuery);
@gmurphey
gmurphey / qunit.js
Created July 20, 2012 15:59
Spy Tests
var Windows = {
method1: function () { }
};
(function ($) {
module('windows-api', {
setup: function () {
sinon.spy(Windows, 'method1');
},
@gmurphey
gmurphey / chain.js
Created October 26, 2012 19:15
Chained jQuery
this.$el.find('article')
.addClass('stage-center')
.prevAll('article')
.addClass('stage-left')
.end()
.nextAll('article')
.addClass('stage-right');
$('.tableClose').click(function (ev) {
$(this).parents('.shopPlansTable').find('.shopPlansSectionHead').toggleClass('visible');
});​
@gmurphey
gmurphey / .gitconfig
Last active December 11, 2015 09:49
Replace a pattern in all files.
# usage: git sed 's/old/new/g'
[alias]
sed = !git grep --full-name -l -z '.' | xargs -0 gsed -i -e
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
options: {
jshintrc: ".jshintrc"
},
files: ["Gruntfile.js", "app/**/*.js", "test/qunit/tests/**/*.js"]