Skip to content

Instantly share code, notes, and snippets.

View Watson1978's full-sized avatar

Watson Watson1978

View GitHub Profile
@Watson1978
Watson1978 / README-badges.md
Created September 18, 2020 17:46 — forked from tterb/README-badges.md
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

cc `llvm-config --cflags` -c sum.c
c++ `llvm-config --cxxflags --ldflags --libs core mcjit native --system-libs` sum.o -o sum

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@Watson1978
Watson1978 / gist:3029741
Created July 1, 2012 21:48 — forked from seanlilmateus/gist:3029710
macruby reject bugs tweets
#!/usr/bin/env macruby -wKU
framework 'Foundation'
## first example reject works great
new_array = ["test", "test 1", "Test 2", "Test 3", 10].reject {|test| test.is_a?(Fixnum) }
p new_array
## second example it still showing tweets with iso_language_code == en
@Watson1978
Watson1978 / 0-README.mdown
Created February 6, 2012 14:13 — forked from Overbryd/0-README.mdown
MacRuby segfaults Picky with a large dataset

This is a report for Issue #73

There seems to be a problem with a large index. I have >95k items in the index. As you know, a simple example of indexing and searching already works pretty well. Therefore I assume the larger dataset is causing problems with MacRuby.

In this Gist you will find the sources except the datafile.
Please download symbols.marshal and Utf8Symbol.rb to the same folder as test.rb before you try.

I am using MacRuby latest nightly at the time of writing. I also assume that you have done sudo macgem install picky.

$ macruby -v

@Watson1978
Watson1978 / objc-macruby.m
Created December 18, 2011 11:24 — forked from kyab/objc-macruby.m
Objective-C + MacRuby
#import <Foundation/Foundation.h>
#import <MacRuby/MacRuby.h>
int main(void)
{
id fooClass;
id foo;
[[MacRuby sharedRuntime] evaluateFileAtPath:@"test.rb"];
fooClass = [[MacRuby sharedRuntime] evaluateString:@"Foo"];
@Watson1978
Watson1978 / associated_objects.m
Created October 11, 2011 02:54 — forked from alloy/associated_objects.m
MacRuby with Objective-C associated objects
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#import <MacRuby/MacRuby.h>
@interface NSObject (MRAssociatedObjects)
- (id)associatedObjectForSymbol:(NSString *)rubySymbolName;
- (void)setAssociatedObject:(id)value forSymbol:(NSString *)rubySymbolName;
@end
@implementation NSObject (MRAssociatedObjects)
@Watson1978
Watson1978 / indeed_bundle_from_so.patch
Created September 17, 2011 08:46 — forked from takaokouji/dot_bundle_instead_of_dot_so.patch
Indeed .bundle from .so in MacRuby
diff --git a/load.c b/load.c
index 06ca712..92ae5d7 100644
--- a/load.c
+++ b/load.c
@@ -267,6 +267,21 @@ rb_require_safe(VALUE fname, int safe)
{
FilePathValue(fname);
+ char *p = strrchr(RSTRING_PTR(fname), '.');
+ if (p != NULL && strcmp(p + 1, "so") == 0) {
@Watson1978
Watson1978 / gist:1210522
Created September 12, 2011 03:31 — forked from alloy/gist:1078981
MacRuby : ticket #1262
diff --git a/array.c b/array.c
index b4a1c7f..ac31015 100644
--- a/array.c
+++ b/array.c
@@ -1203,14 +1203,10 @@ rary_dup(VALUE ary, SEL sel)
}
assert(rb_klass_is_rary(klass));
- VALUE dup = rary_copy(ary, klass);
+ VALUE dup = rary_alloc(klass, 0);