Skip to content

Instantly share code, notes, and snippets.

@pixcelo
pixcelo / Creat_example_database.sql
Created July 5, 2024 08:31
OUTPUT句のテスト用データベース作成クエリ
-- データベースの作成(既存の場合はスキップ)
CREATE DATABASE OutputClauseDemo;
GO
USE OutputClauseDemo;
GO
-- Customersテーブルの作成
CREATE TABLE Customers (
CustomerID INT IDENTITY(1,1) PRIMARY KEY,
@pixcelo
pixcelo / array_merge.js
Created January 27, 2023 22:09
オブジェクトの配列を結合する (重複あり・なし)
const arry1 = [
{id: 1, name: 'Tom'},
{id: 2, name: 'Bob'},
{id: 3, name: 'Jack'}
];
const arry2 = [
{id: 3, name: 'Jack'},
{id: 4, name: 'Robert'},
{id: 5, name: 'Mary'}
@pixcelo
pixcelo / Equipment.cs
Created January 26, 2023 19:24
値なしを表現するクラス
// 装備クラス
class Equipment
{
static Equipment EMPTY = new Equipment("装備なし", 0, 0, 0);
private readonly string name;
private readonly int price;
private readonly int defence;
private readonly int magicDefence;
@pixcelo
pixcelo / HitPoint.cs
Created January 19, 2023 21:46
e.g. RPGのヒットポイントを扱うクラス
public class HitPoint
{
private const int MIN = 0;
private const int MAX = 999;
private readonly int value = 0;
public HitPoint(int value)
{
if (value < MIN)
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pixcelo
pixcelo / shift.ipynb
Created January 7, 2023 05:19
DataFrame.shift()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pixcelo
pixcelo / diff.ipynb
Created January 7, 2023 03:01
DataFrame.diff()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pixcelo
pixcelo / example_joblib.py
Created January 3, 2023 19:44
Joblib で Python タスクを並列化する
import math
import time
from joblib import Parallel, delayed
t1 = time.time()
# 階乗を求める math.factorial(5) => 120 (1x2x3x4x5)
result = [math.factorial(x) for x in range(8000)]
t2 = time.time()
print(t2-t1) # 6.57010817527771
@pixcelo
pixcelo / amCharts5.js
Created October 22, 2022 20:30
amCharts5 Candle Stick Before editing : shapshot in 2022.10.23
<!-- Styles -->
<style>
#chartdiv {
width: 100%;
height: 500px;
max-width: 100%
}
</style>
<!-- Resources -->
@pixcelo
pixcelo / counter.js
Created October 20, 2022 18:58
add ++
const fnFactory = function() {
let n = 0;
function count() {
alert(n);
n++;
}
return count;
}