Skip to content

Instantly share code, notes, and snippets.

View joshdover's full-sized avatar

Josh Dover joshdover

View GitHub Profile
@joshdover
joshdover / controller_template.js
Last active August 29, 2015 13:57
angular unit test blog post
describe('Controller: MyCtrl', function () {
beforeEach(module('MyApp'));
var scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
startController = function() {
$controller('MyCtrl', {
@joshdover
joshdover / activity.js
Last active August 29, 2015 14:00
MozActivity example
new MozActivity({
name: 'send',
data: {
type: 'text/plain',
text: 'Hello Android, I am a web app!'
}
});
@joshdover
joshdover / gauge_view.js.coffee
Last active December 10, 2015 14:58
GaugeView for Batman using JustGage
class Albedo.GaugeView extends Batman.View
@option 'title', 'max', 'min', 'value', 'better'
@::on 'appear', ->
@makeGauge()
makeGauge: ->
node = $(@get('node'))
node.attr 'id', @get('title')
@joshdover
joshdover / Gemfile
Created March 14, 2013 23:10
Standalone RSpec + Capybara Suite
source "https://rubygems.org"
gem "rspec"
gem "capybara"
gem "headless"
@joshdover
joshdover / application.html.erb
Last active December 25, 2015 03:49
Rails helper for automatically generating mixpanel tracking for links.
<!-- Include Mixpanel and init before this. -->
<!-- Place at the bottom of your layout (ex: app/views/layouts/application.html.erb) -->
<% if content_for :mixpanel %>
<%= javascript_tag(yield :mixpanel) %>
<% end %>
@joshdover
joshdover / gist:7966016
Created December 14, 2013 22:49
Declarative Mixpanel Helper Allows you to declare tracking of onClick event on any type of DOM element.
# Helper for tracking mixpanel events, allows for declaritve events. Usage:
# <a href="http://google.com" data-mixpanel="name: 'clicked link'">Google</a>
# <a href="http://cows.com" data-mixpanel="name: 'clicked link', data: { animal: 'cow' }">Cow</a>
# <li data-mixpanel="'clicked list element'">I am not a link!</li>
$(document).on "click", "[data-mixpanel]", (event) ->
options = eval "({" + $(this).attr("data-mixpanel") + "})"
# If event is bound to a link, add delay to ensure event is tracked.
if event.currentTarget.href?
options.data = {} if !options.data?
@joshdover
joshdover / pointer.patch
Created June 2, 2018 03:20
bochs for Mac OS 10.14
--- config.cc 2018-06-01 22:18:19.000000000 -0500
+++ config1.cc 2018-06-01 22:18:02.000000000 -0500
@@ -3258,7 +3258,7 @@
fprintf(fp, ", biosdetect=%s", SIM->get_param_enum("biosdetect", base)->get_selected());
- if (SIM->get_param_string("model", base)->getptr()>0) {
+ if (SIM->get_param_string("model", base)->getptr() != 0) {
fprintf(fp, ", model=\"%s\"", SIM->get_param_string("model", base)->getptr());
}
@joshdover
joshdover / shim.js
Last active August 29, 2018 20:42
Hapi v17 Shim - probably not 100% complete - not recommended for production
const Hapi = require('hapi');
const Boom = require('boom');
function installShim(server) {
/**
* Request wrapping factory that emulates Hapi v14 behavior.
*/
function handlerWrapper(originalHandler, { isPreResponse = false } = {}) {
// Leave undefined, null, and string (registered server functions) values unchanged.
@joshdover
joshdover / keybase.md
Created August 31, 2018 15:38
keybase.md

Keybase proof

I hereby claim:

  • I am joshdover on github.
  • I am joshdover (https://keybase.io/joshdover) on keybase.
  • I have a public key ASAfX7rWttw5Abh7TK_kfxc421jTuwwL82kmpGLn_1W4Bwo

To claim this, I am signing this object:

@joshdover
joshdover / so_types.js
Last active July 8, 2021 16:08
Kibana Saved Object types
const TYPES_7_7_to_7_14 = [
"action",
"action_task_params",
"alert",
"api_key_pending_invalidation",
"apm-indices",
"apm-server-schema",
"apm-services-telemetry",
"apm-telemetry",
"app_search_telemetry",