https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=community&channel=Stable&version=VS18
https://c2rsetup.officeapps.live.com/c2r/downloadVS.aspx?sku=enterprise&channel=Stable&version=VS18
| class EncodingRepairer | |
| REPLACEMENTS = { | |
| "€" => "€", "‚" => "‚", "„" => "„", "…" => "…", "ˆ" => "ˆ", | |
| "‹" => "‹", "‘" => "‘", "’" => "’", "“" => "“", "â€" => "”", | |
| "•" => "•", "–" => "–", "—" => "—", "Ëœ" => "˜", "â„¢" => "™", | |
| "›" => "›", "Å“" => "œ", "Å’" => "Œ", "ž" => "ž", "Ÿ" => "Ÿ", | |
| "Å¡" => "š", "Ž" => "Ž", "¡" => "¡", "¢" => "¢", "£" => "£", | |
| "¤" => "¤", "Â¥" => "¥", "¦" => "¦", "§" => "§", "¨" => "¨", | |
| "©" => "©", "ª" => "ª", "«" => "«", "¬" => "¬", "®" => "®", |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| require 'anima' | |
| require 'transproc' | |
| require 'contracts' | |
| require 'virtus' | |
| require 'benchmark/ips' | |
| USERS = 1000.times.map { |i| { id: "#{i+1}", name: "User #{i+1}", age: "#{(i+1)*2}" } } |
| class Filter | |
| include FormObject | |
| # Proc because Date.yesterday changes every day :) | |
| attribute :from, Date, default: Proc.new { Date.yesterday } | |
| attribute :to, Date, default: Proc.new { 1.month.from_now - 1.day } | |
| end | |
| # in controller | |
| @filter = Filter.new(params[:filter]) |
| module Library | |
| def self.leaf_paths_of(paths) | |
| paths.select{|path| | |
| !paths.any?{|other| | |
| other.start_with?(path + '/') | |
| } | |
| end | |
| end |
| #!/usr/bin/env ruby | |
| command = '/usr/bin/passenger-memory-stats' | |
| memory_limit = 200 # megabytes | |
| def running?(pid) | |
| begin | |
| return Process.getpgid(pid) != -1 | |
| rescue Errno::ESRCH | |
| return false |