Skip to content

Instantly share code, notes, and snippets.

taroyanaka: USにおけるランサーズのようなWebサービス

GitHub Copilot: 米国におけるランサーズのようなWebサービスとしては、以下のようなものがあります。

  1. Upwork
  2. Freelancer
  3. Fiverr
  4. Guru
  5. Toptal
@taroyanaka
taroyanaka / sample_error_handling.js
Created June 29, 2023 08:13
sample_error_handling of try catch
const any_fn = () => {
try {
const any_fn_2 = () => {
try {
(()=>{throw new Error('any_fn_2のエラー1')})();
(()=>{throw new Error('適当なエラーを起こす')})();
console.log('OK');
} catch (error) {
// (()=>{throw new Error('any_fn_2のエラー2')})();
<!DOCTYPE html>
<html>
<head>
<title>広告収入計算</title>
<script type="text/javascript">
function calculateAdRevenue() {
// 入力値の取得
// 広告収入の計算
// 1000000 * 30 * 1 が 20000円になる場合の計算式
var views = parseInt(document.getElementById("views").value);
taroyanaka: vue.jsとsvelteの以下の対応をサンプルコードでそれぞれ出力して
2 way data bind
v-model
v-for
@click
$refs
mounted
async/await
GitHub Copilot: 以下はVue.jsとSvelteのサンプルコードです。
const data = [
{
"dups_parent_id": 7,
"dups_parent_created_at": "2023-04-25T09:41:18.743Z",
"dups_parent_updated_at": "2023-04-25T09:41:18.743Z",
"user_name": "name1",
"dups_content_group_id": 0,
"dups_content_1": "aaBBccDD",
"dups_content_2": "aa\nEF\nHI",
"dups_content_3": "XX\nef\nhi"
@taroyanaka
taroyanaka / wiki_image.json
Last active March 25, 2023 18:06
JSON string
"[\"https://raw.githubusercontent.com/taroyanaka/javascript/master/asset/2023-03-26%202.26.25.png\",\"https://raw.githubusercontent.com/taroyanaka/javascript/master/asset/2023-03-26%202.27.19.png\",\"https://raw.githubusercontent.com/taroyanaka/javascript/master/asset/2023-03-26%202.28.20.png\"]"
@taroyanaka
taroyanaka / book_data.json
Last active March 23, 2023 12:24
json string
"[\"https://online.fliphtml5.com/hhom/ayvb/files/large/1.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/2.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/3.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/4.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/5.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/6.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/7.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/8.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/9.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/10.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/11.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/12.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/13.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/14.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/15.jpg\",\"https://online.fliphtml5.com/hhom/ayvb/files/large/16.jpg\",\"https://online.fliphtml5.com/hhom/ayv
Delete q_a with auth
taro yanaka
// '/delete_q_a'というPOSTのリクエストを受け取るエンドポイントで、nameとpasswordを受け取り、nameとpasswordが一致する場合は、q_aのidが一致するものを削除する
app.post('/delete_q_a', (req, res) => {
const now = new Date().toISOString();
const [name, password, id] = [req.body.name, req.body.password, req.body.id];
const user = db.prepare('SELECT * FROM users WHERE name = ? AND password = ?').get(name, password);
if (user) {
@taroyanaka
taroyanaka / reactjs_sample.html
Last active March 9, 2023 12:42
reactjs_sample for me
<!DOCTYPE html>
<html>
<head>
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
</head>
<body>
<div class="react_app"></div>
<script type="text/babel">
-- Usersテーブルを作成
CREATE TABLE Users (
user_id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
password TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
created_at TEXT NOT NULL
);
-- Tweetsテーブルを作成