Skip to content

Instantly share code, notes, and snippets.

@m-atthieu
m-atthieu / onemanga_downloader.rb
Created December 29, 2011 19:54 — forked from akitaonrails/onemanga_downloader.rb
Download from onemanga.com
#!/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
#
@m-atthieu
m-atthieu / mangafox.rb
Created December 29, 2011 19:54
script for manga download from mangafox.com
#!/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:
@m-atthieu
m-atthieu / gist:1511043
Created December 22, 2011 17:11 — forked from seanlilmateus/gist:1360512
Drawing Fractal with MacRuby concurrently with Grand Central Dispatch
#!/usr/local/bin/macruby
framework 'Foundation'
framework 'Cocoa'
class Grid < NSView
attr_accessor :tiles
def initWithFrame frame
super(frame)
@tiles = []
self
@m-atthieu
m-atthieu / face_detector.rb
Created December 22, 2011 17:09 — forked from pvinis/face_detector.rb
run with "macruby face_detector.rb" or "macruby face_detector.rb https://fbcdn-sphotos-a.akamaihd.net/hphotos-ak-snc7/304055_10150415385415891_522505890_10347873_1682210515_n.jpg?dl=1" for a photo of me with woody and buzz lightyear :p
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],
@m-atthieu
m-atthieu / Datastore.rb
Created December 18, 2011 16:44 — forked from cpowell/Datastore.rb
A singleton class to manage a MacRuby application's data storage requirements.
#
# 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/
# 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
@m-atthieu
m-atthieu / entity.rb
Created December 17, 2011 00:25 — forked from cyberfox/entity.rb
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