Skip to content

Instantly share code, notes, and snippets.


Justin Stanley jstheoriginal

View GitHub Profile
steipete /
Last active Jun 11, 2021
Using iOS 15 devices with Xcode 12.5 (instead of Xcode 13)
# The trick is to link the DeviceSupport folder from the beta to the stable version.
# sudo needed if you run the Mac App Store version. Always download the dmg instead... you'll thank me later :)
# Support iOS 15 devices (Xcode 13.0) with Xcode 12.5:
sudo ln -s /Applications/ /Applications/
# Then restart Xcode and reconnect your devices. You will need to do that for every beta of future iOS versions
# (A similar approach works for older versions too, just change the version number after DeviceSupport)
nbasham / UIColor.swift
Last active Jun 7, 2021
Swift 4: Convert CSS color names and RGB hex values to UIColor. UIColor from hex 3, 4, 6, and 8 characters in length with or without # prefix. UIColor to hex. UIColor extension that creates immutable UIColor instances from hexadecimal and CSS color name strings (e.g. ff0, #f00, ff0000, ff0000ff, Pink, aZure, CLEAR, nil). Conversely, you can obta…
View UIColor.swift
// UIColor.swift
// previously Color+HexAndCSSColorNames.swift
// Created by Norman Basham on 12/8/15.
// Copyright ©2018 Black Labs. All rights reserved.
// 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
View Count lines of code in Xcode project
1. Open Terminal
2. cd to your Xcode project
3. Execute the following when inside your target project:
find . -name "*.swift" -print0 | xargs -0 wc -l
jarretmoses / React Native Clear Cache
Last active May 8, 2021
Clearing the Cache of your React Native Project
View React Native Clear Cache
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
View PaginationNetworkLogic.swift
// PaginationNetworkLogic.swift
// Created by Daniel Tartaglia on 4/9/17.
// Copyright © 2019 Daniel Tartaglia. MIT License
import RxSwift
struct PaginationUISource {
beausmith / SVG.js
Created May 23, 2017
React Native SVG Component using react-native-svg
View SVG.js
// React Native SVG Component
// Process
// 1. Clean up SVG in graphics app (Illustrator/Sketch/etc) to set consistent width, height, and make sure the viewBox is "0, 0, W, H"
// 2. Open SVG in text editor to remove width, height, and any undesired/unnecessary styles
// 3. Open in and optimize.
// 4. Integrate info app by converting SVG tags to component-based SVG tags used in and updating with JS variables such that I can controls dimensions, colors, etc.
// 5. Use in other components.
epynic /
Last active Dec 14, 2020
Bash Scripting Zero to Hero Examples
#debugging shellscripts -x would show the scrips line by line and output followed by
#!/bin/bash -x
echo "$TEST_VAR"
#set -x / start debugginh
#set +x / stop
#-ex exit on stop
#-v prints shell before substitution are applied
alfonsomunozpomer / Fetch.test.js
Created Sep 28, 2017
How to test a React component that sets its state in componentDidMount with fetch, and how to mock it, in Jest
View Fetch.test.js
import React from 'react'
import fetchMock from 'fetch-mock'
import Enzyme from 'enzyme'
import {shallow, mount, render} from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })
pranavrajs / escapeChar.js
Created Dec 19, 2016
React-Native Escape Character
View escapeChar.js
function escapeCharAndroid(url, body) {
return fetch(url, { // Use your url here
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
body: JSON.stringify(body)
.then(response => response.text()) // Convert to text instead of res.json()
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
# Install Xcode command line tools.
xcode-select --install