Skip to content

Instantly share code, notes, and snippets.

import { Application, Router } from 'https://deno.land/x/oak/mod.ts'
const env = Deno.env.toObject()
const PORT = env.PORT || 4000
const HOST = env.HOST || '127.0.0.1'
interface Dog {
name: string
age: number
}
async function getUser() {
return Promise.resolve({userId:10});
}
async function getFriendsOfUser(userId) {
return Promise.resolve(["john","marry"]);
}
async function getUsersPosts(userId) {
@garywu125
garywu125 / gist-hello.ts
Last active May 3, 2020 13:12
demo gist-hosted script
import { bgBlue, red, bold } from "https://deno.land/std/fmt/mod.ts";
const sayMyHello = (name: string = "my world") => {
console.log(bgBlue(red(bold(`Hello ${name}!`))));
}
sayHello();
sayHello("myConlin");
function hello(person: string) {
return "Hello, " + person + " from remote git ";
}
console.log(hello("John"));
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
//改版
}
class MyApp extends StatelessWidget {
void main() {
outerloop: // This is the label name
for (var i = 0; i < 3; i++) {
print("Outerloop:${i}");
for (var j = 0; j < 5; j++) {
if (j == 3){
break outerloop;
}
@garywu125
garywu125 / golang-tls.md
Created October 26, 2016 07:11 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
import {Injectable} from 'angular2/angular2';
@Injectable()
export class Spotify {
url: string;
constructor() {
this.url = 'https://api.spotify.com/v1/';
}
public searchArtist (value) {
@garywu125
garywu125 / destructuring.js
Created September 27, 2015 07:19 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring.
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@garywu125
garywu125 / typescript.json
Created September 23, 2015 08:11 — forked from jimthedev/typescript.json
A few Visual Studio Code 0.8 Snippets for TypeScript and Angular 2
{
"New NG2 Component (Item)": {
"prefix": "ng2c",
"body": [
"import {Component, View, CORE_DIRECTIVES, FORM_DIRECTIVES} from 'angular2/angular2';",
"// import {ExampleListComponent} from '../example/example-list.component';",
"",
"@Component({",
" selector: '${1:dashed-name}',",
" properties: ['id']",