Skip to content

Instantly share code, notes, and snippets.

View gentooboontoo's full-sized avatar

Julien Sanchez gentooboontoo

View GitHub Profile

Keybase proof

I hereby claim:

  • I am gentooboontoo on github.
  • I am gentooboontoo (https://keybase.io/gentooboontoo) on keybase.
  • I have a public key whose fingerprint is 86A7 DC69 068F D81E 6572 6985 1D07 7BB7 05F2 918B

To claim this, I am signing this object:

@gentooboontoo
gentooboontoo / insert-utf8-encoding.rb
Last active December 14, 2015 21:49
Insert missing utf-8 encoding magic comment to existing ruby files. USAGE: ruby insert-utf8-encoding.rb <dir>
#!/usr/bin/env ruby
# encoding: utf-8
Dir[File.join(ARGV[0], '**', '*.{rb,rake}')].each do |file|
lines = File.open(file).readlines
next if lines[0].match(/#\s+(?:en)?coding:\s+utf-8/i)
puts "Adding encoding magic comment to #{file}"
File.open(file, 'w') do |io|
@gentooboontoo
gentooboontoo / murmurhash2.rb
Created July 29, 2011 09:57
Ruby version of Murmurhash 2 digest
# Found at http://toblog.bryans.org/2010/12/14/pure-ruby-version-of-murmurhash-2-0
# Ruby 1.8/1.9 compatible
module Digest
def self.murmur_hash2( string, seed )
# seed _must_ be an integer, but I do try to enforce that.
# m and r are mixing constants generated offline.
# They are not really magic, they just happen to work well.
raise "seed isn't an integer, and I can't convert it either." unless
seed.is_a?( Integer ) or seed.respond_to?( 'to_i' )
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Env-js fail test</title>
<script src="jquery-1.4.4.min.js"></script>
<script src="main.js"></script>
</head>
<body>
<!--
--- jsbeautify.vim 2010-07-27 10:25:28.441826998 +0200
+++ jsbeautify.vim 2010-07-27 11:34:23.800437922 +0200
@@ -120,14 +120,14 @@
endwhile
endif
- "if s:parser_pos != len(s:input) && c =~ /^[0-9]+[Ee]$/ && (s:input[s:parser_pos] == "-" || s:input[s:parser_pos] == "+")
- "let sign = s:input[s:parser_pos]
- "let s:parser_pos += 1
-