Skip to content

Instantly share code, notes, and snippets.

View ospfranco's full-sized avatar

Oscar Franco ospfranco

View GitHub Profile
{
"name": "quack"
}
@ospfranco
ospfranco / build-openssl.sh
Last active October 31, 2024 07:47
Cross-compile OpenSSL 3.X for Android
#!/bin/bash
# This script builds openSSL from source for the Android platform
# while patching some hand-written assembly that fails on Android
# It's useful when trying to use OpenSSL in Rust which tries to
# from the official sources and will therefore fail when launching
# your crate on Android
# Link to the main PR that fixes the sources:
import Cocoa
class _FileIcon: NSView {
let image = NSImageView()
@objc var url: NSString = "" {
didSet {
self.setupView()
}
}
@ospfranco
ospfranco / WebImage.swift
Created January 16, 2022 12:44
React Native macOS Draggable SDWebImage
import Cocoa
import SDWebImage
class InternalWebImage: NSView, NSDraggingSource, NSPasteboardItemDataProvider {
let image = NSImageView()
@objc var url: NSString = "" {
didSet {
self.setupView()
}
const fs = require("fs");
const graph = {};
const file = fs.readFileSync("output2").toString();
file
.split("\n")
.map(l => l.trim())
.map(l => l.split(" -> "))
#!/opt/homebrew/bin/zsh
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title BodyFast Workspaces
# @raycast.mode compact
# Optional parameters:
# @raycast.icon ♻️
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Show WiFi Password
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 📶
# @raycast.packageName Show WiFi Password
@ospfranco
ospfranco / useEventListener.js
Created July 30, 2020 06:32
ReactJS hook for using an event listener
export function useEventListener(eventName: string, handler: () => void) {
let savedHandler = useRef<() => void>()
useEffect(() => {
savedHandler.current = handler
}, [handler])
useEffect(() => {
let eventListener = () => savedHandler.current?.()
[Your event emitter here].addListener(eventName, eventListener)
@ospfranco
ospfranco / useInterval.js
Created July 30, 2020 06:29
ReactJS hook for setting interval
export function useInterval (callback: () => void, delay: number) {
const savedCallback = useRef()
// Remember the latest callback.
useEffect(() => {
savedCallback.current = callback
}, [callback])
// Set up the interval.
useEffect(() => {
@ospfranco
ospfranco / crashalytics_js_stack.js
Created July 27, 2020 14:31
Attach Javascript stack to Crashlytics
// If you are using crashlytics and you cannot update to the latest versions of react-native-firebase (or need sourcemaps which is doesn't support) adding middleware to the error handling can at least provide you with an error stack
//Define an error handler to upload thet stack to crashlytics
const defaultHandler = global.ErrorUtils.getGlobalHandler()
const crashlytics = firebase.crashlytics()
global.ErrorUtils.setGlobalHandler((...args) => {
const error = args[0] || 'Unknown'
//console.log('Crashlytics error sent', error);
if (error instanceof Error) {