Skip to content

Instantly share code, notes, and snippets.

Screensharing using chromecast

Download this package

open terminal cd into this directory and run node app.js

//Now we can inject underscoreJS in the controllers
function MainCtrl($scope, _) {
//using underscoreJS method
_.max([1,2,3,4]); //It will return 4, which is the maximum value in the array
}
@mlakkadshaw
mlakkadshaw / gist:6850612
Created October 6, 2013 07:13
Using underscoreJS with angular
var underscore = angular.module('underscore', []);
underscore.factory('_', function() {
return window._; // assumes underscore has already been loaded on the page
});
@mlakkadshaw
mlakkadshaw / gist:6850524
Created October 6, 2013 07:01
Exampe of _.uniq method in underscoreJS
var data = ['a','b','c','a','s','b']; //This array contains duplicates
_.uniq(data);
//Ouput
['a','b','c','s','b'] //duplicates removed
//Also works on array of objects
var objs = [{name:"Samsung"}, {name: "LG"}, {name:"Sony"}, {name:"Samsung"}]; //contains duplicate objects
_.uniq(objs);
//output
@mlakkadshaw
mlakkadshaw / gist:6850250
Last active February 3, 2016 20:14
Example of _.where clause
var data = [{model:"T", manufacturer: "ford"},
{model:"S", manufacturer:"tesla"},
{model:"r8", manufacturer:"audi"},
{model:"fiesta", manufacturer:"ford"}];
//Code to fetch all the ford cars
var fordCars = _.where(data, {manufacturer: "ford"});
//output
[{model:"fiesta", manufacturer:"ford"},{model:"T", manufacturer: "ford"}]
package com.mohammedlakkadshaw.ken;
import java.util.Vector;
import org.xml.sax.XMLReader;
import android.text.Editable;
import android.text.Html;
import android.text.Spannable;
import android.text.style.BulletSpan;