- Install homebrew if you don't have it already: http://mxcl.github.com/homebrew/
- Run
brew install vpnc --hybrid - Check if you already have virtual tunnel interfaces, run
ls /dev/tun*. If there are none, install "Tun Tap OSX" (see below) - Go to https://www.rz.uni-konstanz.de/angebote/e-mail/usermanager/ and login, then download both the certificate (you need the .pem file) and vpn profile
- Run
openssl x509 -in <certificateFile>.pem -noout -hash - Rename
<certificateFile>.pemto the output of (5) with.pemas extension - Move the
.pemcertificate to a permanent location, e.g./etc/ssl/certs/ - Open
/usr/local/etc/vpnc/default.confin your favorite text editor, delete the contents - Run
pcf2vpnc /.pcfand paste the output to your open text editor
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
| $('form').on('change', '.image_preview input[type="file"]', function(e) { | |
| var files = e.target.files, | |
| f = files[0], | |
| reader = new FileReader(), | |
| t = this | |
| ; | |
| reader.onload = (function(file) { |
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 "errors" | |
| class FacebookService | |
| class << self | |
| def register(data_hash) | |
| data = AuthData.new(data_hash) | |
| auth = User::Facebook.find_by_uid(data.uid) | |
| if auth | |
| raise UserBlockedError if auth.user.blocked? |
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
| function resolveURL(baseURL, relativeURL) { | |
| var html = document.implementation.createHTMLDocument(""); | |
| var base = html.createElement("base"); | |
| base.setAttribute("href", baseURL); | |
| var a = html.createElement("a"); | |
| a.setAttribute("href", relativeURL); | |
| html.head.appendChild(base); | |
| html.body.appendChild(a); | |
| return a.href; | |
| } |
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
| module AccessHelper | |
| include AuthHelper | |
| def check_access(values = {}) | |
| acl.check! self.class.to_s, self.action_name, current_roles, values | |
| end | |
| def current_roles | |
| @current_roles ||= current_user.roles_hash.keys | |
| 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
| YaAcl::Builder.build do | |
| roles do | |
| role :admin, :name => 'Администратор' | |
| role :remote_operator, :name => 'Удаленный Оператор' | |
| role :editor, :name => 'Редактор' | |
| role :taxonom, :name => 'Таксоном' | |
| role :operator, :name => 'Оператор' | |
| role :solo_operator, :name => 'Соло Оператор' | |
| role :transcripter, :name => 'Транскриптер' | |
| role :transcripts_editor, :name => 'Редактор транскриптов' |
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 "money" | |
| class Decorator < BasicObject | |
| undef_method :== | |
| def initialize(component) | |
| @component = component | |
| end | |
| def method_missing(name, *args, &block) |
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
| # Index | |
| --------------------------------------------------------------------- | |
| curl -XPUT http://localhost:9200/pictures/ -d ' | |
| { | |
| "settings": { | |
| "analysis": { | |
| "analyzer": { | |
| "index_analyzer": { | |
| "tokenizer": "standard", |
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
| # Simple JOIN | |
| User.joins(:account) # User -> Account | |
| # Will produce | |
| # SELECT `users`.* FROM `users` INNER JOIN `accounts` ON `accounts`.`user_id` = `users`.`id` | |
| # Complicated JOIN | |
| Trait.joins(:user => :account) # Trait -> User -> Account | |
| # Will produce | |
| # SELECT `traits`.* FROM `traits` INNER JOIN `users` ON `users`.`id` = `traits`.`user_id` INNER JOIN `accounts` ON `accounts`.`user_id` = `users`.`id` |