Skip to content

Instantly share code, notes, and snippets.

View Spittal's full-sized avatar

Jamie Spittal Spittal

View GitHub Profile
@Spittal
Spittal / Format Time Angular Filter
Created July 31, 2014 22:27
Angular Time Filter that takes milliseconds and returns it as full minutes and seconds. For example: 60000 = 1:00, 6000000 = 100:00, 6000000 = 1:40:00 (withHour = true)
.filter('formatTime', function() {
return function(milliseconds,withHour) {
var seconds = parseInt((milliseconds/1000)%60);
var minutes = parseInt((milliseconds/(1000*60))%60);
var hours = parseInt((milliseconds/(1000*60*60))%24);
var out = "";
minutes = (parseInt(minutes) + (60 * parseInt(hours)));
minutes = (minutes < 10) ? "0" + minutes : minutes;
seconds = (seconds < 10) ? "0" + seconds : seconds;
@Spittal
Spittal / disabled-if-directive.js
Last active August 29, 2015 14:06
Disabled If Expression Directive for AngularJS
.directive('disabledIf', disabledIf);
function disabledIf() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var expr = attrs.disabledIf;
scope.$watch(expr, function(val) {
if (val) {
@Spittal
Spittal / Skyrocket Notes App Technical.md
Last active December 30, 2018 22:47
Skyrocket Notes App Technical Overview

Skyrocket Notes

Create a simple 'Note Taking' application on the web using the technologies of your choosing.

We want you to feel like you can be creative and comfortable during this task. So, take the time you need to develop this. Share it with us either on Github as public repo or as a .zip archive. Remember that you can use whatever tools you would like to complete this task, just make sure you leave us instructions on how to run the application.

public updateAvatar(file: File): Observable<any> {
return Observable.create((observer) => {
let formData: FormData = new FormData(),
xhr: XMLHttpRequest = new XMLHttpRequest();
formData.append('avatar', file, file.name);
xhr.onreadystatechange = () => {
if (xhr.readyState === 4) {
import { Injectable } from 'angular2/core';
import {
FormBuilder,
Validators,
Control,
ControlGroup }
from 'angular2/common';
import { ValidationHelper } from
'./validation-helper';
import { Injectable } from '@angular/core';
import {
Validators,
Control,
ControlGroup
} from '@angular/common';
import { ValidationHelper } from
'../../../../common/helpers/validation.helper';
@Spittal
Spittal / obersavbles.ts
Created August 24, 2016 17:31
Why Observables are amazing
import { Injectable } from '@angular/core';
import { Observable, ReplaySubject, Subscription } from 'rxjs';
import { SlideAnimator } from './slide-animator';
import { SlideObservables } from './slide-observables';
import { SlideHelper } from './slide-helper';
import {
SlideServiceConfig,
SlideEventEnd,
SlideEventStart,
SlideEvent,
@Spittal
Spittal / Ts to JS.ts
Last active September 22, 2016 21:09
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { FormGroup, FormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { FlashService } from '../../core';
import { AdminService } from '../admin.service';
export class AdminUserIndexComponent implements OnInit {
@Spittal
Spittal / docker-compose.yaml
Created September 15, 2018 02:43
Docker compose file from SBVR
version: '3'
services:
fpm:
image: sbvr/laravel-fpm:2.1.2
volumes:
- app:/var/www
networks:
- appnet
worker:
@Spittal
Spittal / docker-compose.override.yaml
Created September 15, 2018 02:44
Docker Compose override from Springboard VR
version: '3'
services:
fpm:
volumes:
- ./:/var/www
environment:
- OPCACHE_ENABLED=0
worker:
volumes: