Skip to content

Instantly share code, notes, and snippets.

Avatar
🏀
⛹️

Dustin Smith dustinsmith1024

🏀
⛹️
View GitHub Profile
View sample.sh
▶ 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] }
View App.js
# 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';
View gist:b3ec8f4bedcb4720502d3b0eb1b95342
open -a Google\ Chrome --args --disable-web-security --user-data-dir
@dustinsmith1024
dustinsmith1024 / shell.sh
Last active Feb 26, 2017
Compost.io installing an extension
View shell.sh
▶ 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
View keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "cmd+,", "command": "workbench.action.navigateBack" },
{ "key": "cmd+.", "command": "workbench.action.navigateForward" }
]
View postgres_queries_and_commands.sql
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 Oct 17, 2016
Open a new chrome in specific timezone
View chrome-in-tz.sh
#!/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 Oct 14, 2016
Sample for testing moment parsing methods and timezones
View tz_test.js
"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"];
View globalize-test.js
'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 Jul 16, 2015
Our Golang timing with logger
View timer.go
// for our internal time
saverTimer := logger.Timer()
var totalParseTime time.Duration
var totalTime time.Duration
for {
row, err := csvReader.ReadMap(false)
...
start := time.Now()
You can’t perform that action at this time.