Skip to content

Instantly share code, notes, and snippets.

View sulhome's full-sized avatar
💭

Sul Aga sulhome

💭
View GitHub Profile
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
#Requires -version 4
#Requires -RunAsAdministrator
#Requires -Module Hyper-V
# For detailed information on deploying and managing Nano Server, please go to this link: http://www.aka.ms/nanoserver
Function New-NanoServer {
[CmdletBinding()]
Param(
[Parameter(Mandatory)]
@dbalduini
dbalduini / jquery-mock.js
Last active April 26, 2021 14:05
JQuery stub and mock with Sinon for Unit Tests
(function () {
'use strict';
var sinon = require('sinon');
var keys = ['closest', 'addClass', 'children', 'parent', 'find', 'html',
'remove', 'text', 'ready', 'unveil', 'removeAttr', 'removeClass', 'scroll',
'val', 'height', 'css', 'delay', 'queue', 'dequeue', 'attr'];
function JQueryStub (args) {
var self = this;
@ibratoev
ibratoev / updateTypings.js
Created August 25, 2016 11:58
JS script to update typings
#!/usr/bin/env node
// Script to update typings to their latest versions.
// Note that it should be executed in the folder where typings.json is.
const { exec, execSync } = require('child_process');
const path = require('path');
const typings = require(path.join(process.cwd(), 'typings.json'));
exec('typings ls', (error, _, stderr) => {
if (error) {
@aitorjs
aitorjs / uploadFile.ts
Last active March 18, 2019 20:40
Upload file using angular2 and nodejs (express)
// FRONTEND (angular2)
// product-form.compontent.html
<input type="file" (change)="fileChangeEvent($event)" placeholder="Upload file..." />
<button type="button" (click)="upload()">Upload</button>
// product-form.compontent.ts
import { Component, OnInit } from '@angular/core';
import { Http } from '@angular/http';
@Component({