Skip to content

Instantly share code, notes, and snippets.

How to use Bundler and RubyGems on WebAssembly

# Download prebuilt ruby
curl -LO https://github.com/ruby/ruby.wasm/releases/download/2022-05-11-a/ruby-head-wasm32-unknown-wasi-full.tar.gz
tar xfz ruby-head-wasm32-unknown-wasi-full.tar.gz

# Install the same version of native ruby to avoid bundler version mismatch in "BUNDLED WITH" of Gemfile.lock
rvm install 3.2.0-preview1
rvm use 3.2.0-preview1
@siuying
siuying / Brewfile
Last active November 20, 2023 15:13 — forked from hlb/Brewfile
Clean Install Script
cask_args appdir: '/Applications'
tap 'homebrew/cask'
tap "homebrew/cask-fonts"
tap 'homebrew/cask-versions'
tap "homebrew/bundle"
tap "homebrew/core"
tap "homebrew/services"
brew "git"
brew "git-lfs"
#import "NSString+UnicodeLength.h"
@implementation NSString (UnicodeLength)
/**
* @param range a unicode codepoint range, as described in twitter
* @return rante a NSRange for the string
* @see https://dev.twitter.com/overview/api/counting-characters
*/
- (NSRange)composedRangeWithRange:(NSRange)range {
require 'rubygems'
require 'em-proxy'
require 'http_tools'
require 'uuid'
# > ruby em-proxy-http.rb
# > curl --proxy localhost:8080 www.google.com
host = "0.0.0.0"
port = 8080
@siuying
siuying / face_detector.rb
Created December 1, 2011 16:17 — forked from mattetti/face_detector.rb
Macruby Face Detection in Mac OS X Lion. Usage: $ macruby face_detector.rb or $ macruby face_detector.rb image_url
framework 'Cocoa'
class NSColor
def toCGColor
color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace)
## approach #1
# components = Array.new(4){Pointer.new(:double)}
# color_RGB.getRed(components[0],
# green: components[1],
# blue: components[2],