Skip to content

Instantly share code, notes, and snippets.

View amcdnl's full-sized avatar

Austin amcdnl

View GitHub Profile
@amcdnl
amcdnl / stats.md
Last active August 29, 2015 13:55

Create a statistics engine leveraging MongoDB and C#. The engine should accept some basic query parameters from a Web API and return the appropriate statistical analysis.

Goals

  • Evaluate existing database architecture and provide better use cases
  • Provide direction on statistical analysis leveraging MongoDB Aggregation Framework or Map Reduce
  • Provide direction on keyword searching
  • Implement basic core examples of the above

Use Cases

Google Glass & Privacy / Cyber Security

Google Glass is easily one of the most antipated gadget releases of 2014. Its Google's first shot at wearable tech and it makes 'smart watches' look outdated. A few lucky individuals have had an oppertunity to get ahold of a pair over the past year or so; I was luckily enough to get invited. There are hundreds of reviews on the web about all the different aspects of the google glass but I want to take a moment to focus on the security implications of the gadget.

On a daily basis, I deal with cyber security engineering, prevention, and protection. As I wear the glass, it raises quite a bit questions in regards to security.

You and your privacy

Everyone today already takes millions of pictures on a daily basis with their smartphone, but its not easy to snap one of someone's face without them noticing. In a recent update, google added the ability to take a picture with a simple wink; next you can tweet that to the world by saying 'Ok Google, Share to Twitter

define(['jquery', 'app'], function ($, app) {
return app.factory('Acronym', [function () {
var factory = {
desiredKeyLength: 2,
maxKeyLength: 5,

AngularJS + RequireJS Optimization

RequireJS is a great module loading tool and it has great optimization techniques. When you combine RequireJS with GruntJS you get some really powerful tools; but the AngularJS optimization is still somewhat lacking.

A few key tools you can leverage to make your AngularJS apps blazing fast and clean are:

ng-min

When writing AngularJS controllers/services/directives you often end up with a HUGE constructor to make the code optimizer safe. I ended up with something like this quite a bit:

Inheritance in AngularJS.

angular.module('animal', [])
    .factory('Animal',function(){
        return function(vocalization){
            return {
                vocalization:vocalization,
                vocalize : function () {
                    console.log('vocalize: ' + this.vocalization);

}

AngularJS Debounce Service

Often I update a value like size that updates quite a bit before it is finalized. If I do a AngularJS $watch on that object my update is firing quite a bit and depending on what you are doing might be a performance concern.

This service allows you to debounce those events so you can effectively throttle. Inspired by Ben Alman's jQuery plugin.

Service > throttle.js

define(['angular', 'app'], function (angular, app) {
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-html2js');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-wrap');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
requirejs: {
compile: {
/**
* Simplifies duplicating `define` definitions for `angular.module`.
*
* For example:
*
* define(['app/module1', 'app/module2'], function(module1, module2){
* var module3 = angular.module('app.module3', ['app.module1', 'app.module2']);
* // your code
* return module3;
* });
define(['angular',
'jquery',
'jqueryUI',
'lib/jquery-ui-touch/jquery-ui-touch'], function(angular, $){
var module = angular.module('components.draggable', []);
module.constant('draggableConfig', {
helper: 'clone',
appendTo: 'body',
define(['jquery', 'angular'], function ($, angular) {
var module = angular.module('utils.acronym', []);
module.factory('Acronym', function () {
var factory = {
desiredKeyLength: 2,