This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rope { | |
constructor(text) { | |
this.text = text; | |
this.size = text.length | |
} | |
insert(text, location) { | |
let { left, right } = this.splitAt(location) | |
// Avoid creating empty children | |
if (right.toStringPretty() == '') right = undefined; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
import itertools | |
import pandas | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def lorenz_curve(X): | |
X = np.array(X, dtype='int64') | |
X.sort() | |
X_lorenz = X.cumsum() / X.sum() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
repository(owner: "sdiehl", name: "write-you-a-haskell") { | |
pullRequests(first: 100) { | |
nodes { | |
participants(first: 5) { | |
nodes { | |
login | |
isHireable | |
bio | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT | |
doctors.NPI AS "Provider NPI", | |
users.ufname AS "Provider First Name", | |
users.ulname AS "Provider Last Name" | |
FROM | |
enc INNER JOIN doctors | |
ON enc.doctorID = doctors.doctorID | |
LEFT JOIN users | |
ON doctors.doctorID = users.uid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Diagnoses | |
select "CPTItemDetail"."value", "BillingItems"."itemName", "BillingData"."icdcode1", "BillingData"."icdcode2", "BillingData"."icdcode3", "BillingData"."icdcode4", "PATIENT"."hl7Id", "PATIENT_USERS"."ssn", "PATIENT_USERS"."ptDob", case when "PATIENT_USERS"."sex" = '' then 'Unknown' else "PATIENT_USERS"."sex" end , case when "PATIENT"."deceased" = 1 then 'Yes' when "PATIENT"."deceased" = 0 then 'No' else 'UnKnown' end , "CHARGE_ETHNICITY"."Name", "PATIENT"."language", "encBillingData"."date", "ChargeUser___Patient"."ptDob", "PATIENT_USERS"."ufname", "PATIENT_USERS"."uminitial", "PATIENT_USERS"."ulname", "PATIENT_USERS"."uemail", "PATIENT_USERS"."upPhone", "PATIENT_USERS"."upaddress", "PATIENT_USERS"."upcity", "PATIENT_USERS"."upstate", "PATIENT_USERS"."zipcode", "EDI_FACILITIES"."code", "EDI_FACILITIES"."Id", "EDI_FACILITIES"."Name", "EDI_FACILITIES"."startedOn", "APPOINTMENT_DOCTOR"."NPI", "APPOINTMENT_PROVIDER"."uid", "APPOINTMENT_DOCTOR"."TaxID", "APPOINTMENT_DOCTOR"."SpecialityCode", "APPOIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_id" : ObjectId("55ce337efef5f226a4000010"), | |
"status" : { | |
"state" : "error", | |
"log" : [ | |
"Queued at 2015-08-14 15:09:23 -0400", | |
"Starting MapReduce", | |
"The operation: #<Moped::Protocol::Command\n @length=60262\n @request_id=11\n @response_to=0\n @op_code=2004\n @flags=[]\n @full_collection_name=\"he-development-ecw.$cmd\"\n @skip=0\n @limit=-1\n @selector={:mapreduce=>\"records\", :map=>\"function() {\\n var patient = this;\\n var effective_date = 1451520000;\\n var enable_logging = false;\\n var enable_rationale = true;\\n var short_circuit = true;\\n\\n \\n var test_id = null;\\n \\n\\n hqmfjs = {}\\n if (typeof(map)==\\\"undefined\\\") {\\nmap_reduce_utils();\\nhqmf_utils();\\n}\\n\\n\\n hqmfjs.effective_date = effective_date;\\n hqmfjs.test_id = test_id;\\n \\n \\n var patient_api = new hQuery.Patient(patient) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple script to synchronize Todoist and habitRPG | |
# only marks complete items in Todoist as complete in habitRPG, | |
# doesn't synchronize non-complete to do items | |
# | |
# Note: this script uses a temporary file to store the most recent sequence number from | |
# Todoist. Therefore, it must be stored in a spot where it has write access to a new file, | |
# and if you move it you'll either need to comment out the body of the loop below or else | |
# move the file. | |
# | |
# If this is the first time you're running the script, you might want to comment out the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(R.oo) | |
library(plyr) | |
# Main function. Given the number of new vegetarians (in millions), | |
# returns the number of people brought into or out of poverty. | |
changeInPoor = function(milVeg) { | |
# Demand in the F&P paper was 61 million bushels | |
# We find the % change in feed demand, and use that with the elasticity | |
# from F&P to find % change in price | |
relDemandChange = vegChange(milVeg) / 61 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function q = heat(mph) | |
% Given a walking speed in miles per hour, returns the energy given off as heat | |
% in 30 degree celsius temperature with no wind. | |
% No simple formula for energy taken by exercise, unfortunately | |
if mph == 3 | |
exCalPerH = 230; | |
elseif mph == 4 | |
exCalPerH = 350; | |
elseif mph == 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Normally, we tokenize based on white space. But there are times we want to keep words across whitespace, e.g. | |
/// "in basket" should not become "in" "basket". This class allows you to do that. | |
/// </summary> | |
class SpecialWordsTokenFilter : TokenFilter | |
{ | |
readonly TermAttribute termAttribute; | |
readonly Dictionary<string, string> TwoWords = new Dictionary<string, string>(); | |
private Queue<string> bufferBuffer = new Queue<string>(); | |
NewerOlder