Skip to content

Instantly share code, notes, and snippets.

Avatar

Simon Williams simonista

  • Instructure
  • Austin, TX
View GitHub Profile
@simonista
simonista / zips.json
Created Jan 4, 2018
a large json file for testing json parsing
View zips.json
This file has been truncated, but you can view the full file.
[{ "city" : "AGAWAM", "loc" : [ -72.622739, 42.070206 ], "pop" : 15338, "state" : "MA", "_id" : "01001" }
,{ "city" : "CUSHMAN", "loc" : [ -72.51564999999999, 42.377017 ], "pop" : 36963, "state" : "MA", "_id" : "01002" }
,{ "city" : "BARRE", "loc" : [ -72.10835400000001, 42.409698 ], "pop" : 4546, "state" : "MA", "_id" : "01005" }
,{ "city" : "BELCHERTOWN", "loc" : [ -72.41095300000001, 42.275103 ], "pop" : 10579, "state" : "MA", "_id" : "01007" }
,{ "city" : "BLANDFORD", "loc" : [ -72.936114, 42.182949 ], "pop" : 1240, "state" : "MA", "_id" : "01008" }
,{ "city" : "BRIMFIELD", "loc" : [ -72.188455, 42.116543 ], "pop" : 3706, "state" : "MA", "_id" : "01010" }
,{ "city" : "CHESTER", "loc" : [ -72.988761, 42.279421 ], "pop" : 1688, "state" : "MA", "_id" : "01011" }
,{ "city" : "CHESTERFIELD", "loc" : [ -72.833309, 42.38167 ], "pop" : 177, "state" : "MA", "_id" : "01012" }
,{ "city" : "CHICOPEE", "loc" : [ -72.607962, 42.162046 ], "pop" : 23396, "state" : "MA", "_id" : "01013" }
@simonista
simonista / enrollment_state.rb.diff
Created Oct 24, 2016
Apply this patch to the 2016-09-17 branch to avoid a problem with a migration in the 2016-10-08 branch
View enrollment_state.rb.diff
diff --git a/app/models/enrollment_state.rb b/app/models/enrollment_state.rb
index 66e9700..c6caf91 100644
--- a/app/models/enrollment_state.rb
+++ b/app/models/enrollment_state.rb
@@ -7,6 +7,7 @@ class EnrollmentState < ActiveRecord::Base
validates_presence_of :enrollment_id
self.primary_key = 'enrollment_id'
+ self.lock_optimistically = false
View keybase.md

Keybase proof

I hereby claim:

  • I am simonista on github.
  • I am simonista (https://keybase.io/simonista) on keybase.
  • I have a public key ASAXhGRLvZ_56xngoWxJTLG8Pv4uJUsGGUNc_t1NSx-j_go

To claim this, I am signing this object:

View demoday
Greetings Industry Colleagues,
The School of Computing at the University of Utah will be holding our annual Senior Capstone Demonstration Wednesday, April 27th from 1:30-4:30 in Warnock Engineering Building L130 (with pizza and awards following). On this day, our seniors will show off the software projects they and their teams have completed over the past 6 months.
Judges:
The demonstration is open to all, but we ask any of you who are willing to come (or send another representative) as a judge. The judges walk around and talk to the students, and then score them on a 1-10 scale. At the end of the day, these scores are used to name the top teams for the day. Judging is a great time to really get to interact with our students and see what they are capable of.
Prizes:
We are also asking for "prize" donations from any of your companies that are able to so. We award these prizes to our students in recognition of their hard work. Prizes in the past have ranged from graphics cards to company pens. Any ty
@simonista
simonista / fixme.rb
Last active Feb 10, 2016
Send me your cleanest version of this function
View fixme.rb
# Current gotcha's:
# - any result to be cached in the ivar (currently not true for the early return)
# - if any of the early return stuff, or if the session.key is created, we don't want to run brand_config_for_account(opts)
def active_brand_config(opts={})
@active_brand_config_cache ||= {}
return @active_brand_config_cache[opts] if @active_brand_config_cache.key?(opts)
@active_brand_config_cache[opts] = begin
return nil if !use_new_styles? || (@current_user.try(:prefers_high_contrast?) && !opts[:ignore_high_contrast_preference])
brand_config = if session.key?(:brand_config_md5)
@simonista
simonista / .aprc
Last active Aug 29, 2015
Config files for awesome print
View .aprc
AwesomePrint.defaults = {
:indent => 2,
:sort_keys => true,
:color => {
:args => :greenish,
:array => :pale,
:bigdecimal => :blue,
:class => :yellow,
:date => :greenish,
:falseclass => :red,
View process_canvas_settings.rb
linere = /(\S+):(\d+):\s*(.*)(Setting\.get(_or_set)?\(.*(\))?)(.*)/
settingre = /['"](\S+)['"], (.*)\)/
File.readlines('settings.txt').each do |line|
if linematch = line.match(linere)
all, filename, linenumber, before, setting, or_set, after = linematch.to_a
if settingmatch = setting.match(settingre)
all, name, default = settingmatch.to_a
puts "#### #{name}\n* default: `#{default}`\n* usage: `#{before}#{setting}#{after}`\n* location: `#{filename}:#{linenumber}`\n\n"
end
@simonista
simonista / .vimrc
Created Jan 30, 2014
vimrc tips and tricks from instructure
View .vimrc
" classic conundrum
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
@simonista
simonista / .vimrc
Last active Jul 19, 2021
A basic .vimrc file that will serve as a good template on which to build.
View .vimrc
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
View .vimrc
set nocompatible
filetype off " needed to load vundle
" Manage plugins with vundle
" run :PluginInstall (or vim +PluginInstall +qall on cli)
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#rc()
Plugin 'gmarik/vundle'
" Security