Skip to content

Instantly share code, notes, and snippets.

@sryze
sryze / vscode-settings.json
Last active April 23, 2023 17:15
Visual Studio Code settings
// Place your settings in this file to overwrite the default settings
{
"update.mode": "manual",
"telemetry.telemetryLevel": "off",
"telemetry.enableCrashReporter": false,
"telemetry.enableTelemetry": false,
"editor.fontSize": 15,
"editor.fontFamily": "Source Code Pro Medium",
"editor.fontWeight": "normal",
"editor.unicodeHighlight.ambiguousCharacters": false,
@sryze
sryze / check-repos.sh
Created November 14, 2020 07:04
Find Git repos and check if they are broken
#!/bin/sh
find $1 -name .git -type d -exec sh -c 'echo $(realpath {}/..); cd {}/..; git status > /dev/null' \;
@sryze
sryze / webivew_crash_fix.kt
Last active July 25, 2020 20:51
Fix WebView crash when running on Android emulator: A/libc: Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid XXX (RenderThread), pid YYY
val isHardwareAccelerated =
window.attributes.flags and WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED != 0
if (isHardwareAccelerated) {
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null)
} else {
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null)
}
@sryze
sryze / Preferences.sublime-settings
Created April 18, 2020 20:55
Sublime Text 3 - Settings
{
"color_scheme": "Packages/User/SublimeLinter/base16-ocean.dark (SL).tmTheme",
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"font_face": "Source Code Pro",
"font_size": 11,
"hot_exit": false,
"ignored_packages":
[
"GitStatus",
function mergeArraysKeepOrder(a1, a2) {
var a = [];
var i = 0, j = 0;
while (true) {
for (; i < a1.length; i++) {
if (a2.indexOf(a1[i], j) != -1) {
i++;
break;
}
a.push(a1[i]);
# Put this in /etc/profile.d/history_up_down_keys.sh
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
@sryze
sryze / capitalize.js
Last active January 7, 2020 13:04
Capitalize every word in a string
export function capitalizeWords(text) {
let result = '';
let wordCharIndex = 0;
for (let i = 0; i < text.length; i++) {
let c = text.charAt(i);
if (/\s/.test(c)) {
wordCharIndex = 0;
} else {
if (wordCharIndex == 0) {
c = c.toUpperCase();
@sryze
sryze / cdump.c
Last active January 4, 2019 03:27
Generate C code from a file
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char **argv)
{
FILE *file;
FILE *out_file;
unsigned char c;
@sryze
sryze / patch-xcode-projects.sh
Created December 16, 2018 07:31
Suppress "Update to recommended settings" warnings in Xcode projects of third-party React Native packages
#!/bin/sh
# Add this to your postinstall script in package.json:
# "scripts": {
# "postinstall": "path/to/patch-xcode-projects.sh"
# }
if [[ "$(uname -a)" = *"Darwin"* ]]; then
echo "Patching Xcode projects"
for project in $(find node_modules -name '*.pbxproj'); do
@sryze
sryze / clear-react-native-shit.sh
Last active December 5, 2018 16:51
Clear react-native caches on macOS (to fix some weird ass bug / make things work again)
#!/bin/sh
rm -rf $TMPDIR/metro-*
rm -rf $TMPDIR/haste-*
watchman watch-del-all