Skip to content

Instantly share code, notes, and snippets.

Avatar

Donn Felker donnfelker

View GitHub Profile
@Culttm
Culttm / axios.refresh_token.js
Created Oct 5, 2017
axios interceptors for refresh token
View axios.refresh_token.js
axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
const originalRequest = error.config;
if (error.response.status === 401 && !originalRequest._retry) {
originalRequest._retry = true;
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active Oct 15, 2021
How to reset PG Database on Heroku (for Rails app)?
View heroku_pg_db_reset.md

It's important to note that running this reset will drop any existing data you have in the application

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

@Vestride
Vestride / encoding-video.md
Last active Oct 8, 2021
Encoding video for the web
View encoding-video.md

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@quanturium
quanturium / CursorRecyclerAdapter.java
Last active Jul 10, 2020
A simple implementation of CursorAdapter for the new RecyclerView. It is designed to work with CursorLoaders and do not register any content observer (which can cause leaks if not handled properly)
View CursorRecyclerAdapter.java
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 ARNAUD FRUGIER
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@JakeWharton
JakeWharton / README.md
Last active Jan 8, 2020
A JUnit @rule which launches an activity when your test starts. Stop extending gross ActivityInstrumentationBarfCase2!
View README.md
@codeluggage
codeluggage / .zshrc
Last active Apr 10, 2018
Somewhat sensible .zshrc for those using Oh-My-Zsh, iTerm2, Android Studio, Xcode, and general git work.
View .zshrc
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
@redsquare
redsquare / mongoadd
Created Jan 9, 2014
mongo bulk add
View mongoadd
//r = require('rethinkdb')
var MongoClient = require('mongodb').MongoClient,
format = require('util').format;
var querystring = require('querystring');
var https = require('https');
var Inserter = function (collection) {
this.collection = collection;
@tyvsmith
tyvsmith / dex-count.sh
Created Jul 22, 2013
"`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH." Use this to keep track of methods and fields in your apk. They are both limited to 65536. Example use: $ source dex-count.sh; $ dex-field-count classes.dex; Original method scrip…
View dex-count.sh
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
@i386
i386 / hn.css
Created Feb 14, 2013
Sylish style to make Hacker News less raw
View hn.css
.title {
font-size: 12pt;
}
.comhead !important {
font-size: 12pt;
}
.topsel a {
color: #ff9913;
@romannurik
romannurik / CheatSheet.java
Last active Sep 8, 2021
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
View CheatSheet.java
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software