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
class A
private
def one
end
private
def two
class A
private
private
private
private
private
private
private
private
@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
# 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)
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
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|
private static String MAIN = "/crafty.clj";
private Object crafty = null; // hold onto reference for loaded clojure file
@Override
public void onLoad() {
// executeScript will return an instance of clojure.lang.Var
crafty = executeScript(getClass().getResourceAsStream( MAIN ), MAIN);
try {
// is there a way I can invoke "onLoad" using the `crafty` reference I've created?
RT.var("crafty.core", "onLoad").invoke();
@Override
public void onLoad() {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
try {
crafty = executeScript(getClass().getResourceAsStream( "/crafty/core.clj" ), "/crafty/core.clj");
} catch (Exception e) {
System.out.println(e.getMessage());
}
protected Object executeScript(InputStream ins, String path) {
# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
#include "shared.h"
void insert_item(int item, int semid, int *shared_buffer) {
int index = get_buffer_size(shared_buffer);
shared_buffer[index] = item;
}
int produce_item() {
return 0xFF; // nothing dynamic just write a static integer a slot
}