Skip to content

Instantly share code, notes, and snippets.

View cojack's full-sized avatar
🏠
Working from home

cojack cojack

🏠
Working from home
View GitHub Profile
@cojack
cojack / bump_version
Last active June 11, 2020 17:54
Bump version for git project with npm package.json file
#!/usr/bin/env bash
bump_version () {
LOCKFILE="/var/lock/bump_version_for_$(basename `pwd`).lock"
trap "{ rm -f $LOCKFILE ; return 255; }" EXIT
if [[ -f $LOCKFILE ]]; then
echo "Lockfile ${LOCKFILE} exists, clean it fist"
return 1
fi
import {Controller} from '@nestjs/common';
@Controller('cats')
export class CatsController {
@Get()
public async findAll(): void {
// logic
}
}

Testing An Angular CLI Project in a Headless Environment

I recently started a new project and we used [Angular CLI][4] to get started. Angular CLI, as in the name, is a command line utility for creating and managing Angular 2 projects. Using Angular CLI to create a project is very easy and it gives you a great starting point for new Angular 2 projects. The only draw back I found was that in my mind it wasn't CI ready.

Angular CLI out of the box gives you a few unit tests and an end to end (e2e) test. This is great because you can generate a project and set up your build server to build the artefacts. This is where I ran into problems.

Having everything generated for you is great until something you want to do does not work; and this is where I was. I wanted to build and test my angular application on a headless build agent. The generated code from Angular CLI runs tests using Google Chrome by default. Which is fine, but running Google Chrome on a bui

@cojack
cojack / biru.zsh-theme
Created November 3, 2017 05:32
ZSH Theme based on bira, but modified for node and add clock at the right
local return_code="%(?..[%{$fg[red]%}%? ↵%{$reset_color%}]─)"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
local user_symbol='#'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
local user_symbol='$'
fi
##!/bin/ksh
#================================================================
# HEADER
#================================================================
#% SYNOPSIS
#+ ${SCRIPT_NAME} [-hv] [-o[file]] args ...
#%
#% DESCRIPTION
#% This is a script template
#% to start any good shell script.
@cojack
cojack / git-bump-version
Created February 8, 2017 15:01
Automatically bump version in package.json and commit it, merge to master, then create tag and push evrything to origin
bump_version () {
git fetch origin
git checkout develop
git pull origin develop
npm version patch --no-git-tag-version
VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[", ]//g')
git commit package.json -m "chore(package): Bump version up to $VERSION"
git push origin develop
git checkout master
git pull origin master
(function() {
'use strict';
var HashMap = require('./utils/HashMap');
/**
*
* @static
* @class ComponentType
*/
(function() {
/* global requestAnimationFrame, ArtemiJS*/
'use strict';
var MovementSystem = require("./systems/MovementSystem");
var Tutorial = function Tutorial() {
var world = new ArtemiJS.World();
/*global it,describe*/
var assert = require('assert'),
Bag = require('./../../src/utils/Bag');
var bag = new Bag();
function testFunc(name) {
this.name = name;
};
var assert = require('assert'),
Bag = require('./../../src/utils/Bag');
var bag = new Bag();
function testFunc() {};
var testObj = new testFunc(),
testObj1 = new testFunc(),
testObj2 = new testFunc();