This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
puts "hello world!" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require "opengl" | |
require "glut" | |
require 'RMagick' | |
module Panorama | |
WINDOW_WIDTH = 800 | |
WINDOW_HEIGHT = 600 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
static const char* chk(int n) | |
{ | |
return n ? "passed" : "failed"; | |
} | |
static void test1(NSString *v1, NSString *v2, NSString *v3) | |
{ | |
int r1 = [v1 compare:v2 options:NSNumericSearch]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Obj-C shardInstance(Singlton) Macro | |
*/ | |
/* example | |
// header(.h) file | |
#include "this macro file.h" | |
@interface SampleClass : NSObject | |
+ (id)shardInstance; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
# Pure Ruby minimal .tar file un-archiver | |
class Untar | |
def initialize(file, root_directory) | |
@root = root_directory | |
@f = file | |
loop do | |
name, size = read_header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def say(text) | |
system "say #{text}" | |
end | |
n = %w(zero ichi knee sun yon go lowcoo shechi hachi kyu ju) | |
say 'de-wa-- e-ma-ka-ra-- sun-no-buy-su-tow-- sun-gha-tscoo-- suu-jee-no-tohki-da-que-- ahhoo-knee-nari-masu' | |
(1..40).each do |i| | |
text = i <= 10 ? n[i] : i < 20 ? "ju #{n[i%10]}" : i%10 == 0 ? "#{n[i/10]} ju" : "#{n[i/10]} ju #{n[i%10]}" | |
text = "-v Hysterical #{text}" if i%3 == 0 or "#{i}".include?('3') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "DummyProtocolHandler.h" | |
@implementation DummyProtocolHandler | |
// other | |
- ruby_method_0 { return nil; } | |
- ruby_method_1:a1 { return nil; } | |
- ruby_method_2:a1 :a2 { return nil; } | |
- ruby_method_3:a1 :a2 :a3 { return nil; } | |
- ruby_method_4:a1 :a2 :a3 :a4 { return nil; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubycocoa' | |
class MyAppDelegate < OSX::NSObject | |
def applicationDidFinishLaunching(application) | |
@window = OSX::UIWindow.alloc.initWithFrame(OSX::UIScreen.mainScreen.bounds) | |
@window.setBackgroundColor(OSX::UIColor.darkGrayColor) | |
@window.makeKeyAndVisible | |
@textView = OSX::UILabel.alloc.initWithFrame(OSX::UIScreen.mainScreen.bounds) | |
@textView.setText("hello RubyCocoa world") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# basic test ;) | |
irb(main):001:0> 1+2 | |
3 | |
# I want to get MyAppDegetate instance | |
irb(main):002:0> OSX::UIApplication | |
OSX::UIApplication | |
irb(main):003:0> OSX::UIApplication.sharedApplication | |
#<OSX::UIApplication:0x1eefba class='UIApplication' id=0x26f6d0> |
OlderNewer