- 하하하
// 예시코드에욤
- 호호호
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>GistRun</title> | |
<link rel="stylesheet" href="styles.css"> | |
</head> | |
<body> | |
<h1>Hello world!</h1> | |
<script src="script.js"></script> |
function applyStrokeOptions(ctx, options = {}) { | |
ctx.setLineDash(options.dash || []) | |
ctx.lineWidth = options.width || 1 | |
ctx.strokeStyle = options.color || '#000000' | |
} | |
function applyFillOptions(ctx, options = {}) { | |
ctx.fillStyle = options.color || '#000000' | |
} |
export function average(...points) { | |
if (points.length === 0) { | |
return { x: 0, y: 0 } | |
} | |
return { | |
x: points.reduce((carry, p) => carry + p.x, 0) / points.length, | |
y: points.reduce((carry, p) => carry + p.y, 0) / points.length, | |
} | |
} |
function stringify(value) { | |
if (value === null) { | |
return "null" | |
} | |
if (typeof value === "number") { | |
return `${value}` | |
} | |
if (typeof value === "boolean") { | |
return value ? "true" : "false" | |
} |
const obj = { | |
isregexp: /email/, | |
isinfinity: Infinity, | |
isninfinity: -Infinity, | |
isnan: NaN, | |
} | |
JSON.stringify(obj) // '{"isregexp": {}, "isinfinity":null,"isninfinity":null,"isnan":null} |
type ConstructType<P> = {new (...args: any[]): P} | |
function mixer<P, L>(parentCtors: ConstructType<P>, childCtors: ConstructType<L>): ConstructType<P & L> { | |
const result: any = class extends (parentCtors as any) {} | |
Object.getOwnPropertyNames(childCtors.prototype) | |
.forEach(name => result.prototype[name] = childCtors.prototype[name]) | |
return result | |
} |
#!/usr/bin/env php | |
<?php | |
if (!isset($argv[1])) { | |
$mode = 'record'; | |
} else if (in_array($argv[1], ['record', 'play'])) { | |
$mode = $argv[1]; | |
} else { | |
fwrite(\STDERR, "first parameter must be record or play.\n"); | |
exit(-1); | |
} |
server { | |
listen 8080; | |
server_name laravel.dev; | |
root /var/www; | |
access_log /usr/local/etc/nginx/logs/$host.access.log; | |
location / { | |
include /usr/local/etc/nginx/conf.d/php-fpm; | |
try_files $uri $uri/ /index.php?$query_string; |