Skip to content

Instantly share code, notes, and snippets.

@skilldrick
skilldrick / saveRestore.js
Created Nov 25, 2010
No more pesky context.save() and context.restore() - use this handy sandwich function instead!
View saveRestore.js
function saveRestore(ctx, func) {
ctx.save();
func(ctx);
ctx.restore();
}
//Usage
saveRestore(context, function (ctx) {
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, width, height);
View New Google Doodle.js
(function () {
try{
if(!google.doodle)google.doodle = {};
var a = 200, g = -200, j = -200, k, l, m, n = 0, o = 0, p = 0, q = 35, r, s = [], t, u, v;
google.doodle.init = function () {
if(!v&&window.location.href.indexOf("#") = = -1){
v = true;
if(t = document.getElementById("hplogo")){
google.j&&google.j.en&&w(100, x, function () {
return google.rein&&google.dstr});