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
// Motivation: | |
var formatted = new Intl.NumberFormat('de-DE', { | |
style: 'currency', | |
currency: 'EUR', | |
}).ormat(1332123.55); | |
// This will format currency however 1 million iterations take 27.000 ms | |
// Caching the formatter is faster at 440 ms | |
var formatter = new Intl.NumberFormat('de-DE', { | |
style: 'currency', | |
currency: 'EUR', |
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 campaigns = [ | |
@foreach($facebookCampaigns as $campaign) | |
{ id: '{{ $campaign->id }}', text: `{!! addslashes($campaign->name) !!}` }, | |
@endforeach | |
]; | |
window.campaigns = campaigns; | |
const products = [ | |
@foreach($wooCommerceProducts as $product) | |
{ id: '{{ $product->product_id }}', text: `{!! addslashes($product->name) !!}` }, | |
@endforeach |
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
// Initialize a FlexSearch Document index with typo-tolerance and partial matching for products | |
const flexIndex = new FlexSearch.Document({ | |
preset: 'match', | |
charset: "latin:advanced", | |
tokenize: "full", | |
resolution: 20, | |
document: { | |
id: "id", | |
index: [ | |
{ |
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
Essentially: | |
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento {command} -vvv | |
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento deploy:mode:set production -vvv | |
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento indexer:reindex -vvv | |
PHP_MEMORY_LIMIT=-1 php -d memory_limit=-1 -d display_errors=1 -d display_startup_errors=1 bin/magento deploy:mode:set default -vvv | |
php bin/magento maintenance:status | |
php bin/magento maintenance:disable |
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
日立製作所は4日、家電量販店などが勝手に値引きできない家電の「指定価格制度」を始めた。長年、量販店に握られてきた価格の決定権をメーカーの手に戻そうとする動きで、国内家電大手ではパナソニックに次ぐ2社目。今後、業界でどこまで広がるかが注目される。 子会社の日立グローバルライフソリューションズ(GLS)が4日、11月に発売する最新のドラム式洗濯乾燥機「ビッグドラム」2機種を発表した。価格は洗濯容量13キロの製品が37万円前後(税込み)、12キロが33万円前後(同)の予定。価格は日立による指定で、制度に参加する量販店や通販サイトなど、「正規取扱店」約1万5千店舗で販売する。 メーカーによる価格の拘束は独占禁止法で禁じられている。ただ、今回の制度は店からの返品を受け付け、売れ残りのリスクを日立が負う形にすることで、法的な問題をクリアしたという。今後、11月以降に発売する洗濯機や冷蔵庫などの白物家電の1割程度、主に付加価値の高い製品を対象にする見込みだ。 |
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 big_zero = BigInt(0); | |
const big_16 = BigInt(16); | |
const big_2p16m1 = BigInt(2**16-1); // 0xFFFFn | |
function bigIntToUint16Array(bigInt) { | |
const bitLength = Math.ceil(Math.log2(Number(bigInt) + 1)); | |
const arrayLength = (bitLength + 15) >>> 4; | |
const uint16Array = new Uint16Array(arrayLength); | |
let tempValue = bigInt; | |
for (let i = 0; i < arrayLength; 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
const mailRegex = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi | |
function getValidMails(str){ | |
return Array.from(str.matchAll(mailRegex)) | |
} | |
function containsValidEmail(str){ | |
return getValidMails(str).length>0 | |
} | |
function isValidEmail(str){ | |
let mail = str.match(mailRegex); | |
return mail && mail[0].length === str.length; |
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
Quantum Safe Algorithms: | |
https://openquantumsafe.org/liboqs/algorithms/ | |
Quantum Safe openssl implementation (Open Quantum Safe): | |
https://github.com/open-quantum-safe/openssl | |
Note: Combination of classical and quantum algorithms via <classical_tag>_<quantum_tag> possible. | |
Open Quantum Safe examples for popular applications: | |
https://github.com/open-quantum-safe/oqs-demos | |
Signature schemes: |
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
{{template config_path="design/email/header_template"}} | |
<table> | |
<tr class="email-intro"> | |
<td> | |
<p class="greeting">{{trans "%customer_name," customer_name=$order_data.customer_name}}</p> | |
<p> | |
{{trans "Thank you for your order from %store_name." store_name=$store.frontend_name}} | |
{{trans "Once your package ships we will send you a tracking number."}} | |
{{trans 'You can check the status of your order by <a href="%account_url">logging into your account</a>.' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}} |
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
// Primitives, Date, RegExp, Functions, all Arrays, Object, Object with null Prototype, all Errors, circular Objects, Map, Set, Fuction Arguments | |
// ToDo: self referencing structures are not correcly handled (in certain cases non-self referencing structures are falsely labeled), but they never fail to stringify | |
// Notes: https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript/53263848#53263848 | |
var objectHash = (function(){ | |
var primitiveTypes = new Set(); | |
primitiveTypes.add('Date'); | |
primitiveTypes.add('RegExp'); | |
primitiveTypes.add('Number'); | |
primitiveTypes.add('String'); | |
primitiveTypes.add('Boolean'); |
NewerOlder