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 'endpoint_base' | |
require 'multi_json' | |
class HelloEndpoint < EndpointBase | |
post '/' do | |
process_result 200, { 'message_id' => @message[:message_id] } | |
end | |
post '/product_existence_check' do | |
passed_in_name = @message[:payload]['product']['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
module DummyShip | |
def self.validate_address(address) | |
## Zipcode must be within a given range. | |
unless (20170..20179).to_a.include?(address['zipcode'].to_i) | |
raise "There was a problem with this address." | |
end | |
end | |
end |
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
18670 futex(0x8510848, FUTEX_WAIT_PRIVATE, 56984, NULL <unfinished ...> | |
18687 clock_gettime(CLOCK_REALTIME, {1371052434, 447034689}) = 0 | |
18687 munmap(0xb13bf000, 3411968) = 0 | |
18687 write(56, "\25\3\1\0\30\355\336\10\343\222~\374\265\0[\365\351\240\352\351\203zHhO\342\251\37\372", 29) = -1 EBADF (Bad file descriptor) | |
18687 write(27, "\25\3\1\0\30\323\270n;\307\226\227\313Wr\2539\214\fT\375*\352\217\377\275\306{\277", 29) = 29 | |
18687 read(27, <unfinished ...> | |
18682 <... ppoll resumed> ) = 1 ([{fd=83, revents=POLLIN}]) | |
18682 futex(0x8510848, FUTEX_WAIT_PRIVATE, 56985, NULL <unfinished ...> | |
26949 <... select resumed> ) = 0 (Timeout) | |
26949 select(4, [3], NULL, NULL, {0, 100000}) = 0 (Timeout) |
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 | |
~ ruby test.rb | |
n = 10000 | |
user system total real | |
0.010000 0.000000 0.010000 ( 0.002855) | |
0.000000 0.000000 0.000000 ( 0.005343) | |
-- | |
n = 20000 | |
user system total real | |
0.010000 0.000000 0.010000 ( 0.005923) |
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/env bash | |
if [[ "${rvm_ruby_string}" =~ "jruby" ]] | |
then | |
export JAVACMD=`which drip` | |
export DRIP_INIT_CLASS=org.jruby.main.DripMain | |
# settings from: https://github.com/jruby/jruby/wiki/Improving-startup-time | |
export JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify" | |
fi% |
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
file = "#{File.expand_path File.dirname(__FILE__)}/dripmain_is_running.tmp" | |
File.open(file, "w") { |f| f.write("Yay") } | |
require_relative 'config/application' |
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
# /etc/nginx/sites-available/app | |
upstream app_server { | |
server unix:/tmp/.unicorn_app.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name app.com; |
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
<ul id="user-list" data-token="eyJ0..."> | |
<li> | |
Pablo Cantero - <a href="#" rel="phone-number">+551199...</a> | |
</li> | |
</ul> |
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/notify-site-is-down.rb | |
require "rubygems" | |
require "twilio-ruby" | |
account_sid = ENV["TWILIO_ACCOUNT_SID"] | |
auth_token = ENV["TWILIO_AUTH_TOKEN"] | |
@client = Twilio::REST::Client.new account_sid, auth_token |
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
### Environment variables ### | |
export PATH="/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:~:$PATH:." | |
export CDPATH=".:~:~/projects/personal:~/projects/sandbox" | |
export LANG="en_US.UTF-8" | |
export NODE_PATH="/usr/local/lib/node:/usr/local/lib/node_modules" | |
export CLICOLOR=1 | |
export TERM=xterm-256color |