- 解压缩文件, 修正GBK编码
env LANG=GBK 7za x -olande "kepulande-r2 1.31.zip"
find . -exec convmv -f GBK -t utf8 --notest -r {} \;
- 修改 import_image_libraries_for_kepulande.rake
- 修改要导入的xls文件名
- 修改解压缩的文件路径
# | |
# Please go to https://github.com/paulnsorensen/lifesaver | |
# | |
class Foo < ActiveRecord::Base | |
has_many :bars | |
belongs_to :baz | |
include IndexingHandler | |
indexed_associations :bars, :baz | |
end |
env LANG=GBK 7za x -olande "kepulande-r2 1.31.zip"
find . -exec convmv -f GBK -t utf8 --notest -r {} \;
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> |
#!/bin/sh | |
set -u | |
set -e | |
# Feel free to change any of the following variables for your app: | |
export PATH=/usr/local/bin:$PATH | |
export HOME=/home/deploy | |
APP_ROOT=/var/www/pragmaticly/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid |
module CookieStepHelper | |
class Cookies | |
def Cookies.for(session) | |
case session.driver | |
when Capybara::Driver::Selenium | |
SeleniumCookies.new(session.driver) | |
when Capybara::Driver::RackTest | |
RackTestCookies.new(session.driver) | |
when Capybara::Webkit::Driver |
# | |
# Slightly tighter CORS config for nginx | |
# | |
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs | |
# | |
# Despite the W3C guidance suggesting that a list of origins can be passed as part of | |
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox) | |
# don't seem to play nicely with this. | |
# |
Directory structure:
/data/gotunnel/
- gotunnel
- iptables
- redsocks/
-- config
-- redsocks
- start.sh
class ProtectedResource < ActiveResource::Base | |
# since the gateway uses oauth2 every call needs to be authenticated, | |
# so the token for is needed | |
class << self | |
attr_accessor :token_string | |
end | |
# setup the headers for oauth2 | |
def self.headers | |
{ 'authorization' => "Bearer #{token_string}"} |
#Behold, the nav_link:
The nav_link helper works just like the standard Rails link_to helper, but adds a 'selected' class to your link (or its wrapper) if certain criteria are met. By default, if the link's destination url is the same url as the url of the current page, a default class of 'selected' is added to the link.
For full usage details, see: http://viget.com/extend/rails-selected-nav-link-helper
Drop nav_link_helper.rb into app/helpers in your Rails 3.x app and enjoy.
# An example of elasticsearch & Tire setup for ActiveRecord associations. | |
# | |
# A `Book has_many :chapters` scenario, with mapping and JSON serialization | |
# for indexing associated models. | |
# | |
# Demonstrates three important caveats as of now: | |
# | |
# 1. You you have to use `touch: true` in the `belongs_to` declaration, | |
# to automatically notify the parent model about the update. | |
# |