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 changeTimeZone = (date: Date, timeZone: string) => | |
new Date( | |
date.getTime() - | |
(date.getTime() - | |
new Date(date.toLocaleString("en-US", { timeZone })).getTime()) | |
); | |
const dateTimeLocalValue = (date: Date) => { | |
const pad = (value: number) => value.toString().padStart(2, "0"); | |
return ( |
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
{ | |
"configurations": [ | |
{ | |
"name": "dev", | |
"request": "launch", | |
"runtimeExecutable": "pnpm", | |
"runtimeArgs": ["vite", "--host", "--open"], | |
"type": "node" | |
} | |
] |
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
<script> | |
navigator.serviceWorker.register('/sw.js').then(() => history.go(0)) | |
</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
<script> | |
var width = 5; | |
var height = 5; | |
var length = 10; | |
var possible_directions = [ | |
[0, -1, "↑"], // up | |
[0, 1, "↓"], // down | |
[-1, 0, "←"], // left | |
[1, 0, "→"], // right |
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 html = function (text) { | |
return text | |
.replace(/&/g, '&') | |
.replace(/</g, '<') | |
.replace(/>/g, '>') | |
.replace(/"/g, '"') | |
.replace(/'/g, ''') | |
} | |
var userName = 'John' |
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
<?php | |
class Pluralize | |
{ | |
function pluralize($word) | |
{ | |
return $this->replaceWord( | |
$word, | |
$this->irregularSingles, | |
$this->irregularPlurals, |
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
<?php | |
function create_group($symbols, $prefix) | |
{ | |
return (object) [ | |
'tag' => 'group', | |
'symbols' => $symbols, | |
'prefix' => $prefix, | |
'key' => 0, | |
'used' => [] |
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 { patch, begin, end, text } from "./immediate.js"; | |
var count = 0; | |
function tick(event) { | |
if (event.type === "click") { | |
if (event.target.id === "increment") { | |
count++; | |
} else if (event.target.id === "decrement") { | |
count--; |
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
<?php | |
namespace tiny_blade; | |
function _replace(string $template): string | |
{ | |
// @endif | |
$template = preg_replace('/^\s*@(end.+?)\s*$/m', '<?php $1 ?>', $template); | |
// @if ($foo) | |
$template = preg_replace('/^\s*@(.+?)\s*$/m', '<?php $1: ?>', $template); |
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
<?php | |
/** | |
* @method static Tag a() | |
* @method static Tag audio() | |
* @method static Tag body() | |
* @method static Tag br() | |
* @method static Tag button() | |
* @method static Tag div() | |
* @method static Tag form() |
NewerOlder