Skip to content

Instantly share code, notes, and snippets.

View stargt's full-sized avatar
🐔
Fried chicken

stargt stargt

🐔
Fried chicken
View GitHub Profile
@stargt
stargt / NSObject+class_copyPropertyList.swift
Created March 21, 2024 08:22 — forked from codelynx/NSObject+class_copyPropertyList.swift
Use class_copyPropertyList to extract properties from NSObject based object,
// source:
// https://stackoverflow.com/questions/24750186/i-cant-get-properties-of-a-class-using-swift-by-class-copypropertylist
import Foundation
extension NSObject {
func dictionaryRepresentation() -> [String: Any] {
@stargt
stargt / macOS Internals.md
Created May 7, 2023 04:49 — forked from kconner/macOS Internals.md
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@stargt
stargt / Xcode_version_from_package.sh
Created December 7, 2022 05:41 — forked from wynch/Xcode_version_from_package.sh
React Native - Set Gradle & XCode build version from package.json
#!/usr/bin/env bash -e
##
## Automatic version from package.json file
##
## Call this script from your XCode Scheme:
## - Copy / paste this script in a .sh file
## - Open your app scheme in XCode (shortcut: Cmd + <)
## - go to Build > Pre-actions
## - Add a run Script ('+' button in scheme window > "New Run Script Action"
@stargt
stargt / nvmlink
Created November 29, 2022 09:43 — forked from MeLlamoPablo/nvmlink
Creates a symlink to /usr/bin/node after using nvm
@stargt
stargt / App.tsx
Created August 31, 2022 07:05 — forked from robertohein/App.tsx
React Native WebView persist state from localStorage on AsyncStorage and load state from AsyncStorage (useful with redux-persist)
import React, { useEffect, useRef, useState } from 'react';
import { StyleSheet } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { SafeAreaView } from 'react-native-safe-area-context';
import WebView, { WebViewMessageEvent } from 'react-native-webview';
import { StatusBar } from 'expo-status-bar';
enum MessageTypes {
@stargt
stargt / web-servers.md
Created January 18, 2020 18:25 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@stargt
stargt / expand-collapse.java
Created April 11, 2019 07:57 — forked from ZkHaider/expand-collapse.java
Simple Expand / Collapse RecyclerView Item
public static class ExampleViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private int originalHeight = 0;
private boolean isViewExpanded = false;
private YourCustomView yourCustomView
public ExampleViewHolder(View v) {
super(v);
v.setOnClickListener(this);
@stargt
stargt / dispatch-touch-event.coffee
Created June 4, 2018 05:14 — forked from morewry/dispatch-touch-event.coffee
Programmatically trigger touch event
# http://codepen.io/morewry/pen/pvLxPV
# manually create touch event
touchStartOn = (el, x = 0, y = 0) ->
try
e = document.createEvent('TouchEvent')
e.initTouchEvent("touchstart", true, true)
catch err
try
e = document.createEvent('UIEvent')
function b64EncodeUnicode(str) {
return btoa( unescape( encodeURIComponent( str ) ) );
}
function b64DecodeUnicode(str) {
return decodeURIComponent( escape( atob( str ) ) );
}