Skip to content

Instantly share code, notes, and snippets.

View tnewman's full-sized avatar

Thomas Newman tnewman

  • General Motors
  • Detroit, MI
View GitHub Profile
@tnewman
tnewman / async-express.js
Last active December 15, 2018 01:01
Async Callbacks with Express
"use strict";
const express = require('express');
const app = express();
const port = 3000;
function asyncHandler(fn) {
return function(req, res, next) {
Promise
.resolve(fn(req, res, next))
@tnewman
tnewman / 2600hzkazoocarrier.txt
Created November 11, 2017 16:00
2600hz Kazoo Carrier
{
"data": {
"name": "Telnyx",
"gateways": [
{
"server": "sip.telnyx.com",
"channel_selection": "ascending",
"enabled": true,
"endpoint_type": "sip",
"force_port": false,
@tnewman
tnewman / SimpleResume
Created March 19, 2017 18:18
Simple Resume Class for LaTeX
\ProvidesClass{SimpleResume}[2017/03/18 Simple Resume Class]
\LoadClass[11pt,letterpaper]{article}
\usepackage[letterpaper,margin=0.75in]{geometry}
\usepackage{enumitem}
\setlist{nolistsep}
\newcommand{\contact}[5]{
\centerline{\LARGE\textbf{#1}}
\centerline{#2 -- #3}
@tnewman
tnewman / atoi.asm
Last active January 2, 2024 12:13
atoi in Assembly - Convert a number string to a 64 bit integer.
global atoi
section .text
atoi:
mov rax, 0 ; Set initial total to 0
convert:
movzx rsi, byte [rdi] ; Get the current character
test rsi, rsi ; Check for \0
// Angular 2: Configuring LoginService
@Injectable() class LoginService {
constructor(@Inject("LoginServiceConfig") public config: {url: string}) {}
//...
}
@Component({
selector: 'app',
template: `<login></login>`,
@tnewman
tnewman / __init__.py
Last active January 11, 2016 04:16
Python Plugin Loader
import importlib
import pkgutil
import os
# Uses the package as the directory to search for plugins
plugin_directory=os.path.dirname(__file__)
# Loads all of the modules in this package
for module in pkgutil.iter_modules([plugin_directory]):
name_index=1
@tnewman
tnewman / sqlite.c
Last active December 16, 2015 14:28
Basic SELECT of an SQLite database using prepared statements.
#include <stdio.h>
#include "sqlite3.h"
int main()
{
const char filename[] = "Atm.db";
sqlite3 *dbHandle;
const char sql[] = "SELECT * FROM User;";
sqlite3_stmt *ppStmt;