Skip to content

Instantly share code, notes, and snippets.

View OlivierAlbertini's full-sized avatar
🇨🇦

Olivier Albertini OlivierAlbertini

🇨🇦
View GitHub Profile
const pendingTimers = [];
const pendingOSTasks = [];
const pendingOperations = [];
// New timers, tasks, operations are recorded from myFile running
myFile.runContents();
function shouldContinue() {
// Check one: Any pending setTimeout, setInterval, setImmediate?
// Check two: Any pending OS tasks? (Like server listening to port)
@OlivierAlbertini
OlivierAlbertini / hero.ts
Created October 19, 2017 19:02 — forked from brennanMKE/hero.ts
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@OlivierAlbertini
OlivierAlbertini / reconnect.js
Created May 15, 2017 23:53 — forked from carlhoerberg/reconnect.js
How to build reconnect logic for amqplib
var amqp = require('amqplib/callback_api');
// if the connection is closed or fails to be established at all, we will reconnect
var amqpConn = null;
function start() {
amqp.connect(process.env.CLOUDAMQP_URL + "?heartbeat=60", function(err, conn) {
if (err) {
console.error("[AMQP]", err.message);
return setTimeout(start, 1000);
}
var EXTRA_FILES = [
"/xjs/_/js/k=xjs.ntp.en_US.avfLKzXx4YU.O/m=jsa,ntp,d,csi/am=ig/rt=j/d=1/t=zcms/rs=ACT90oFEy3lvnukSCk3QiMKs2eguQ14CaA",
];
var CHECKSUM = "mk2or3";
var BLACKLIST = [
'/gen_204\?',
'/async/',
];
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
http://blog.wolksoftware.com/setting-up-your-typescript-vs-code-development-environment
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "tsc",
"isShellCommand": true,
"args": [
"--target","ES5",
"--outDir", "js",
"--module","commonjs",
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
{
"compilerOptions": {
"target": "es5",
"outDir": "js",
"module": "commonjs",
"sourceMap": true,
"watch": true
},
"files": [
"app.ts"