Skip to content

Instantly share code, notes, and snippets.

View khamer's full-sized avatar

Kevin Hamer khamer

View GitHub Profile
@khamer
khamer / x
Created October 22, 2008 18:13
Resize Text Areas Bookmarklet from The Man in Blue (http://themaninblue.com/)
CmdUtils.makeBookmarkletCommand({
name: "Resize Text Areas",
url:"javascript:TxtRsz={formEl:null,adEv:function(t,ev,fn){if(typeof%20document.addEventListener!='undefined'){t.addEventListener(ev,fn,false)}else{t.attachEvent('on'+ev,fn)}},rmEv:function(t,ev,fn){if(typeof%20document.removeEventListener!='undefined'){t.removeEventListener(ev,fn,false)}else{t.detachEvent('on'+ev,fn)}},init:function(){var%20textareas=document.getElementsByTagName('textarea');for(var%20i=0;i<textareas.length;i++){textareas[i].style.cursor='se-resize'}var%20inputs=document.getElementsByTagName('input');for(var%20i=0;i<inputs.length;i++){if(inputs[i].type=='text'){inputs[i].style.cursor='e-resize'}}TxtRsz.adEv(document,'mousedown',TxtRsz.initResize)},initResize:function(event){if(typeof%20event=='undefined'){event=window.event}var%20target=event.target||event.srcElement;if(target.nodeName.toLowerCase()=='textarea'||(target.nodeName.toLowerCase()=='input'&&target.type=='text')){TxtRsz.formEl=target;TxtRsz.formEl.startWidth=TxtRsz.f
@khamer
khamer / gist:659688
Created November 2, 2010 14:33
Just a quick test of gist
var gist = {
github: function() {
this.com = true;
}
}
gist.github.com;
@khamer
khamer / gist:758206
Created December 29, 2010 05:19
Swiss Inheritance
Function.prototype.swiss = function (parent) {
for (var i = 1; i < arguments.length; i += 1) {
var name = arguments[i];
this.prototype[name] = parent.prototype[name];
}
return this;
};
@khamer
khamer / gist:758290
Created December 29, 2010 07:07
Swiss Inheritance Function as defined by Douglas Crockford
/**
* Original: http://www.crockford.com/javascript/inheritance.html
*/
Function.method('swiss', function (parent) {
for (var i = 1; i < arguments.length; i += 1) {
var name = arguments[i];
this.prototype[name] = parent.prototype[name];
}
return this;
});
@khamer
khamer / gist:788576
Created January 20, 2011 20:20
is_accessible() - function to check whether a property or method is accessible
<?php
function is_accessible($object, $prop) {
$rc_object = new ReflectionClass($object);
if ($rc_object->hasProperty($prop)) {
return $rc_object->getProperty($prop)->isPublic();
} elseif ($rc_object->hasMethod($prop)) {
return $rc_object->getMethod($prop)->isPublic();
} else {
return false;
@khamer
khamer / gist:860502
Created March 8, 2011 16:36
== Isn't Transitive
<?php
$A = "Zero";
$B = 0;
if ($A && !$B && $A == $B) echo "A and not B and A == B is True!\n";
@khamer
khamer / svn.sh
Created March 29, 2011 13:43
First pass at creating a bash script to overload additional commands onto svn
#!/bin/bash
B="\033[1;7;32m"
R="\033[0m"
COMMAND="$0"
COMMAND=${COMMAND##*/}
ORIGINAL="$(which -a $COMMAND | grep -vE "^$0$" | head -1)"
case $1 in
'')
[web@imarc006 /usr/home/web/www]$ df -h
Filesystem Size Used Avail Capacity Mounted on
/dev/mfid0s1a 1.9G 37M 1.7G 2% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/mfid0s1e 1.9G 381M 1.4G 21% /tmp
/dev/mfid0s1f 122G 117G -4.4G 104% /usr
/dev/mfid0s1d 3.9G 3.0G 592M 84% /var
procfs 4.0K 4.0K 0B 100% /proc
[web@imarc006 /usr/home/web/www]$
"" _ Kevin Hamer This is my .vimrc file. I primarily use GVIM,
"" /_/ _____ [email protected] so you should expect it to have that kind of
"" _ / / ___ __ __ style and settings. Hopefully you'll find
"" / / / / / / / , / / _/ / _/ something useful in this file to use.
"" /_/ /_/_/_/ /_/_/ /_/ /__/
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" PLUGINS
"" Color Sampler Pack
"" Just a big pack with lots of colorschemes. I like colorschemes.
"" From http://www.vim.org/scripts/script.php?script_id=625
#Minecraft server properties
#Fri Feb 25 17:48:44 EST 2011
level-name=world #I don't know where this gets used, but it must be a world name.
hellworld=false #enables/disables spawning hell mode monsters in the regular world.
spawn-monsters=true #enables/disables spawning any monsters.
online-mode=true #disables users needing to authenticate against the login server. Not really that useful, as if they are not authenticated, it doesn't log them into their characters with their stuff, but rather as 'guests' if you will, at spawn, with no items.
spawn-animals=true #looks like in Beta 1.3 they split out spawning animals from spawning monsters.
max-players=20 #max players.
server-ip= #I think this is to 'lockdown' what IP addresses can be used to access the server.
pvp=true #whether you can hurt fellow players by punching/slicing/stabbing/chopping/picking/shovelling them.