Skip to content

Instantly share code, notes, and snippets.

View jeffrafter's full-sized avatar
✨
You are amazing

Jeff Rafter (he/him) jeffrafter

✨
You are amazing
View GitHub Profile
@jeffrafter
jeffrafter / FunWithNSCursor.m
Last active August 29, 2015 13:59
FunWithNSCursor.m
- (void)cursorUpdate:(NSEvent *)theEvent {
[self.cursor set];
}
- (void)resetCursorRects
{
// ...
}
- (NSImage *)cursorImage
@jeffrafter
jeffrafter / sql_views
Created July 25, 2008 08:13
Trying to understand how to use mysql query profiling to win
SELECT count(*)
FROM drug_order
INNER JOIN drug ON drug_order.drug_inventory_id = drug.drug_id
INNER JOIN concept_set as arv_drug_concepts ON
arv_drug_concepts.concept_set = 460 AND
arv_drug_concepts.concept_id = drug.concept_id
WHERE drug.concept_id IS NOT NULL;
=>
+----------+
| count(*) |
I want to JOIN only the last item
table_1
------------
id | Name |
============
1 Bob |
============
table_2
def say_hello
name = yield # runs the block and captures the output
puts "Hello #{name}"
end
say_hello do
"ellisTAA"
end
DROP TABLE IF EXISTS patient_prescription_totals;
CREATE TABLE patient_prescription_totals (
`id` int(11) NOT NULL auto_increment,
`patient_id` int(11) NOT NULL,
`drug_id` int(11) NOT NULL,
`prescription_date` DATE NOT NULL,
`daily_consumption` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `patient_id_drug_id_presciption_date` (`patient_id`, `drug_id`, `prescription_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
njero@alexandria:/var/www/bart$ rake db:migrate:reset RAILS_ENV=test
(in /private/var/www/bart)
== 20080711115602 CreateSessions: migrating ===================================
-- create_table(:sessions)
-> 0.0022s
-- add_index(:sessions, :session_id)
-> 0.0087s
-- add_index(:sessions, :updated_at)
-> 0.0048s
== 20080711115602 CreateSessions: migrated (0.0171s) ==========================
<html>
<head>
<title>This is a test</title>
</head>
<body onload="doit()">
<h1>You are my favorite person, okay?</h1>
<script type="text/javascript">
function window_click(x, y) {
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
class AddPrescriptions < ActiveRecord::Migration
def self.up
# Good chance this should be in the fixtures
ActiveRecord::Base.connection.execute <<EOF
DROP TABLE IF EXISTS prescription_time_periods;
EOF
ActiveRecord::Base.connection.execute <<EOF
CREATE TABLE prescription_time_periods (
`id` int(11) NOT NULL auto_increment,
class Thing
def say_hi
puts "Hi"
end
end
thing = Thing.new
thing.say_hi
# "Hi"
@jeffrafter
jeffrafter / Gemfile
Created May 28, 2015 20:30
Uploading static files to S3
# Aws and static site rendering
gem 'aws-sdk', '< 2.0'