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 | |
let formatter = DateFormatter() | |
formatter.calendar = Calendar(identifier: .gregorian) | |
formatter.dateFormat = "yyyy/MM/dd" | |
let start = formatter.date(from: "2020/04/01")! | |
let days = (0..<12).map { month in | |
Calendar.current.date(byAdding: .month, value: month, to: start)! | |
} |
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
const app = new Vue({ | |
el: '#app', | |
data: { | |
editFriend: null, | |
friends: [] | |
}, | |
methods: { | |
deleteFriend(id, i) { | |
fetch("http://rest.learncode.academy/api/mh/friends/" + id, { |
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
function myClass() {} | |
Object.defineProperty(myClass.prototype, "x", { | |
get() { | |
return this.store_x; | |
}, | |
set(newValue) { | |
this.store_x = newValue; | |
}, | |
}); |
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 Target { | |
static use(plugin, options) { | |
plugin.install(Target, options) | |
} | |
methodA() { | |
console.log("call methodA") | |
} | |
} |
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 Target { | |
methodA() { | |
console.log("call methodA"); | |
} | |
static include(mixin) { | |
Object.assign(this.prototype, mixin); | |
} |
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
const inquirer = require("inquirer"); | |
inquirer | |
.prompt([ | |
{ | |
name: "name", | |
message: "What's your name?", | |
default: "mh-mobile", | |
}, | |
{ |
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
const Listr = require("listr"); | |
const tasks = new Listr([ | |
{ | |
title: "Task1", | |
task: () => Promise.resolve("Foo"), | |
}, | |
{ | |
title: "Can be skipped", | |
skip: () => { | |
if (Math.random() > 0.5) { |
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
const terminalLink = require("terminal-link"); | |
const link = terminalLink("My WebStie", "https://github.com/mh-mobile/"); | |
console.log(link); |
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
const terminalImage = require("terminal-image"); | |
(async () => { | |
console.log(await terminalImage.file("profile.png")); | |
})(); |
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
const logSymbols = require("log-symbols"); | |
[ | |
logSymbols.success, | |
logSymbols.info, | |
logSymbols.warning, | |
logSymbols.error, | |
].forEach(function (symbol) { | |
console.log(symbol, "symbol"); | |
}); |