Skip to content

Instantly share code, notes, and snippets.


Justin Stanley jstheoriginal

View GitHub Profile
ccabanero / Count lines of code in Xcode project
Created Aug 9, 2014
Count lines of code in Xcode project
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 "*.[hm]" -print0 | xargs -0 wc -l
View CrashReporter.js
import { Client, Configuration } from 'bugsnag-react-native';
module.exports = { // cached singleton instance
instance: null,
create(key, store, codeBundleId) {
if (this.instance === null) {
if (key == null) {
slorber / Lazy.js
Created Apr 23, 2018
Lazy react native comp
View Lazy.js
import React from 'react';
import {InteractionManager, ActivityIndicator} from 'react-native';
import {View} from 'glamorous-native';
const DefaultLoader = (
<View padding={20} alignItems="center" justifyContent="center">
<ActivityIndicator size="large"/>
andymatuschak / MultiDirectionAdjudicatingScrollView.swift
Created Jan 26, 2015
Source for the Khan Academy app's unusual scrolling interactions
View MultiDirectionAdjudicatingScrollView.swift
// MultiDirectionAdjudicatingScrollView.swift
// Khan Academy
// Created by Andy Matuschak on 12/16/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
import UIKit
import UIKit.UIGestureRecognizerSubclass
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
# Install Xcode command line tools.
xcode-select --install
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()
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() })
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
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.
View PaginationNetworkLogic.swift
// PaginationNetworkLogic.swift
// Created by Daniel Tartaglia on 4/9/17.
// Copyright © 2019 Daniel Tartaglia. MIT License
import RxSwift
struct PaginationUISource {