Skip to content

Instantly share code, notes, and snippets.

View Hrafnkellos's full-sized avatar
🧹

Hrafnkell Orri Sigurðsson Hrafnkellos

🧹
  • Advania
  • Reykjavík, Iceland
View GitHub Profile
@ivanbatic
ivanbatic / typescript-async-await-demo.ts
Last active January 12, 2021 21:55
Typescript async/await demo
"use strict";
class Cheese {
private state = "hard";
public async melt() {
console.log("Melting...");
return new Promise((resolve) => {
setTimeout(() => {
this.state = "melted";
@cgmartin
cgmartin / logging-middleware.js
Created May 24, 2015 01:43
Morgan JSON log format example
'use strict';
var morgan = require('morgan');
var os = require('os');
morgan.token('conversation-id', function getConversationId(req) {
return req.conversationId;
});
morgan.token('session-id', function getSessionId(req) {
return req.sessionId;
@Mithrandir0x
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"