This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readDir(start, callback) { | |
// Use lstat to resolve symlink if we are passed a symlink | |
fs.lstat(start, function(err, stat) { | |
if(err) { | |
return callback(err); | |
} | |
var found = {dirs: [], files: []}, | |
total = 0, | |
processed = 0; | |
function isDir(abspath) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
color() { | |
tput setaf $1 | |
shift | |
printf -- "$@" | |
tput sgr0 | |
} | |
color_yellow() { | |
color 3 "$@" | |
} | |
PS1='\n$(color_yellow \u)\w ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_submodule() { | |
# Find out if the parent directory of our current git repo is also a git repo | |
parent_git=`cd "$_git_dir/.." && git rev-parse --show-toplevel 2> /dev/null` | |
if [[ -n $parent_git ]]; then | |
# If it is, list all submodules of the parent | |
submodules=`cd $parent_git && git submodule --quiet foreach 'echo $path'` | |
for line in $submodules; do | |
# cd to each directory, if it matches our current git repo then we are in a submodule | |
cd "$parent_git/$line" | |
if [[ `pwd` = $_git_dir ]]; then return 0; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import twill.commands | |
import BeautifulSoup | |
import time | |
class browser: | |
def __init__(self, url="http://www.google.com",log = None): | |
self.a=twill.commands | |
self.a.config("readonly_controls_writeable", 1) | |
self.b = self.a.get_browser() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit e9501568acae1988ba51b5a29269023d3400db42 | |
Author: Andrew Ray <[email protected]> | |
Date: Thu Aug 4 18:37:11 2011 -0700 | |
making chosen work with whatever width the input box is set to with css for jquery, addressing issue #92 | |
diff --git a/chosen/chosen.jquery.js b/chosen/chosen.jquery.js | |
index 2b95f10..43ee5b4 100644 | |
--- a/chosen/chosen.jquery.js | |
+++ b/chosen/chosen.jquery.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: $form.find('input[type="checkbox"]').shiftSelectable(); | |
// replace input[type="checkbox"] with the selector to match your list of checkboxes | |
$.fn.shiftSelectable = function() { | |
var lastChecked, | |
$boxes = this; | |
$boxes.click(function(evt) { | |
if(!lastChecked) { | |
lastChecked = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Go to the "see all votes" section of the report, then | |
* paste this script into your console. It will show you actual | |
* vote counts for your images. "Normalized" OKC data is BS and | |
* misleading. Don't be fooled! | |
*/ | |
var imgs = document.querySelectorAll('img[title="An image of you"]'),i=0,img,badge, | |
badges = document.querySelectorAll('div.badge'), | |
prev = imgs[0].getAttribute('src'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var size = 100, | |
uvMat = mesh.geometry.faceVertexUvs[0], | |
faceVerts, fi, vi; | |
for( fi = 0; faceVerts = uvMat[fi++]; ) { | |
for( vi = 0; vi < faceVerts.length; vi++ ) { | |
var pos = mesh.localToWorld( mesh.geometry.vertices[ vi ].clone() ); | |
faceVerts[ vi ] = new THREE.Vector2( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var texelMap = { | |
0: 3, | |
1: 1, | |
2: 0, | |
3: 2 | |
}; | |
for( fi = 0; faceVerts = uvMat[fi++]; ) { | |
for( vi = 0; vi < faceVerts.length; vi++ ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
compression=80 | |
hasExif=`which exiftool` | |
pngs=`git status -s | grep .png | awk '{print $2}'` | |
arr=($pngs) | |
if [ -n "$arr" ]; then | |
echo "Compressing png images by $compression%..." | |
for png in "${arr[@]}" |
OlderNewer