A quick questionnaire for someone unsure if they're able to vote.
Data from ProCon.org and driven by the following spreadsheet.
| { | |
| "id": "00Q22000001GZsGEAW", | |
| "status": null, | |
| "lead_contact": { | |
| "name": "test Test", | |
| "phone": null, | |
| "email": null | |
| }, | |
| "archived": null, | |
| "expire_at": null, |
A quick questionnaire for someone unsure if they're able to vote.
Data from ProCon.org and driven by the following spreadsheet.
| Leads Actions: | |
| ------------ | |
| GetLeads (URL: /locations/:location_id/leads?filter=<active|archived>) | |
| ------------ | |
| GetLead (URL: /locations/:location_id/leads/:lead_id) |
| <script type="text/javascript"> | |
| (function(doc) { | |
| var flat = doc.location.toString() | |
| if( flat.match(/genius\.it/) !== null ) document.location = flat.split('genius.it').join('/') | |
| })(document) | |
| </script> |
| #!/usr/bin/env bash | |
| sudo rm -rf /Applications/iTunes.app | |
| sudo echo "BAD APPLE! NO" > /Applications/iTunes.app | |
| sudo chmod 000 /Applications/iTunes.app | |
| sudo chflags uchg /Applications/iTunes.app |
| #!/usr/bin/env bash | |
| # Use on .env files, structured as KEY=VALUE. Will load into bash env | |
| # Must be called with $ . load.sh | |
| ENV_FILE=${1:-'./.env'} | |
| cat $ENV_FILE | awk -F"=" '{print "Loading " $1}' | |
| declare -a $(cat $ENV_FILE | awk -F"=" '{print $1"="$2}') |
| find . -maxdepth 1 -type d -exec bash -c "(source ~/.bash_profile && cd {} && echo {} && bundle install)" \; |
I beefed an interview with AirBNB last week when my interviewee asked me to solve the NP-Complete problem described in this XKCD comic.
I got in my head almost immediately and got lost trying to design a recursive solution - instead attempting to iterate over the possibilities and then sub-iterate over a smaller set while keeping track of price.
Clear of the interview by a few days (and with a rejection letter in the inbox 😎) I wanted to try the problem again - starting from the very basic question: what are all the possible combinations of a N lengthed array of i length?
In the simplest form - how many 3-letter combinations can be produced from ['a', 'b', 'c']?
def possibilities(options, steps, prefix=nil)| require 'csv' | |
| raw = CSV.read('/tmp/pipeline_stat_table.csv') | |
| labels = raw.shift | |
| labels.delete('sample_id') | |
| labels.delete('index') | |
| data = raw.map{ |row| better = {}; labels.each_with_index{|k,i| v = row[i+2]; better[k] = v.index('.').nil? ? v.to_i : v.to_f }; [row.second, better] } | |
| data.each{ |row| sample = Sample.find_by(name: row[0]); result = sample ? sample.results.first : nil; result ? (result.pipeline_metrics.update(row.second); result.save) : '' } |