This file contains 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
class MainScreen < PM::Screen | |
title "My Screen" | |
layout MyLayout | |
stylesheet MainScreenStylesheet | |
def on_load | |
stylesheet.layout | |
set_state user_logged_in: false, first_name: "n/a", last_name: "n/a" | |
end | |
This file contains 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 pbi(st) | |
st.frame = 'a0:j8' | |
st.background_color = color.pbi | |
st.z_position = 1 | |
st.hidden = true | |
st.clips_to_bounds = true | |
end | |
def instruction_image(st) | |
st.frame = 'a11:j15' |
This file contains 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
class NSRConfig | |
# In AppDelegate: NSRConfig.defaultConfig.additional_query_parameters = {auth_token: 'yourtoken'} | |
attr_accessor :additional_query_parameters | |
end | |
class NSRRequest | |
alias :old_http_request :HTTPRequest | |
def HTTPRequest | |
if additional_params = self.config.additional_query_parameters | |
self.queryParameters = {} unless self.queryParameters |
This file contains 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
(main)> a = ‘test’ | |
=> "test" | |
(main)> b = WeakRef.new(a) | |
=> "test" | |
(main)> b == a | |
=> true | |
(main)> a == b | |
=> true | |
(main)> c = UIViewController.alloc.init | |
=> #<UIViewController:0×963c630> |
This file contains 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
# Add the following to your Rakefile | |
# app.frameworks += ['MediaPlayer'] | |
class SystemSounds | |
class << self | |
BASE_AUDIO_PATH = "#{NSBundle.mainBundle.resourcePath}/audio/" | |
@@system_sounds = {} | |
def play_system_sound(file_name) | |
path = "#{BASE_AUDIO_PATH}#{file_name}" |
This file contains 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
# Foo folder in vendor with .h and .m files | |
app.vendor_project('vendor/Foo', :static, :cflags => '-fobjc-arc' |
This file contains 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
# RubyMotion: Adding a block to Teacup's animate_to_style, for completion. You can do something like this | |
# | |
# popup.animate_to_style( duration: 0.9, left: 5) do |finished| | |
# popup.animate_to_style( duration: 0.3, left: 105) do |finished| | |
# popup.animate_to_style( duration: 0.5, top: 300) do |finished| | |
# popup.hidden = true | |
# end | |
# end | |
# end | |
# |
This file contains 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
# A simple example of creating a UIView with a UICollectionView as a subview | |
# in RubyMotion using Teacup for styling | |
# | |
# Your controller will need to set the stylesheet: stylesheet :example | |
# and create this view like so: subview Example, :my_example_view | |
class Example < UIView | |
CELL_IDENTIFIER = 'example_cell' | |
def initWithFrame(frame) |
This file contains 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
# RubyMotion | |
class Color < UIColor | |
class << self | |
alias :clear :clearColor | |
alias :white :whiteColor | |
alias :lightgray :lightGrayColor | |
alias :gray :grayColor | |
alias :darkgray :darkGrayColor | |
alias :black :blackColor |
This file contains 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
#!/bin/bash | |
mongod -vvvv --profile=2 --logpath /usr/local/var/log/mongodb/mongod.log -f /usr/local/etc/mongod.conf --fork | |
echo 'mongodb started' |
NewerOlder