open Gemfile
add gem ‘carrierwave’
bundle
rails g uploader Image
rails g migration add_image_to_product image:string
rake db:migrate| // | |
| // EAN.swift | |
| // | |
| import Foundation | |
| class EAN { | |
| class func isValid(ean: String) -> Bool { | |
| return EAN().isValid(ean) | |
| } |
| // usage: call $.foobaa.initialize(); | |
| (function($) { | |
| var hoge; | |
| var moge; | |
| var register_click_actions = function() { | |
| $(hoge).show(); | |
| }; |
| ActiveSupport::Inflector.inflections(:en) do |inflect| | |
| inflect.acronym 'PaaS' | |
| end |
| # | |
| # A: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.subscribe do |data| | |
| # puts "data: #{data} is coming!" | |
| # end | |
| # | |
| # B: | |
| # pubsub = PgPubSub.new('channelname') | |
| # pubsub.publish("hello world") |
| 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) |
| 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/")) | |
| ... | |
| } | |
| Koala.config.api_version = 'v2.0' |
open Gemfile
add gem ‘carrierwave’
bundle
rails g uploader Image
rails g migration add_image_to_product image:string
rake db:migrate| # hash = { a: { b: 1 } } | |
| # path hash, :a, :b -> 1 | |
| def path(source, *keys) | |
| return nil unless source | |
| return nil unless source.respond_to? :[] | |
| keys.each do |key| | |
| return nil unless source.respond_to? :[] | |
| source = source[key] |