Skip to content

Instantly share code, notes, and snippets.

View nknighta's full-sized avatar

Nknight AMAMIYA nknighta

View GitHub Profile
const anExampleVariable:number [] = [1,2,3,4,5,6,7];
const anExampleVariable2:number [] = [];
anExampleVariable.map(item => {
anExampleVariable2.push(item * 2)
})
console.log(...anExampleVariable2)
@nknighta
nknighta / toggle.jsx
Created January 7, 2024 13:52
React Toggle Button
const WebToggle = () => {
const [toggle, setToggle] = useState<boolean>(false);
toggle ? '#000' : '#fff';
return (
<div>
<h1>WebToggle</h1>
<button onClick={() => {
setToggle(!toggle);
}}
style={{
@nknighta
nknighta / countbtn.js
Created September 26, 2023 07:36
Count-and-Move
import React, {useState} from "react";
export default function Index () {
const [count, setCount] = useState(0);
return (
<>
test ui app
{count}
<div>
//正解
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// 最初の#を追加する
StringBuilder sb = new StringBuilder("#");
for (int i = 0; i < 3; i++ ) {
// 10新数ベースの色入力 (R G B)
int a = sc.nextInt();
import React from 'react';
interface TextBoxState {
text: string;
}
class TextBox extends React.Component<{}, TextBoxState> {
constructor(props: {}) {
super(props);
this.state = {
//クラス名は必ずMainにする必要があります。
import java.util.*;
public class Main {
public static void main(String args[] ) throws Exception {
Scanner sc = new Scanner(System.in);
String s = sc.next();
String s2 = sc.next();
String s3 = sc.next();
int sleng = s.length();
String x = "sss";
if (x.endWith("s") && x.startWith("s") ) {
// other code
}
public class UpperCaseTest {
public static void main (String[] args) {
// toUpperCaseTest
String stunum = "";
String upperStunum = stunum.toUpperCase();
System.out.println(upperStunum);
// toLowerCaseTest
String myName = "";
String lowerStunum = myName.toLowerCase();
@nknighta
nknighta / indexOf_and_substring.java
Created June 19, 2023 01:14
index and substring
public class StrUtil {
public static void main(String[] args) {
// 文字列編集
String str = "aaa/aaaaaaa___________a";
// lastIndexOf -> 一致する複数の文字列の最後のやつを返す
// endStr.length()
String endStr = "/";
int endIndex = str.lastIndexOf(endStr) + endStr.length();
@nknighta
nknighta / .vimrc
Created May 23, 2023 05:49
2023 Vimrc setup
set number
set t_Co=256
set cmdheight=2
set backspace=indent,eol,start
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }