Skip to content

Instantly share code, notes, and snippets.

View rramsden's full-sized avatar
♨️
Keep On Keeping On

Richard Ramsden rramsden

♨️
Keep On Keeping On
View GitHub Profile
def on_enable
# Tell everyone in players world that they have joined
event(:player_join) do |e|
e.player.world.players.each do |p|
p.send_message "Player #{e.player.name} has joined"
end
end
# Tell everyone in players world that they have quit
event(:player_quit) do |e|
I'm getting some weird behaviour running `autoconf -i` after cloning down mike
When I run autoconf -i on the project it throws multiple warnings.
However, if I run it again the warning messages disappear:
➜ mike git:(master) autoconf -i
configure.ac:12: error: possibly undefined macro: AC_PROG_LIBTOOL
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:13: error: possibly undefined macro: AM_PROG_CC_C_O
configure.ac:49: error: possibly undefined macro: AM_INIT_AUTOMAKE
# Find the named object in this tree's contents
#
# Examples
# Repo.new('/path/to/grit').tree/'lib'
# # => #<Grit::Tree "6cc23ee138be09ff8c28b07162720018b244e95e">
# Repo.new('/path/to/grit').tree/'README.txt'
# # => #<Grit::Blob "8b1e02c0fb554eed2ce2ef737a68bb369d7527df">
#
# Returns Grit::Blob or Grit::Tree or nil if not found
def /(file)
@rramsden
rramsden / Ctags + Ruby + RVM
Created June 7, 2011 23:35
Generates ctags for your RVM gemset and current directory
" You will need the latest version of Exuberant CTAGS @ http://ctags.sourceforge.net/
" F8 - Generate ctags for your current directory and current RVM gemset
let g:ctagdirs = "!/usr/local/bin/ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . ".$HOME."/.rvm/gems/".system("rvm current | tr -d '\n'")."/gems"
map <F8> :exe g:ctagdirs<CR>
" You can use Ctrl-] to jump to a function.... Ctrl-p will jump back
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <C-p> :pop<CR>
" You can cycle through multiple function definitions using
class A
private
private
private
private
private
private
private
private
class A
private
def one
end
private
def two
Domingo = {} || Domingo
->
class Camera
constructor: (args...) ->
console.log args
Domingo.Camera = Camera
class A
def initialize
@stub = lambda {|&block| [1,2,3,4].each{|n| block.call(n)}}
end
def each(&block)
@stub.call(&block)
end
end
# we have to fake an enumerable object :) oh what fun!
block = proc {
[@zipfile].each do |file|
yield
end
}
@zip.stub!(:each).and_return(&block)
Website.reflect_on_all_associations( :has_many ).each do | assoc |
instance_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
if #{assoc.name}.first.respond_to?(:to_backup)
xml.#{assoc.name} do
#{assoc.name}.each {|collection| xml << collection.to_backup}
end unless #{assoc.name}.blank?
end
RUBY_EVAL
end