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
#include <WiFi.h> | |
//#include <ESP8266WiFi.h> | |
void setup() { | |
// put your setup code here, to run once: | |
Serial.begin(115200); | |
Serial.println("Hello, ESP32!"); | |
printHardwareInfo(); | |
printBoardName(); | |
printMacIp(); |
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
https://stackoverflow.com/a/73744343/3633498 | |
<br/> | |
<br/> | |
<br/> | |
<input type="file" id="inputImg"> | |
<img src="" id="pic1"> | |
<script> | |
async function compressImage(blobImg, percent) { |
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 { performance } = require('perf_hooks'); | |
const assert = require('assert'); | |
const DURATION_COLUMN = 'time[ns]'; | |
// Create 1000 random numbers | |
const createTestArray = length => Array.from({ length }, () => 1 + Math.floor(Math.random() * 1000)); | |
const createReferenceArray = testArray => testArray.map(v => Math.ceil((v + 2) / 10)); | |
const sumUp = array => array.reduce((sum, value) => sum + value, 0); | |
const computeBenchmark = v => Math.ceil((v + 2) / 10); |
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 {performance} = require('perf_hooks'); | |
// Create 1000 random numbers | |
const arr = length => | |
Array.from({length}, () => Math.floor(Math.random() * 1000)); | |
function record(arr) { | |
const result = []; | |
function timeRun(callback, message) { |
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
{% if first_time_accessed %} | |
<script> | |
(function(dataLayer){ | |
var customer_type = ({{customer.orders_count}} > 1) ? 'repeatcustomer' : 'newcustomer'; | |
var discounts = "{{ order.discounts | map: 'code' | join: ',' | upcase}}"; | |
function strip(text){ | |
return text.replace(/\s+/, ' ').replace(/^\s+/, '').replace(/\s+$/, ''); | |
} |
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 | |
class TextUtil { | |
public static function sanitize($title) { | |
$replacement = '-'; | |
$map = array(); | |
$quotedReplacement = preg_quote($replacement, '/'); | |
$default = array( | |
'/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ|À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ|å/' => 'a', | |
'/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ|È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ|ë/' => 'e', | |
'/ì|í|ị|ỉ|ĩ|Ì|Í|Ị|Ỉ|Ĩ|î/' => '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
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |