Skip to content

Instantly share code, notes, and snippets.

@tanmaypatel
tanmaypatel / .gitconfig
Created February 6, 2014 13:07
Git Behind Corporate Firewall FTW!
Add these entried to your '.gitconfig' file in your user directory (go to %USERPROFILE%):
[url "https://"]
insteadOf = git://
[http]
proxy = http://<proxy_server>:<port>/
[https]
proxy = http://<proxy_server>:<port>/
@tanmaypatel
tanmaypatel / isDocumentLoaded.js
Created February 16, 2014 07:39
How to check if an HTML page is already loaded. Even after "load" event has dispatched!
/* This has been supported in IE and webkit for a long time. It was added to Firefox in 3.6. Here's the spec (http://www.w3.org/TR/html5/dom.html#dom-document-readystate). "loaded" is for older Safari browsers.*/
if (document.readyState == "complete" || document.readyState == "loaded")
{
// document is already ready to go
}
/* If you want to know when the page has been parsed, but all subresources have not yet been loaded, you can add the "interactive" value: */
if (document.readyState == "complete"
|| document.readyState == "loaded"
|| document.readyState == "interactive") {
@tanmaypatel
tanmaypatel / UploadService.js
Last active August 29, 2015 13:56
Uploading files using AJAX
// Library used: http://malsup.com/jquery/form/
define(['jquery',
'amplify',
'moment'],
function($, amplify, moment, undefined)
{
var UPLOAD_SERVICE_BASE = 'http://127.0.0.1:8080/';
var FileUploadService = function(){};
@tanmaypatel
tanmaypatel / Gruntfile.js
Created April 18, 2014 13:02
Grunt Configuration
module.exports = function(grunt)
{
require('time-grunt')(grunt);
require('load-grunt-config')(grunt, {
config: {
srcLocation: 'src',
distLocation: 'dist'
}
});
@tanmaypatel
tanmaypatel / stickyfooter.html
Created July 10, 2014 07:36
Sticky Footer with Bootstrap!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sticky footer &middot; Twitter Bootstrap</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS -->
<link href="../assets/css/bootstrap.css" rel="stylesheet">
@tanmaypatel
tanmaypatel / umd.js
Created August 12, 2014 10:23
Defining modules supporting AMD/CommonJS/Node and Globals!
/*
* From blogpost @ http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/
*/
(function (root, factory)
{
if(typeof define === "function" && define.amd)
{
// Now we're wrapping the factory and assigning the return
// value to the root (window) and returning it as well to
@tanmaypatel
tanmaypatel / elements.html
Created September 26, 2014 14:56
Bouncing Chameleon Spinner - LessHat version!
<div class="spinner">
<div class="element1"></div>
<div class="element2"></div>
</div>

CSS Layout Debbuger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

<html>
<head>
<title>Select styles with CSS only</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
background-color: #fff;
font-family: helvetica, sans-serif;
margin: 4% 10%
}
@tanmaypatel
tanmaypatel / stuns
Last active August 29, 2015 14:10 — forked from yetithefoot/stuns
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},