Skip to content

Instantly share code, notes, and snippets.

View anandof28's full-sized avatar

Anand Chitravelu anandof28

  • Outbound.Ai
  • Chennai,India
View GitHub Profile
@anandof28
anandof28 / db.js
Created April 22, 2013 07:39
Mongodb Find for Retrieving the Closest Larger / Closest Smaller Values from a List when there is No Exact Match?
var mongoose = require('mongoose')
, Schema = mongoose.Schema;
var CloudSchema = new Schema({
'Cloud_Provider' : {type : String, required : true, trim: true},
'Lat' : {type: Number, required : true},
'Long' : {type: Number, required : true},
'Server_Type' : {type : String, required : true, trim: true},
'Memory' : {type : Number, required : true, trim: true},
@anandof28
anandof28 / app.js
Created May 14, 2016 15:13
Angular JS Code Snippets
(function() {
'use strict';
angular.module('demo', ['ui.router','ui.bootstrap','ngCookies','angular-jwt'])
.config(config)
.run(init);
config.$inject = ['$stateProvider', '$urlRouterProvider','$httpProvider'];
function config($stateProvider, $urlRouterProvider,$httpProvider){
@anandof28
anandof28 / angularjs_directive_attribute_explanation.md
Created July 19, 2016 09:48 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
/**
* Literals and Variable declaration
* Arrow Function
* ES6 Classes , Object destrucing
* Async Programing - Classbacks, Promises
* Modularity - Es6 Modules
*/
/**
* How to declare variable
import React from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
//Function component and props
/**
*
* in Functional component prop is available as function arg.
*/
import React from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
import PropTypes from "prop-types";
const Payment = prop => {
return (
<div>
<h1>Payment Component</h1>
<p>Payment method : {prop.mode}</p>
import React from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
const DashBoard = prop => {
return (
<div>
{/* <ProfileContainer
name={prop.name}
city={prop.city}
import React from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
const Exchange = prop =>{
const data = [
{
"exchange_name" : "BSE",
"index" : 2323.78
},
import React from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
const Account = props => {
//update new balance;
/**
* TypeError: Cannot assign to read only property 'balance' of object '#<Object>'
*/
// props.balance = 8000;
import React, { Component, Fragment } from "react";
import { render } from "react-dom";
import "bootstrap/dist/css/bootstrap.css";
/**
* Context
*/
//Without context : how to pass theme to child components via props
class App extends Component {
theme = {