Skip to content

Instantly share code, notes, and snippets.

View soberstadt's full-sized avatar
🤷‍♂️
yep.

Spencer Oberstadt soberstadt

🤷‍♂️
yep.
  • Stevens Point, WI
View GitHub Profile
# "borrowed" from https://connorshea.gitlab.io/blog/how-i-write-and-maintain-type-sigs-in-my-rails-app-with-sorbet.html
namespace :sorbet do
namespace :update do
desc "Update Sorbet and Sorbet Rails RBIs."
task all: :environment do
Bundler.with_unbundled_env do
# Pull in community-created RBIs for popular gems, such as Faker.
#
# If you want to use a fork of sorbet-typed for any reason, you can set
# SRB_SORBET_TYPED_REPO to the git URL and SRB_SORBET_TYPED_REVISION

Keybase proof

I hereby claim:

  • I am soberstadt on github.
  • I am soberstadt (https://keybase.io/soberstadt) on keybase.
  • I have a public key ASAyiEWJ-DxTLNCT88dhN_x8i_0ZtEEiBS_ascJnOuGsawo

To claim this, I am signing this object:

@soberstadt
soberstadt / configuration.yaml
Last active February 1, 2021 01:17
Home Assistant Roku Remote (requires HA 0.62)
homeassistant:
customize:
script.roku_button:
# using https://github.com/c727/home-assistant-tiles
custom_ui_state_card: state-card-tiles
config:
columns: 3
column_width: 75px
row_height: 75px
entities:
@soberstadt
soberstadt / git-branch-cleanup.rb
Created September 6, 2017 13:00
A git branch cleanup script for people who use 'Squash and merge' on Github
#!/usr/bin/env ruby
# There are other solutions to deleting local branches that have been deleted on the remote,
# but I have found they all assume you are deleting fully-merged branches on github, but
# because I use the 'Squash and merge' strategy, my branches are never actually merged.
# So if you use 'Squash and merge' on Github, this might be helpful for you!
deleted_branches = `git fetch -p --dry-run 2>&1 | grep deleted`.split("\n")
deleted_branches = deleted_branches.map do |line|
line.split('origin/')[1]
@soberstadt
soberstadt / prof.rb
Last active February 17, 2017 15:30
A script to paste into your rails console to evaluate performance of arbitrary command
# frozen_string_literal: true
# find ruby-prof gem on global scope
@ruby_prof_path = `cd .. && gem which ruby-prof`
if path.blank?
# install ruby-prof if we can't find it
`cd .. && gem install ruby-prof`
@ruby_prof_path = `cd .. && gem which ruby-prof`
end
@ruby_prof_path = @ruby_prof_path.sub(/ruby-prof.rb\n/, '')
@soberstadt
soberstadt / Rakefile
Created August 27, 2016 19:50
Gizmodo Once Workers
namespace :jobs do
task work: :environment do
client = Twitter::REST::Client.new do |config|
config.consumer_key = ENV["TWITTER_CONSUMER_KEY"]
config.consumer_secret = ENV["TWITTER_CONSUMER_SECRET"]
config.access_token = ENV["TWITTER_ACCESS_TOKEN"]
config.access_token_secret = ENV["TWITTER_ACCESS_TOKEN_SECRET"]
end
tweets = GizmodoTweet.latest_tweets(client).reverse
tweets.each do |tweet|
#!/usr/bin/env bash
# Happy Birthday, Jordan! I hope this can help make your day extra special!
# so this will make your Terminal's "Command not found" messages a little
# more fun. Examples:
# $ bundler install
# bundler? I hardly know her!
angular.module('missionhub')
.factory('personCache', function() {
// set up variables and constants
var cachedPeople = {};
// define methods
// if you give person() a person object, it will cache it.
// if you give it an id, it will return a person object if it has it.
function person(newValue) {
@soberstadt
soberstadt / facebook_phonegap_example.js
Last active October 13, 2015 20:08
Facebook, phonegap, oauth, ajax
// facebook_phonegap_example.js
//
// Facebook connection with Phonegap Example
//
// Depends on Phonegap plug-in ChildBrowser
//
// Author: Spencer Oberstadt
// github.com/soberstadt
// twitter.com/spencersshutter
//
@soberstadt
soberstadt / GeneralHTTPRequestExampleActivity.java
Created January 25, 2012 21:51
Asynctask in Android and onCompleteListener
package com.spencero.example.generalHttpRequest;
import com.spencero.example.generalHttpRequest.GeneralHttpTask.OnResponseListener;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;