Skip to content

Instantly share code, notes, and snippets.

View neurotech's full-sized avatar
🍔
We codin'

Tim Douglas neurotech

🍔
We codin'
View GitHub Profile
@neurotech
neurotech / gist:3759280
Created September 21, 2012 01:27
Gender Counts Question
WITH accepted_applications AS
(
SELECT
contact.firstname,
contact.surname,
gender.gender,
exp_form_run,
external_school.external_school
FROM table(edumate.getallstudentstatus(current_date)) accepted
@neurotech
neurotech / gist:4116984
Created November 20, 2012 09:37 — forked from schneems/gist:3029994
Databases and Rails Recap Quiz for Week 4

1) What does MVCr stand for?

Model View Controller Route

2) In what file do we store 'r' from MVCr ?

/config/routes.rb

3) What two components make up a route

@neurotech
neurotech / gist:4314578
Created December 17, 2012 00:27
GB API Question
require 'rubygems'
require 'httparty'
require 'ap'
class GiantBomb
include HTTParty
base_uri 'api.giantbomb.com'
default_params :api_key => 'SECRET', :format => 'json'
def self.thing(resource, id)
@neurotech
neurotech / latest-videos.xml
Created December 17, 2012 20:20
Latest 5 videos
<!--
Accessing this:
http://api.giantbomb.com/videos/?api_key=SECRET&field_list=name&limit=5&sort=publish_date&format=xml
generates the XML below.
How can I get the API to give me the 5 latest videos instead of (I assume) the 5 oldest?
require 'sinatra'
require 'nokogiri'
require 'open-uri'
get '/' do
url = "http://dota2.com/hero/Earthshaker/"
data = Nokogiri::HTML(open(url))
name = data.css('h1').text
abilities = data.css('#abilitiesInner h2').text
<h1><%= name %></h1>
<% abilities.each do |ability| %>
<h2><%= ability %></h2>
<% end %>
> gem install middleman
Successfully installed middleman-3.0.11
1 gem installed
Installing ri documentation for middleman-3.0.11...
Installing RDoc documentation for middleman-3.0.11...
> middleman init test
zsh: command not found: middleman
@neurotech
neurotech / student_status_id.sql
Last active December 14, 2015 01:49
Useful for working with the GETALLSTUDENTSTATUS function.
CASE STUDENT_STATUS_ID
WHEN 1 THEN 'Application Cancelled'
WHEN 2 THEN 'Alumni'
WHEN 3 THEN 'Past Enrolment'
WHEN 4 THEN 'Returning Enrolment'
WHEN 5 THEN 'Current Enrolment'
WHEN 6 THEN 'Place Accepted'
WHEN 7 THEN 'Offered Place'
WHEN 8 THEN 'Interview Pending'
WHEN 9 THEN 'Wait Listed'
SELECT YEAR(current timestamp) + 1 AS "NEXT_TWENTY_YEARS" FROM SYSIBM.SYSDUMMY1
UNION
SELECT YEAR(current timestamp) + 2 AS "YEAR_PLUS_TWO" FROM SYSIBM.SYSDUMMY1
UNION
SELECT YEAR(current timestamp) + 3 AS "YEAR_PLUS_THREE" FROM SYSIBM.SYSDUMMY1
UNION
SELECT YEAR(current timestamp) + 4 AS "YEAR_PLUS_FOUR" FROM SYSIBM.SYSDUMMY1
UNION
SELECT YEAR(current timestamp) + 5 AS "YEAR_PLUS_FIVE" FROM SYSIBM.SYSDUMMY1
UNION
@neurotech
neurotech / over-under-on-30.rb
Created February 23, 2013 09:43
My birthday
if Time.now < Time.gm(2013,"jun",12,00,00,01)
"late twenties"
else
"early thirties"
end