Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created March 27, 2012 11:47
Show Gist options
  • Select an option

  • Save brainopia/2215241 to your computer and use it in GitHub Desktop.

Select an option

Save brainopia/2215241 to your computer and use it in GitHub Desktop.

Revisions

  1. Ravil Bayramgalin revised this gist Oct 11, 2012. No changes.
  2. Ravil Bayramgalin revised this gist Mar 27, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    bom = "\xEF\xBB\xBF".force_encoding('binary')
    Path.glob('**/*.rb') do |file|
    next if file.binread(3) == bom
    next if file.binread(3) == bom
    previous = file.binread
    file.write bom + previous
    end
  3. Ravil Bayramgalin revised this gist Mar 27, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    bom = "\xEF\xBB\xBF".force_encoding('binary')
    Path.glob('**/*.rb') do |file|
     next if file.binread(3) == bom
     previous = file.binread
     file.write bom + previous
    next if file.binread(3) == bom
    previous = file.binread
    file.write bom + previous
    end
  4. Ravil Bayramgalin renamed this gist Mar 27, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. Ravil Bayramgalin created this gist Mar 27, 2012.
    9 changes: 9 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/usr/bin/env ruby
    require 'epath'

    bom = "\xEF\xBB\xBF".force_encoding('binary')
    Path.glob('**/*.rb') do |file|
     next if file.binread(3) == bom
     previous = file.binread
     file.write bom + previous
    end