Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / .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 / android-settings.txt
Created February 6, 2014 09:19
Accessing Internet on Android Emulator behind Corporate Firewall
In order to use internet on emulator if you are setting behind a proxy server perform the following steps:
Go to settings->Wireless & networks->mobile networks->Access Point Names.
Press menu button. an option menu will appear.
from the option menu select New APN.
Click on Name. provide name to apn say My APN.
Click on APN. Enter www.
Click on Proxy. enter your proxy server IP. you can get it from internet explorers internet options menu.
@tanmaypatel
tanmaypatel / jqmFAIcons.less
Created February 4, 2014 08:16
Using FontAwesome icons in jQuery Mobile!
[class^="ui-icon-fa"],
[class*=" ui-icon-fa"]
{
background-image: none;
&:before
{
font-family:FontAwesome!important;
display: inline-block;
font-style: normal;
@tanmaypatel
tanmaypatel / jquery-mobile-theme.less
Created February 4, 2014 08:11
LESSified jQuery Mobile Theme (jQuery Mobile 1.4.0)
@global-font-family: @contentFontFamily;
@global-corner-radius-blocks: @controlsBorderRadius;
@global-corner-radius-buttons: @controlsBorderRadius;
@global-box-shadow: @shadow;
@global-inset-box-shadow: @shadow;
@global-icon-color: white;
@global-icon-shadow: ~"none";
@bar-background-color: @headerBackgroundColor;
@bar-border-color: darken(@headerBackgroundColor, 5%);
@tanmaypatel
tanmaypatel / breakpoints.less
Created February 4, 2014 08:06
Bootstrap's Media Query Breakpoints (LESS Version)
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
// Note: Deprecated @screen-xs and @screen-phone as of v3.0.1
@screen-xs: 480px;
@screen-xs-min: @screen-xs;
@screen-phone: @screen-xs-min;
// Small screen / tablet
@tanmaypatel
tanmaypatel / page-transitions.less
Created February 4, 2014 08:01
Changing Transitions of Pages in jQuery Mobile 1.4.0 using LESS and 3L
.slide
{
@animation-duration: 500ms;
&.in
{
.transform(translateX(0) scale(1));
.animation(inanimation @animation-duration ease-in-out);
.opacity(1);
}
@tanmaypatel
tanmaypatel / server.js
Created January 6, 2014 12:59
Simple HTTP Server in Node JS
var connect = require('connect'),
http = require('http'),
app;
var serverPort = 9090;
app = connect()
.use(connect.static(__dirname));
http.createServer(app).listen(serverPort, function()
@tanmaypatel
tanmaypatel / Simple HTTP Server.py
Last active January 1, 2016 19:49
Simple HTTP Server in Python 3
python -m http.server <port>