Skip to content

Instantly share code, notes, and snippets.

View gist:34365
class Object
def metaclass
(class << self; self; end)
end
end
class Foo
puts "1. #{self} #{self.__id__}"
def meth1
View gist:54120
/**
* Implementation of hook_menu().
*/
function whatever_menu() {
$items = array();
$items['whatever/somepage'] = array(
'title' => 'Whatever',
'page callback' => 'drupal_get_form',
View gist:54122
get '/whatever/somepage' do
'Hello World'
end
View gist:74444
if (!isObject(FollowMouseExBehavior))
{
%template = new BehaviorTemplate(FollowMouseExBehavior);
%template.friendlyName = "Follow Mouse Ex";
%template.behaviorType = "Input";
%template.description = "Set the object to follow the position of the mouse. This version can be " @
"restricted by world limits and will obey collisions.";
%template.addBehaviorField(flipX, "Flip X axis", bool, true);
View gist:77783
%%{
machine ruby;
alpha_u = alpha | '_';
alnum_u = alnum | '_';
boundary = ^(alnum_u | '.');
newline = '\r'? '\n';
consume_line = any* :>> newline;
id = alpha_u (alnum_u)*;
View gist:77788
#line 1 "ext/ruby.rl"
#include <stdio.h>
#include <string.h>
#include "ruby.h"
#include "lightr.h"
// TODO: EOF for consume_line
// TODO: #{ interpolation
// TODO: heredocs ( mirroring of identifier as well)
View constrain.php
<?php
/**
* Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
define('GD_CONSTRAIN_DIMENSIONS_VERSION', '0.0.1');
class GD_Constrain_Dimensions {
View gist:78787
# Torque Script
if (!isObject(FollowMouseExBehavior))
{
%template = new BehaviorTemplate(FollowMouseExBehavior);
%template.friendlyName = "Follow Mouse Ex";
%template.behaviorType = "AI";
%template.description = "Set the object to follow the position of the mouse. This version can be " @
"restricted by world limits and will obey collisions.";
View gist:80770
/**
* Create a range string which can be evaluated to a native array.
*
* @param {int} start
* @param {int} end
* @return {string}
* @api public
*/
function range(start, end) {
View gist:81317
# Torque Alternative Syntax
unless is_object(FollowMouseBehavior)
:template = new BehaviorTemplate(FollowMouseBehavior)
:template
.friendly_name = "..."
.behavior_type = "..."
.description = "..."
You can’t perform that action at this time.