Skip to content

Instantly share code, notes, and snippets.

ssh-keygen -t dsa; cat ~/.ssh/id_dsa.pub | ssh -l REMOTE_USER REMOTE_SERVER 'cat >> ~/.ssh/authorized_keys'
@badsyntax
badsyntax / replace.sh
Created May 28, 2010 10:15
Simple recursive search and replace string in files
#!/usr/bin/env bash
#
# simple recursive search and replace string in files
# setup: alias replace='~/replace.sh'
# notes: you will need to escape special chars! eg: replace '\/dir1' '\/dir2' .
# usage: replace <oldstring> <newstring> <path> <depth>
# examples:
# replace "([^\s]+.php)" "\/\1" .
# replace "\"\/([^\/]+.php)" "\"\/dir\/\1" .
// jQuery UI - Extending the base widget class
// create new base widget class
$.widget('ui.chunk');
// class definition
$.extend($.ui.chunk.prototype, {
//
});
$.fn.exists = function( func ){
return ( this.length && func && func.apply( this ) ) ? this : ( !func ? this.length : this );
};
.ui-ellipsis {
white-space: nowrap;
overflow: hidden;
}
/*
* jQuery UI Ellipsis
*
* @Author Richard Willis
* @Url http://github.com/badsyntax/jquery-plugins/tree/master/ellipsis/
* @Depends
* jquery.ui.core.js
* jquery.ui.widget.js
*
*/
if ( $('#myelement').exists() ) {
alert('element exists!');
}
// delegate a list item mouseenter event to a list
function mouseenter( event ){
$( event.target ).addClass( 'mouseenter' );
}
$('ul').delegate( 'li', 'mouseenter', mouseenter );
// trigger the first list items delegated event
$('ul').find('li:first').each(function(){
// usage: var size = $.size( selectorOrObject );
// code borrowed from: http://stackoverflow.com/questions/5223/length-of-javascript-associative-array
$.size = function(obj){
if ( typeof obj === 'object' ) {
var size = 0, key;
for (key in obj) {