Skip to content

Instantly share code, notes, and snippets.

@midu
midu / oo-stuff.js
Created November 23, 2010 22:40
A bunch of examples of OO in JS
2.1.1
[EX. 1]
var double = function(a) {
return a * 2;
}
> double(21)
42
> typeof double
@midu
midu / gist:722330
Created November 30, 2010 20:23
Remove an attribute from an object, so easy I could dance a jig
// Remove an element from an object
var kik = {"a": "lalala", "b": {"dom_thing": window}, "c": 42};
> undefined
kik
> Object
a: "lalala"
b: Object
c: 42
__proto__: Object
delete kik['a']
@midu
midu / gist:795155
Created January 25, 2011 16:26
joins 2 pdfs
i = 1
h.each_pair do |id, type|
puts "#{id} - #{i}/#{h.size}"
begin
eval "`python '/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py' -o #{id}/joined.pdf #{id}/#{id}.pdf #{id}/attachment.pdf`"
rescue
puts "oh :("
end
i = i+1
end
@midu
midu / gist:795156
Created January 25, 2011 16:27
applies watermark to a pdf
i = 1
h.each_pair do |id, type|
puts "#{id} - #{i}/#{h.size}"
begin
eval "`python '/System/Library/Automator/Watermark PDF Documents.action/Contents/Resources/tool.py' --input #{id}/joined.pdf --output all/#{id}.pdf --scale=0.7 --yOffset=739 --xOffset=450 #{id}/thumb.png`"
rescue
puts "oh :("
end
i = i+1
end
@midu
midu / gist:795224
Created January 25, 2011 17:05
create thumnail w/ submission ID + type
# recipes
h = {904=>"Vegetable",
1105=>"Grains",
770=>"Grains",
971=>"Vegetable",
837=>"Legumes"
# , ...
}
# create watermak
[user]
name = Stefano B.
email = [email protected]
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
<script type="text/javascript">
var insertAtCursor = function (myField, myValue) {
//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
remove_rootfs_verification() {
echo "$*" | sed '
s| root=/dev/dm-0 | root=/dev/sd%D%P |
s| dm_verify[^=]*=[-0-9]*||g
s| dm=*"[^"]*"||
s| ro | rw |'
}
/* .ir from html5boilerplate */
.ir { display: block; text-indent: -999em; overflow: hidden; background-repeat: no-repeat; text-align: left; direction: ltr; }
/* fix for .ir on inputs (ie) */
.ie7 input.ir {
padding-top: 999em !important;
display: inline-block;
}
@midu
midu / .gitconfig
Created April 11, 2011 22:00 — forked from schacon/.gitconfig
[url "https://github.com/"]
insteadOf = "gh:"