Skip to content

Instantly share code, notes, and snippets.

@madrobby
madrobby / Custom invoice header example
Created September 24, 2012 18:13
Configuring a custom invoice header in Freckle
<style>
#invoice, #invoice_report {
font-family: Georgia;
}
#invoice div.custom-header {
padding: 0 0 20px 0;
margin: 0 0 20px 0;
border-bottom: 1px solid #9dd64b;
}
</style>
@madrobby
madrobby / gist:3733875
Created September 16, 2012 19:09
Fade out elements on WebKit and Firefox
<style>
.fade-right {
-webkit-mask-image: -webkit-gradient(linear, left top, right top, from(rgba(0,0,0,1)), color-stop(0.75, rgba(0,0,0,1)), to(rgba(0,0,0,0)));
mask: url(#fade_right_svg_mask);
}
#mask_demo {
background: #d0d0d0;
height: 100px;
width: 500px;
padding: 10px;
$ git push
fatal: The current branch render-performance has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin render-performance

So why doesn't git have a shorthand command for that? This is likely what you want to do anyway.

@madrobby
madrobby / gist:3202087
Created July 29, 2012 22:01
Fallback to PNG if SVG is not supported
<!-- example for the http://retinafy.me ebook -->
<style>
div.rss {
background: url(rss.svg);
width: 32px;
height: 32px;
}
body.no-svg div.rss {
@madrobby
madrobby / gist:3201472
Created July 29, 2012 19:50
Check if the browsers supports SVG
// comments welcome, there may be better ways to do this!
function supportsSVG(){
return !!('createElementNS' in document &&
document.createElementNS('http://www.w3.org/2000/svg','svg').createSVGRect)
}
@madrobby
madrobby / gist:3161015
Created July 22, 2012 20:43
Detect retina support. Tested on iOS, Android 2.x, Chrome for Android, Safari on MacBook Pro Retina, Firefox mobile (beta) for Android, Opera Mobile (Android)
function isRetina(){
return (('devicePixelRatio' in window && devicePixelRatio > 1) ||
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches))
}
$ dig typemedia2012.com +trace
; <<>> DiG 9.7.3-P3 <<>> typemedia2012.com +trace
;; global options: +cmd
. 152727 IN NS c.root-servers.net.
. 152727 IN NS d.root-servers.net.
. 152727 IN NS b.root-servers.net.
. 152727 IN NS k.root-servers.net.
. 152727 IN NS j.root-servers.net.
. 152727 IN NS a.root-servers.net.
// Solution to Part 1.
Function.prototype.cached = function(){
var self = this, cache = {};
return function(arg){
if(arg in cache) return cache[arg];
return cache[arg] = self(arg);
}
}
var countdown = (function() {
return function(){ console.log('!!!') }
})();