Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>V5 vs V6 Search Comparison</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f5f5; color: #333; padding: 24px; line-height: 1.5; }
h1 { font-size: 22px; margin-bottom: 8px; }
h2 { font-size: 18px; margin: 32px 0 12px; padding-bottom: 6px; border-bottom: 2px solid #ddd; }
h3 { font-size: 15px; margin: 20px 0 8px; color: #555; }
.summary-bar { display: flex; gap: 24px; background: #fff; padding: 16px 20px; border-radius: 8px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); flex-wrap: wrap; }
.summary-item { display: flex; flex-direction: column; }
@ninjitaru
ninjitaru / coredata.swift
Created September 10, 2021 07:58
NSAsynchronousFetchRequest test
let asyncRequest = NSAsynchronousFetchRequest(fetchRequest: request) { fetchResult in
// this may or may not right in the same thread as the context thread
// except when the context is main thread, this will always run in main thread
// TODO: can i access NSManagedObject safely if this is not the same thread?
print("ttt: blk thread: \(Thread.current)")
Thread.sleep(forTimeInterval: 100)
guard let dataResult = fetchResult.finalResult else {
return
}
@ninjitaru
ninjitaru / gist:9124fc157363a80b68e7c4c231477d31
Created December 24, 2019 09:35
Get reservation table history
async function printReservation() {
const companyId = '-Kl2_DOjdmBh4Rlj58C1';
const branchId = '-Kl2_DOjdmBh4Rlj58C2';
const db = getCachedAdminDB(companyId);
const tableData = (await db.ref(`branchTables/${companyId}/${branchId}`).once('value')).val();
const tableMap = {};
for (const [sectionId, section] of Object.entries(tableData)) {
for (const [tableId, table] of Object.entries(section.tables)) {
{
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-LuuTCKCHkZS-_MRRLLH/autoTableIds: [
0: "-Kl7-4NnyHWpkLXNXzVj"
]
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-Luuw9YunML-YZ7Jy6Al/autoTableIds: [
0: "-Kl3S7kPpTA9V_570Q7e"
1: "-Kl3S8vGcRe0f4WnEe-Z"
2: "-Kl3SAkzCGky85zAR41B"
3: "-Kl7-7CYtKKHM4-HIUT9"
]
{
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-LuuTCKCHkZS-_MRRLLH/autoTableIds: [
0: "-Kl7-4NnyHWpkLXNXzVj"
]
reservations/-Kl2_DOjdmBh4Rlj58C1/-Kl2_DOjdmBh4Rlj58C2/-Luuw9YunML-YZ7Jy6Al/autoTableIds: [
0: "-Kl3S7kPpTA9V_570Q7e"
1: "-Kl3S8vGcRe0f4WnEe-Z"
2: "-Kl3SAkzCGky85zAR41B"
3: "-Kl7-7CYtKKHM4-HIUT9"
]
const { redis, getSubscriber, subscribeWithSubscriber, publish } = require('applib/redis');
const _ = require('lodash');
// 1 ~ 80ms
// 10 ~ 80ms
// 100 ~ 80ms
// 1000 ~ 90ms
// 10000 ~ 200ms
// spread across 10 client
@ninjitaru
ninjitaru / gist:b82557a6ccad653bc2a0
Last active August 29, 2015 14:11
iOS 8+ open app setting
if(&UIApplicationOpenSettingsURLString) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
@ninjitaru
ninjitaru / gist:88879b4e3cca35ba2e08
Created November 9, 2014 09:04
gen localized string on xcode
genstrings -o zh-Hant.lproj *.m
// only need 112 bit for 14 ascii character
LDPC_Parity_Irregular H;
H.generate(224,
"0 0.27684 0.28342 0 0 0 0 0 0.43974",
"0 0 0 0 0 0.01568 0.85244 0.13188",
"rand", // random unstructured matrix
"500 8"); // optimize girth
LDPC_Generator_Systematic G(&H);
LDPC_Code C(&H, &G);
C.set_exit_conditions(2500);
@ninjitaru
ninjitaru / gist:761d76ac3219a969d054
Last active August 29, 2015 14:01
build facebook aar
cd facebook-sdk/facebook
open build.gradle modify buildToolsVersion
run gradle from compatable version
gradle build
facebook.aar is in build/libs/