Skip to content

Instantly share code, notes, and snippets.

View krystofwoldrich's full-sized avatar
🐝
Busy bee, improving my code every day.

Krystof Woldrich krystofwoldrich

🐝
Busy bee, improving my code every day.
View GitHub Profile
chrome.webRequest.onHeadersReceived.addListener(
function (details) {
for (var i = 0; i < details.responseHeaders.length; ++i) {
if (details.responseHeaders[i].name.toLowerCase() == 'x-frame-options') {
details.responseHeaders.splice(i, 1);
return {
responseHeaders: details.responseHeaders
};
}
}
@krystofwoldrich
krystofwoldrich / get-xcode-version.sh
Created September 19, 2022 09:39
Get xcode version in bash
#!/usr/bin/env bash
set -euo pipefail
# Matches the version number from the output of xcodebuild -version
# Example: 13.4.1
xcodeBin=/usr/bin/xcodebuild
xcodeVersionOutput=$($xcodeBin -version)
xcodeVersion=$(echo "$xcodeVersionOutput" | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')
@krystofwoldrich
krystofwoldrich / handy-git.sh
Created January 23, 2023 17:34
Handy git aliases
alias git_delete_no_upstream="git branch --format "%(refname:short) %(upstream)" | awk '{if (!$2) print $1;}' | xargs git branch -D"
@krystofwoldrich
krystofwoldrich / install-ruby-2.sh
Created August 31, 2023 18:59
Sadly the only way to install 2.x.x Ruby
brew install openssl@1.1
brew uninstall --ignore-dependencies openssl@3
rvm install 2.5.1
brew install --ignore-dependencies openssl@3
@krystofwoldrich
krystofwoldrich / example.mm
Last active December 3, 2023 21:54
How to use RN JSI to convert String to UTF8 Bytes (iOS)
// Inspired by https://ospfranco.com/post/2021/02/24/how-to-create-a-javascript-jsi-module/
struct MuttableStringBuffer : facebook::jsi::MutableBuffer {
MuttableStringBuffer(std::string s) : _s(std::move(s)) {}
size_t size() const override {
return _s.length();
}
uint8_t *data() override {
return reinterpret_cast<uint8_t *>(_s.data());