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
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 | |
} |
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
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)) { |
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
{ | |
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" | |
] |
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
{ | |
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" | |
] |
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 { redis, getSubscriber, subscribeWithSubscriber, publish } = require('applib/redis'); | |
const _ = require('lodash'); | |
// 1 ~ 80ms | |
// 10 ~ 80ms | |
// 100 ~ 80ms | |
// 1000 ~ 90ms | |
// 10000 ~ 200ms | |
// spread across 10 client |
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(&UIApplicationOpenSettingsURLString) { | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; | |
} |
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
genstrings -o zh-Hant.lproj *.m |
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
// 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); |
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
cd facebook-sdk/facebook | |
open build.gradle modify buildToolsVersion | |
run gradle from compatable version | |
gradle build | |
facebook.aar is in build/libs/ | |
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
git rm $(git ls-files --deleted) | |
git ls-files --deleted --exclude-standard -z | while read -r -d '' file; do | |
git rm "$file" | |
done |
NewerOlder