Skip to content

Instantly share code, notes, and snippets.

View thclark's full-sized avatar

Tom Clark thclark

View GitHub Profile
@anton-petrov
anton-petrov / home-brew_m1.sh
Created December 24, 2020 04:38
Homebrew for Apple M1
# We'll be installing Homebrew in the /opt directory.
cd /opt
# Create a directory for Homebrew. This requires root permissions.
sudo mkdir homebrew
# Make us the owner of the directory so that we no longer require root permissions.
sudo chown -R $(whoami) /opt/homebrew
# Download and unzip Homebrew. This command can be found at https://docs.brew.sh/Installation.
@rafaelrozon
rafaelrozon / mock_axios_storybook.jsx
Last active April 26, 2023 12:29
Mock Axios requests in Storybook
import React from 'react';
import { storiesOf } from '@storybook/react';
// 1. import axios and MockAdapter
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
// 2. create the mock
const mock = new MockAdapter(axios);
@vladiibine
vladiibine / swap_django_auth_user.md
Last active March 9, 2020 20:59
Swap django auth.User with custom model after having applied the 0001_initial migration

Swapping the django user model during the lifecycle of a project (django 1.8 guide)

I've come to a point where I had to swap django's user model with a custom one, at a point when I already had users, and already had apps depending on the model. Therefore this guide is trying to provide the support that is not found in the django docs.

Django warns that this should only be done basically at the start of a project, so that the initial migration of an app includes the creation of the custom user model. It took a while to do, and I ran into problems created by the already existing relations between other models and auth.User.

There were good and not so good things regarding my project state, that influenced the difficulty of the job.

Things that made the swap simpler
  1. My custom user also had an id field, that's just a usual default django id
@diverted247
diverted247 / README
Last active March 21, 2024 18:55
Export slides from Google Slides as SVG - Console Script (Chrome tested)
To export SVG from Google Slides.
1. Open Slide deck.
2. View -> 100%
3. Click on every thumbnail from first to last, this puts the SVG into the DOM.
4. Paste the export.js in the console.
5. Make sure to allow multiple downloads.
6. All SVG should be in Downloads folder.
Cheers,