Skip to content

Instantly share code, notes, and snippets.

@fbartho
fbartho / hoc-generics-partial-application.tsx
Last active July 26, 2019 17:46 — forked from miloszpp/hoc.ts
Test that demonstrates the new Generic Propagation features available in TypeScript 3.4
import React from "react";
interface InjectedProps {
injected1: string;
}
interface PubProps<Foo> {
pubProp1: Foo;
}
declare function bind<T>(
component: React.ComponentType<T & InjectedProps>,
@fbartho
fbartho / openx_bash_for_ios
Last active October 30, 2018 18:19 — forked from johngraham262/openx_bash_for_ios
A simple bash script that will open a `.xcworkspace` if it exists in the current directory, otherwise a `.xcodeproj` if it exists, otherwise nothing. It will print the name of the file that is being opened. When using Cocoapods with iOS apps, a second file is created with the `MyProject.xcworkspace` name, alongside the `MyProject.xcproject` file…
# Add the following lines of code to your `~/.bash_profile`,
# and then run `source ~/.bash_profile` to be able to execute
# this from the command line.
# Originally from: https://gist.github.com/johngraham262/6546595
# Spaces-in-filenames from: https://gist.github.com/johngraham262/6546595#gistcomment-1823783
openx() {
fileToOpen='';
find . -maxdepth 1 -name *.xcworkspace -print0 | while IFS= read -r -d '' file; do
fileToOpen=$file
done
@fbartho
fbartho / xcode-toggle.bash
Last active August 29, 2015 14:27
Bash implementation
#!/bin/bash
`xcode-select -p | grep -i beta > /dev/null`
if [ $? -eq 0 ]
then
echo "Using beta. Switching to release."
sudo xcode-select -s /Applications/Xcode.app
else
echo "Using release. Switching to beta."
sudo xcode-select -s /Applications/Xcode-beta.app