This file contains hidden or 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/env ruby | |
| # | |
| # Put this script in your PATH and download from onemanga.com like this: | |
| # onemanga_downloader.rb Bleach [chapter number] | |
| # | |
| # You will find the downloaded chapters under $HOME/Documents/OneManga/Bleach | |
| # | |
| # If you run this script without arguments, it will check your local manga downloads | |
| # and check if there are any new chapters | |
| # |
This file contains hidden or 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/env ruby | |
| # | |
| # Mangafox Downloader | |
| # By Leonardo Prado | |
| # http://twitter.com/leonardodna | |
| # http://lprado.com.br | |
| # | |
| # Based on AkitaOnRails gist for onemanga.com: https://gist.github.com/285032 | |
| # | |
| # USAGE: |
This file contains hidden or 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/local/bin/macruby | |
| framework 'Foundation' | |
| framework 'Cocoa' | |
| class Grid < NSView | |
| attr_accessor :tiles | |
| def initWithFrame frame | |
| super(frame) | |
| @tiles = [] | |
| self |
This file contains hidden or 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
| framework 'Cocoa' | |
| class NSColor | |
| def toCGColor | |
| color_RGB = colorUsingColorSpaceName(NSCalibratedRGBColorSpace) | |
| ## approach #1 | |
| # components = Array.new(4){Pointer.new(:double)} | |
| # color_RGB.getRed(components[0], | |
| # green: components[1], | |
| # blue: components[2], |
This file contains hidden or 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
| # | |
| # Datastore.rb | |
| # A singleton class to manage a MacRuby application's data storage requirements. | |
| # | |
| # Chris Powell, cpowell@prylis.com, http://cbpowell.wordpress.com | |
| # | |
| # This work is licensed under a Creative Commons Attribution 3.0 Unported License. | |
| # http://creativecommons.org/licenses/by/3.0/ | |
| # | |
| # For usage and discussion, see http://cbpowell.wordpress.com/category/macruby/ |
This file contains hidden or 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
| # Based off of Rails, by way of http://www.raulparolari.com/Rails/class_inheritable | |
| class Class | |
| def class_inheritable_reader(*syms) | |
| syms.each do |sym| | |
| class_eval <<-EOS | |
| def self.#{sym} | |
| read_inheritable_attr(:#{sym}) | |
| end | |
| EOS |
This file contains hidden or 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
| require 'inheritable_attrs' | |
| class Entity < NSManagedObject | |
| class_inheritable_accessor :entity_name | |
| self.entity_name = 'Entity' | |
| def self.inherited(sub) | |
| sub.entity_name = sub.to_s | |
| end |