Skip to content

Instantly share code, notes, and snippets.

@ayaysir
ayaysir / delete_proc.php
Created Jan 27, 2021
좋아요 기능이 있는 게시판 http://yoonbumtae.com/phpex
View delete_proc.php
<?php
header('Content-Type: text/html; charset=utf-8');
$seq = $_POST['seq'];
include "initializeDB.php";
$sql = "delete from messages where seq='$seq'";
if($mysqli->query($sql)) {
@ayaysir
ayaysir / Array.swift
Last active Jan 15, 2021
Swift playgrounds
View Array.swift
// ===== Array =====
var evenNumbers: [Int] = [2, 4, 6, 8]
// let evenNumbers: Array<Int> = [2, 4, 6, 8]
// let keyword는 immutable
evenNumbers.append(10)
evenNumbers += [12, 14, 16]
evenNumbers.append(contentsOf: [18, 20])
View image-with-tooltip.html
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.image-container {
position: relative;
@ayaysir
ayaysir / add.js
Created Nov 30, 2020
dynamic module import example
View add.js
let currentIdx = 1
export function add() {
const $ul = document.getElementById("todo-list")
const $li = document.createElement("li")
$li.textContent = `할 일 ${currentIdx++}`
$ul.appendChild($li)
}
View snake.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Snake Game</title>
</head>
<body>
<canvas id="game-canvas" width="400" height="400"></canvas>
@ayaysir
ayaysir / Paginator.java
Last active Aug 26, 2020
페이지네이션(Pagination) 도와주는 프로그램
View Paginator.java
package com.example.awsboard.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 페이지네이션을 위한 숫자 리스트 생성기
*
@ayaysir
ayaysir / MidiApiController.java
Last active Aug 17, 2020
Safari <audio> 태그의 구간 탐색 문제 ("라이브 방송") 해결 코드
View MidiApiController.java
package com.example.awsboard.web;
import com.example.awsboard.config.auth.LoginUser;
import com.example.awsboard.config.auth.dto.SessionUser;
import com.example.awsboard.service.posts.MidiService;
import com.example.awsboard.util.TimidityRunner;
import com.example.awsboard.web.dto.midi.MidiPublicResponseDTO;
import com.example.awsboard.web.dto.midi.MidiRequestDTO;
import com.example.awsboard.web.dto.midi.MidiResponseDTO;
import lombok.RequiredArgsConstructor;
View intersection-observer-infinite-scroll.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IntersecionObserver: infinite scroll example</title>
<style>
body {
padding: 30px;
background-color: gray;
}
View TimidityRunner.java
import java.io.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class TimidityRunner {
// 여기로 보낼 때 루트 패스 포함해서 보냄.
public static File convertMidiToMp3(String midiPath) throws IOException {
Integer lastIndexOfDot = midiPath.lastIndexOf(".");
View tts.html
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<select id="select-lang">