Skip to content

Instantly share code, notes, and snippets.

View mutle's full-sized avatar

Mutwin Kraus mutle

View GitHub Profile
HotCocoa::Mappings.map :gl_view => :NSOpenGLView do
defaults :frame => DefaultEmptyRect,
:layout => {}
constant :auto_resize, {
:none => NSViewNotSizable,
:width => NSViewWidthSizable,
:height => NSViewHeightSizable,
def has_gem?(name, version=nil)
if !$GEM_LIST
gems = {}
`gem list --local`.each_line do |line|
gems[$1.to_sym] = $2.split(/, /) if line =~ /^(.*) \(([^\)]*)\)$/
end
$GEM_LIST = gems
end
if $GEM_LIST[name.to_sym]
return version ? $GEM_LIST[name.to_sym].include?(version) : true
require 'rubygems'
require 'json'
require 'sinatra'
File.open('whois_proxy.pid', 'w') { |f| f.write(Process.pid) }
get '/whois/:tld/:domain' do
domain = (params['domain'] || '').gsub(/[^a-zA-Z0-9\-\_]/, '')
tld = (params['tld'] || '').gsub(/[^a-zA-Z0-9\-\_]/, '')
available = false
#!/bin/ruby
filename = $*[0]
lines = {}
puts "Comparing #{filename}"
File.open(filename, "r") do |f|
while (line=f.gets) do
line = line.downcase.gsub(/\n/, '')
lines[line] ||= 0
lines[line] += 1