Skip to content

Instantly share code, notes, and snippets.

View hdsenevi's full-sized avatar
😙
Typing my life away...

Sha Senevirathne hdsenevi

😙
Typing my life away...
View GitHub Profile
@hdsenevi
hdsenevi / gist:2ad654e434fdac46119dffdf096dec0c
Created October 31, 2021 18:05
Setup prettier for new create react app project
1. npx create-react-app <project-name>
2. npm i --save-dev prettier
3. npm i --save-dev eslint-config-prettier eslint-plugin-prettier
4. Edit the "eslintConfig" section in package.json or create a .eslintrc file at the project root to hold our ESLint configuration.
```
{
"extends": ["react-app"],
"rules": {}
}
```
1. Install (pyenv)[https://github.com/pyenv/pyenv] (make sure to do install stesp after step #2 in readme)
1a. For M1 macs try (this)[https://laict.medium.com/install-python-on-macos-11-m1-apple-silicon-using-pyenv-12e0729427a9]
2. Install a latest version of python (3.8.10)
`pyenv install 3.10.3`
3. Set latest python version to be default
`pyenv global 3.10.3`
4. Install and/or verify pip is installed
`pip --version`
4a. Upgrade pip if needed
`pip3 install --upgrade pip`
@hdsenevi
hdsenevi / instructions-publish-gatsby-gitbook-starter-on-github-pages.md
Last active December 18, 2020 04:17
Publish Gatsby gitbook starter on github pages
  1. Check out https://github.com/hasura/gatsby-gitbook-starter
  2. Create a public repo on githut (knowledgebase-test)
  3. Check out knowledgebase-test
  4. git checkout -b master
  5. copy gatsby-gitbook-starter files on to knowledgebase-test
  6. push master to remote
  7. update package.json run scripts with : "deploy": "gatsby build --prefix-paths && gh-pages -d public"
  8. install gh-pages npm package : npm i gh-pages
  9. add .gitignore file and add the following to it
  • node_modules
@hdsenevi
hdsenevi / Install-instructions-unity-without-local-admin-permissions.md
Last active October 21, 2020 10:28
Instructions on how to install Unity game engine on a mac that you don't have sudo (local admin) permissions on

Instructions on how to install Unity game engine on a mac that you don't have sudo (local admin) permissions on

Prerequisites

  1. mac that you have local admin on (MAC_WITH_ADMIN)
  2. mac that you don't have local admin on. That you want to run Unity on (MAC_NO_ADMIN)
  3. Unity Hub and Unity version installed on MAC_WITH_ADMIN
  4. a way to copy files from MAC_WITH_ADMIN to MAC_NO_ADMIN

Steps

  1. Zip both Unity folder and Unity hub into an archive
@hdsenevi
hdsenevi / publish-gitbook-docs-to-github-pages.md
Last active April 9, 2024 03:26
Publishing Gitbook documentation on Github pages
@hdsenevi
hdsenevi / Podfile
Created January 22, 2019 19:17
Podfile that has an issue in it
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
install! 'cocoapods', :deterministic_uuids => false
target 'OUR_PROJECT_NAME' do
pod 'AppCenter/Crashes', '~> 1.9.0'
pod 'AppCenter/Analytics', '~> 1.9.0'
pod 'AppCenterReactNativeShared', '~> 1.8.1'
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
@hdsenevi
hdsenevi / Button.test.js
Created December 11, 2018 13:01
Article helper gist for "Unit testing in React Native with Jest and Enzyme" (https://github.com/hdsenevi/react-native-unit-testing-recipes)
import React from 'react';
import {shallow} from 'enzyme';
import Button from './Button';
let mockOpenURL = jest.fn();
// 1. Set openURL module function to jest.fn
jest.mock('Linking', () => ({
openURL: mockOpenURL,
}));
@hdsenevi
hdsenevi / Button.test.js
Last active December 11, 2018 12:24
Article helper gist for "Unit testing in React Native with Jest and Enzyme" (https://github.com/hdsenevi/react-native-unit-testing-recipes)
import React from 'react';
import {shallow} from 'enzyme';
import Button from './Button';
describe('Button', () => {
describe('Rendering', () => {
it('should match to snapshot - Primary', () => {
const component = shallow(<Button label="test label" primary />)
expect(component).toMatchSnapshot("Primary button snapshot")
});
@hdsenevi
hdsenevi / Button.test.js
Created December 11, 2018 11:29
Article helper gist for "Unit testing in React Native with Jest and Enzyme" (https://github.com/hdsenevi/react-native-unit-testing-recipes)
import React from 'react';
import {shallow} from 'enzyme';
import Button from './Button';
describe('Button', () => {
describe('Rendering', () => {
it('should match to snapshot - Primary', () => {
const component = shallow(<Button label="test label" primary />)
expect(component).toMatchSnapshot("Primary button snapshot")
});