Skip to content

Instantly share code, notes, and snippets.

View BrianMehrman's full-sized avatar
🏠
Working from home

Brian Mehrman BrianMehrman

🏠
Working from home
View GitHub Profile
**Patreon**(http://www.patreon.com/) is a service that connects **patrons** with **creators**. A creator promises to produce creations; these could be videos, songs, podcast episodes, comics, or anything else that can be delivered digitally.
Each patron is automatically a creator if they create a **creator's** **page**. A creator charges patrons **per creation** or **per month** (of creations). A creator creates **posts** for their page (think "blog").  A post has content (displayed in a feed of posts); some posts have a creation that needs to be billed.
The creator also establishes **reward** **tiers** for their page (e.g., $1 per whatever, $5 per whatever, $25 per whatever). A patron chooses a tier *and* an amount for their pledge; they must pledge as much or *more* than their reward tier.  A post is either public or linked to a reward tier. The content of public posts can be seen by everyone, even visitors not logged in; the content of posts tied to a reward tier can be seen by a patron at that tier or h
@BrianMehrman
BrianMehrman / configmap.yaml
Last active August 12, 2021 19:04
These are instructions to start a mongo db deployment. Assuming these files are all in the same directory you can run this ``` kubectl apply -k . ```
apiVersion: v1
kind: ConfigMap
metadata:
name: mongo-configmap
labels:
app: meal-plan-app
component: mongo-db
data:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootR0xks
man dmesg
Get is list of killed processes
```
dmesg -TL
```
@BrianMehrman
BrianMehrman / prettySQL.py
Last active July 5, 2018 20:10
pretty print your SQL
#!/usr/bin/env python
import argparse
import sys
import sqlparse
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import TerminalTrueColorFormatter
def prettyPrint(raw_sql):
CREATE USER postgres;
SELECT rolname FROM pg_roles;
ALTER USER postgres WITH CREATEUSER;
@BrianMehrman
BrianMehrman / TransisPropParser.rb
Created January 17, 2018 18:02
scans a JS file using TransisJS for prop dependencies
#!/usr/bin/env ruby
require 'pry'
class PropParser
HEX = %w(8 9 A B C D E F)
attr_reader :colors
def self.execute(source_file, out_file)
@BrianMehrman
BrianMehrman / timeUtils.js
Last active June 17, 2017 22:36
Code to alter date quickly
const daysAgo = ((days, date) => { let d = date || new Date(); d.setDate(d.getDate() - (days || 1)); return d; });
const hoursAgo = ((hours, date) => { let d = date || new Date(); d.setHours(d.getHours() - (hours || 1)); return d; });
const mintuesAgo = ((mins, date) => { let d = date || new Date(); d.setMinutes(d.getMinutes() - (mins || 1)); return d; });
@BrianMehrman
BrianMehrman / Vim Capture Find and Replace
Created June 12, 2017 15:34
Every forget to wrap some text in some parenthesis or brackets. Yeah me too.
%s/\(Foo::SubFoo::.*\.name\)/"#{\1}"/g
[
Foo::SubFoo::One,
Foo::SubFoo::Two,
Foo::SubFoo::Three,
Foo::SubFoo::Four
]
# =>
@BrianMehrman
BrianMehrman / .screenrc
Created June 12, 2017 01:27 — forked from ddrscott/.screenrc
screenrc with pretty colors
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'
require 'benchmark/ips'
module ExtraMath
def self.build_math(attr_name)
attr_name = attr_name.to_s
class_eval %Q{
def #{attr_name}(x)
x + x
end
}