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
const makeDateRangeRegexp = (from, to) => { | |
const indices = Array.from('01235689') | |
const unders = indices.map(i => { | |
const digit = from[i] | |
return digit > 0 ? from.slice(0, i) + `[0-${digit - 1}]` : null | |
}) | |
const overs = indices.map(i => { |
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
VERSION 1.0 CLASS | |
BEGIN | |
MultiUse = -1 'True | |
Persistable = 0 'NotPersistable | |
DataBindingBehavior = 0 'vbNone | |
DataSourceBehavior = 0 'vbNone | |
MTSTransactionMode = 0 'NotAnMTSObject | |
END | |
Attribute VB_Name = "CdeclCallback" | |
Attribute VB_GlobalNameSpace = False |
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
Option Explicit | |
Public Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _ | |
Destination As Any, _ | |
Source As Any, _ | |
ByVal Length As Long) | |
Public Function sprintf(ByRef FormatString As String, ParamArray Arguments() As Variant) As String | |
Dim h As OLE_HANDLE | |
Dim hTerm As OLE_HANDLE |
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.addEventListener('DOMContentLoaded', _ => { | |
const canvas = document.querySelector('#canvas') | |
const context = canvas.getContext('2d') | |
context.font = '300px "Yu Mincho"' | |
context.fillStyle = 'white' | |
context.fillRect(0, 0, canvas.width, canvas.height) | |
context.textBaseline = 'top' |
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.addEventListener('DOMContentLoaded', _ => { | |
const x0208 = [ 0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0x005C,0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,0x3012,0x2192,0x2190,0x2191,0x2193,0x3013,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,0x2220,0x22A5,0x2312,0x2202,0x2207,0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x223 |
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.addEventListener('DOMContentLoaded', _ => { | |
const x0208 = [ 0x3000,0x3001,0x3002,0xFF0C,0xFF0E,0x30FB,0xFF1A,0xFF1B,0xFF1F,0xFF01,0x309B,0x309C,0x00B4,0xFF40,0x00A8,0xFF3E,0xFFE3,0xFF3F,0x30FD,0x30FE,0x309D,0x309E,0x3003,0x4EDD,0x3005,0x3006,0x3007,0x30FC,0x2015,0x2010,0xFF0F,0x005C,0x301C,0x2016,0xFF5C,0x2026,0x2025,0x2018,0x2019,0x201C,0x201D,0xFF08,0xFF09,0x3014,0x3015,0xFF3B,0xFF3D,0xFF5B,0xFF5D,0x3008,0x3009,0x300A,0x300B,0x300C,0x300D,0x300E,0x300F,0x3010,0x3011,0xFF0B,0x2212,0x00B1,0x00D7,0x00F7,0xFF1D,0x2260,0xFF1C,0xFF1E,0x2266,0x2267,0x221E,0x2234,0x2642,0x2640,0x00B0,0x2032,0x2033,0x2103,0xFFE5,0xFF04,0x00A2,0x00A3,0xFF05,0xFF03,0xFF06,0xFF0A,0xFF20,0x00A7,0x2606,0x2605,0x25CB,0x25CF,0x25CE,0x25C7,0x25C6,0x25A1,0x25A0,0x25B3,0x25B2,0x25BD,0x25BC,0x203B,0x3012,0x2192,0x2190,0x2191,0x2193,0x3013,0x2208,0x220B,0x2286,0x2287,0x2282,0x2283,0x222A,0x2229,0x2227,0x2228,0x00AC,0x21D2,0x21D4,0x2200,0x2203,0x2220,0x22A5,0x2312,0x2202,0x2207,0x2261,0x2252,0x226A,0x226B,0x221A,0x223D,0x221D,0x223 |
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 | |
declare(strict_types=1); | |
namespace Damn\IO; | |
use ZipArchive; | |
class ExcelWriter | |
{ |
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
const encodeWindows31J = text => { | |
const range = (from, to) => [...Array(to - from + 1).keys()].map(b => b + from) | |
const islead = b => (b >= 0x81 && b <= 0x9F) || (b >= 0xe0 && b <= 0xef) | |
const follows = [...range(0x40, 0x7e), ...range(0x80, 0xfc)] | |
const decoder = new TextDecoder('Windows-31J') | |
const sbmap = b => ({ [decoder.decode(new Uint8Array([b]))]: [b] }) | |
const dbmap = l => follows.reduce((mapping, f) => ({ ...mapping, [decoder.decode(new Uint8Array([l, f]))]: [l, f] }), {}) |
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
using Microsoft.VisualBasic; | |
using NlsTest; | |
using System; | |
using System.Globalization; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
const int COMPARE_STRING = 1; | |
const int NORM_IGNOREWIDTH = 0x00020000; |
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
const ranks = (values, comparator = (a, b) => b - a) => values | |
.map((value, i) => [value, i]) | |
.slice().sort(([a], [b]) => comparator(a, b)) | |
.reduce((ranks, [value, i], rank, ordered) => [ | |
...ranks.slice(0, i), | |
rank && !comparator(value, ordered[rank - 1][0]) ? ranks[ordered[rank - 1][1]] : rank + 1, | |
...ranks.slice(i + 1), | |
], Array.from({length: values.length})) |