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/env ruby | |
| # | |
| # Testing multipart uploads into s3 with threads | |
| # Tested with Ruby 1.8 and 1.9 | |
| # This is proof of concept code, it works, but is not suitable for production, and may even have nasty bugs in the | |
| # threading section | |
| # Refs: | 
  
    
      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
    
  
  
    
  | def calc_range list | |
| last = nil | |
| flip = false | |
| list.chunk do |e| | |
| flip ^= (!last || (e > last + 1)) | |
| last = e | |
| flip | |
| end.map &:last | |
| end | |
| calc_range [1,2,3,5,6,9,10] | 
  
    
      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/env bash | |
| uninstall() { | |
| list=`gem list --no-versions` | |
| for gem in $list; do | |
| gem uninstall $gem -aIx | |
| done | |
| gem list | |
| gem install bundler | |
| } | 
  
    
      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
    
  
  
    
  | def mask email | |
| email.gsub(/(?<=.)([^@]+)(?=@)/) do |x| | |
| star_size = x.size == 1 ? x.size : $1.size / 2 | |
| '*' * star_size + $1.slice(star_size, $1.size) | |
| end | |
| 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
    
  
  
    
  | for (var i = 0; i < 1024 * 1024; i++) { | |
| process.nextTick(function () { Math.sqrt(i) } ) | |
| } | 
NewerOlder