Skip to content

Instantly share code, notes, and snippets.

View joncardasis's full-sized avatar
Hold on a sec. My pour over is on its second bloom.

Jon Cardasis joncardasis

Hold on a sec. My pour over is on its second bloom.
View GitHub Profile
@thehappydinoa
thehappydinoa / $React.png
Last active March 17, 2024 16:14
Awesome React Native
$React.png
@Venryx
Venryx / Example.tsx
Last active February 9, 2023 22:36
Using "useImperativeHandle" in a React functional component, with automatic TypeScript typing
import {forwardRef, useImperativeHandle, ForwardRefExoticComponent, RefAttributes, Ref} from "react";
export type Handle<T> = T extends ForwardRefExoticComponent<RefAttributes<infer T2>> ? T2 : never;
export const Parent = (props: {})=> {
let childHandle: Handle<typeof Child>;
return (
<div onClick={()=>childHandle.SayHi()}>
<Child name="Bob" ref={c=>childHandle = c}/>
</div>
@efrapp
efrapp / howto-setup-sidekiq-on-heroku.md
Last active October 30, 2024 19:54
Steps to setup Sidekiq on Heroku

Setup Sidekiq for Heroku

Install Heroku Redis Add-on

Option 1: Using the dashboard

Go to the Resources tab and in the Add-ons section type Heroku Redis in the search field. It will appear in the search list. Click on it and a modal will show up to install it, click in the Provision button to start the installation.

@mbret
mbret / metro.config.js
Last active October 1, 2019 16:06
Symlink for React Native 0.59 (symlink + scoped package + hast name collision)
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const {
getSymLinkedModules,
getBlacklistedModulesForAlternateRoot,
getExtraModulesForAlternateRoot,
@joncardasis
joncardasis / optimizeImage.sh
Created April 5, 2019 20:28
Compresses and optimizes png image sizes for a given file or directory via pngquant.
#!/bin/bash
# Compresses and optimizes png image sizes for a given file or directory.
# @author: Jonathan Cardasis
CHECK_MARK="\033[0;32m\xE2\x9C\x94\033[0m"
PNGQUANT_BINARY_URL="https://pngquant.org/pngquant.tar.bz2"
optimize() {
ORIGINAL_PATH="$1"
NEW_PATH="$ORIGINAL_PATH.new"
@pcmaffey
pcmaffey / Code.gs
Last active September 19, 2023 15:56
Roll your own analytics - Google Apps Script for writing custom analytics to Google Sheets
// original from: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
// original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6
// NOTE: Uses es5 javascript
// handle method: get
function doGet(e){
return handleResponse(e);
}
// handles method: post
function doPost(e){
@atereshkov
atereshkov / podspec-example
Last active April 29, 2023 16:11
Xcode 10 Fat framework - How to create universal binary iOS framework (+ Cocoapods podspec)
If you've got something like this:
file was built for arm64 which is not the architecture being linked (x86_64):
Than this gist is for you.
Let's say you have already developed the framework itself and just want to build the binary
and distribute it through the Cocoapods.
1. Make sure your framework "Deployment Target" is equal to all the dependencies from your podspec file.
@joncardasis
joncardasis / FVPasswordManager.py
Created May 3, 2018 20:17
A python script to check if a FileVault password has ever been used on macOS before.
import os, sys
import re
import base64
import hashlib
import plistlib
from binascii import unhexlify
class FVPasswordManager(object):
PL_SALTED_HASH_ARRAY_KEY = 'SALTED-SHA512-PBKDF2'
@joncardasis
joncardasis / DebugLogger.swift
Last active July 25, 2024 18:49
Reroute print and NSLogs to BOTH Xcode console and a file url [Swift + ObjC Solutions]
//
// DebugLogger.swift
//
// Created by Jonathan Cardasis. on 1/1/18.
// Copyright ©2018 Jonathan Cardasis. All rights reserved.
//
#if DEBUG
import Foundation
@Bashta
Bashta / SnappCameraView.swift
Last active June 28, 2019 15:08
Basic implementation of camera scanner for rectangles.
//
// SnappCameraView.swift
// EdgeDetection
//
// Created by er on 11/4/17.
// Copyright (c) 2017 Erison Veshi
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights