Skip to content

Instantly share code, notes, and snippets.

View premasagar's full-sized avatar

Prem Rose premasagar

View GitHub Profile
@premasagar
premasagar / tim.js
Created August 12, 2010 17:52
A tiny, secure JavaScript micro-templating script. It doesn't use eval or (new Function), so it cannot execute malicious code.
/*
== Tim ==
A tiny, secure JavaScript micro-templating script.
This has now moved to:
github.com/premasagar/tim
*/
// e.g. scrollToTarget(document.getElementById('foo'));
function offset(target){
var left = 0,
top = 0;
while (target && target !== document.body){
if (target.offsetLeft){
left += target.offsetLeft;
top += target.offsetTop;
@premasagar
premasagar / blur.html
Created July 1, 2011 13:28
SVG blur filter
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>SVG Blur</title>
</head>
<body>
<h1>SVG filters: blurring</h1>
@premasagar
premasagar / google-chrome-restore.sh
Created March 29, 2010 10:29
Restore Google Chrome on Linux (Ubuntu), when it starts with "Could not restore your profile"
#!/bin/sh
# Restore Google Chrome on Linux (Ubuntu), when it
# starts with "Could not restore your profile"
# $ ./google-chrome-restore.sh
rm -rf ~/.config/google-chrome/Backup
mv ~/.config/google-chrome/Default ~/.config/google-chrome/Backup
rm -rf ~/.config/google-chrome/Default
cp -R ~/.config/google-chrome/Backup ~/.config/google-chrome/Default
rm -rf ~/.config/google-chrome/Backup
[{"conference":{"hash_tags":["#asyncjs"],"twitter_account":"@asyncjs","api_urls":{"conference":"http://lanyrd.asyncjs.com/2012/asyncjs-onecanvas-2/","speakers":"http://lanyrd.asyncjs.com/2012/asyncjs-onecanvas-2/speakers/","trackers":"http://lanyrd.asyncjs.com/2012/asyncjs-onecanvas-2/trackers/","attendees":"http://lanyrd.asyncjs.com/2012/asyncjs-onecanvas-2/attendees/","staff":"http://lanyrd.asyncjs.com/2012/asyncjs-onecanvas-2/staff/"},"name":"[Async]: One Canvas - part two","end_date":"2012-09-27","url":"http://asyncjs.com/onecanvas-2/","short_url":"http://lanyrd.comchpcp","topics":[{"web_url":"http://lanyrd.com/topics/art/","name":"Art","api_urls":{"topic":"http://lanyrd.asyncjs.com/topics/art/"}},{"web_url":"http://lanyrd.com/topics/hack-day/","name":"Hack Day","api_urls":{"topic":"http://lanyrd.asyncjs.com/topics/hack-day/"}},{"web_url":"http://lanyrd.com/topics/html5/","name":"HTML5","api_urls":{"topic":"http://lanyrd.asyncjs.com/topics/html5/"}},{"web_url":"http://lanyrd.com/topics/javascript/","name"
@premasagar
premasagar / jsonpx.html
Created June 29, 2011 17:43
Wrap random content (e.g. HTML source code) in a JSONP-transportable JavaScript string
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>jsonpx-ify</title>
<script src=jquery.js></script>
<script src=jsonpx.js></script>
<style>
label, textarea, input, button {
Pablo.load('example.svg', function(){
this.children().each(function(el){
console.log(el.nodeName, Pablo(el).attr());
});
})
@premasagar
premasagar / speakers.md
Last active December 21, 2015 07:09
Async Show and Tell speaker's list

[Async's][async] [2013 International Show n' Tell][event]

Thursday 7th November, 2013

☞ [Full info on the Async website][event]
✈ Sign up to attend [on the event's Lanyrd page][event-lanyrd].

Speakers gist

Would you like to speak on the night? You’ll have five minutes to tell us about something… a project, a library, a technique, a story, or anything else about JavaScript, related tech (HTML, CSS, SVG, etc), or the wider world of web.

@premasagar
premasagar / async-speakers.md
Last active December 16, 2015 20:09
Async Show and Tell

[Async's][async] [3rd Birthday Show n' Tell][event]

Thursday 23rd May, 2013

☞ [Full info on the Async website][event]
✈ Sign up to attend [on the event's Lanyrd page][event-lanyrd].

Speakers gist

Would you like to speak on the night? You’ll have five minutes, that’s 300 seconds, to tell us about something… a project, a library, a technique, a story, or anything else on JavaScript and its techy friends (HTML, CSS, SVG, animated GIFs), or the wider world of web.

// Helper function to escape a string for HTML rendering
// from Tasket project
function escapeHTML(string) {
return string.replace(/&(?!\w+;)/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}