Skip to content

Instantly share code, notes, and snippets.

View danro's full-sized avatar
👀

Dan Rogers danro

👀
View GitHub Profile
@danro
danro / git-recursive-pull.sh
Created September 18, 2010 22:55
Bash git recursive pull
#!/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 October 8, 2010 21:30
Bash 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 March 12, 2011 01:00
jQuery vertical align function
(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 March 20, 2011 21:18
CSS replace a block of text with an image
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 05:26
JavaScript faster for loop
for ( var i = 0, j = my.length; i < j; i++ ) {
}
@danro
danro / phonegap.css
Created May 18, 2011 17:02
CSS Useful PhoneGap Properties
* {
-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 08:27
JavaScript Array Remove - By John Resig
// 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 July 25, 2011 22:55
The macvim config continues to grow!
" 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 August 12, 2011 01:06
Configure git diff to use pretty MacVim splits
[diff]
external = ~/scripts/git-diff-wrapper.sh
@danro
danro / ender-rollover.js
Created September 6, 2011 22:10
Some animation code using ender / jeesh / morpheus
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");