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
| require 'faye' | |
| require File.expand_path('../config/initializers/faye_token.rb', __FILE__) | |
| require 'logger' | |
| class ServerAuth | |
| def incoming(message, callback) | |
| if message['channel'] !~ %r{^/meta/} | |
| if message['ext']['auth_token'] != FAYE_TOKEN | |
| message['error'] = 'Invalid authentication token' | |
| end |
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
| after "deploy:symlink", "deploy:restart_workers" | |
| after "deploy:restart_workers", "deploy:restart_scheduler" | |
| ## | |
| # Rake helper task. | |
| # http://pastie.org/255489 | |
| # http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/ | |
| # http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/ | |
| def run_remote_rake(rake_cmd) | |
| rake_args = ENV['RAKE_ARGS'].to_s.split(',') |
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
| if [ "$(id -u)" -eq "0" ]; then | |
| echo "This script should not be run as root" | |
| exit 1 | |
| fi | |
| sudo apt-get update | |
| sudo apt-get install gcc -y | |
| sudo apt-get install language-pack-zh-hant -y | |
| sudo apt-get install language-pack-zh-hans -y |
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
| def profile_tool(msg, &block) | |
| start_time = Time.now | |
| res = block.call | |
| end_time = Time.now | |
| elapsed = (end_time - start_time).to_f * 1000 | |
| Rails.logger.debug "profile #{msg}, #{elapsed}" | |
| res | |
| end |
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
| def get_asset_with_type(type) | |
| unless @_assets | |
| @_assets = self.assets.each_with_object({}) do |asset, result| | |
| result[asset.file_type] = asset | |
| end | |
| end | |
| @_assets[type] | |
| end |
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
| <VirtualHost 192.168.10.1:82 220.222.222.222:82> | |
| ServerName csco-show.pro-preview.com | |
| DocumentRoot /srv/backend/current/public | |
| Header set Access-Control-Allow-Origin "*" | |
| <Directory /srv/backend/current/public> | |
| Options FollowSymLinks | |
| AllowOverride None |
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
| <ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"> | |
| <OperationRequest> | |
| <HTTPHeaders> | |
| <Header Name="UserAgent" Value="Jeff/0.6.0 (Language=Ruby; leslie.local)"/> | |
| </HTTPHeaders> | |
| <RequestId>998a4ff1-2fd4-4462-8ee5-ece3a81089d1</RequestId> | |
| <Arguments> | |
| <Argument Name="Operation" Value="ItemSearch"/> | |
| <Argument Name="Service" Value="AWSECommerceService"/> | |
| <Argument Name="Signature" Value="jamK2vX4ip8A9N3omj3wKUcOHAb3QdTY4l1V8mVjeSA="/> |
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
| para_options = params.slice(:search_index, :operation, :keywords) | |
| # options = para_options.inject({}){|h, (k,v)| h[k.camelize] = v; h } | |
| options = para_options.each_with_object({}){|(k,v), h| h[k.camelize] = v } |
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
| var _u = require('underscore') | |
| var request = require('request') | |
| var $ = require('jquery') | |
| var fs = require('fs'); | |
| var async = require('async'); | |
| var _url = require('url'); | |
| var http = require('http') | |
| var exec = require('child_process').exec; | |
| var spawn = require('child_process').spawn; |
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
| #!/usr/sbin/dtrace -Zs | |
| #pragma D option quiet | |
| #pragma D option switchrate=10 | |
| self int depth; | |
| ruby*:::method-entry | |
| /pid == $target/ | |
| { |