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
@labnol
labnol / gist:1907323
Created February 25, 2012 08:20 — forked from mhawksey/gist:1388321
Google Apps Script - Twitter Search
// Part of this code up to END OF (c) is:
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@labnol
labnol / gist:1907325
Created February 25, 2012 08:20 — forked from mhawksey/gist:1106744
Google Apps Script - Social Bookmarking Counts
/*
All code apart from getPlusones()
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@labnol
labnol / google_apps_script
Created February 25, 2012 08:22 — forked from kysnm/google_apps_script
Google Analytics API for Google Docs
var DateTime = function() {
var now = new Date();
this.year = now.getFullYear();
this.month = ('00' + now.getMonth()).slice(-2);
var monthEndDate = new Date(this.year, this.month, 0);
this.startDate = this.year + '-' + this.month + '-01';
this.endDate = this.year + '-' + this.month + '-' + monthEndDate.getDate();
}
var Profile = function(profileName, tableId) {
/**
* POST data from a Google Spreadsheet to a remote URL, via menu option Add-ons > Post values
* See: http://www.google.com/google-d-s/scripts/guide.html for more info
*/
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var r = sheet.getRange("B5");
function onOpen() {
@labnol
labnol / whd_google_docs.js
Created February 25, 2012 08:26 — forked from kevee/whd_google_docs.js
Web Help Desk post to Google Docs
// INSTRUCTIONS:
// 1. Start a new form in Google docs
// 2. Go to Tools > Script editor from the spreadhseet
// 3. Paste in the below code
// 4. Go to Triggers > Current script's triggers
// 5. Add a new trigger
// 6. Select "onFormSubmit" then "On Form Submit" from the third select box. Click save.
// 7. Save the script and go back to your spreadsheet. You should see a "WHD Options" menu.
// 8. Click WHD Options > Ticket settings and enter the API key (from WHD's user setting screen) and the URL to your "Create Ticket" post. The script will automatically append "?apiKey=xxx" to the end of this URL.
// 9. Use the email settings in the WHD Options if you want to email users with their WHD ticket.
@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";
@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 / 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 / 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 / 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