Skip to content

Instantly share code, notes, and snippets.

View arpit's full-sized avatar

Arpit Mathur arpit

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="400" height="300" creationComplete="minimizeToDock()">
<mx:Label text="Dockable" horizontalCenter="0" verticalCenter="0">
</mx:Label>
<mx:Script>
<![CDATA[
private function minimizeToDock():void{
nativeWindow.addEventListener(Event.CLOSING, function(event:Event):void{
import flash.filters.DisplacementMapFilter;
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.geom.Point;
var str = 100;
this.addEventListener (Event.ENTER_FRAME,enterframe);
/**
This code snippet shows how an Android activity can trigger a web based auth using webview and then use
the cookies from there to make subsequent calls to an API (since the api is checking the cookies to detect
sign in)
MyApplication: The root "controller" and the first activity in my app
OAuthLogin: A class that handles the web based login.
It montors the url change and if the user had been redirected to
a "success" page it sends out the cookie string to the root controller
Once the controller has the cookie, it sets those on the service that
@arpit
arpit / gist:666010
Created November 7, 2010 07:50
Spec for Todo List
<Project name="">
<Task>
<label></label>
<description></description>
<priority></priority>
<due_date></due_date>
<depends_on></depends_on>
<recurring></recurring>
<location></location>
<tags></tags>
@arpit
arpit / gist:674571
Created November 12, 2010 19:50
Readability JavaScript
javascript:(function(){readConvertLinksToFootnotes=false;readStyle='style-newspaper';readSize='size-medium';readMargin='margin-wide';_readability_script=document.createElement('script');_readability_script.type='text/javascript';_readability_script.src='http://lab.arc90.com/experiments/readability/js/readability.js?x='+(Math.random());document.documentElement.appendChild(_readability_script);_readability_css=document.createElement('link');_readability_css.rel='stylesheet';_readability_css.href='http://lab.arc90.com/experiments/readability/css/readability.css';_readability_css.type='text/css';_readability_css.media='all';document.documentElement.appendChild(_readability_css);_readability_print_css=document.createElement('link');_readability_print_css.rel='stylesheet';_readability_print_css.href='http://lab.arc90.com/experiments/readability/css/readability-print.css';_readability_print_css.media='print';_readability_print_css.type='text/css';document.getElementsByTagName('head')[0].appendChild(_readability_prin
@arpit
arpit / Android TimeZone Ids
Created June 20, 2011 13:26
List of all Android TimeZone ids
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
<!doctype html>
<html>
<head>
<title>Hello Canvas</title>
<style>
#can{
background:#dfdfdf;
}
@arpit
arpit / gist:1269327
Created October 7, 2011 02:55
Minimize an application to dock in Adobe AIR
private function minimizeToDock():void{
nativeWindow.addEventListener(Event.CLOSING, function(event:Event):void{
event.preventDefault();
nativeWindow.visible = false;
nativeApplication.addEventListener(InvokeEvent.INVOKE, function(event:InvokeEvent):void{
trace(" Invoking...");
nativeWindow.visible = true;
});
});
}
@arpit
arpit / AndroidUI.md
Created February 26, 2012 18:45
A list of apps updated with Android UI guidelines

Astrid app:

Stumbleupon:

@arpit
arpit / AndroidImageUtils.java
Created March 1, 2012 19:26
Android Image Util
private Bitmap getBitmapFromAsset(String strName) throws IOException
{
AssetManager assetManager = getAssets();
InputStream istr = assetManager.open(strName);
Bitmap bitmap = BitmapFactory.decodeStream(istr);
return bitmap;
}