Skip to content

Instantly share code, notes, and snippets.

View kamiljozwik's full-sized avatar

Kamil Józwik kamiljozwik

View GitHub Profile
@kamiljozwik
kamiljozwik / firestore.chat.rules
Last active July 28, 2023 09:00
Firebase Firestore security rules
rules_version = '2';
// Example rules for chat app
// https://www.youtube.com/watch?v=zQyrwxMPm88
// collections: "users", "messages", "banned"
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
@kamiljozwik
kamiljozwik / getData.js
Created November 17, 2021 07:00
Split fetch into smaller chunks
const getData = async () => {
/** 1. Everything as one big fetch: */
let res_1 = await fetch('https://icanhazdadjoke.com/search?term=music&limit=3', {
headers: { accept: 'application/json' },
});
/** 2. Split above into smaller chunks 🪓 */
/* 2.1. Set search params values */
let term = 'music';
@kamiljozwik
kamiljozwik / index.js
Created August 5, 2021 09:59
Node.js docker web app
import express from "express";
const app = express();
const port = 8080;
app.get("/", (req, res) => {
res.send("Cześć świecie 👋");
});
app.listen(port, () => {
const name = "NAME"
@kamiljozwik
kamiljozwik / index.js
Last active January 10, 2021 21:08
Gist z dwoma plikami
console.log("cześć świat");
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
const path = require('path');
const { GraphQLClient } = require(`graphql-request`);
const parseGHUrl = require(`parse-github-url`);
/**
* Used to gather repo details data
*/
const githubApiClient = process.env.GITHUB_TOKEN
? new GraphQLClient(`https://api.github.com/graphql`, {
headers: {
// To poniżej wywołać w PowerShell
code --list-extensions | ForEach-Object {"code --install-extension $_"} > extensions.ps1
// Na drugim komputerze:
.\extensions.ps1
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { withAuthenticator } from 'aws-amplify-react'
import { API, graphqlOperation } from 'aws-amplify' // dodajemy komunikację z API na froncie
// Pytamy API o listę wszystkich notatek
const ListNotes = `
query {
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import { withAuthenticator } from 'aws-amplify-react' // HOC do sprawdzania czy mamy zalogowanego użytkownika
class App extends Component {
render() {
return (
<div className="App">