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 viewWillAppear | |
unless @image_view | |
@image_view = UIImageView.alloc.initWithFrame([[0,0],[200,200]]) | |
@image_view.contentMode = UIViewContentModeScaleAspectFit | |
@image_view.backgroundColor = UIColor.blackColor | |
@image_view.center = view.center | |
view.addSubview @image_view | |
if self.navigationController | |
@test_a_button = UIBarButtonItem.alloc.initWithTitle('Test', style: UIBarButtonItemStylePlain, target: self, action: :on_click_test_a) |
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
Pod::Spec.new do |s| | |
s.name = 'QuickDialog' | |
s.version = '0.7' | |
s.platform = :ios | |
s.license = 'Apache License, Version 2.0' | |
s.summary = 'Quick and easy dialog screens for iOS.' | |
s.homepage = 'http://escoz.com/quickdialog' | |
s.author = { 'Eduardo Scoz' => '[email protected]' } | |
s.source = { :git => 'https://github.com/escoz/QuickDialog.git', :tag => '0.7' } |
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 LifoQueue | |
def initialize(name, depth) | |
raise ArgumentError, "depth must be a number greater than zero" unless Fixnum === depth and depth > 0 | |
super | |
@depth = depth | |
@stack = [] | |
@mutex = Mutex.new | |
@queue = Dispatch::Queue.send :new, 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
#!/usr/bin/ruby | |
printf "\033[0mAll attributes off\033[0m\n" | |
printf "\033[1mBold\033[0m\n" | |
printf "\033[4mUnderline\033[0m\n" | |
printf "\033[5mBlink\033[0m\n" | |
printf "\033[8mHide\033[0m\n" | |
printf "\033[30mBlack\033[0m\n" | |
printf "\033[31mRed\033[0m\n" | |
printf "\033[32mGreen\033[0m\n" | |
printf "\033[33mYellow\033[0m\n" |
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
app.libs << '/usr/lib/libz.1.1.3.dylib' | |
app.libs << '/usr/lib/libsqlite3.dylib' | |
app.frameworks += [ | |
'AudioToolbox', | |
'Accounts', | |
'AdSupport', | |
'CFNetwork', | |
'CoreGraphics', | |
'CoreLocation', | |
'MobileCoreServices', |
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
- testOffline { | |
// Important! do all methods without Network | |
PFObject *todo1 = [PFObject objectWithClassName:@"Todo"]; | |
[todo1 setObject:@"Learn Parse API" forKey:@"text"]; | |
[todo1 saveEventually]; | |
PFObject *todo2 = [PFObject objectWithClassName:@"Todo"]; | |
[todo2 setObject:@"Implement iOS" forKey:@"text"]; | |
[todo2 saveEventually]; |
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
# Example: | |
# self.navigationItem.leftBarButtonItems = [ | |
# ui_bar_button_item('1'){App.alert('One')}, | |
# ui_bar_button_item('2'){App.alert('Two')} | |
# ] | |
def ui_bar_button_item(title, &block) | |
item = UIBarButtonItem.alloc.initWithTitle(title, style: UIBarButtonItemStylePlain, target: block, action: :call) | |
item.instance_variable_set('@_target', block) # retain | |
item | |
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
# -*- coding: utf-8 -*- | |
# phases = %w{🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘} | |
phases = (0x1F311..0x1F318).to_a.collect{|c| [c].pack('U*')} | |
clear_line = "\r\e[0K" | |
1000.times do |i| | |
phase = phases[i % phases.size] | |
print "#{clear_line} #{phase}\t#{i} #{phase.unpack('U*').map{ |i| "\\u" + i.to_s(16).rjust(4, '0') }.join}" | |
sleep rand / 10.0 |
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
api_url = "http://www.xe.com/currencytables/?from=USD&date=#{Time.now.strftime('%Y-%m-%d')}" | |
doc = Nokogiri(open(api_url)) | |
rows = doc.search('#historicalRateTbl tr') | |
rows.shift # disgard header | |
currencies = {} | |
while row = rows.shift | |
currency = row.children[0].inner_text | |
rate_to_us = row.children[2].inner_text | |
# rate_from_us = row.children[3].inner_text |
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
az=("A".."z").to_a.map {|m| | |
"\033[38;5;#{rand(180)+16}m#{m}\033[0m" # wrap char in random color | |
} | |
loop { | |
puts [az*" "] * 25 # fill some of the screen | |
az<<(az.shift) # rotate chars | |
sleep(0.3) # slow down | |
puts "\e[26F" # cursor up 26 lines | |
} |
OlderNewer