Skip to content

Instantly share code, notes, and snippets.

View aguestuser's full-sized avatar

Austin Guest aguestuser

View GitHub Profile
@aguestuser
aguestuser / oauth_signup_handlers.rb
Created May 16, 2018 13:33
OAuth Signup Handler sketch for affinity.works
module OAuthSignupHandlers
extend ActiveSupport::Concern
def classify_person
if @person = Person.find_by_email(@auth.info.email)
classify_existing_person
elsif @person = Person.build_from_oauth_signup(@auth)
NewMember
else
Invalid
@aguestuser
aguestuser / scuttlebutt-setup.md
Created March 11, 2018 15:49
How to Setup Scuttlebutt
@aguestuser
aguestuser / tags_for.rb
Created August 31, 2017 18:49
tags_for
def tags_for(user)
{
all: add_permissions(Tag.all, user),
current: add_permissions(tags, user)
}
end
private
def add_permissions(tags, user)
@aguestuser
aguestuser / sideload-signal.sh
Last active October 25, 2017 18:38
Side-load Signal instead of using the Google Play Store.
# USAGE:
# cd /path/to/sideload-signal.sh
# chmod +x sideload-signal.sh
# ./sideload-signal.sh
# DEPENDENCIES:
# * Android Debug Bridge
# (install with: `sudo apt install adb`)
package org.osmdroid.tileprovider.tilesource;
import org.osmdroid.tileprovider.MapTile;
import java.util.ArrayList;
import java.util.List;
public class TileSourceFactory {
// private static final Logger logger = LoggerFactory.getLogger(TileSourceFactory.class);
import _ from 'lodash';
import fs from 'fs';
/**
* FILENAME: `makeFolders.js`
* USAGE: `babel-node makeFolders <rootFolder> <startMonth> <endMonth>`
*/
const pad = (num) => num < 10 ? `0${num}` : num;
const has30 = (month) => _.contains([4, 6, 9, 11], month);
@aguestuser
aguestuser / scratchpad.js
Created November 2, 2015 19:29
scratchpad: example mini-program for learning about node & bash
// main loop
// run with `node scratchpad some arguments` (from same directory)
(function (){
var args = process.argv;
console.log(wrapInEverything(args[2]));
// teaser for later: what will lines 11-13 do?
// what about lines 15-17?
@aguestuser
aguestuser / Text.java
Last active October 1, 2015 19:24
Wrapper around Android's `Linkfy` class for wrapping substrings of strings with hyperlinks
import android.text.SpannableString;
import android.text.util.Linkify;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Text {
// takes arbitrary string and wraps arbitrary substring with an arbtitrary URL
public static SpannableString linkify(String txt, String linkTxt, String scheme, String url) {
SpannableString s = new SpannableString(txt);
@aguestuser
aguestuser / init.el
Created August 14, 2015 00:34
my init.el
;;; init.el --- Prelude's configuration entry point.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: http://batsov.com/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
@aguestuser
aguestuser / pairingNotes_20150622.js
Last active August 29, 2015 14:23
Notes from Tim & Austin Pairing
/*
BIG TAKEAWAY LESSON:
* stop and ask yourself: "WHAT PROBLEM AM I TRYING TO SOLVE RIGHT NOW"
* particularly when the code starts pushing you around
* you can tell the code is pushing you around when:
* things are breaking
* you start chasing frantically from error message to error message