Skip to content

Instantly share code, notes, and snippets.

View vinothbabu's full-sized avatar
🤘

Thalaivar vinothbabu

🤘
  • Chennai, TamilNadu
View GitHub Profile
@vinothbabu
vinothbabu / dojo editor
Created March 22, 2015 22:18
Dojo Editior template
<!DOCTYPE html>
<html>
<head>
<link href="//ajax.googleapis.com/ajax/libs/dojo/1.10.1/dijit/themes/claro/claro.css" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.1/dojo/dojo.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body class="claro" style="height:500px; width: 100%">
angular.element(document.querySelector('[ng-app]').injector()
.invoke(function($rootScope){
var per = performance.now();
$rootScope.$apply();
console.log(performance.now() - per);
})
});
This file has been truncated, but you can view the full file.
/**
* @license AngularJS v1.2.20
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {'use strict';
/**
* @description
*
@vinothbabu
vinothbabu / Sorting JSON response based on type
Created August 10, 2012 13:49
Sorting JSON response based on type
<script type="text/javascript">
onerror = function (a, b, c) {
alert([a, b, c]);
};
</script>
<script type="text/javascript">
var x = {
"JsonResult": {
"List": [{
"Subject": "My book report on J. K. Rowling's <u>Harry Potter</u> series.",
@vinothbabu
vinothbabu / searchable and sortable data structure - Plugin NodeJS
Created August 10, 2012 13:37
searchable and sortable data structure - Using NodeJS
//sortable-2d-array.js
exports = module.exports = sortable2DArray;
function sortable2DArray(data) {
this.data = data;
}
sortable2DArray.prototype.sortBy = function (o) {
var fields = o.fields || [];
@vinothbabu
vinothbabu / HTTPClient
Last active October 10, 2015 01:27
Generic HTTPClient or Ajax Class which only creates a single instance.
var JSONCall = function(url,data, onLoad, onError){
this.url = url;
this.data = data;
this.onLoad = onLoad;
this.onError = onError;
};
JSONCall.prototype = {
call: function(){
if(typeof JsonClient==='undefined'){
JsonClient = Titanium.Network.createHTTPClient();
@vinothbabu
vinothbabu / Puzzle
Created September 3, 2012 16:06
Puzzle Game - Titanium and JavaScript
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>15 Puzzle</title>
<style type="text/css">
body{color:black;background:white;font-family:Arial,Helvetica,sans-serif;font-size:20px;margin:0;}
table tr td{text-align:center;}
@vinothbabu
vinothbabu / gist:3610375
Created September 3, 2012 16:11
call a private function from a string in javascript
var valdiate = (function() {
var _p={};//toss all private members into a single object.
_p.list=[];
_p.init=function(){
_p.list=[];
};
var noDigits = function() {
@vinothbabu
vinothbabu / gist:3666340
Created September 7, 2012 13:40
Capture picture using Titanium
function capturePictureDialog(opts) {
var dialogCallback = (typeof opts.callback == "undefined") ? new Function("") : opts.callback;
function cropImageBlob(image, cropRect) {
var h = image.height;
var w = image.width;
var toH = cropRect.height;
if (toH > h) {
toH = h;
@vinothbabu
vinothbabu / gist:3691041
Created September 10, 2012 13:50
Capture picture and Scribbling using Titanium
function capturePictureDialog(opts)
{
var dialogCallback=(typeof opts.callback=="undefined")?new Function(""):opts.callback;
var scribblingEnabled=(typeof opts.scribbling=="undefined")?false:opts.scribbling;
if(scribblingEnabled)
{
Titanium.Paint = require('ti.paint');
Ti.Paint = Titanium.Paint;