Skip to content

Instantly share code, notes, and snippets.

@co3moz
co3moz / lock.ts
Last active July 17, 2019 02:47
Locking mechanism for critical tasks with basic deadlock prevention and acquire timeout features
export class Lock {
private chain: Promise<any> = Promise.resolve(null);
busy = false;
acquire(deadlockSafeTimeout = 0, acquireTimeout = 0) {
let acquireTimeoutId: any = null;
let acquireFailed = false;
let unlock: () => void;
let unlockingPromise = new Promise(r => unlock = r);
@Kudo
Kudo / Steps_for_WebkitGTK_2_24_2.md
Last active September 5, 2023 10:16
Steps to integrate experimented JSC

Intro

Here are the steps to integrate experimented JavaScriptCore. Hopefully this could solve the JSC crash issue on RN 0.59.

Steps (for RN 0.59)

  1. yarn add 'jsc-android@next'
  2. Modify build.gradle files.
diff --git a/android/app/build.gradle b/android/app/build.gradle
@alvr
alvr / packages.md
Last active April 14, 2024 10:51
Available Packages

Available Packages:

Path Version Description
add-ons;addon-google_apis-google-15 3 Google APIs
add-ons;addon-google_apis-google-16 4 Google APIs
add-ons;addon-google_apis-google-17 4 Google APIs
add-ons;addon-google_apis-google-18 4 Googl
@arjunv
arjunv / keyevents.json
Created December 2, 2018 00:01
All Android Key Events for usage with adb shell
{
"key_events": {
"key_unknown": "adb shell input keyevent 0",
"key_soft_left": "adb shell input keyevent 1",
"key_soft_right": "adb shell input keyevent 2",
"key_home": "adb shell input keyevent 3",
"key_back": "adb shell input keyevent 4",
"key_call": "adb shell input keyevent 5",
"key_endcall": "adb shell input keyevent 6",
"key_0": "adb shell input keyevent 7",
@co3moz
co3moz / thecrims-bukakale.js
Last active May 21, 2018 15:09
thecrims-bot
var getRobberies = function (done) {
console.log('%c Soygun seçiliyor.', 'background: black; color: white')
$.ajax({
type: "GET",
url: 'https://www.thecrims.com/api/v1/robberies',
success: function (res) {
done(res.single_robberies
.filter(robbery => robbery.successprobability == 100)
.sort((a, b) => b.difficulty - a.difficulty)
.find((x, index) => index == 0))
@unnamedd
unnamedd / apns.sh
Last active October 28, 2020 10:12 — forked from greencoder/apns.sh
cURL the APNS HTTP/2 API
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>

Note

Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.

Updates

  • [UPDATE 4] iOS 10 update: apparently settings now can be reached using App-Pref instead of prefs
  • [UPDATE 3] For now you just can use url schemes to open your apps's settings with Swift 3.0 (Xcode 8). I'll keep you informed when OS preferences can be reached
  • [UPDATE 2] The openURL() method of UIApplication is now deprecated. You should use application(_:open:options:) instead
  • [UPDATE 1] Not yet tested in iOS 10. It will fail because of policies changes in URL scheme handling.
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active June 28, 2024 20:49
React Native Bridging Cheatsheet

genel

isim değiştirme ve ayar moduna girme

  • CIHAZ> enable
  • CIHAZ# configure terminal
  • CIHAZ(config)# hostname isim
  • isim(config)# exit

ayarları kaydetme

  • isim(config)# exit (ten sonra)
  • isim# write
@erayarslan
erayarslan / observer_pattern.js
Created May 9, 2016 14:07
observer pattern for js
var Observable = function () {
this.observers = [];
};
Observable.prototype.register = function ($) {
if (this.observers.indexOf($) == -1) {
this.observers.push($);
}
};