Skip to content

Instantly share code, notes, and snippets.

View jpowell's full-sized avatar

Justin Powell jpowell

View GitHub Profile
@nandorojo
nandorojo / knew.md
Last active June 30, 2024 13:09
What I wish I knew when I started with Expo Web, React Navigation & Next.js

I started using React Native in September 2018. I always forget some things when I build new apps, so I'll keep track of the gotchas on this post.

Some topics, such as navigation, will be fundamental to how I think about apps. Others, will be one-line helpers that make apps work more smoothly.

It's gotten to the point where I find my own answers from 6 months before on certain Github issues.

I'll keep adding over time as I think of more. If anyone thinks these topics would be useful, let me know and I'll elaborate.

I have made libraries to address a number of the topics here, from navigation to design.

@gburgett
gburgett / logentries
Last active July 9, 2021 16:05
logentries API wrapper
#! /usr/bin/env bash
COLOR_NC='\033[0m' # No Color
COLOR_LGREEN='\033[1;32m'
COLOR_GRAY='\033[1;30m'
COLOR_LGRAY='\033[0;37m'
COLOR_RED='\033[0;31m'
logv() {
[[ -z "$VERBOSE" ]] && return 0;
@gburgett
gburgett / bugsnag
Last active March 9, 2020 16:10
A utility script to download error instances from the Bugsnag API. Automatically paginates and handles rate limits.
#! /bin/bash
COLOR_NC='\033[0m' # No Color
COLOR_LGREEN='\033[1;32m'
COLOR_GRAY='\033[1;30m'
COLOR_LGRAY='\033[0;37m'
COLOR_YELLOW='\033[1;33m'
COLOR_RED='\033[0;31m'
DIR="$( cd "$( dirname "$0" )" && pwd )"
@gburgett
gburgett / template.sh
Last active July 30, 2022 21:34
Bash Script Template
#! /bin/bash
COLOR_NC='\033[0m' # No Color
COLOR_LGREEN='\033[1;32m'
COLOR_GRAY='\033[1;30m'
COLOR_LGRAY='\033[0;37m'
COLOR_RED='\033[0;31m'
logv() {
[[ -z "$VERBOSE" ]] && return 0;
@gburgett
gburgett / changelog.sh
Last active January 5, 2022 15:59
generates a changelog from git history, grabbing PRs from github
#! /bin/bash
COLOR_NC='\033[0m' # No Color
COLOR_LIGHT_GREEN='\033[1;32m'
COLOR_GRAY='\033[1;30m'
COLOR_RED='\033[0;31m'
logv() {
[[ ! -z "$VERBOSE" ]] && >&2 echo -e "${COLOR_GRAY}$*${COLOR_NC}"
}
@xaviershay
xaviershay / database_cache_store.rb
Created June 12, 2012 00:14
DatabaseCacheStore
# Implementation of Rails.cache backed by our database. We don't have high
# performance or space requirements, so using existing infrastructure for our
# caching needs is desirable.
class DatabaseCacheStore < ActiveSupport::Cache::Store
class CacheEntry < ActiveRecord::Base
end
def self.migrate_up(m)
m.create_table :cache_entries do |t|
t.string :key, :null => false
@bratsche
bratsche / fix-postgres-seqs.rb
Last active September 30, 2015 11:37
Fix up broken id seqs on Postgres after migrating from MySQL using ar_dbcopy gem
require 'pg'
unless ARGV[0]
puts "Pass the name of the database"
exit 1
end
# Get our Postgres connection
conn = PGconn.open(:dbname => ARGV[0], :host => 'localhost')
filetype on " to prevent non-0 exit codes
filetype off
call pathogen#runtime_append_all_bundles()
filetype plugin indent on
set nocompatible
set modelines=0
set softtabstop=2
#!bash
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
@nifl
nifl / grok_vi.mdown
Created August 29, 2011 17:23
Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question http://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118

Your problem with Vim is that you don't grok vi.

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

The "Zen" of vi is that you're speaking a language. The initial y is a verb. The statement yy is a simple statement which is, essentially, an abbreviation for 0 y$:

0 go to the beginning of this line. y yank from here (up to where?)