Skip to content

Instantly share code, notes, and snippets.

View jantimon's full-sized avatar
🧨

Jan Nicklas jantimon

🧨
View GitHub Profile
@jantimon
jantimon / gist:f764e179baeee7c98b8bb6035fb2964a
Last active July 29, 2023 19:43
install stable diffusion v1 on Apple M1
brew update
brew install Cmake protobuf rust python
git clone https://github.com/bfirsh/stable-diffusion.git
git checkout apple-silicon-mps-support
mkdir -p models/ldm/stable-diffusion-v1/
# accept license and download the model
# sd-v1-4.ckpt from:
# https://huggingface.co/CompVis/stable-diffusion-v-1-4-original
@jantimon
jantimon / gist:2c464e8589b258a9516b3d7e99c580e4
Created August 4, 2022 20:03
Git Checkout Main / Cleanup / Yarn
#!/usr/bin/env bash
git fetch &
MAIN_BRANCH="main"
# detect master / main branch
if [ "$(git rev-parse --quiet --verify $MAIN_BRANCH)" ]; then
echo "main branch: ${MAIN_BRANCH}"
else
MAIN_BRANCH="master"
@jantimon
jantimon / reducerTypings.tsx
Created September 21, 2020 12:30
use reducer typings
export const actionCreator = <TState>() => <TOptions extends {}>(
actionHandler: ActionHandler<TOptions, TState>
) => actionHandler;
type ActionHandler<TOptions extends {}, TState extends {}> = (
state: TState,
options: TOptions
) => TState;
type ActionOptions<T> = T extends ActionHandler<infer TOptions, infer State>
? TOptions
: never;
@jantimon
jantimon / responsiveTests.js
Last active November 21, 2018 09:49
Codepen for Responsive Tests
//https://codepen.io/anon/pen/XyVQyp
setUpTestEnvironment();
console.log('Test', 500)
setViewportSize(500);
assert.equal(meassureElementWidth('.content'), 500)
@jantimon
jantimon / index.js
Created August 13, 2018 15:35
DynamicRequire
export default function() {
return import('react-dom');
}
const viewportClassPrefix = (viewport: 'xs' | 'sm' | 'md' | 'lg') => viewport === 'xs' ? '' : ('-' + viewport);
const flexAlignment = {
col: {
direction: {
outer: (viewport: 'xs' | 'sm' | 'md' | 'lg') => `flex${viewportClassPrefix(viewport)}-column`,
inner: (viewport: 'xs' | 'sm' | 'md' | 'lg') => `flex${viewportClassPrefix(viewport)}-row`,
},
@jantimon
jantimon / switch-case.ts
Created July 20, 2018 10:09
Typescript Prevent Default Case
interface Box {
height: number;
width: number;
color: 'RED' | 'BLUE'
}
function logColor(box: Box) {
switch (box.color) {
case 'RED':
console.log(box, 'is red');
@jantimon
jantimon / switch-case.ts
Created July 20, 2018 10:09
Typescript Prevent Default Case
interface Box {
height: number;
width: number;
color: 'RED' | 'BLUE'
}
function logColor(box: Box) {
switch (box.color) {
case 'RED':
console.log(box, 'is red');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
app: './src/app.js'
},
output: {
[alias]
# Delete any branches that have been merged except master, development and the current branch
cleanup = !git remote prune origin && git branch --merged | egrep -v '(^\\*|master|develop)' | xargs git branch -d