Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Heath DanielHeath

View GitHub Profile
@DanielHeath
DanielHeath / system.report
Created Jul 31, 2019
SteamVR system report
View system.report
This file has been truncated, but you can view the full file.
SteamVR System Report created Wed Jul 31 10:58:45 2019
<Report>
SteamVR Version: 1.6.10 (1564442420)
SteamVR Date: 2019-07-30
Steam: Public
Steam Branch: beta
Steam AppID: 250820
Tracking: lighthouse
@DanielHeath
DanielHeath / csv_import.rb
Created Sep 4, 2018
How I do CSV imports with postgres & rails
View csv_import.rb
class CsvImport
include ActiveRecord::Sanitization::ClassMethods
attr_accessor :connection, :header
def self.read_csv(file)
file.is_a?(Array) ? file : file.read.encode(newline: :universal).lines
end
def initialize(connection, csv_lines, table_name)
@connection, @table_name = connection, table_name
@DanielHeath
DanielHeath / chrome_tracing.rb
Last active Jul 18, 2018
Javascript coverage with selenium & chrome. Must not compile an asset bundle (or otherwise transpile assets) in test mode.
View chrome_tracing.rb
# TODO: Support headless-chrome (does not have chrome://version page)
# Probably needs 'sys/proctable' or similar as it's not exposed otherwise.
module ChromeTracing
def self.register_simplecov!
require 'simplecov'
SimpleCov.profiles.define "jscov" do
# ignore RB but not JS in vendor
filters.clear
View livesearch.js
//= require jquery
//= require lodash
$(function() {
var input = $('#searchInput'),
loader = $('#loader'),
searchInputTarget = $('#searchTarget'),
value = input.val();
if (!input.length)
@DanielHeath
DanielHeath / nvm.sh
Created Jan 10, 2017
How I source nvm (because it's slow
View nvm.sh
#!/usr/bin/env bash
export NVM_DIR="$HOME/.nvm"
function _source_nvm() {
if [ -z "$NVM_PATH" ] ; then
# Prevent infinite recursion
unset -f nvm;
unset -f npm;
unset -f grunt;
. /usr/local/opt/nvm/nvm.sh;
View NPM and shrinkwrapping.md

How does npm >4.0 work with shrinkwrapping?

What happens when I run npm i without a shrinkwrap file

For each dependency specified in package.json, npm attempts to find a compatible version, and installs it (and all dependencies, transitively) to node_modules

What happens when I run npm i with a shrinkwrap file

The exact versions of the libraries specified in the shrinkwrap file are installed, regardless of whether they match package.json or have their dependencies met.

What happens when I run npm shrinkwrap?

The exact versions of the currently installed libraries in node_modules are written to npm-shrinkwrap.json.

@DanielHeath
DanielHeath / deploy.sh
Last active Aug 1, 2016
Deploying to github pages, from e.g. a webpack static site generator [OSX/LINUX]
View deploy.sh
#!/usr/bin/env bash
set -o pipefail # If you pipe one command into another, fail the whole lot if any fail
set -e # fail if there are any errors in the script
set -u # fail if you use an uninitialized variable
# Warn about the dire consequences of this action
read -r -p "THIS WILL WIPE OUT ANY UNCOMMITTED CHANGES - control-c to stop" yn
HEAD=$(git rev-parse HEAD) # Save where you're up to
git reset --hard "$HEAD" # Avoid using uncommitted changes to build the site
@DanielHeath
DanielHeath / .env
Last active Dec 14, 2016
Setting up a go project to produce a binary
View .env
export GOPATH="$(pwd):$(pwd)/vendor"
export PATH="$(pwd)/bin:$PATH"
export CDPATH=.:$(pwd)/src/github.com:$(pwd)/vendor/src/golang.org:$(pwd)/src
if [ -f .env.secret ] ; then
source .env.secret
fi
@DanielHeath
DanielHeath / Last output lines
Last active May 3, 2016
Flowtype hardlock (0.24.0, installed via flow-bin on linux, run under gnu parallel in a docker container running debian jessie)
View Last output lines
flow is still initializing; this can take some time. [local inference] \flow is still initializing; this can take some time. [local inference] |flow is still initializing; this can take some time. [local inference] /flow is still initializing; this can take some time. [local inference] -flow is still initializing; this can take some time. [local inference] \flow is still initializing; this can take some time. [local inference] |flow is still initializing; this can take some time. [local inference] /flow is still initializing; this can take some time. [local inference] -flow is still initializing; this can take some time. [local inference]
It just sits printing these at 100% CPU for hours
View keybase.md

Keybase proof

I hereby claim:

  • I am danielheath on github.
  • I am danielheath (https://keybase.io/danielheath) on keybase.
  • I have a public key ASB64BNLOuSdIVF8CXaTle3Sq2GsnpxBwPhdcErwvGd6lAo

To claim this, I am signing this object:

You can’t perform that action at this time.