Skip to content

Instantly share code, notes, and snippets.

View alunny's full-sized avatar

Andrew Lunny alunny

  • Twitter
  • San Francisco, CA
View GitHub Profile
set -g mode-mouse on
set -g mouse-select-pane on
set -g mouse-resize-pane on
# important!
bind-key d confirm-before -p "detach-client? (NO) (y/n)" detach-client
set -g status-bg black
set -g status-left-fg green
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:93:in `load'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:172:in `load_from_file'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:89:in `load'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:86:in `block in load'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:86:in `each'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:86:in `load'
from ./config/deploy.rb:17:in `load'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
from /home/alunny/.rvm/gems/RUBY_VERSION/gems/capistrano/lib
Sub LockAllVisibleToolbars()
Dim cb As CommandBar
For Each cb In CommandBars
If cb.Visible = True Then
cb.Protection = msoBarNoChangeDock + _
msoBarNoChangeVisible + _
msoBarNoCustomize + _
msoBarNoMove + _
msoBarNoResize
@alunny
alunny / uglyNoSuchMethod.js
Created December 10, 2009 18:15
noSuchMethod / methodMissing -ish interface in vanilla javascript
var Foo = function Foo() {
var someValue = 1;
this.noSuchMethodHandler(id, args) {
if (id == "increment") {
return someValue++;
}
}
};
Foo.prototype.exec = function(id,args) {
// courtesy https://twitter.com/tomdevdiary/status/8946331934
("foo" + + "bar") === "fooNaN" // true
@alunny
alunny / node-crockford.js
Created April 14, 2010 17:35
print out a crockford fact, just like that!
// using node 1.90
var sys = require('sys'), http = require('http');
var crockfordator = http.createClient(80, 'crockfordfacts.com');
var req = crockfordator.request('GET', '/',
{
'accept':'application/json',
'host':'crockfordfacts.com'
}
);
@alunny
alunny / client-side-xauth.js
Created June 21, 2010 22:39
accessing twitter xAuth through client-side JS
/*****
To authorize on Twitter API through xAuth, you need HMAC-SHA1
I'm using the following lib for that:
http://jssha.sourceforge.net
Make sure you have sha.js included!
<script src="http://jssha.sourceforge.net/sha.js"></script>
Also, you need to email api@twitter.com to get xAuth access
I cannot do that for you - see http://dev.twitter.com/pages/xauth
@alunny
alunny / convert.rb
Created July 12, 2010 18:42
convert image with image_science
#! /usr/bin/ruby
# usage: ruby convert.rb icon.jpg png
require 'rubygems'
require 'image_science'
if ARGV.length == 2
source_file = ARGV.first
target_extension = ARGV.last
target_file = source_file.sub /[\w\d]+$/, target_extension
@alunny
alunny / appActive.m
Created July 26, 2010 23:50
appActive event for phonegap-iphone
// insert this into your AppDelegate.m file
// this will fire an "appActive" event on the webview every time the app is launched
// whether through fast-app switching or a cold launch
- (void)applicationDidBecomeActive:(UIApplication *)application {
// delay of 1ms ensures code will be executed in new stack trace
// that way, event listener can't block applicationDidBecomeActive
// and crash the app
NSString *fireActiveEvent = @"window.setTimeout(function() { \n"
"var appActive = document.createEvent('Events'); \n"
@alunny
alunny / xui-new-wrap.js
Created August 13, 2010 18:50
a stab at a new wrap function for xui
// private method
// Wraps the HTML in a TAG, Tag is optional
// If the html starts with a Tag, it will wrap the context in that tag.
// doesn't ACTUALLY work
function wrap(xhtml, tag) {
// new approach
// createDocumentFragment
var docFrag = document.createDocumentFragment(),
dummy,
wrapTag;