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.glob("**/*.java").map{|it| it.split('/').last[0..-6]}.map{|it| [it, it.length]}.sort{|a, b| b[1] <=> a[1]}[0..5] | |
| # A bit short version: | |
| Dir['**/*'].grep(/(\w*)\.java/){$1}.sort_by(&:length).reverse.first(5).map{|it| [it,it.length]} |
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
| myport = 80 | |
| hostname = 'xxx.xxx.xxx.xxx' | |
| port = 80 | |
| server = TCPServer.open(myport) | |
| while true | |
| Thread.start(server.accept) do |client| | |
| s = TCPSocket.open(hostname, port) | |
| req_content_length = 0 |
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
| find . -type f |grep "\.txt$" | xargs cat | wc -l | |
| ruby -e 'p Dir.glob("./**/*.txt").reduce(0){|sum,f| sum += File.readlines(f).size}' | |
| 543 |
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
| <table width="100%"> | |
| <tr> | |
| <td valign="top"> | |
| <h1><%=t(:text_groups)%></h1> | |
| <br/> | |
| <table class="data" id="groups"> | |
| <thead> | |
| <tr> | |
| <th class="left"><%=t(:text_group_name)%></th> | |
| <th class="left"><%=t(:text_description)%></th> |
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
| class I18nExtractor | |
| SKIP_INLINE_TAG = [/<%(.*?)%>/,/<(.*?)>/,/<%(.*)$/,/^(.*)%>/] | |
| SEPERATOR = '_@@@_' | |
| SKIP_TAGS = [[/<script/i,/<\/script>/i],[/<%/,/%>/],[/<style/i,/\/style>/i]] | |
| def initialize(filename) | |
| p '-----------------------------------------' | |
| p filename | |
| p '-----------------------------------------' | |
| @filename = filename |
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/bin/ruby | |
| unless ARGV[0] | |
| puts 'Usage: np "the post title"' | |
| exit(-1) | |
| end | |
| title = ARGV.join ' ' | |
| date_prefix = Time.now.strftime("%Y-%m-%d") | |
| postname = title.strip.downcase.gsub(/ /, '-') |
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
| <% ... %> | |
| <table border="1" cellspacing="5" cellpadding="5"> | |
| <tr><th>Info</th><th>Value</th></tr> | |
| <tr><td>Client</td><td><%= customerName %></td></tr> | |
| <tr><td>Project Name</td><td><%= name %></td></tr> | |
| <tr><td>Description</td><td><%= desc %></td></tr> | |
| </table> | |
| <% ... %> | |
| <h1>Employees</h1> | |
| <table border="1" cellspacing="5" cellpadding="5"> |
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/imap' | |
| require 'tmail_mail_extension' | |
| class MailFetcher | |
| cattr_accessor :email_download_path | |
| self.email_download_path = File.join(RAILS_ROOT, 'public','emails_download') | |
| def initialize(setting) | |
| @setting = setting | |
| end |