Skip to content

Instantly share code, notes, and snippets.

@christophermark
christophermark / setIosVersion.sh
Last active January 9, 2024 13:13
Shell script to set the iOS version of a project
# Prints out the iOS version number
printIosVersion() {
sed -n 'N;s/.*CFBundleShortVersionString.*>\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' ios/Compass/Info.plist
}
# Sets the iOS version number
#
# {$1} The new version number to set
###### Documentation ######
# sed -i '' ' # -i '' will modify the file and save it
@christophermark
christophermark / jestSetSystemTime.js
Created December 7, 2020 19:38
Forcing system time for jest tests
/**
* Set the system time for our tests.
* This ensures that our tests can't fail based on the local time of the CI machine.
* This guards against app code where the behavior changes based on the device time.
* For example, a test might fail if we attempt to set the search time "before now".
*/
beforeAll(() => {
// @TODO: 'modern' is default once we upgrade to Jest 27 https://jestjs.io/blog/2020/05/05/jest-26#new-fake-timers
jest.useFakeTimers("modern");
const JS_DATE_11_AM = new Date(new Date().setHours(11, 0, 0, 0));
@christophermark
christophermark / listServerSideCipherSuites.md
Created December 3, 2020 02:18 — forked from gotev/listServerSideCipherSuites.md
List server-side cipher suites

On OS X:

brew install nmap
nmap --script ssl-enum-ciphers -p 443 example.server.com

Example output

Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-18 15:34 CEST
Nmap scan report for example.server.com (1.2.3.4)
Host is up (0.036s latency).
@christophermark
christophermark / list_git_files_by_extension
Created October 5, 2020 16:26
List git files by extension
git status | egrep -v '.js|.png'
@christophermark
christophermark / diffs.js
Last active August 22, 2020 13:37
Log the diffs between props in a react component
componentDidUpdate(prevProps) {
console.log("Render update diff:");
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined && val !== undefined) return true;
if (prevProps[key] !== val) {
console.log(`${key}
+ ${JSON.stringify(val)}
- ${JSON.stringify(prevProps[key])}`);
@christophermark
christophermark / adbCommand
Created April 29, 2020 18:27
ADB Constant logging debugging into logcat
adb logcat '*:W' > logcatWarningsAndErrors.txt
@christophermark
christophermark / play_store_research.md
Last active October 13, 2022 16:06
Play Store Research
@christophermark
christophermark / eslint_cheatsheet.md
Last active March 25, 2019 14:27
ESLint Cheatsheet

Print ESLint Rules

./node_modules/eslint/bin/eslint.js --print-config .eslintrc.json > rules.json

Show all errors for a specific rule

// todo
@christophermark
christophermark / selectorDebugging.js
Created October 24, 2018 22:43
Selector Debugging
'use strict';
function getDependencies(funcs) {
const dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs
if (!dependencies.every(dep => typeof dep === 'function')) {
const dependencyTypes = dependencies.map(
dep => typeof dep
).join(', ')
throw new Error(
// List the full gradle dependencies for an Android app
./gradlew app:dependencies -q