DEV Open Owl Tour w/gist.github.com as referrer
This file contains hidden or 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
| <?php | |
| require 'conf/webapp.conf'; | |
| $sessionTableName = ''; | |
| $sessionLifetime = ini_get('session.gc_maxlifetime'); | |
| $sdir = '/opt/www/domains/tourbuzz/runtime/sessions'; // hard-code so it still works after switching live to dynamo | |
| $awsKey = ''; | |
| $awsSecretKey = ''; |
This file contains hidden or 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
| // Example of a promise that could be used to wrap bracketed capture | |
| import Foundation | |
| import BrightFutures | |
| func grabBrackets (n:Int) -> Future<[AnyObject]> { | |
| let promise = Promise<[AnyObject]>() | |
| var data = [AnyObject]() |
This file contains hidden or 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
| virtualtour=> \d+ tour_event | |
| Table "public.tour_event" | |
| Column | Type | Modifiers | Storage | Stats target | Description | |
| --------------------+-----------------------------+-----------------------------------------------------------------------------------+----------+--------------+------------- | |
| tour_event_id | integer | not null default nextval(('public.tour_event_tour_event_id_seq'::text)::regclass) | plain | | | |
| tour_event_type_id | integer | not null | plain | | | |
| tour_id | integer | not null | plain | | | |
| visitor_id | text | |
This file contains hidden or 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
| #!/bin/zsh | |
| # configure curl output format | |
| echo '%{url_effective},%{time_namelookup},%{time_connect},%{time_appconnect},%{time_pretransfer},%{time_redirect},%{time_starttransfer},%{time_total}' > curltime.format | |
| # configure postgres | |
| echo "create table wifi_data (ssid text,url_effective text,time_namelookup numeric(9,5),time_connect numeric(9,5),time_appconnect numeric(9,5),time_pretransfer numeric(9,5),time_redirect numeric(9,5),time_starttransfer numeric(9,5),time_total numeric(9,5));" | |
| echo "" | |
| echo "\\\\copy wifi_data from './wifi-data.csv' DELIMITER ',' CSV HEADER" | |
| echo "select ssid, count(*), avg(time_total), stddev(time_total), min(time_total), max(time_total) from wifi_data group by ssid having count(*) > 5;" |
This file contains hidden or 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
| chdir /opt/www/domains/tourbuzz/current | |
| screen -t db 0 rake db | |
| screen -t code 1 | |
| chdir /opt/www/domains/tourbuzz/shared/log | |
| screen -t log 2 |
This file contains hidden or 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
| ## DEMO of appropriate way to bin variables with a factor | |
| ## this is particularly useful if one wants to bin things of asymmetric widths | |
| ## alternative would be non-linear axis | |
| library(ggplot2) | |
| library(grid) | |
| library(gridExtra) | |
| library(data.table) | |
| r <- data.table(x = rgeom(1000, .01)) |
This file contains hidden or 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
| is_established_customerF <- function(customer_segment, credits_purchased) { | |
| print(typeof(customer_segment)) # prints only once? | |
| established_customer_threshold <- 100000000 # infinitely large | |
| customer_segment <- as.character(customer_segment) | |
| if (customer_segment == "multiple_photographer_company") { | |
| established_customer_threshold <- 3000 | |
| } else if (customer_segment == "in_house_photography_department") { | |
| established_customer_threshold <- 1000 | |
| } else if (customer_segment == "full_time_single_re_photographer") { |
This file contains hidden or 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
| # Markdown Quicklook plugin | |
| port install qlmarkdown | |
| # multiple clipboard | |
| http://jumpcut.sourceforge.net | |
| # don't go to sleep, sometimes | |
| http://lightheadsw.com/caffeine/ |
This file contains hidden or 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
| const headerRowI = 1; // the row with the header cols | |
| const UUID_COLUMN_NAME = 'UUID' | |
| const LAST_UPDATED_COLUMN_NAME = 'LAST UPDATED' | |
| // ENTRY POINTS | |
| // SHEET HOOK ENTRY POINTS | |
| function onEdit(e) { | |
| // Spreadsheet is the 'file', Sheet is the actual sheet, similar but incompatible APIs on different objects, quite the gotcha | |
| var sheet = e.source.getActiveSheet(); |