Skip to content

Instantly share code, notes, and snippets.

View andlewis's full-sized avatar
💭
Debating the merits of immanentizing the eschaton

Andrew Lewis andlewis

💭
Debating the merits of immanentizing the eschaton
View GitHub Profile
@andlewis
andlewis / AuthorService.cs
Created February 10, 2012 13:28 — forked from mythz/AuthorService.cs
1 class in ServiceStack
/*
With no other C# or config other than OrmLite DB config in AppHost below - this web service provides all the screenshots attached, out-of-the-box, for free.
Code-first Simplicity at Great Speed - http://www.servicestack.net/benchmarks/
container.Register<IDbConnectionFactory>(
new OrmLiteConnectionFactory(ConfigUtils.GetConnectionString("AppDb"), //ConnectionString in Web.Config
SqlServerOrmLiteDialectProvider.Instance) {
ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) });
@andlewis
andlewis / index.js
Created December 30, 2018 22:18
Return a random image from a folder
const express = require('express');
const recursive = require('recursive-readdir');
const app = express();
const port = 3000;
var images = [];
app.get('/', (req, res) => {
var image = images[Math.floor(Math.random() * images.length)];
res.sendFile(image);
@andlewis
andlewis / Use Ping Tracker
Created May 29, 2019 17:17
Angular - add a ping attribute to every a tag on the page
ngAfterViewChecked() {
let count = 0;
Array.from(document.getElementsByTagName('a')).filter((x: any) => !x.ping).forEach((x: any) => { x.ping = this.metricsUrl; count++ });
if (count > 0) {
console.log(`ngAfterViewChecked. ${count} linked updated`);
}
}
{
"basics": {
"name": "Andrew Lewis",
"label": "20 years’ experience leading teams in agile environments that design and build web-based enterprise applications. Currently focused on .net core and Angular.",
"picture": "https://media-exp1.licdn.com/dms/image/C4E03AQHm57nuJaUuyw/profile-displayphoto-shrink_200_200/0?e=1591228800&v=beta&t=T-26C_IhysZE5RujLy99VYXhxWSasnsJwCbudjB1eZI",
"email": "andlewis@gmail.com",
"phone": "(403) 400-1761",
"website": "http://andrewlewis.ca",
"summary": "Full-stack developer, team lead, agile project manager",
"location": {