open Gemfile
add gem ‘carrierwave’
bundle
rails g uploader Image
rails g migration add_image_to_product image:string
rake db:migrateopen Gemfile
add gem ‘carrierwave’
bundle
rails g uploader Image
rails g migration add_image_to_product image:string
rake db:migrate| Koala.config.api_version = 'v2.0' |
| class AppDelegate, NSObject, NSApplicationDelegate { | |
| @IBOutlet weak var linkField: NSTextField! | |
| func applicationDidFinishLaunching(aNotification: NSNotification) { | |
| ... | |
| linkField.attributedStringValue = link_string("Google", url: NSURL(string: "http://www.google.com/")) | |
| ... | |
| } | |
| var taskQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0) | |
| dispatch_async(taskQueue, { () -> Void in | |
| let task = NSTask() | |
| task.launchPath = "/bin/ls" | |
| task.arguments = [] | |
| let pipe = NSPipe() | |
| task.standardOutput = pipe | |
| task.launch() | |
| let data = pipe.fileHandleForReading.readDataToEndOfFile() | |
| var dataString = NSString(data: data, encoding: NSUTF8StringEncoding) |
| # | |
| # A: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.subscribe do |data| | |
| # puts "data: #{data} is coming!" | |
| # end | |
| # | |
| # B: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.publish("hello world") |
| ActiveSupport::Inflector.inflections(:en) do |inflect| | |
| inflect.acronym 'PaaS' | |
| end |
| // usage: call $.foobaa.initialize(); | |
| (function($) { | |
| var hoge; | |
| var moge; | |
| var register_click_actions = function() { | |
| $(hoge).show(); | |
| }; |
| // | |
| // EAN.swift | |
| // | |
| import Foundation | |
| class EAN { | |
| class func isValid(ean: String) -> Bool { | |
| return EAN().isValid(ean) | |
| } |
| class WebPay | |
| alias_method :original_initialize, :initialize | |
| Configuration = Struct.new :public_key, :secret_key | |
| @@default_configuration = Configuration.new | |
| def self.configuration; @@default_configuration end | |
| def self.configure(&block) | |
| block.call(@@default_configuration) | |
| end | |
| def initialize(options = {}) | |
| original_initialize(@@default_configuration.secret_key, options) |
| # gem 'google-api-client' | |
| # gem 'mime-types' | |
| # | |
| # prepare config/ocr.yml | |
| # default: &default | |
| # google: | |
| # auth_passphrase: <passphrase> | |
| # auth_email: <email> | |
| # permission: e.g. https://www.googleapis.com/auth/drive | |
| # |