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 Foundation | |
extension String { | |
func numberOfLines(_ maxLine: Int) -> Self { | |
if maxLine <= 0 { return self } | |
return self.split(whereSeparator: \.isNewline).prefix(maxLine).joined(separator: "\n") | |
} | |
} |
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
(function () { | |
"use strict"; | |
var app = WinJS.Application; | |
var activation = Windows.ApplicationModel.Activation; | |
app.onactivated = function (args) { | |
if (args.detail.kind === activation.ActivationKind.launch) { | |
if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { | |
// TODO: This application has been newly launched. Initialize your application here. |
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> | |
<head> | |
<meta charset="utf-8" /> | |
<title>UITest</title> | |
<!-- WinJS references --> | |
<link href="WinJS/css/ui-dark.css" rel="stylesheet" /> | |
<script src="WinJS/js/base.js"></script> | |
<script src="WinJS/js/ui.js"></script> |
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
(function () { | |
"use strict"; | |
// WinJS を使えるように設定 | |
var app = WinJS.Application; | |
// Windows Runtime を使えるように設定 | |
var activation = Windows.ApplicationModel.Activation; | |
// アプリ起動時に呼び出される | |
app.onactivated = function (args) { |
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
function p() { | |
var raw = String.raw.apply(null, arguments) | |
console.log(`<p>${raw}</p>`) | |
} | |
p`test ${ 4*4 } !` // <p>test 16 !</p> | |
p`test ${ 8*4 } !` // <p>test 32 !</p> |
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
function str(s,...v){ | |
console.log(s) | |
console.log(v) | |
console.log(s.raw[0]); | |
console.log(s.raw[1]); | |
console.log(s.raw[3]); | |
} | |
str`test1: ${1}, test2: ${2} !` | |
/* 出力結果 |
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
var a = 2 | |
var txt = `答え1:${ 1 + 1 }\n答え2:${ a * 2 }` | |
console.log(txt) | |
/* 出力結果 | |
答え1:2 | |
答え2:4 | |
*/ |
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
var txt1 = "test" | |
var txt2 = `test` | |
txt1 == txt2 // true |
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
var txt = `Les sanglots longs | |
Des violons | |
De l'automne | |
Blessent mon coeur | |
D'une langueur | |
Monotone.` | |
console.log(txt) | |
/* 出力結果 |
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
function test(a = 1, b = 2, [...c] = [1,2,3]){ | |
console.log(a,b,...c) | |
} | |
test() // 1 2 1 2 3 | |
test(5,4,[3,2,1]) // 5 4 3 2 1 |
NewerOlder