Skip to content

Instantly share code, notes, and snippets.

Michael Smith mikespokefire

Block or report user

Report or block mikespokefire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am mikespokefire on github.
  • I am mikespokefire (https://keybase.io/mikespokefire) on keybase.
  • I have a public key whose fingerprint is 7DAC 9902 9F83 0A17 21F5 AE10 5758 4673 88FA B364

To claim this, I am signing this object:

View _serf_test.sh
# On Machine A
serf agent -bind 192.168.50.10
# On Machine B
serf agent -bind 192.168.50.20
serf join 192.168.50.10
# On Machine A (with some time between each command)
serf event deploy feature/testing
serf event test-event payload
View custom_rspec_matcher.rb
# The actual matcher class
class VirtusAttributeMatcher
# initialize is called with the expected outcome
# => expect(described_class).to have_attribute(:token)
def initialize(attribute_name)
@attribute_name = attribute_name
@options = {}
end
# When RSpec will call matches? on the expectation class, this needs to
@mikespokefire
mikespokefire / my_class.js
Last active Dec 14, 2015
Object Orientated JavaScript
View my_class.js
"use strict";
var MyClass = (function() {
function MyClass(publicString) {
this.publicString = publicString;
};
var privateString = "I'm a private string that can't be accessed directly";
// ============================================================================
@mikespokefire
mikespokefire / gist:3774881
Created Sep 24, 2012
Marking fields as dirty in Mongoid and ActiveRecord
View gist:3774881
class Muppet
include Mongoid::Document
field :tags, Array
end
m = Muppet.new(:biography => ['a', 'b', 'c'])
m.save
m.tags.pop
m.tags_will_change!
View appcontrollersadmin_controller.rb
class AdminController < ApplicationController
layout "admin"
http_basic_authenticate_with :name => "user", :password => "password"
end
View coasters controller
def index
@all_coasters = Coaster.all
@coasters = @all_coasters
Coaster.include_root_in_json = false
end
View gist:2421581
var myFunc = function() {
console.log(this); //currently outs DOMelement
};
if ($('body.home').length) {
$('.slideshow').cycle({
after: myFunc
});
}
View Full rake task
namespace :flickr do
desc "Pull all data from Flickr"
task :pull => :environment do
# Remove everything to do with the gallery
#Album.destroy_all
#Photo.destroy_all
View gist:2001722
def pending_orders?
orders.where(:status => Order::PENDING).exists?
end
You can’t perform that action at this time.