Skip to content

Instantly share code, notes, and snippets.

View masuidrive's full-sized avatar

Yuichiro MASUI masuidrive

View GitHub Profile
@masuidrive
masuidrive / samegame.rb
Created August 2, 2012 17:41
samegame.rb
#
# support: CRuby & mruby
#
module Enumerable
def map_with_index(&block)
i = 0
self.map { |val|
val = block.call(val, i)
i += 1
@masuidrive
masuidrive / gist:3333874
Created August 12, 2012 19:20
Generate BridgeSupport file for iOS
/usr/bin/gen_bridge_metadata -f "Someone.framework" -c "-D__IPHONE_OS_VERSION_MIN_REQUIRED=50100 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk"
DeferredCallbacks
Emit
Network::HttpRequest.get(URL).success{...}.failure{...}
.parse(:json)
@masuidrive
masuidrive / rubyvm1.rb
Created October 21, 2012 13:38
mruby thread proposal
# It's running on sub thread
# it isn't sharing with rubyvm_proposal1.rb's VM.
$action1_result = 0
def action1a
$action1_result
end
def action1b
@masuidrive
masuidrive / docker_rails.sh
Last active November 15, 2022 06:02
Docker ComposeでRails環境作成 mkdir -p railsapp && cd railsapp && curl -L http://bit.ly/rails6-docker | sh
#!/usr/bin/env bash
rails_version="${RAILS_VERSION:-7}"
ruby_version="${RUBY_VERSION:-3.0}"
node_version="${NODE_VERSION:-16}"
docker run --rm -v `pwd`:/usr/src/app ruby:$ruby_version sh -c "gem install rails --version $rails_version && rails new /usr/src/app --database mysql ${RAILS_OPTIONS} --git --force --version $rails_version"
cat << __EOT__ > Dockerfile
FROM ruby:$ruby_version