Skip to content

Instantly share code, notes, and snippets.

View Kraloz's full-sized avatar
🏠
Working from home

Tomas Aprile Kraloz

🏠
Working from home
  • Buenos Aires, Argentina
View GitHub Profile
@Kraloz
Kraloz / tasks.json
Created October 6, 2021 15:12
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "build-backend",
"type": "npm",
"script": "build",
"path": "app/backend/",
"group": "build",
"problemMatcher": [],
@Kraloz
Kraloz / launch.json
Created October 6, 2021 15:10
launch.json multiuse
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Backend",
"preLaunchTask": "build-backend",
"program": "${workspaceFolder}/app/backend/src/index.ts",
@Kraloz
Kraloz / launch.json
Created September 29, 2021 13:12
vscode remote debugging chrome
{
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}/app/frontend"
}
@Kraloz
Kraloz / clean-branches.sh
Created June 3, 2021 17:20
delete all branches but master
git branch | grep -v "master" | xargs git branch -D
@Kraloz
Kraloz / fix-crlf.sh
Last active August 18, 2021 22:18
git disable autocrlf
git config --global core.autocrlf false
git rm --cached -r .
git reset --hard
const fileDownloadManager = {
initDownload({ endpoint, filename }) {
fileDownloadManager.endpoint = endpoint
fileDownloadManager.filename = filename
const permissions = window.cordova.plugins.permissions
permissions.checkPermission(
permissions.READ_EXTERNAL_STORAGE,
fileDownloadManager.checkPermissionCallback,
null
@Kraloz
Kraloz / axios-catch-error.js
Created October 31, 2019 20:40 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨