Skip to content

Instantly share code, notes, and snippets.

View jasonmccallister's full-sized avatar

Jason McCallister jasonmccallister

View GitHub Profile
USE "cafe-cinema"
GO
-- drop tables, bad for real code
IF OBJECT_ID('dbo.orders', 'U') IS NOT NULL
DROP TABLE dbo.orders;
IF OBJECT_ID('dbo.customers', 'U') IS NOT NULL
DROP TABLE dbo.customers;
@jasonmccallister
jasonmccallister / entity.go
Created January 8, 2018 06:42
entity pattern
package entity
import (
"fmt"
"log"
"os"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/postgres"
_ "github.com/jinzhu/gorm/dialects/sqlite"
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mcrypt mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip
@jasonmccallister
jasonmccallister / php.json
Created September 25, 2018 14:05
PHPUnit Test Function Snippet (php.json)
{
"PHPUnit Test Method": {
"prefix": "tf",
"body": [
"/**",
"* @test",
"*/",
"public function $1()",
"{",
"\t// Arrange",
# composer
FROM composer as vendor
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install --ignore-platform-reqs --no-interaction --no-plugins --no-scripts --prefer-dist
# node
# FROM node:8-alpine as frontend
# RUN mkdir -p /app/web
# COPY package.json package-lock.json tailwind-config.js /app/
<VirtualHost *:80>
<IfModule mod_setenvif.c>
SetEnvIf X-Forwarded-Proto "^https$" HTTPS
</IfModule>
ServerAdmin [email protected]
DocumentRoot /var/www/html/web
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
.DEFAULT: local
IMAGE ?= your-docker-image
TAG ?= staging
REGISTRY ?= your-registry-info
build:
docker build . -t $(IMAGE):$(TAG)
down:
@jasonmccallister
jasonmccallister / index.js
Created April 17, 2019 10:52
NuxtJS Server Middleware Proxy Passthrough
// lives at /api/index.js
const httpProxy = require('http-proxy')
const proxy = httpProxy.createProxyServer()
const API = process.env.API_URL || 'http://localhost:8080/v1alpha1/graphql'
export default function(req, res, next) {
proxy.web(req, res, {
target: API
})
}
@jasonmccallister
jasonmccallister / index.js
Created April 22, 2019 12:44
NuxtJS server middleware proxy pass example
const httpProxy = require('http-proxy')
const proxy = httpProxy.createProxyServer()
const API_URL = process.env.API_URL || 'https://api.mydomain.com'
export default function(req, res, next) {
proxy.web(req, res, {
target: API_URL
})
}
@jasonmccallister
jasonmccallister / nuxt.config.js
Created April 22, 2019 12:46
NuxtJS server middleware config example
// left out for brevity
serverMiddleware: [
{
path: 'api/v1',
handler: '~/api/v1/index.js'
}
],