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
#!/usr/bin/ruby | |
# README | |
# gem install aws-sdk | |
# add this to bashrc | |
# export HT_DEV_AWS_ACCESS_KEY_ID=???? | |
# export HT_DEV_AWS_SECRET_ACCESS_KEY=???? | |
# put your pem file in ~/.ssh and chmod 0400 | |
# for more info see; https://rubygems.org/gems/aws-sdk |
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
require 'rubygems' | |
require 'ruby-prof' | |
def slideview_image_url(photo) | |
if CDN_OPTIONS && CDN_OPTIONS[:s3_host_alias] | |
hosts = Array.wrap(CDN_OPTIONS[:s3_host_alias]) | |
host = hosts[photo.id % hosts.size] | |
"http://#{host}/photos/images/#{photo.id}/search2.jpg" | |
else | |
"/system/images/#{photo.id}/search2/#{photo.image_file_name}" |
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
# place this in lib/fakeout.rb | |
require 'ffaker' | |
module Fakeout | |
class Builder | |
FAKEABLE = %w(User Product) | |
attr_accessor :report |
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
" get visually selected words/lines | |
function! GetVisualSelection() | |
let [lnum1, col1] = getpos("'<")[1:2] | |
let [lnum2, col2] = getpos("'>")[1:2] | |
let lines = getline(lnum1, lnum2) | |
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)] | |
let lines[0] = lines[0][col1 - 1:] | |
return join(lines, ' ') | |
endfunction |
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
# Returns a score for last 10 bookings' acceptance rate | |
# If 1 booking rejected over past 10 bookings, return 0.5 | |
# If 2 bookings rejected, return 0.0 | |
def booking_acceptance_score | |
total_bookings_to_be_considered = 10 | |
booking_ids = [] | |
offset = 0 | |
while booking_ids.length < total_bookings_to_be_considered do | |
# Fetch histories one by one |
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
# WARNING: fragment cache is no longer cleared on deploy to clear completely | |
# use a version key or bump FRAGMENT_CACHE_VERSION above | |
def fragment_cache(name, options = {}, &block) | |
old_within_fragment = @within_fragment | |
@within_fragment = true | |
# trace execution for NewRelic | |
CachingHelper.trace_execution_scoped(["Custom/Fragment cache overhead: #{name}"]) do | |
if_conditions = Array.wrap(options[:if]) | |
unless_conditions = Array.wrap(options[:unless]) |
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
[mysqld] | |
thread_concurrency = 16 | |
#log-bin=mysql-bin | |
#binlog_format=mixed | |
innodb_data_file_path = ibdata1:100M:autoextend | |
innodb_buffer_pool_size = 1024M | |
innodb_additional_mem_pool_size = 20M | |
innodb_log_file_size = 256M | |
innodb_log_buffer_size = 32M | |
innodb_flush_log_at_trx_commit = 2 |
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
-----BEGIN CERTIFICATE----- | |
MIIDdDCCAlygAwIBAgIBATANBgkqhkiG9w0BAQUFADBAMQ0wCwYDVQQDDARtYXR0 | |
MRowGAYKCZImiZPyLGQBGRYKaGlkZGVubG9vcDETMBEGCgmSJomT8ixkARkWA2Nv | |
bTAeFw0xMzA2MDMxMDA0NDNaFw0xNDA2MDMxMDA0NDNaMEAxDTALBgNVBAMMBG1h | |
dHQxGjAYBgoJkiaJk/IsZAEZFgpoaWRkZW5sb29wMRMwEQYKCZImiZPyLGQBGRYD | |
Y29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApUgO+NlewgetOcmX | |
8kk5IiISAmGGYqoFrDnzO7/NGjlWcSit91hZszadsQ00OM9h30WMDqSGPlwt2qVL | |
CQShDjOTx4PQcN9O8PchlhLow/wNVfB5b5sYQX3aDIiIoSLViQt+zquPhTHExN4X | |
HJJFxwUVIQot0JHV7mh9jApu+RJIpiVPM0is18NnOC2BIXjrGYxqHr7cG4BafvLz | |
tNTmPtpnp+bxKtp/bGP0wRtPSU9jX/a3V1p1DyI48O5wDLzctXJq/I088sTmB0Ao |
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
# /usr/local/etc/nginx/nginx.conf | |
worker_processes 4; | |
events { | |
worker_connections 1024; | |
} | |
http { |
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
server { | |
listen 443 ssl; | |
server_name housetrip.dev; | |
root /u/apps/housetrip/public; | |
index index.html index.htm; | |
### SSL log files ### | |
access_log logs/housetrip.dev-ssl-access.log; | |
error_log logs/housetrip.dev-ssl-error.log; |