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
| use_frameworks! | |
| target 'RxSwiftSample' do | |
| pod 'RxSwift', '~> 2.0' | |
| pod 'RxCocoa', '~> 2.0' | |
| end | |
| # RxTests and RxBlocking have most sense in the context of unit/integration tests | |
| target 'RxSwiftSampleTest' do | |
| pod 'RxBlocking', '~> 2.0' |
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 python | |
| # -*- coding: utf-8 -*- | |
| import urllib.request | |
| from bs4 import BeautifulSoup | |
| html = urllib.request.urlopen('https://teratail.com/tags/Python') | |
| soup = BeautifulSoup(html, 'lxml') | |
| userRanking_month = soup.find(id='userRanking__month') |
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
| import UIKit | |
| import PlaygroundSupport | |
| let view = UIView(frame: CGRect(x: 0, y:0, width:320, height:44)) | |
| view.backgroundColor = UIColor.black | |
| PlaygroundPage.current.liveView = view | |
| (0...2).forEach { | |
| let sushi = UILabel(frame: CGRect(x:320, y:0, width:44, height:44)) |
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
| import UIKit | |
| import PlaygroundSupport | |
| let view = UIView(frame: CGRect(x: 0, y:0, width:320, height:44)) | |
| view.backgroundColor = UIColor.black | |
| PlaygroundPage.current.liveView = view | |
| (0...2).forEach { | |
| let sushi = UILabel(frame: CGRect(x: 320, y: 0, width: 44, height: 44)) |
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
| (1..100).map { | |
| when { | |
| it % 15 == 0 -> "fizzbuzz" | |
| it % 3 == 0 -> "fizz" | |
| it % 5 == 0 -> "buzz" | |
| else -> it.toString() | |
| } | |
| }.forEach { println(it) } |
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
| (1...100).map { | |
| switch ($0 % 3, $0 % 5) { | |
| case (0, 0): return "Fizz Buzz" | |
| case (0, _): return "Fizz" | |
| case (_, 0): return "Buzz" | |
| case (_, _): return "\($0)" | |
| } | |
| }.forEach { print($0) } |
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
| import Foundation | |
| // try! Swift NYC 2016 | |
| // https://academy.realm.io/posts/tryswift-rob-napier-swift-legacy-functional-programming/ | |
| // Sample1: 分解して再構築 | |
| struct Person { | |
| let name: String | |
| let isValid: Bool = true | |
| } |
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
| package main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "time" | |
| ) | |
| func main() { | |
| rand.Seed(time.Now().UnixNano()) |
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
| import Algorithms | |
| let word = ("GAKKOU".permutations().uniqued().map { String($0) }.sorted(by: <)[99]) | |
| print(word) |
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
| fun main() { | |
| val string = "GAKKOU" | |
| val chars: List<Char> = string.toList() | |
| val word = chars.permutations().distinct().map { it.toCharArray().concatToString() }.sorted()[99] | |
| println(word) | |
| } | |
| fun <T> List<T>.permutations(): List<List<T>> { | |
| if (this.isEmpty()) return listOf(emptyList()) |