Skip to content

Instantly share code, notes, and snippets.

View Martinnord's full-sized avatar
⚛️
Taking over the world

Martin Nordström Martinnord

⚛️
Taking over the world
View GitHub Profile
// Import required Node.js modules
const { exec } = require("child_process");
const { promisify } = require("util");
const fs = require("fs").promises;
// Promisify the exec function to use with async/await
const execAsync = promisify(exec);
(async () => {
try {
@Martinnord
Martinnord / useCookie.ts
Last active December 18, 2019 14:07
Hook for mange cookie with universal-cookie lib
import { useState } from "react";
import Cookies, { CookieSetOptions, Cookie } from "universal-cookie";
export const useCookie = (key: string) => {
const cookies = new Cookies();
const [value, setValue] = useState(() => {
if (Boolean(cookies.get(key))) {
return cookies.get(key);
}
const persistUserToStore = user => localStorage.setItem(
"user",
JSON.stringify(user)
);
class UserProvider extends Component {
state = {
user: {....}
};
Git:
radera fil i repo:
git rm path/fil
git add -u (bara dem filer som redan traskas)
git add . alla ändringar
git add -u
git reset
PLUGINS:
- eamodio.gitlens
- esbenp.prettier-vscode
- icrawl.discord-vscode
- midnightsyntax.vscode-wrap-console-log
- mikestead.dotenv
- monokai.theme-monokai-pro-vscode
- ms-python.python
- ms-vsliveshare.vsliveshare
- wix.vscode-import-cost
/*
Author: Martin Nordström
Created: 2018/03/09
Keep coding!
*/
// REVERSE A STRING CHALLENGE
// Return string in reverse
function reverseString(str) {}