Skip to content

Instantly share code, notes, and snippets.

View vinothbabu's full-sized avatar
🤘

Thalaivar vinothbabu

🤘
  • Chennai, TamilNadu
View GitHub Profile
@fernandohu
fernandohu / Reading configuration files before application startup in Angular2 final release.md
Last active July 7, 2024 19:31
Reading configuration files before application startup in Angular2 final release

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

@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 / 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 || [];