Skip to content

Instantly share code, notes, and snippets.

@joshorvis
joshorvis / I Dream in Code.js
Created October 24, 2015 19:45 — forked from katowulf/I Dream in Code.js
I Dream in Code...
/*********************
** I Dream in Code **
*********************/
while( I .sleep() ) {
I.dream() in code;
I.dream() in algorithms;
I.dream() in subroutines;
Rewind.age(5) && I.dream.of(["missing pants", "driving hotwheels", "peeing in fountains"]) ); //hint: it’s my bed
@joshorvis
joshorvis / sampleBoxFileUpload.js
Created March 25, 2016 14:21 — forked from seanrose/sampleBoxFileUpload.js
A sample file upload in javascript to the Box API
// Requires JQuery and CORS enabled for the Origin you're testing from.
// Uncomment the next 4 lines to import JQuery
// var script= document.createElement('script');
// script.type= 'text/javascript';
// script.src= '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js';
// document.head.appendChild(script);
// Set up the multipart form using HTML5 FormData object
// https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/FormData
var form = new FormData();
@joshorvis
joshorvis / rxjs subjects.md
Created February 11, 2018 04:14 — forked from orod/rxjs subjects.md
Subject, ReplaySubject, BehaviorSubject in RxJS

1 source, Three subscribers
Subscriber 1 subscribes and source starts emitting
Subscriber 2 subscribes halfway
Subscriber 3 subscribes after source has completed.

import Rx from 'rxjs/Rx';

var data = [];

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.