Skip to content

Instantly share code, notes, and snippets.

View vespertilian's full-sized avatar

Cameron vespertilian

View GitHub Profile
@vespertilian
vespertilian / app.routes.ts
Last active August 10, 2016 14:45
NG2 router learnings
## Employee key is avaliable on child components when parent component is just a path
// :employeeKey will be avaliable on:
// this.route.snapshot.params['employeeKey'] && this.route.params.subscribe(values => console.log(values))
// on the **EmployeeDetails** and **Dependants** component
{
path: 'employee/:employeeKey',
canActivate: [AuthGuard],
children: [
@vespertilian
vespertilian / instructions.md
Last active April 6, 2016 12:21
Host file for accessing local iis
  1. Open notepad as an administrator
  2. Edit the host file at c:\windows\system32\drivers\etc\hosts
  3. Add the current ip address
@vespertilian
vespertilian / somedirective.js
Created March 21, 2016 15:51
Retrofit bindToController for Angular 1.2 Typescript
export function infoChart() {
return {
restrict: 'A',
scope: {
highchartsOptions: '=',
title: '@',
info: '@'
},
templateUrl: 'template.html',
controllerAs: 'vm',
@vespertilian
vespertilian / login.ts
Created March 3, 2016 19:27
Angular 1.5 Component Typescript Definition for use with webpack
var ngModule = angular.module('app',[]);
// be sure to call new
ngModule
.component('login', new login())
@vespertilian
vespertilian / gist:c63d6f06c14bed5af90b
Last active February 14, 2017 06:46
Filter samples for Swagger and Strongloop Loopback
{"where": {"teamId": 1}}
use in swagger will url encode
{"include": ["price","item"]}
or
localhost:3000/api/stores/66525d9f-ca9a-4e6e-aaac-79f41746543f/storeitems?filter[include]=price&filter[include]=item
const filter = {
filter: {
@vespertilian
vespertilian / config.js
Last active August 5, 2018 14:01
Sample gulp config task for typescript using gulp ng-constant, creates a Angular constant typescript file
'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
gulp.task('config', function () {
var config = require('../config.json'),
envConfig = config['development'];
[process.env.NODE_ENV === 'production' ? 'production' : 'development']
@vespertilian
vespertilian / gist:16c6b62371af551aeae2
Created March 20, 2015 00:41
Bash with git colours
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
source ~/git-completion.bash
function parse_git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "("${ref#refs/heads/}")"
}