Skip to content

Instantly share code, notes, and snippets.

View donnfelker's full-sized avatar

Donn Felker donnfelker

View GitHub Profile
@redsquare
redsquare / mongoadd
Created January 9, 2014 18:55
mongo bulk add
//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;
@codeluggage
codeluggage / .zshrc
Last active November 19, 2022 23:04
Somewhat sensible .zshrc for those using Oh-My-Zsh, iTerm2, Android Studio, Xcode, and general git work.
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"
@JakeWharton
JakeWharton / README.md
Last active April 17, 2023 14:07
A JUnit @rule which launches an activity when your test starts. Stop extending gross ActivityInstrumentationBarfCase2!
@quanturium
quanturium / CursorRecyclerAdapter.java
Last active July 10, 2020 17:50
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)
/*
* 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
@Vestride
Vestride / encoding-video.md
Last active March 12, 2024 16:41
Encoding video for the web

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
@rossharper
rossharper / ParameterizedKotlinTest.kt
Created February 20, 2016 21:51
Parameterized JUnit4 test example in Kotlin
@RunWith(Parameterized::class)
class KotlinTest(val paramOne: Int, val paramTwo: String) {
companion object {
@JvmStatic
@Parameterized.Parameters
fun data() : Collection<Array<Any>> {
return listOf(
arrayOf(1, "I"), // First test: (paramOne = 1, paramTwo = "I")
arrayOf(1999, "MCMXCIX") // Second test: (paramOne = 1999, paramTwo = "MCMXCIX")
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active January 29, 2024 10:09
How to reset PG Database on Heroku (for Rails app)?

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

@ammarshah
ammarshah / all_email_provider_domains.txt
Last active April 17, 2024 02:36
A list of all email provider domains (free, paid, blacklist etc). Some of these are probably not around anymore. I've combined a dozen lists from around the web. Current "major providers" should all be in here as of the date this is created.
0-mail.com
007addict.com
020.co.uk
027168.com
0815.ru
0815.su
0clickemail.com
0sg.net
0wnd.net
0wnd.org
@culttm
culttm / axios.refresh_token.js
Created October 5, 2017 18:46
axios interceptors for refresh token
axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
const originalRequest = error.config;
if (error.response.status === 401 && !originalRequest._retry) {
originalRequest._retry = true;