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 / 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 / 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 / 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 / flashblock.html
Created October 26, 2010 03:20
Inconsistent problem with flashblock and swfobject
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">
swfobject.registerObject("swfobject_static", "9.0.115", "expressInstall.swf");
</script>
</head>
s = 'FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedea
numbers = 3, 4, 9, 14, 15, 19, 28, 37, 47, 50, 54, 56, 59, 61, 70, 73, 78, 81, 92, 95, 97, 99
set_count = 0
numbers.each_with_index do |number, i|
numbers.combination(i).each do |combination|
set_count += 1 and puts combination.inspect if combination[0..-2].sum == combination[-1]
end
end
class User < Sequel::Model
one_to_many :posts
def tags_dataset
posts.join(Tag, :post_id => :id)
end
def tags
tags_dataset.all
end
end
import Ember from 'ember';
const {computed} = Ember;
export default Ember.Component.extend({
tagName: 'a',
_setupDropdown: Ember.on('didInsertElement', function() {
this._super.apply(this, arguments);
Ember.run.scheduleOnce('afterRender', this, function() {
@zaius
zaius / var is weird.js
Created December 10, 2014 01:41
Javascript var
var foo = 1;
var bar = 1;
(function() {
console.log(foo, bar)
var bar = 2
foo = 2
console.log(foo, bar)
})()
@zaius
zaius / keybase.md
Created July 2, 2014 04:22
Keybase

Keybase proof

I hereby claim:

  • I am zaius on github.
  • I am davidkelso (https://keybase.io/davidkelso) on keybase.
  • I have a public key whose fingerprint is 2B2C 209F BCC0 BF21 4234 7292 7427 8BD5 9B48 8C48

To claim this, I am signing this object: