Skip to content

Instantly share code, notes, and snippets.

@mattsnyder
mattsnyder / warrior_6.rb
Created March 6, 2014 01:56
Ruby Warrior Level 6
class Strategy
def initialize(warrior, player)
@warrior = warrior
@player = player
end
def remember(memo)
player.remember memo
end
@mattsnyder
mattsnyder / warrior_7.rb
Created March 6, 2014 02:08
Ruby WarriorLevel 7
class Strategy
def initialize(warrior, player)
@warrior = warrior
@player = player
end
def run
false
end
@mattsnyder
mattsnyder / warrior_8.rb
Created March 6, 2014 02:21
Ruby Warrior Level 8 (kills captive)(works on 9 too)
class Strategy
def initialize(warrior, player)
@warrior = warrior
@player = player
end
def run
false
end
@mattsnyder
mattsnyder / level6.rb
Created March 6, 2014 13:17
Ruby Warrior Solutions Levels 6-9
class Strategy
def initialize(warrior, player)
@warrior = warrior
@player = player
end
def remember(memo)
player.remember memo
end
:ruby
@site = UT::SiteSucker.new(params[:url])
= content_for :bottom_js do
:plain
window.launchTest = function(e){
$('#utfst_start').remove()
$('#sucked_site').show()
};
@mattsnyder
mattsnyder / GsRYp6No.sql
Last active August 29, 2015 14:01
remove linked studies from dropdown (Trello GsRYp6No)
begin;
SELECT
id,
linked_study_id,
folder_id
FROM studies
WHERE
linked_study_id IS NOT NULL AND
folder_id IS NOT NULL;
  • Would I want this person to be my boss?
  • Would I learn a significant amount from him or her?
  • What if this person went to work for our competition?
  • What kind of T shape are they?
    • Highly skilled at a broad set of valuable things (top of T)?
    • Among the best in their field within a narrow discipline (leg of the T)?
@mattsnyder
mattsnyder / heroku-helpers.md
Last active March 24, 2017 20:49
Heroku Census Helpers

Add Graphene with specific version

heroku addons:add graphenedb --version v218

Backup neo4j

tar -cjf graph.tar.bz2 /opt/neo4j-enterprise-2.1.5/data/graph.db

Add Remote for Heroku Staging

git remote add heroku-staging git@heroku.com:ut-census-staging.git

@char_types [{~r/(?<number>\d)/, :digit}, {~r/(?<letter>\w)/, :letter}, {~r/(?<allowed>[\(\)\.\-])/, :allowed} ]
defp identify_char(char) do
{_, type} = Enum.find(@char_types, {nil, :unknown}, fn {reg, type} ->
String.match?(char, reg)
end)
{type, char}
end
Definitions.
INT = [0-9]
SPECIAL = [\(\)\.\-]
WHITESPACE = [\s\t\n\r]
Rules.
{INT} : { token, {int, TokenLine, TokenChars}}.
{SPECIAL} : skip_token.