Skip to content

Instantly share code, notes, and snippets.

View killmenot's full-sized avatar

Alexey Kucherenko killmenot

  • Taganrog, Russian Federation
  • 23:27 (UTC +03:00)
View GitHub Profile
@killmenot
killmenot / terminal-git-branch-name.md
Created January 14, 2019 17:35 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
@killmenot
killmenot / startup.js
Created December 27, 2018 10:18
Example of using json-server with EwdRedis adapter with Qewd microservices startup
const low = require('lowdb')
const jsonServer = require('json-server')
const config = require('./startup_config.json');
let app;
let bodyParser;
config.addMiddleware = function(bp, express, q) {
bodyParser = bp;
app = express;
@killmenot
killmenot / ngrxintro.md
Created November 12, 2018 22:40 — forked from btroncone/ngrxintro.md
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

function healthcheck(args, finished) {
finished({
ok: true,
timestamp: Date.now()
});
}
module.exports = {
restModule: true,
const express = require('express')
const app = express();
const router1 = express.Router();
router1.route('/test1').get(function(req, res) {
res.json('test1');
});
const router2 = express.Router();
router2.route('/test2').get(function(req, res) {
@killmenot
killmenot / test.spec.js
Created November 30, 2017 19:15
How to use createSpyObj properly
var RequestHandler = function () {
this.checkConnection = function () {};
this.getQueryResult = function (sQuery) {
this.checkConnection();
try {
return this.conn.executeQuery.apply(this.conn, arguments);
} catch (err) {
this.conn.close();
@killmenot
killmenot / account.js
Created November 28, 2017 00:03
Testing from a file, Jasmine
var fs = require('fs');
function Account(file) {
this._file = file;
}
Account.prototype.readfile = function () {
if (!this._file) {
throw new Error('File not found')
}
@killmenot
killmenot / account.js
Created November 25, 2017 10:51
How to correctly use Jasmine spies to mock transactions
function Account(statement, transaction){
this._statement = statement
this._transaction = transaction
this._balance = 0;
}
Account.prototype.deposit = function(amount) {
this._transaction.deposit(amount)
this._statement.storeHistory(amount, this._balance, "Deposit")
}
@killmenot
killmenot / gist:78e92fda87d2d171f303a2406323d1c2
Created September 27, 2017 13:58 — forked from fernandoaleman/gist:5083680
How to update VirtualBox Guest Additions with vagrant
# Start the old vagrant
$ vagrant init centos-6.3
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
# this machine, please update the guest additions and repackage the
# box.
@killmenot
killmenot / curl.md
Created September 12, 2017 10:42 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.