Skip to content

Instantly share code, notes, and snippets.

View jjaffeux's full-sized avatar

Joffrey JAFFEUX jjaffeux

View GitHub Profile
@jjaffeux
jjaffeux / dynamic_layer.rb
Created June 4, 2013 11:01
dynamic_layer.rb
class DynamicLayerViewController < UIViewController
def viewDidLoad
super
self.view.backgroundColor = UIColor.whiteColor
@layer = DynamicLayer.alloc.init
@layer.frame = self.view.bounds
self.view.layer.addSublayer(@layer)
@jjaffeux
jjaffeux / sine_animation_rubymotion.rb
Created June 1, 2013 14:21
sine_animation_rubymotion.rb
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'dynamic_calayer'
app.frameworks += ['QuartzCore', 'CoreGraphics']
end
@jjaffeux
jjaffeux / adress_book_email.rb
Created May 30, 2013 14:13
adress_book_email.rb
class PickerViewController < UIViewController
def viewDidLoad
show_picker = UIButton.buttonWithType(UIButtonTypeRoundedRect)
show_picker.setTitle("show picker", forState:UIControlStateNormal)
show_picker.frame = [[10,10],[100,40]]
show_picker.addTarget(self, action: :display_picker, forControlEvents:UIControlEventTouchUpInside)
self.view.addSubview(show_picker)
end
def peoplePickerNavigationController(peoplePicker, shouldContinueAfterSelectingPerson:person)
@jjaffeux
jjaffeux / adress_book_copy_value.rb
Created May 30, 2013 13:08
adress_book_copy_value
class PickerViewController < UIViewController
def viewDidLoad
show_picker = UIButton.buttonWithType(UIButtonTypeRoundedRect)
show_picker.setTitle("show picker", forState:UIControlStateNormal)
show_picker.frame = [[10,10],[100,40]]
show_picker.addTarget(self, action: :display_picker, forControlEvents:UIControlEventTouchUpInside)
self.view.addSubview(show_picker)
end
def peoplePickerNavigationController(peoplePicker, shouldContinueAfterSelectingPerson:person)
@jjaffeux
jjaffeux / adress_book.rb
Created May 29, 2013 22:06
adress_book.rb
class PickerViewController < UIViewController
def viewDidLoad
show_picker = UIButton.buttonWithType(UIButtonTypeRoundedRect)
show_picker.setTitle("show picker", forState:UIControlStateNormal)
show_picker.frame = [[10,10],[100,40]]
show_picker.addTarget(self, action: :display_picker, forControlEvents:UIControlEventTouchUpInside)
self.view.addSubview(show_picker)
end
def peoplePickerNavigationController(peoplePicker, shouldContinueAfterSelectingPerson:person)
@jjaffeux
jjaffeux / imageview_zoom_in_scrollView.rb
Last active December 17, 2015 19:58
imageview_zoom_in_scrollView.rb
class ViewController < UIViewController
def viewDidLoad
super
image = UIImage.imageNamed("photo1.png")
@imageView = UIImageView.alloc.initWithImage(image)
@scrollView = UIScrollView.alloc.initWithFrame([[0,0],[320,480]])
@scrollView.delegate = self
open HomeScreen.new(nav_bar: true)
def on_init
# Fires right after the screen is initialized
end
def on_load
# Fires just before a screen is added to a view for the first time.
end
def will_appear
# Fires every time the screen will appear
# Copyright (c) 2012, HipByte SPRL and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
@jjaffeux
jjaffeux / unicorns_manager.rb
Last active December 14, 2015 04:09
unicorns_manager.rb
#!/usr/bin/env ruby
APP_ROOT = "/apps/<%= node['type'] %>/htdocs/current"
PID_FILE = "<%= node['unicorn']['pid'] %>"
COMMAND = "cd /apps/<%= node['type'] %>/htdocs/current && bundle exec unicorn -E production -D -c /etc/unicorn/<%= node['type'] %>.rb"
def pid
open(PID_FILE).read.strip.to_i
end
def running?