Skip to content

Instantly share code, notes, and snippets.

View yonycalsin's full-sized avatar
🎯
Focusing

Yony yonycalsin

🎯
Focusing
View GitHub Profile
@yonycalsin
yonycalsin / create-layer.sh
Created March 29, 2024 13:17 — forked from bendalby82/create-layer.sh
Create Node.js layer to simplify connecting AWS Lambda to PostgreSQL
#!/usr/bin/env bash
#https://medium.com/coinmonks/connecting-aws-lambda-node-js-to-redshift-or-postgresql-try-aws-lambda-layers-78e60c27f39b
#Note the name of the folder *must* be nodejs, see explanation here:
#https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html
mkdir nodejs
cd nodejs
npm init -y
npm install --save pg
@yonycalsin
yonycalsin / index.md
Created October 22, 2022 23:15 — forked from cdrini/index.md
Adding lodash type hinting to monaco using addExtraLib

Well that was a headache! This is certainly not an elegant solution, but it works. Hopefully someone can use these notes to save themselves a bunch of time.

Known issues:

  • This does not scale easily to any other library
  • Requires some internal knowledge of lodash's types library which might break on a lodash update

Add raw-loader and @types/lodash

npm install --save-dev @types/lodash raw-loader
@yonycalsin
yonycalsin / How to find out line-endings in a text file?
Created May 24, 2022 00:38
How to find out line-endings in a text file?
https://stackoverflow.com/questions/3569997/how-to-find-out-line-endings-in-a-text-file/34376951#34376951
@yonycalsin
yonycalsin / delete_git_submodule.md
Created April 30, 2022 21:12 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@yonycalsin
yonycalsin / git-pushing-multiple.rst
Created January 2, 2022 18:17 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@yonycalsin
yonycalsin / babel build directory compile has not working on windows.md
Created November 25, 2021 17:33
babel build directory compile has not working on windows

I also encountered this, using similar setup after switching from mac to windows.

I tried

babel src --out-dir lib --extensions .ts,.tsx
@yonycalsin
yonycalsin / How to check if running in Cygwin, Mac or Linux with bash, sh.sh
Last active November 25, 2021 16:51
How to check if running in Cygwin, Mac or Linux with bash, sh
# https://stackoverflow.com/a/3466183/12405219
pax> uname -a
CYGWIN_NT-5.1 IBM-L3F3936 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
pax> uname -s
CYGWIN_NT-5.1
# script.sh
unameOut="$(uname -s)"
@yonycalsin
yonycalsin / The argument type 'String' can't be assigned to the parameter type 'Uri'.dart
Created November 19, 2021 13:41
The argument type 'String' can't be assigned to the parameter type 'Uri' with flutter & dart
// To improve compile-time type safety, package:http 0.13.0 introduced
// breaking changes that made all functions that previously accepted
// Uris or Strings now accept only Uris instead. You will need to
// explicitly use Uri.parse to create Uris from Strings.
// (package:http formerly called that internally for you.)
// https://stackoverflow.com/a/66473447/12405219
await http.post(
@yonycalsin
yonycalsin / React Native Android Fetch failing on connection to local API in windows 10.sh
Created November 17, 2021 22:20
React Native Android Fetch failing on connection to local API in windows 10
# https://stackoverflow.com/a/61711341
# command
adb -s <device_name> reverse tcp:backend_port tcp:backend_port
# example
adb -s emulator-5554 reverse tcp:4444 tcp:4444
@yonycalsin
yonycalsin / Reset react-native Android cache.sh
Created November 17, 2021 18:00
Reset react-native Android cache
# Reset / delete problematic node_modules
npx react-native start --reset-cache
npx react-native run-android