Skip to content

Instantly share code, notes, and snippets.

View vespertilian's full-sized avatar

Cameron vespertilian

View GitHub Profile
@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/}")"
}
@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: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 / 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 / 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 / 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 / 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 / dateFilter.ts
Created September 15, 2016 10:12
Date filter in Angular 1.2 using angular 2 style inputs (one way) and outputs (events).
let templateUrl: string = require('./date-filter.jade');
require('./date-filters.sass');
// note: to call the on change values you must match this call signature
// on-validation-change='vm.validationChange(valid)',
// on-date-change='vm.dateChange({toDate: toDate, fromDate: fromDate})',
export function dateFilter(): ng.IDirective {
return {
restrict: 'A',
@vespertilian
vespertilian / communications.component.ts
Created November 14, 2016 15:05
ngrx compose for selecting slices of the store
import { Component, OnInit } from '@angular/core';
import {Store, State} from "@ngrx/store";
import {EmailTemplateState} from "./shared/email-template/ngrx/reducer.email-template";
import {EmailTemplate} from "./shared/email-template/model.email-template";
import {compose} from "@ngrx/core";
import {Observable} from "rxjs";
let styles = require('./communications.sass');
@Component({
selector: 'communications',
template: require('./communications.component.jade'),
@vespertilian
vespertilian / communications.component.ts
Created November 14, 2016 15:05
ngrx compose for selecting slices of the store
import { Component, OnInit } from '@angular/core';
import {Store, State} from "@ngrx/store";
import {EmailTemplateState} from "./shared/email-template/ngrx/reducer.email-template";
import {EmailTemplate} from "./shared/email-template/model.email-template";
import {compose} from "@ngrx/core";
import {Observable} from "rxjs";
let styles = require('./communications.sass');
@Component({
selector: 'communications',
template: require('./communications.component.jade'),