Skip to content

Instantly share code, notes, and snippets.

* Promise vs Observable
* Promise
* Single async event that can either complete or fail once.
* Can be used with async/await keywords.
* Observable
* Can emit multiple events async.
* Offers a bit more control over the async task, for example cancelling.
* Cannot be used with async/await keywords.
* Think of Observables as a stream of data instead of an async task.
* Observable is the default used in Angular, but promises are still fine to use.
@tahoeRobbo
tahoeRobbo / mongoose-cheatsheet.md
Created January 6, 2020 20:49 — forked from subfuzion/mongoose-cheatsheet.md
mongoose cheatsheet

Definitely not comprehensive. This is meant to be a basic memory aid with links to get more details. I'll add to it over time.

Install

$ npm install mongoose --save

Connect

const mongoose = require('mongoose');
@tahoeRobbo
tahoeRobbo / frontendDevlopmentBookmarks.md
Created February 2, 2018 22:56 — forked from dypsilon/frontendDevlopmentBookmarks.md
A badass list of frontend development resources I collected over time.
@tahoeRobbo
tahoeRobbo / hackerRankExample.js
Last active September 25, 2015 17:59 — forked from mhart/test1.js
stdin/stdout pipe in node.js
process.stdin.resume();
process.stdin.setEncoding('ascii');
var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;
process.stdin.on('data', function (data) {
input_stdin += data;
});
@tahoeRobbo
tahoeRobbo / angularjs_directive_attribute_explanation.md
Last active August 29, 2015 14:26 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@tahoeRobbo
tahoeRobbo / app.js
Last active August 29, 2015 14:24 — forked from katowulf/app.js
var app = angular.module('app', ['firebase']);
app.controller('ctrl', function($scope) {
var ref = new Firebase('https://fbutil.firebaseio.com/paginate');
$scope.scrollItems = $scrollArray(ref, 'number');
});
app.factory('$scrollArray', function($firebaseArray) {
return function(ref, field) {
// create a special scroll ref
angular.module('app')
.controller('ImageUpload', ['$scope', '$log',
function ImageUpload($scope, $log) {
$scope.upload_image = function (image) {
if (!image.valid) return;
var imagesRef, safename, imageUpload;
image.isUploading = true;
imageUpload = {