Skip to content

Instantly share code, notes, and snippets.

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;
@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"}]
@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: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
});
//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
}

Screensharing using chromecast

Download this package

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

Environment:
Request Method: GET
Request URL: http://localhost:8000/me/
Django Version: 1.7b4
Python Version: 2.7.5
Installed Applications:
('django.contrib.admin',
collaborativeLearningApp.service('screenShare', function($q, mainService) {
var $scope = undefined;
var that = this;
this.socket = mainService.socket;
this.getScope = function(s, room) {
$scope = s;
that.loadCount = 0;
var countx = 0,
county = 0;
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mqtt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process,global){
'use strict';
/**
* Module dependencies
*/
/*global setImmediate:true*/
var events = require('events'),
Store = require('./store'),
eos = require
@mlakkadshaw
mlakkadshaw / install_sentry.sh
Created October 1, 2015 11:51 — forked from bjmc/install_sentry.sh
Basic setup script for installing Sentry (http://getsentry.com) + Redis on new Ubuntu 14.04 Amazon EC2 instance
#! /bin/bash
export RUN_AS='sentry';
export INSTALL_DIR='/var/www/sentry';
HOSTNAME='http://mysentry.example.com'; # No trailing slash
DB_HOST='something.rds.amazonaws.com';
DB_PORT='5432';
DB_USER='sentry';
DB_NAME='sentry';
DB_PASSWORD='DB_PASSWORD';