Skip to content

Instantly share code, notes, and snippets.

View abarnhard's full-sized avatar

Adam Barnhard abarnhard

  • USA - Denver, CO
View GitHub Profile
@abarnhard
abarnhard / .gitconfig
Last active December 7, 2017 17:57
Sample git config
# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = Adam Barnhard
email = adam.barnhard@whereeveriwork.com
[alias]
# https://stackoverflow.com/a/39616600 utility to escape commands for aliases
# quote-string = "!read -r l; printf \\\"!; printf %s \"$l\" | sed 's/\\([\\\"]\\)/\\\\\\1/g'; printf \" #\\\"\\n\" #"
scrub = "!f(){ git scrubbranches && git prstashclean; };f"
@abarnhard
abarnhard / sybase.py
Created December 11, 2016 03:40 — forked from pawl/sybase.py
Copy Sybase IQ Table Schema to MySQL Using SQLalchemy and SQL Anywhere ODBC
import sqlalchemy, sqlanydb
from sqlalchemy import create_engine, Table, Column, Integer, Unicode, MetaData, String, Text, update, and_, select, func, types
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
def connect():
return sqlanydb.connect(DSN='<your DNS>', userid='<username>', password='<password>')
srcEngine = sqlalchemy.create_engine('sqlalchemy_sqlany://', creator=connect, echo=True) # pip install sqlalchemy-sqlany
@abarnhard
abarnhard / users.js
Created January 10, 2015 17:27
Acceptance test file upload for Hapi
/* jshint expr:true, -W079 */
'use strict';
var expect = require('chai').expect,
cp = require('child_process'),
h = require('../helpers/helpers'),
server = require('../../server/index'),
Lab = require('lab'),
FormData = require('form-data'),
@abarnhard
abarnhard / .jscsrc
Last active August 29, 2015 14:12 — forked from chyld/.jscsrc
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch",
"switch"
@abarnhard
abarnhard / .jshintrc
Last active August 29, 2015 14:12 — forked from chyld/.jshintrc
{
"camelcase": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"indent": 2,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
@abarnhard
abarnhard / gulpfile.js
Last active August 29, 2015 14:12 — forked from chyld/gulpfile.js
var gulp = require('gulp');
var gutil = require('gulp-util');
var bower = require('bower');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var sh = require('shelljs');
var jade = require('gulp-jade');
var jshint = require('gulp-jshint');
@abarnhard
abarnhard / find_note
Last active August 29, 2015 14:10
find_note.sql
CREATE OR REPLACE FUNCTION find_note(noteid integer)
RETURNS TABLE("noteId" integer, "title" varchar, "body" text, "updatedAt" timestamp, "tags" varchar[]) AS $$
DECLARE
BEGIN
RETURN QUERY
SELECT n.id AS "noteId", n.title, n.body, n.updated_at AS "updatedAt", array_agg(t.name) AS tags
FROM notes n
LEFT OUTER JOIN notes_tags nt ON n.id = nt.note_id
LEFT OUTER JOIN tags t ON nt.tag_id = t.id
WHERE n.id = noteid
@abarnhard
abarnhard / find_user_notes
Last active August 29, 2015 14:10
find_user_notes.sql
-- DROP FUNCTION find_user_notes(integer, integer);
CREATE OR REPLACE FUNCTION find_user_notes(userid integer, lmt integer)
RETURNS TABLE("noteId" integer, title character varying, body text, "updatedAt" timestamp without time zone, tags character varying[]) AS $$
DECLARE
BEGIN
RETURN QUERY
SELECT n.id AS "noteId", n.title, n.body, n.updated_at AS "updatedAt", array_agg(t.name) AS tags
FROM notes n
LEFT OUTER JOIN notes_tags nt ON n.id = nt.note_id
@abarnhard
abarnhard / db_rebuild
Created December 4, 2014 21:54
DB Rebuild
create table users(
id serial primary key,
username varchar(255) unique not null,
password char(60) not null,
avatar varchar(500) not null,
created_at timestamp not null default now()
);
create table notes(
id serial primary key,
title varchar(255) not null,
@abarnhard
abarnhard / .jshintrc
Last active August 29, 2015 14:09 — forked from chyld/.jshintrc
{
"camelcase": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"immed": true,
"indent": 2,
"latedef": "nofunc",
"newcap": true,
"noarg": true,