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
'use client'; | |
import { useRouter } from 'next/navigation'; | |
import { useState } from 'react'; | |
import Link from 'next/link'; | |
import { useAppDispatch } from '@/hooks/redux-hooks'; | |
import { asyncCreateThread } from '@/lib/threads/action'; | |
import Alert from '@/components/alert'; | |
import useInput from '@/hooks/use-input'; | |
import Editor from './editor'; |
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 { | |
describe, | |
test, | |
expect, | |
afterEach, | |
beforeAll, | |
vi, | |
} from 'vitest'; | |
import { render, screen, cleanup } from '@testing-library/react'; | |
import userEvent from '@testing-library/user-event'; |
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 Solution | |
{ | |
/** @var array SYMBOLS This is roman symbols cannot loop */ | |
const SYMBOLS = ['V' => 5, 'L' => 50, 'D' => 500]; | |
/** @var array LOOP_SYMBOLS This is roman symbols can loop */ | |
const LOOP_SYMBOLS = ['I' => 1, 'X' => 10, 'C' => 100, 'M' => 1000]; |
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
document.getElementById("floatTextBox").addEventListener('input', function (event) { | |
// jika value yang dimasukkan pertama adalah karakter (-), langsung keluar dari function | |
if(this.value === '-') return 0; | |
// selain dari itu, jika value input cocok dengan expression | |
if(/^-?\d+(,|\.)?\d*$/.test(this.value)) { | |
// set oldValue = value input dan keluar dari function | |
this.oldValue = this.value; return 0; |
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
document.getElementById("floatTextBox").addEventListener('keyup', function (event) { | |
// jika yang ditekan bukan backspace dan del | |
if(event.keyCode !== 8 && event.keyCode !== 46) { | |
// jika value cocok dengan expression | |
if(/^-?\d+(,|\.)?\d*$/.test(this.value)) { | |
// set oldValue = value dan keluar dari function; | |
this.oldValue = this.value; return 0; |