Skip to content

Instantly share code, notes, and snippets.

View stevewithington's full-sized avatar
⛑️
solving problems

Steve Withington stevewithington

⛑️
solving problems
View GitHub Profile
import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Router, RouterModule } from '@angular/router';
import { NgModuleFactoryLoader, Component, NgModule } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { routes } from './app-routing.module'
import { Location } from '@angular/common';
describe('PageNotfoundComponent', () => {
let component: AppComponent;
onSelectUser(participantId:string) {
this.participantsService.findParticipantById(parseInt(participantId))
.debug("Loading participant from backend")
.subscribe(
participant => {
...
},
console.error
);
@stevewithington
stevewithington / is-mobile-device.js
Created April 26, 2019 05:08
Detects Mobile Device Script
window.mobilecheck = function() {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|j
@stevewithington
stevewithington / Angular-cli.md
Last active April 19, 2019 00:40 — forked from cortesben/Angular-cli.md
Bash commands and Angular CLI commands

Angular-cli

https://cli.angular.io/reference.pdf

Commands Description
ng help returns all commands with flags they can take as a param
ng new [project-name] create a brand new angular project with live server BANG!
ng init grabs name from folder that already exist
ng build builds the production version of project
@stevewithington
stevewithington / mura-form-populate-employee.cfc
Last active April 11, 2019 21:45
Mura Populate Form Select Menu With Custom User Subtype
// Select `Custom Object` as `Source`
// Then, the other `Source` is the path to the cfc file under the site.
component extends='mura.cfobject' {
// On the form, select 'Custom Object' then for the 'Source' enter the dotted notation path to wherever you placed this file.
// For example 'includes.myCustomValues' if your file was called 'myCustomValues.cfc' and placed under the 'includes' directory.
// Mura will automatically invoke the getData() method below
// See http://www.getmura.com/blog/populating-form-builder-dropdowns-via-remote-objects/ for more information
@stevewithington
stevewithington / config.xml.cfm
Last active July 21, 2021 21:41
Mura Module With HTML Editor Example
<mura name="My Module" contenttypes="*" iconclass="mi-rebel" />
Continent_Name Continent_Code Country_Name Two_Letter_Country_Code Three_Letter_Country_Code Country_Number
Asia AS Afghanistan, Islamic Republic of AF AFG 4
Europe EU Albania, Republic of AL ALB 8
Antarctica AN Antarctica (the territory South of 60 deg S) AQ ATA 10
Africa AF Algeria, People's Democratic Republic of DZ DZA 12
Oceania OC American Samoa AS ASM 16
Europe EU Andorra, Principality of AD AND 20
Africa AF Angola, Republic of AO AGO 24
North America NA Antigua and Barbuda AG ATG 28
Europe EU Azerbaijan, Republic of AZ AZE 31
@stevewithington
stevewithington / mura-404-redirect-example.cfm
Last active December 14, 2023 10:04
Mura CMS: 404 Redirect Example
<cfscript>
public any function onSite404(m) {
if (m.event('currentFilenameAdjusted') == 'some/bad-url') {
// If you want to preserve the requested URL ...
// var cb = m.getBean('content').loadBy(filename='some/good-url');
// m.setContentBean(cb);
// If you want to redirect to the new URL ...
location(url=arguments.m.createHREF(filename='some/good-url'), addtoken=false);
@stevewithington
stevewithington / gist-markdown-cheatsheet.md
Created November 29, 2018 14:06
Gist Markdown (MD) Cheatsheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Paragraph

'use strict'
const fs = require('fs')
// Save this list as `eng_10k.txt`: https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english.txt
const _getFrequencyList = () => {
const frequencyList = fs.readFileSync(`${__dirname}/eng_10k.txt`).toString().split('\n').slice(1000)
const dict = {};
frequencyList.forEach(word => {
// Ignore weird consonant clusters
// match returns `null` if `word` contains no vowels