Skip to content

Instantly share code, notes, and snippets.

View bradobro's full-sized avatar
🌲

Brad Olson bradobro

🌲
View GitHub Profile
// This module loads a config file in the current working directory matching the NODE_ENV variable.
// I.e. either './development.js' or './production.js' based on the process.env.NODE_ENV variable.
// If not set, it defaults to './development.js'.
// Can load custom environment files as well, as long as the NODE_ENV variable matches
// a file in the current directory. E.g. './staging.js'
// Usage: calling code can just require this module, e.g. "var config = require('./config')"
// assuming this file is named "index.js" and lives in a subdirectory named "config" of the app root.
var config
, config_file = './' + (process.env.NODE_ENV ? process.env.NODE_ENV : 'development') + '.js';
@bradobro
bradobro / ReactStyleExample.coffee
Created May 19, 2015 14:32
A lightweight, versatile way to override styles client-side with react
H = React.Dom
H.div className: "page-wrapper",
H.style null,
"""
.header-section {background: red !important;}
.primary-action {background: red !important;}
.primary-action:hover, .primary-action.hover {border: 1px solid red !important;}
"""
@bradobro
bradobro / lessq.fish
Last active January 18, 2017 19:39
Fish functions for watching files with less
# You can use `funced` to edit these or just run this script.
# If you want them there for you next time, be sure to `funcsave` them
function lessq --description 'View github.com/y0ssar1an/q go debug logs'
set fname {$TMPDIR}q
echo 'q.Q watcher help: ^C to browse, F to resume following' > $fname
less -R +F $fname
end
function lessw --description 'Like tail -f but with less powers. ^C to scroll and search. F to resume watching.' --argument fname
@bradobro
bradobro / .gitconfig
Last active July 23, 2018 17:04
go get via ssh
# command-line version: git config --global --add '[email protected]' 'https://github.com'
[url "[email protected]"] # this works on Linux
insteadOf = https://github.com
# Git for Windows (git version 2.18.0.windows.1) seems to do less magic with the substitution and needs:
[url "[email protected]:"] # Git for Windows (under MING) needs the trailing ":" here and the trailing "/" below.
insteadOf = https://github.com/
@bradobro
bradobro / cordova-android-mac.md
Last active December 10, 2018 22:30
getting `cordova build android` working on MacOS Dec 2018

Getting Cordova to Build Android on a Mac

This works in Dec 2018 on MacOS High-Sierra. If you find changes that work in a later time or on later releases, suggest an edit.

Java, Cordova, Android, Android Studio, MacOS--five moving targets that don't stay in sync with each other. Commands and paths change (e.g. android is out, sdkmanager is in, but it doesn't open a UI as some helps suggest.) Mac Java versions can get wonky, and the Android SDK is picky about versions too.

Setting Up Cordoba

Follow the first Cordova app guide.

@bradobro
bradobro / parse_dotenv.bash
Created June 24, 2019 15:23 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@bradobro
bradobro / logemout.ps
Created January 14, 2020 21:21
Log someone else out of Windows 10
PS C:\as_admin> query session
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
betty 1 Disc
>console bobby 2 Active
PS C:\as_admin> logoff 1
@bradobro
bradobro / macbook-M1-dev-notes.md
Last active September 15, 2021 14:51
Doing Web dev on Macbook M1 (Apple Silicon)

Start terminal using Rosetta

(Props to @rlundquist3!)

  • you'll want to do this before installing homebrew and any other brew packages or other dependencies, including nvm and rbenv
  • before doing project setup:
  • finder > go > applications
  • right-click your terminal and duplicate (maybe give it a better name like "iTerm Rosetta" for clarity)
  • right-click > "get info"
  • check "open using Rosetta"
@bradobro
bradobro / git-helps.sh
Last active September 24, 2021 14:58
Short utilities for git and others in fish
# Create a list of repos in the directory
ls -d */.git > repos.txt
# remove the origin, (fetch) grep only fetch
# (manual)
# clone the repos from a repos list file
for r in (cat repos.txt | sort | uniq);
echo $r; git clone $r
@bradobro
bradobro / ksql_cli_steps.sh
Created April 5, 2022 15:31
How to build ksql-cli locally on a mac so you don't have to run it via docker
#!/bin/bash
# you probably don't want to run this file--just use it as a guide
$ You'll need a Java SDK (like openjdk) and the Java build tool, maven.
# for Mac: brew install maven
git clone [email protected]:confluentinc/ksql.git