Skip to content

Instantly share code, notes, and snippets.

Avatar

Charles Lowell cowboyd

View GitHub Profile
View gist:302029
# Hack to avoid "allocator undefined for Proc" issue when unpacking Gems:
# gemspec provided by Jeweler uses Rake::FileList for files, test_files and
# extra_rdoc_files, and procs cannot be marshalled.
# Jeweler Issue GH-73
# Workaround by Alex Coles (myabc)
def gemspec
@clean_gemspec ||= eval("#{Rake.application.jeweler.gemspec.to_ruby}") # $SAFE = 3\n
end
@cowboyd
cowboyd / gccv.rb
Created Feb 16, 2010
Find GCC Major Version
View gccv.rb
#Builds scripts often use the GCC major and minor version
#to make tweaks and adjustments to compilation parameters
#by setting GCC_VERSION=41 for example. However, gcc doesn't
#provide an out of the box way to get at this value.
#this works until we get to GCC version 10 ;)
if /(\d)\.(\d)\.(\d)/ =~ `gcc --version`
puts "#{$1}#{$2}" #=> 44
else
puts "unabled to find gcc version in #{`gcc --version`}"
View v8_in_context.cc
#include "v8.h"
#include "stdio.h"
int main (int argc, char const *argv[])
{
printf("In Context? %d\n", v8::Context::Context());
return 0;
}
View env.js
/*
* Envjs core-env.1.2.0.0
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
var Envjs = function(){
var i,
name
View gist:414353
legolas:purely_functional_data_structures cowboyd$ rake cucumber
(in /Users/cowboyd/Projects/purely_functional_data_structures)
/opt/local/bin/ruby -I "/Users/cowboyd/Projects/cucumber/lib:lib" "/Users/cowboyd/Projects/cucumber/bin/cucumber"
Using the default profile...
Feature: Adding Lists
Scenario: adding to an empty list yields second list # features/adding_lists.feature:3
Given an empty list "list1" #
And an empty list "list2" #
When I cons "2" to "list2" #
View jasmine_mate.rb
require 'v8/jasmine'
require 'time'
require 'erb'
module JasmineMate
def self.start
start = Time.now
begin
cxt = V8::Jasmine::Context.new
env = cxt['jasmine'].getEnv()
env.addReporter(Reporter.new)
View env.rb
require 'v8'
cxt = V8::Context.new
cxt.load('env.js')
cxt['document'].tap do |document|
puts document
document.createElement('div').tap do |div|
puts div
div.setAttribute("id", "foo")
View env.js
/*
* Envjs core-env.1.2.13
* Pure JavaScript Browser Environment
* By John Resig <http://ejohn.org/> and the Envjs Team
* Copyright 2008-2010 John Resig, under the MIT License
*/
var Envjs = function(){
var i,
name,
View ruby-1.8.7-p174
#!/usr/bin/env sh
if [ -s "/Users/cowboyd/.rvm/environments/ruby-1.8.7-p174" ] ; then
. "/Users/cowboyd/.rvm/environments/ruby-1.8.7-p174"
exec ruby "$@"
else printf "ERROR: Missing RVM environment file:
'/Users/cowboyd/.rvm/environments/ruby-1.8.7-p174'
" ; exit 1fi
View weakref.mri.rb
ruby-1.8.7-p174 > WeakRef
NameError: uninitialized constant WeakRef
from (irb):1
ruby-1.8.7-p174 > require 'weakref'
=> true
ruby-1.8.7-p174 > WeakRef
=> WeakRef
ruby-1.8.7-p174 >