Skip to content

Instantly share code, notes, and snippets.

View micahbrich's full-sized avatar

Micah Rich micahbrich

View GitHub Profile
@micahbrich
micahbrich / next js starter code
Last active August 19, 2019 02:14
Next.js Starter Code
yarn add next react react-dom @emotion/core @emotion/styled babel-plugin-emotion @zeit/next-mdx @mdx-js/loader
@micahbrich
micahbrich / packages.json
Created July 8, 2018 10:00
atom sync-settings
//
# to run: docker-compose run
#
# Create a .evn file in the same folder as this file and change the variables.
# MOUNT_POINT=/tmp/
# VPN_PROVIDER=changeme
# VPN_CONFIG=changeme
# VPN_USERNAME=changeme
# VPN_PASSWORD=changeme
#
#

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@micahbrich
micahbrich / vhost
Last active November 3, 2015 19:16 — forked from asimpson/bash_function
This little script sets up a custom domain in MAMP and your hosts file.
#!/bin/bash
RED="\033[0;31m"
YELLOW="\033[33m"
REDBG="\033[0;41m"
BLACKBG="\033[0;40m"
WHITE="\033[1;37m"
NC="\033[0m"
mkdir -p /Applications/MAMP/Library/vhosts;
@micahbrich
micahbrich / git-grab
Created August 6, 2015 19:54
git-grab – snagging a specific piece of a git repo using SVN, of all things
#!/bin/bash
#######################################
# List the contents, or download a
# folder from a GitHub repo.
# Argument:
# HTTPS URI to folder
#######################################
echo ${1} | sed 's/tree\/master/trunk/g' | { read uri; (svn export $uri); }
@micahbrich
micahbrich / Gemfile
Created September 19, 2014 23:06
The default rails server when you run it on your local computer is WEBrick, which is great for developing, but awful once a bunch of people start using it at once. Instead, let's add a new, more production-ready server in on Heroku, and add a file that tells Heroku to use it.
source 'https://rubygems.org'
group :production do
gem "thin"
end
class Pitcher
attr_accessor :whip, :age
alias :whip_1 :whip
(2..20).each do |num|
define_method("whip_#{num}") do
if self.age < 28
eval("self.whip_#{num-1}") * 0.95
else
eval("self.whip_#{num-1}") * 1.05
{% for post in paginator.posts %}
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
<h5 class="date">{{post.date}}</h5>
<div class="content">
{{ post.content }}
</div>
{% endfor %}
@micahbrich
micahbrich / gist:4127466
Created November 21, 2012 20:31
Reading Time
def reading_time(content)
wordcount = content.to_s.scan(/(\w|-)+/).length.to_f # count words
reading_time_in_s = (wordcount / 275)*60 # avg american reading time is around 250 words per minute
reading_time = Time.at(reading_time_in_s).gmtime.strftime("%-M minutes, %-S seconds") #convert to pretty string
end