Skip to content

Instantly share code, notes, and snippets.

View zaius's full-sized avatar

David Kelso zaius

  • Beyond Pricing
  • San Francisco
View GitHub Profile
@zaius
zaius / console.html
Created January 21, 2011 05:59
Overriding of console for debugging on jquery plugins
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$.fn.myWidget = function(params) {
(function(console){
if (!params.debug) console = { log: function(){} };
console.log("Logging enabled!");
})(console);
@zaius
zaius / 0001-Update-for-10.6.patch
Created April 26, 2011 21:48
TerminalTabSwitching update for 10.6
From 95badf3776ce6a69bdff356649c7f345567c148c Mon Sep 17 00:00:00 2001
From: David Kelso <david@kelso.id.au>
Date: Tue, 26 Apr 2011 14:44:09 -0700
Subject: [PATCH] Update for 10.6.
---
TerminalTabSwitching.xcodeproj/project.pbxproj | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/TerminalTabSwitching.xcodeproj/project.pbxproj b/TerminalTabSwitching.xcodeproj/project.pbxproj
@zaius
zaius / open_uri.rb
Created October 7, 2011 21:46
Allow open-uri to follow unsafe redirects (i.e. https to http)
# Allow open-uri to follow unsafe redirects (i.e. https to http).
# Relevant issue:
# http://redmine.ruby-lang.org/issues/3719
# Source here:
# https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
module OpenURI
class <<self
alias_method :open_uri_original, :open_uri
alias_method :redirectable_cautious?, :redirectable?
@zaius
zaius / verisign_certs.sh
Last active October 13, 2015 22:25 — forked from grahamlyons/verisign_certs.sh
Add missing Verisign certificates back into CA bundle on Ubuntu
#!/bin/sh
CERT_PATH=/usr/local/share/ca-certificates/verisign.crt
write_certs() {
cat > $1 <<EOF
-----BEGIN CERTIFICATE-----
MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG
A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz
cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2
@zaius
zaius / .tmux.conf
Last active December 17, 2015 22:38
basic zshrc
# Remap prefix to ctrl-s - keeps ctrl-a free for start of line
set -g prefix C-s
unbind C-b
# Keep consistent with screen behavior
bind C-s last-window
bind C-d detach
bind C-c new-window
bind C-r source-file $HOME/.tmux.conf
@zaius
zaius / hostcheck.rb
Created July 1, 2013 21:10
Website monitoring with SMS notifications
#!/usr/bin/env ruby
require 'curb'
require 'yaml'
hosts = %w(
example.com
google.com
)
@zaius
zaius / handlebars.rb
Created November 20, 2013 21:51
Serving ember templates from rails
# Put in config/initializers/handlebars.rb
# Add templates to app/assets/javascripts/templates/whatever.js.handlebars
# Then require from applicaiton.js (or any manifest) as usual. e.g.
# //= require_tree templates
class EmberHandlebars < Tilt::Template
def self.default_mime_type
'application/javascript'
end
@zaius
zaius / post.js.coffee
Created December 3, 2013 22:16
Relationship mixin factory
App.Post = App.Model.extend App.RelationshipMixinFactory('comments'),
comments: DS.hasMany('comment', async: true)
@zaius
zaius / output.txt
Created February 19, 2016 21:30
Vagrant IPv6 Issue
$ vagrant up
Bringing machine 'default' up with 'vmware_fusion' provider...
==> default: Cloning VMware VM: 'hashicorp/precise64'. This can take some time...
==> default: Checking if box 'hashicorp/precise64' is up to date...
==> default: Skipping vmnet device verification, verify_vmnet is set to false.
==> default: Deleting the VM...
/Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:784:in `hostonly_config': undefined method `+' for nil:NilClass (NoMethodError)
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:706:in `block in call'
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:699:in `each'
from /Users/zaius/.vagrant.d/gems/gems/vagrant-vmware-fusion-4.0.6/lib/vagrant-vmware-fusion/action_farm.rb:699:in `call'
@zaius
zaius / git-submodule-rm.sh
Created May 9, 2012 07:31 — forked from barraponto/git-submodule-rm.sh
Add rm command to git submodule
#!/bin/zsh
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}