Skip to content

Instantly share code, notes, and snippets.

@simpulton
simpulton / typescript.json
Last active June 11, 2021 16:19
VS Code NgRx Snippets
{
"Print to console": {
"prefix": "clog",
"body": [
"console.log('$1', $2)$0"
],
"description": "Log output to console"
},
"NgRx: Single Entity Action": {
"prefix": "ngrx-act-single",

This documentation is meant to notate the build process starting from simply generating a project directory all the way to finishing with a full master detail application. This application is using the “Sparkle Stack”, which is best used in cases where a full application environment is needed (database to server to frontend). Before each step of the project below, a quick overview of technologies used will be described along with and links and references.

Root Directory

The root level of the application is meant as a container for our Frontend (client) and Backend (server) applications, however we also take advantage of this directory to define any workspace rules based on languages. More importantly, we compose Docker at this level.

Technologies:

  • Makefile
  • Docker
  • editorconfig/prettier
@simpulton
simpulton / ng2 component live template
Created March 16, 2016 18:58
An Angular 2 component live template for Webstorm
import {Component, ViewEncapsulation} from 'angular2/core';
@Component({
selector: '$SELECTOR$',
template: require('./$SELECTOR$.html'),
style: [
require('./$SELECTOR$.scss')
],
encapsulation: ViewEncapsulation.None,
directives: []
$(document).ready(function() {
$('pre.code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
@simpulton
simpulton / Firebase + AngularJS Presence
Last active June 21, 2016 05:21
A real-time presence service using Firebase and AngularJS.
app.controller('MainCtrl', ['$scope', 'PresenceService', function ($scope, PresenceService) {
$scope.totalViewers = 0;
$scope.$on('onOnlineUser', function(){
$scope.$apply(function () {
$scope.totalViewers = PresenceService.getOnlineUserCount();
});
});
}]);
it.only('buildIndex should properly build an index', inject(function (RealtimeQuestion) {
var post = generateMockPost();
var index = generateMockIndex(post);
RealtimeQuestion.buildIndex(post).should.deep.equal(index);
}));
//-------------------------------------------------------------------------
// HELPER FUNCTIONS
//-------------------------------------------------------------------------
var getRandomInt = function(min, max) {
it.only('buildIndex should properly build an index', inject(function (RealtimeQuestion) {
var post = {
_id: 'p1',
comments: [
{_id: 'p2'},
{_id: 'p3'},
{_id: 'p4'}
],
answers: [
{_id: 'p5'},