This file contains 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
for i in range(100):print(i%3//2*"Fizz"+i%5//4*"Buzz"or-~i) | |
# コードゴルフで解いた | |
# i%3//2*"Fizz" は、i%3//2の結果が3の倍数なら1、それ以外なら0になり、0 * "Fizz"は空文字になる。//は割り算した際に小数点を切り捨てる | |
# i%5//4*"Buzz" は、i%5//4の結果が4の倍数なら1、それ以外なら0になり、0 * "Buzz"は空文字になる。//は割り算した際に小数点を切り捨てる | |
# or-~iはその前の文字が空文字だった場合に、-~iを実行し、-~iはビット反転演算子を使用してiに1を加える |
This file contains 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
const List<int> list = [1, 2, 3, 4]; | |
final result = list | |
.filter((e) => e > 2) // 2以上の値をfilter [3,4] | |
.plus([1, 2, 3]) // [1,2,3]をListに足す [3, 4, 1, 2, 3] | |
.drop(2) //最初の2要素を落とす (1,2,3) Iterableのメソッド | |
.intersect([2, 3]) //[2,3]と共通要素を抽出 [2,3] | |
.map((e) => e * 2) //要素に2を掛ける [4,6] Iterableのメソッド | |
.take(1) //先頭から2要素を取得 [4] Iterableのメソッド | |
; |
This file contains 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 stripeJs, {PaymentMethod, StripeError} from '@stripe/stripe-js'; | |
import {Option} from 'fp-ts/Option'; | |
import {CardCvcElement, CardExpiryElement, CardNumberElement} from '@stripe/react-stripe-js'; | |
import {pipe} from 'fp-ts/lib/pipeable'; | |
import * as O from 'fp-ts/lib/Option' | |
export class StripePaymentService { | |
public clearElements(elements: Option<stripeJs.StripeElements>): void { |
This file contains 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
from functools import reduce | |
import re | |
# 00. 文字列の逆順 | |
# 文字列”stressed”の文字を逆に(末尾から先頭に向かって)並べた文字列を得よ. | |
# https://nlp100.github.io/ja/ch01.html#00-%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E9%80%86%E9%A0%86 | |
print("stressed"[::-1]) | |
# スライス構文を使わないでやってみたパターン |
This file contains 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
///6.0.2を使用して動作確認済み | |
///https://github.com/malcommac/SwiftDate/releases/tag/6.0.2 | |
import SwiftDate | |
let dateTruncated = Date().dateTruncated([.second]) |
This file contains 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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Documnet</title> | |
<base href=""> | |
</head> | |
<body> | |
<!--1.Display the application --> | |
<calendar-demo>Loading...</calendar-demo> |
This file contains 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 {Component} from 'angular2/core'; | |
import {CORE_DIRECTIVES} from 'angular2/common'; | |
import {bootstrap} from 'angular2/platform/browser'; | |
import {CalendarComponent} from '../components/calendar/calendar'; | |
bootstrap(CalendarComponent) |
This file contains 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 {Component} from 'angular2/core'; | |
import {CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/common'; | |
import {DATEPICKER_DIRECTIVES} from 'ng2-bootstrap'; | |
import * as moment from 'moment'; | |
@Component({ | |
selector: 'calendar-demo', | |
templateUrl: 'components/calendar/calendar.html', | |
directives: [DATEPICKER_DIRECTIVES, CORE_DIRECTIVES, FORM_DIRECTIVES] | |
}) |
This file contains 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
<style> | |
.full button span { | |
background-color: limegreen; | |
border-radius: 32px; | |
color: black; | |
} | |
.partially button span { | |
background-color: orange; | |
border-radius: 32px; | |
color: black; |
This file contains 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 ( | |
"github.com/PuerkitoBio/goquery" | |
"fmt" | |
"io/ioutil" | |
"os" | |
) | |
func main() { |
NewerOlder