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
class Burger { | |
let customerName:String | |
let veggieProduct:Bool | |
let patties:Int | |
let pickles:Bool | |
let mayo:Bool | |
let ketchup:Bool | |
let lettuce:Bool | |
let cook:Cooked | |
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
protocol Floorplan { | |
var seats:Int { get } | |
var enginePosition:EngineOption { get } | |
} | |
enum EngineOption : String { | |
case FRONT = "Front" | |
case MID = "Mid" | |
} |
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
protocol RentalCar { | |
var name:String { get } | |
var passengers:Int { get } | |
var pricePerDay:Float { get } | |
} | |
class Compact : RentalCar { | |
var name = "VW Golf" | |
var passengers = 3 | |
var pricePerDay:Float = 20 |
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
class Book { | |
let author:String | |
let title:String | |
let stockNumber:Int | |
var reader:String? | |
var checkCount = 0 | |
init(author:String, title:String, stock:Int) { | |
self.author = author | |
self.title = title |
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
class DataItem { | |
enum ItemType : String { | |
case Email = "Email Address" | |
case Phone = "Telephone Number" | |
case Card = "Credit Card Number" | |
} | |
var type:ItemType | |
var data:String |
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
class Product : NSObject, NSCopying { | |
private(set) var name:String | |
private var stockLevelBackingValue:Int = 0 | |
init(name:String, stockLevel:Int) { | |
self.name = name | |
super.init() | |
self.stockLevel = stockLevel | |
} |
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
class Product { | |
var name:String | |
var price:Double | |
private var stockBackingValue:Int = 0 | |
var stock:Int { | |
get { | |
return stockBackingValue | |
} | |
set { |
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 | |
require "csv" | |
require "yaml" | |
product_id = ARGV[0].to_i | |
path_to_csv = ARGV[1] | |
path_to_yaml = 'hoge.yaml' | |
hash = {} |
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
var http = require('http'); | |
var parser = new (require('xml2js')).Parser({ | |
trim: true, | |
explicitArray: false | |
}); | |
var colors = require('colors'); | |
var trendingTopics = require('./twitter_trends.js'); | |
var hotTrends = Object.create(trendingTopics, { | |
trends: { |
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
var http = require('http'); | |
var colors = require('colors'); | |
var trendingTopics = module.exports = { | |
trends: { | |
urlOpts: { | |
host: 'api.twitter.com', | |
path: '/1/trends/23424856.json', | |
headers: {'User-Agent': 'Node Cookbook: Twitterトレンド'} | |
} |