Skip to content

Instantly share code, notes, and snippets.

@willrax
willrax / my_scene.rb
Last active August 29, 2015 14:01
Parallax scrolling with Sprite Kit and RubyMotion
# Video of it in action: http://cl.ly/VSIF
class MyScene < SKScene
def scroll_action(x, duration)
width = (x * 2)
move = SKAction.moveByX(-width, y: 0, duration: duration * width)
reset = SKAction.moveByX(width, y: 0, duration: 0)
SKAction.repeatActionForever(SKAction.sequence([move, reset]))
end
@jacklynrose
jacklynrose / motion-kit-love.rb
Created December 18, 2014 10:31
I do love motion-kit
class ProfileLayout < MotionKit::Layout
def layout
add UIImageView, :profile_image
add UILabel, :name_label
add UILabel, :bio_label
background_color UIColor.whiteColor
end
def profile_image_style
@hardez
hardez / gist:985ce910f82f151b01e2
Created January 4, 2015 15:53
NSURLConnectionDelegate
func connection(connection: NSURLConnection, canAuthenticateAgainstProtectionSpace protectionSpace: NSURLProtectionSpace?) -> Bool
{
return protectionSpace?.authenticationMethod == NSURLAuthenticationMethodServerTrust
}
func connection(connection: NSURLConnection, didReceiveAuthenticationChallenge challenge: NSURLAuthenticationChallenge?)
{
if challenge?.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust
{
if challenge?.protectionSpace.host == "www.myhost.com"
@FloorD
FloorD / gist:944d152fdd655cae03e8
Last active August 29, 2015 14:19
A recap of ROSSConf Vienna, April 25 2015

###The ROSSConf project, or: helping Open Source help Open Source

Last April Saturday ROSSConf Vienna took place. Sixty registered participants, some loose canons, 5 projects, 6 maintainers, 8-ish team members, 1 baby all in one coworking space. Here's what happened.

*credit: Manuel Gruber*

####In the beginning October last year, at arrrrcamp, I came up with the concept for ROSSConf. Having attended 1001 tech conferences (I haven't kept count) I concluded that I'm always missing something. I found myself listening to a talk and wishing I could contribute to the project discussed but the internet connection wasn't sufficient for cloning the repo, nor was there time to hack on the project as the next talk was about to start. And, I figured, I'd need some time to get into the project and the contributing etiquette before being able to contribute.

@koriroys
koriroys / doccsv.rb
Created January 19, 2012 01:43
Tom
# encoding: utf-8
require 'csv'
def is_suffix? name
case name
when "Jr"
true
when "JR"
true
@runemadsen
runemadsen / fileupload.rb
Created May 23, 2012 18:35
How to read an uploaded file in sinatra
post '/process' do
file = params[:fileupload][:tempfile]
json = JSON.parse(open(file).read)
# do something with your json here
end
@Bodacious
Bodacious / REAME.md
Created July 6, 2012 13:05
Transposing An Existing XCode Project to Rubymotion

For the last two weeks I've been working flat out with Rubymotion, a new toolchain that allows developers to build native iOS applications using the beautiful, elegant Ruby programming language instead of the verbose and somewhat fussy Objective-C programming language.

The app I've been working on is an existing client app we've been developing for several months. The app was about 80% ready for a pilot launch but still had quite a bit of development to go before being shipped. After discussing Rubymotion with the client, we agreed that it would save us both time and money in future development if we move over to Rubymotion. I was tasked with doing the migration; transposing the entire application to Rubymotion.

Timescale

For those of you looking to do the same, here are some stats that might help you estimate the time required and the costs

@ParkinT
ParkinT / Rakefile
Last active October 7, 2015 07:18
RubyMotion Rakefile - improved workflow
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
# custom rake tasks
require '../raketasks/gemerator.rb'
desc "Open latest crash log"
task :log do
app = Motion::Project::App.config
@georgy-martirosov
georgy-martirosov / post-commit
Created August 14, 2012 13:23
Take webcam shot after each commit via post-commit hook
#!/usr/bin/env ruby
# take photo after commit ; )
file="~/.gitshots/#{Time.now.to_i}.jpg"
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file}"
exit 0