Skip to content

Instantly share code, notes, and snippets.

View dustinsmith1024's full-sized avatar
🏀
⛹️

Dustin Smith dustinsmith1024

🏀
⛹️
View GitHub Profile
▶ c2fo WM-292 ✗ node test-csv.js test.csv
test.csv
[ { header1: '1-1', header2: '1-2', header3: '1-3' },
{ header1: '2-1', header2: '2-2', header3: '2-3' },
{ header1: '3-1', header2: '3-2', header3: '3-3' } ]
▶ c2fo WM-292 ✗ node
> let val1 = false;
undefined
> t = require('./test-csv')
{ newTable: [Function: newTable] }
@dustinsmith1024
dustinsmith1024 / App.js
Created August 6, 2017 20:14
Graphiql start
# run create-react-app
# npm install --save graphiql
# edit App.js to look like this...
# enable CORS on your GraphQl API (http://0.0.0.0:4000 below)
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import '../node_modules/graphiql/graphiql.css';
open -a Google\ Chrome --args --disable-web-security --user-data-dir
@dustinsmith1024
dustinsmith1024 / shell.sh
Last active February 26, 2017 14:37
Compost.io installing an extension
▶ master ✗ sudo "/Applications/Postgres.app/Contents/Versions/9.4/bin/psql" -Ufocker -ddev -p5445
psql (9.4.11)
Type "help" for help.
dev=# create extension "pgcrypto";
CREATE EXTENSION
sms_us_dev=# \q
@dustinsmith1024
dustinsmith1024 / keybindings.json
Last active April 13, 2017 21:02
VS Code Settings
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "cmd+,", "command": "workbench.action.navigateBack" },
{ "key": "cmd+.", "command": "workbench.action.navigateForward" }
]
@dustinsmith1024
dustinsmith1024 / postgres_queries_and_commands.sql
Last active March 28, 2018 14:58 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
https://www.postgresql.org/docs/9.4/static/monitoring-stats.html
https://www.postgresql.org/docs/9.4/static/functions-admin.html
-- show blocking pids in a nice tree
-- query as blocked_query
-- 9.6++
select pid, usename,
age(query_start, clock_timestamp()),
pg_blocking_pids(pid) as blocked_by,
query
@dustinsmith1024
dustinsmith1024 / chrome-in-tz.sh
Created October 17, 2016 20:29
Open a new chrome in specific timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every
@dustinsmith1024
dustinsmith1024 / tz_test.js
Created October 14, 2016 21:36
Sample for testing moment parsing methods and timezones
"use strict";
console.log(process.env.TZ);
// process.env.TZ = "Asia/Shanghai";
let moment = require('moment');
const format = "YYYY-MM-DD";
let d, dUTC, dTZ, dJS;
const hours = ["00","01","02","03","04","05","06","07","08","09","10","11","12",
"13","14","15","16","17","18","19","20","21","22","23","24"];
@dustinsmith1024
dustinsmith1024 / globalize-test.js
Last active July 26, 2016 21:33
Globalize by Locale
'use strict';
/**
* This shows the currency formatting by locales.
* To add a new locale just update the locales var below.
*
* To run:
* `node translations/tasks/example_outputs.js` to view the output.
*/
@dustinsmith1024
dustinsmith1024 / timer.go
Created July 16, 2015 19:56
Our Golang timing with logger
// for our internal time
saverTimer := logger.Timer()
var totalParseTime time.Duration
var totalTime time.Duration
for {
row, err := csvReader.ReadMap(false)
...
start := time.Now()