Skip to content

Instantly share code, notes, and snippets.

View ARHEIO's full-sized avatar

Adam RH Eggleston ARHEIO

View GitHub Profile
@ARHEIO
ARHEIO / app.component.ts
Created April 17, 2018 00:55
This gist shows the implementation of a window in Angular to avoid using $window by importing it from AngularJS
import { Component } from '@angular/core';
import { WindowReferenceService } from '.window-reference.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
@ARHEIO
ARHEIO / arheio.md
Last active April 26, 2018 05:02
Examples of various spec test injections in Angular 5

// This is a selection of components and their accompanying spec test files that show off how to test different scenarios // This is a quick reference companion to a larger angular application that has not yet been uploaded

// document.ts // this example shows the need to grab something directly from the document in an instance where @ViewChild is not available // the actual scenario was a global object injected into the window by another system, that we needed to manipulate // this shows how you can spy on header functions to return mock data

// input.ts // shows how to change your spec test to mock a host component as your testing component

// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting
@ARHEIO
ARHEIO / firebase.json
Created December 22, 2017 04:51
This is a stock standard firebase.json file that allows hosting for angular from the ./dist directory, and also allows proper routing
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
@ARHEIO
ARHEIO / KeycodeManager
Last active December 3, 2017 04:27
An absolutely awful function that you can pass a keyboard letter to and will return the keycode (that you can get from event.keycode)
export function getKeyCode(letter) {
switch (letter) {
case 'a':
return 65;
case 'b':
return 66;
case 'c':
return 67;
case 'd':
return 68;
@ARHEIO
ARHEIO / index.js
Created November 4, 2017 03:59
A super simple index.js for an express server that takes a single post request and can output a json file if a hard copy is needed
// server.js
'use strict'
const bodyParser = require('body-parser');
const express = require('express');
const fs = require('fs');
const app = express()
app.use(bodyParser.json());