Skip to content

Instantly share code, notes, and snippets.

View labnol's full-sized avatar
🇮🇳
Building stuff for the Internet!

Amit Agarwal labnol

🇮🇳
Building stuff for the Internet!
View GitHub Profile
// You create your bookmarklet by instantiating
// a new Bookmarklet function, then pass in the options like so.
// This example checks to see if the var is already defined, and makes
// sure not to overwrite it. This could happen if the user clicks on
// the bookmarklet more than once.
var MyBookmarklet = MyBookmarklet || new Bookmarklet({
// debug: true, // use debug to bust the cache on your resources
css: ['/my/style.css'],
js: [],
@labnol
labnol / youtube.js
Created April 9, 2013 09:01
YouTube Embeds
var i,c,y,v,s,n;v=document.getElementsByClassName("youtube");if(v.length>0){s=document.createElement("style");s.type="text/css";s.innerHTML='.youtube{background-color:#000;max-width:100%;overflow:hidden;position:relative;cursor:hand;cursor:pointer}.youtube .thumb{bottom:0;display:block;left:0;margin:auto;max-width:100%;position:absolute;right:0;top:0;width:100%;height:auto}.youtube .play{filter:alpha(opacity=80);opacity:.8;height:77px;left:50%;margin-left:-38px;margin-top:-38px;position:absolute;top:50%;width:77px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE0AAABNCAYAAADjCemwAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAABgtJREFUeNrtXE1IJEcUFuYgHhZZAzOQwKLsaeY4MuCisLNkMUYM+TtmQwgYQSEg8RCIBAMBSYIQPCgEEiEYISZIgrhzCRLYg+BBMiiDGCHGH4xGETH4O85M+huql7Knuqe7urq7ercePAZnuqtefXZVvfe911VToyRUUqdpVNMmTROaJjVt0bRN0/uapslnG/k+Sa5rIvfVPQ8gRTSNaRrX9B4Bxa3eI+3FSPvPjLxAnpAbA+7s7HxrcnLyk8XFxe82NjZ+Ozw8XDk9Pd29urr6r1Ao5EulUhGf+Bvf43dch+txH+5ngJgg/YVWXtI0RQ9qbGzso1wu99PJyclfJQGCdtAe2jWAlyL9h0ZeJGtQeQC9vb2Pst
@labnol
labnol / Gmail-Archive.js
Created January 20, 2013 12:27
Archiver for Gmail
/*
*
* Copyright 2012 - Luca Giacomel (lgiacomel [at] google [dot] com)
* Use this at your own risk!
* Remember that Google has nothing to do with this
* Distributed under GPLv3
*
*/
function doGet(e) {
@labnol
labnol / Twitter.js
Created January 20, 2013 12:19
A simple Google App Script to monitor your followers on Twitter by @olak_F
/**
* @fileoverview A simple Google App Script to monitor Twitter followers
* @version 1.0
* @author Twitter: @olaf_k | Github: olaf-k
*/
/**
* Twitter screen name (without @) to monitor
* @constant
*/
@labnol
labnol / index.html
Created January 19, 2013 04:12
A CodePen by Amit Agarwal. Bookmarklets - A useful resource for all the people looking for bookmarklets for their favourite services. Additions are welcome. Just comment with the name of the service and a link to the bookmarklets.
<header>
<div class="wrap">
<h1 class="site-heading">Bookmarklets</h1>
<p class="description">Collecting useful bookmarklets accross the web. Curated by <a href="http://twitter.com/RadLikeWhoa_" target="_blank">Sacha Schmid</a>.</p>
<p class="links"><a href="#howto">Read the instructions</a><span class="separator">|</span><a href="http://twitter.com?status=@RadLikeWhoa_ I'd like to suggest a new bookmarklet: " target="_blank">Suggest a bookmarklet</a></p>
</div>
</header>
<section id="toolbar" class="toolbar" style="display: block;">
<div class="column">
<input id="search" class="search" type="search" placeholder="Search by name or by category">
@labnol
labnol / index.html
Created October 10, 2012 19:05
Draw on the html5 canvas using text as your medium.
<canvas id='canvas'></canvas>
<span id='info'>Click and drag to draw!<span>
<!--
Drawing with text:
- Click and drag to draw.
- Double click to clear.
Ported from java at http://www.generative-gestaltung.de
@labnol
labnol / GenBoxShadow.php
Created October 4, 2012 08:48 — forked from seanlinehan/GenBoxShadow.php
Create a pure-CSS version of any image
// Do whatever you'd like with the script! Show it off, mod it up, post it places, or whatever. :)
// (If you do, I wouldn't mind a Twitter shoutout at @_slinehan when appropriate!)
$imageURL = "URL HERE";
$image = imagecreatefromjpeg($imageURL);
$width = imagesx($image);
$height = imagesy($image);
// First, let's resize the image to something manageable while maintaining aspect ratio.
@labnol
labnol / qr.html
Created October 3, 2012 15:23
Social QR Code
<!-- This template was designed by Amit Agarwal of Digital Inspiration (www.labnol.org) -->
<!-- The design and template is licensed under a Creative Commons Attribution 3.0 License -->
<!-- Please see http://www.labnol.org/?p=25841 for instructions on how to modify the file -->
<html>
<head>
<title>QR Code</title>
<meta name="HandheldFriendly" content="True">
@labnol
labnol / index.html
Created October 3, 2012 08:24
A textbox that looks like a notepad! Forms are fun!
<div id="wrapper">
<form id="paper" method="get" action="">
<div id="margin">Title: <input id="title" type="text" name="title"></div>
<textarea placeholder="Enter something funny." id="text" name="text" rows="4" style="overflow: hidden; word-wrap: break-word; resize: none; height: 160px; "></textarea>
<br>
<input id="button" type="submit" value="Create">
</form>
</div>
@labnol
labnol / gas-email.js
Created February 25, 2012 08:36
Google Apps Script for forms in Google Docs
/* Google Apps Script for adding Email Notifications to Google Docs */
/* For video and implementation, go to http://labnol.org/?p=20884 */
function sendFormByEmail(e)
{
// Remember to replace XYZ with your own email address
// Also, don't miss the semicolon
var email = "XYZ";