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
| ActiveAdmin.register Category do | |
| index do | |
| reorderable_column(self) | |
| column :name | |
| end | |
| controller do | |
| private |
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 'spec_helper' | |
| describe 'update distribution list', ldap: true do | |
| it 'updates data in LDAP' do | |
| n = 4 | |
| # Do add 4 DL entries | |
| expect(TEST_LDAP_SERVER.store.count).to eql n |
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
| Dir['*/'].each do |dir| | |
| root = File.dirname __FILE__ | |
| cmd = "cd #{root}/#{dir} && git pull" | |
| puts cmd | |
| `#{cmd}` | |
| 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Capybara race condition with `text` matcher</title> | |
| <script type="text/javascript" src="/jquery.min.js"></script> | |
| <script type="text/javascript"> | |
| $(document).ready(function () { |
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
| # Two great articles allow to understand Ruby better | |
| # http://yugui.jp/articles/846 | |
| # http://yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/ | |
| class A; end | |
| A.instance_eval { define_method(:hoge) { "hoge" } } | |
| A.class_eval { define_method(:fuga) { "fuga" } } | |
| A.instance_eval { def piyo ; "piyo"; end } | |
| A.class_eval { def foo ; "foo"; 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
| # Got from: http://stackoverflow.com/questions/8028211/tree-to-array-algorithm-ruby | |
| def build_tree(i, edges) | |
| list = {} | |
| out_nodes = edges.select {|e| e[0] == i}.map {|e| e[1]}.uniq | |
| out_nodes.each {|n| list[n] = build_tree(n, edges)} | |
| list | |
| end | |
| edges = [[1,2],[1,6],[1,9],[2,3],[3,10],[4,7]] |
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
| # https://github.com/macks/ruby-ntlm | |
| require 'ntlm/http' | |
| require 'open-uri' | |
| require 'net/https' | |
| http = Net::HTTP.new(host, 443) | |
| http.use_ssl = true | |
| http.verify_mode = OpenSSL:SSL::VERIFY_NONE | |
| request = Net::HTTP::Get.new('/ews/Services.wsdl') |
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 'net/http' | |
| require 'net/http/faster' | |
| require 'uri' | |
| require 'cgi' # for escaping | |
| require 'http_configuration' | |
| ## | |
| # Persistent connections for Net::HTTP | |
| # | |
| # Net::HTTP::Persistent maintains persistent connections across all the |
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
| How to redeploy rails application in case of deployment went wrong. | |
| rm /var/chef/cache/revision-deploys/app | |
| rm file and the latest release directory. | |
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
| # encoding: utf-8 | |
| require 'erb' | |
| require 'psych' | |
| require 'yaml' | |
| puts YAML # => 'psych' | |
| Dir.glob('**/*.yml').map do |file| | |
| puts file | |
| Psych.load(IO.read file) unless file =~ /cucumber/ | |
| end |