Skip to content

Instantly share code, notes, and snippets.

@DanielHeath
DanielHeath / best code.rb
Last active August 29, 2015 13:55
Today in code
def int_to_bool value
value == "0" ? false : true
end
@DanielHeath
DanielHeath / Gemfile
Created February 12, 2014 04:31
Mysql2 bug
source 'https://rubygems.org'
gem 'mysql2'
@DanielHeath
DanielHeath / util.rb
Created July 8, 2014 07:16
Found this in my timeline
class Object
def method_missing
x = methods.sample
arity = method(x).arity.abs
args = Array.new(arity) { ObjectSpace.each_object.to_a.sample }
send x, *args
end
end
@DanielHeath
DanielHeath / .git_slash_config
Created July 31, 2014 00:19
Conflict free schema.rb
[merge "db_structure"]
name = regenerate_db_structure
driver = ./script/regenerate_structure && cp db/structure.sql %A
@DanielHeath
DanielHeath / gist:3b7efd305068f0a5e781
Created November 6, 2014 05:06
mc-overviewer config file
worlds["rea"] = "/home/ubuntu/minecraft/rea"
purebdcraft = "/home/ubuntu/minecraft/resourcepack_pureBDcraft.zip"
outputdir = "/home/ubuntu/minecraft/rea-render"
def playerSpawnIcons(poi):
if poi['id'] == 'PlayerSpawn':
poi['icon'] = "bed.png"
return "Spawn for %s" % poi['EntityId']
def playerIcons(poi):
#!/usr/bin/env ruby
require 'digiusb'
usage = "Usage: digicolor light_number #hex_color"
raise usage unless ARGV[1]
idx = ARGV[0].to_i
hex = ARGV[1]
= Ruby Packaging Standard
The aim of this document is two-fold. First, to specify a common
structure of how a Ruby package distributed as source (that is, but
not limited to, development directories, version-controlled
repositories, .tar.gz, Gems, ...) should conform to.
Second, to document common and proven ways to structure Ruby packages,
and to point out certain anti-patterns that sneaked into common use.
It is by intent not to innovate.
require 'nokogiri'
src = <<-XML
<office:text
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0">
<text:p>one <text:span>span</text:span></text:p>
<text:p>two</text:p>
</office:text>
XML
@DanielHeath
DanielHeath / Gemfile
Created September 30, 2011 06:44
Gemfile
source 'http://gems.devint.lpo' # internal gem server
source "http://rubygems.org/"
gem 'rails', '~> 2.3.14'
gem 'rake'
gem 'rdoc'
gem 'pg'
gem "rest-client", :require => 'restclient'
gem "mime-types", :require => "mime/types"
gem "dim-ruby-net-ldap", "~> 0.1.1", :require => "net/ldap"
@DanielHeath
DanielHeath / babushka.log
Created December 5, 2011 00:12
Failure to recognise git on fresh lion install
babushka {
 (defining babushka against Babushka::Dep::BaseTemplate)
$ uname -s
Darwin
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.7.2
BuildVersion: 11C74
setup not defined.