Skip to content

Instantly share code, notes, and snippets.

@danro
danro / git-recursive-pull.sh
Created Sep 18, 2010
Bash git recursive pull
View git-recursive-pull.sh
#!/bin/bash
# find all .git directories and exec "git pull" on the parent.
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;
@danro
danro / run-corona-simulator
Created Oct 8, 2010
Bash run-corona-simulator
View run-corona-simulator
#!/bin/bash
osascript -e "tell application \"Terminal\"
activate
do script \"/Applications/CoronaSDK/simulator $TM_DIRECTORY\"
end tell"
@danro
danro / jquery-valign.js
Created Mar 12, 2011
jQuery vertical align function
View jquery-valign.js
(function ($) {
// vertical align (parent relative)
$.fn.vAlign = function() {
return this.each(function(i) {
var ah = $(this).height();
var ph = $(this).parent().height();
var mh = Math.ceil((ph-ah) / 2);
$(this).css('margin-top', mh);
});
};
@danro
danro / text-replacement.css
Created Mar 20, 2011
CSS replace a block of text with an image
View text-replacement.css
h1.someClass {
margin: 0; padding: 0;
width: 175px; height: 37px;
background: url('images/someClass.png') no-repeat;
}
h1.someClass span {
display: block;
width: 0;
height: 0;
overflow: hidden;
@danro
danro / for-loop.js
Created May 10, 2011
JavaScript faster for loop
View for-loop.js
for ( var i = 0, j = my.length; i < j; i++ ) {
}
@danro
danro / phonegap.css
Created May 18, 2011
CSS Useful PhoneGap Properties
View phonegap.css
* {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
margin: 0;
padding: 0;
border: 0;
}
@danro
danro / js-array-remove.js
Created May 24, 2011
JavaScript Array Remove - By John Resig
View js-array-remove.js
// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
@danro
danro / .gvimrc
Created Jul 25, 2011
The macvim config continues to grow!
View .gvimrc
" What a funny comment character
" .gvimrc.local
" Remember to set the following in vimrc:
" let g:snips_trigger_key='<c-space>' " Custom snipmate trigger
" let mapleader="," " Change the leader
" let g:loaded_matchparen=1 " Disable matchparen highlight
" start macvim config
if has("gui_macvim")
@danro
danro / .gitconfig
Created Aug 12, 2011
Configure git diff to use pretty MacVim splits
View .gitconfig
[diff]
external = ~/scripts/git-diff-wrapper.sh
@danro
danro / ender-rollover.js
Created Sep 6, 2011
Some animation code using ender / jeesh / morpheus
View ender-rollover.js
function mouseOver (e) {
var bg = $(this).find("h2 .background");
var tween = bg.data("tween");
if (tween) tween.stop();
tween = morpheus(bg, { left: 0, duration: 200, easing: easings.easeOutStrong });
bg.data("tween", tween);
}
function mouseOut (e) {
var bg = $(this).find("h2 .background");