Skip to content

Instantly share code, notes, and snippets.

View donnfelker's full-sized avatar

Donn Felker donnfelker

View GitHub Profile
@donnfelker
donnfelker / demo.txt
Created September 21, 2011 19:25
Maven Third Party Repo
# This will create a pom, md5 and sha1 for the jar and pom in your ~/.m2/ directory.
# here i'm installing the FlurryAgent from my /tmp/ directory
mvn install:install-file -Dfile=/tmp/FlurryAgent.jar -DgroupId=com.flurry -DartifactId=FlurryAgent -Dversion=2.2 -Dpackaging=jar -DcreatePom=true -DcreateChecksum=true
# Copy this entire folder from your ~/.m2/ folder
# Place it into your third.party.closed.source repo (local repo checked into source control)
# In your applications pom file, add a third party repo
@i386
i386 / hn.css
Created February 14, 2013 00:36
Sylish style to make Hacker News less raw
.title {
font-size: 12pt;
}
.comhead !important {
font-size: 12pt;
}
.topsel a {
color: #ff9913;
@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;
@lucapette
lucapette / application.css
Created October 19, 2011 22:20
twitter bootstrap rails 3.1 notes
/*
*= require_self
*/
html, body {
background-color: #eee;
}
body {
padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */
}
@tyvsmith
tyvsmith / dex-count.sh
Created July 22, 2013 18:45
"`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…
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)
@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
@veganstraightedge
veganstraightedge / gist:1063033
Created July 4, 2011 08:05
blacklist of usernames
about
account
add
admin
api
app
apps
archive
archives
auth
@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;
@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"
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',