Skip to content

Instantly share code, notes, and snippets.

@kawanet
kawanet / string_to_buffer.js
Last active May 16, 2024 10:35
String と ArrayBuffer の相互変換 JavaScript
// 文字列から ArrayBuffer への変換
function string_to_buffer(src) {
return (new Uint16Array([].map.call(src, function(c) {
return c.charCodeAt(0)
}))).buffer;
}
// ArrayBuffer から文字列への変換
@syokunin
syokunin / validation.php
Last active December 30, 2021 02:45
Laravel 5.1 日本語バリデーションメッセージファイル
<?php // resources/lang/ja/validation.php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
@sergiodxa
sergiodxa / async-thread.js
Last active June 27, 2023 05:38
Use WebWorkers and promises to run sync heavy functions in a worker (process) and get the result in a promise
function asyncThread(fn, ...args) {
if (!window.Worker) throw Promise.reject(
new ReferenceError(`WebWorkers aren't available.`)
);
const fnWorker = `
self.onmessage = function(message) {
(${fn.toString()})
.apply(null, message.data)
.then(result => self.postMessage(result));
@artixnous
artixnous / php-fpm
Created March 18, 2017 23:30
php-fpm-openrc
#!/usr/bin/openrc-run
set_phpvars() {
PHP_FPM_CONF="/etc/php/php-fpm.conf"
PHP_FPM_PID="/run/php-fpm.pid"
}
extra_commands="depend"
extra_started_commands="reload"

タイトルで出オチ。

説明

visibility:hiddenしたフォームコントロールはタブフォーカスできない(タブオーダーから外れる)ことに気が付きました。

display:noneしたフォームコントロールがタブフォーカスできないのは知っていたし理解できるけど、visibility

  • 見えてるか見えてないか」の表示性を表すプロパティであり、
  • displayのように存在までなくしてしまうわけではない
@gangsta
gangsta / SSL.md
Last active March 9, 2025 17:07
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr
public class ProductReadModel
{
public ProductReadModel(ProductAddedEvent @event)
{
Id = @event.Id;
Name = @event.Name;
CategoryId = @event.CategoryId;
OrderAmount = 0;
Review = new ReviewReadModel();
@r3-yamauchi
r3-yamauchi / App.js
Last active March 3, 2022 16:07
aws-amplify-react の withAuthenticator HOC を日本語化する
import Amplify from 'aws-amplify';
import aws_exports from './aws-exports';
import { withAuthenticator } from 'aws-amplify-react';
import { I18n } from 'aws-amplify';
Amplify.configure(aws_exports);
const dict = {
'ja': {
'User does not exist.': "ユーザー名またはパスワードが正しくありません",