Skip to content

Instantly share code, notes, and snippets.

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

Konstantin Tarkus koistya

🏠
Working from home
View GitHub Profile
@koistya
koistya / React-Directory-Layout.md
Last active April 7, 2024 19:01
File and folder naming convention for React.js components

File and folder naming convention for React.js components

Directory Layout #1

/actions/...
/components/common/Link.js
/components/common/...
/components/forms/TextBox.js
/components/forms/TextBox.res/style.css
@koistya
koistya / pull_request_template.md.txt
Last active February 23, 2024 19:27
Pull Request Template for GitHub
<!--
Craft a meaningful explanation for why this tweak matters and outline the awesome updates you've implemented. Feel free to toss in some snazzy screenshots if you've got 'em. ✨
-->
### 🚀 What's new
- [ ] Some change...
- [ ]
### 📣 Special notes for reviewer
@koistya
koistya / crypto.md
Last active December 29, 2023 21:27
Using Google Cloud credentials (service account keys) in Cloudflare Workers environment

Allow retrieving an OAuth 2.0 authentication token for interacting with Google services using the service account key.

Usage Example with Cloudflare Workers

Base64-encode your service account JSON key and save it to *.env files (GOOGLE_CLOUD_CREDENTIALS)

import { getAuthToken, Env } from "core";

export default {
@koistya
koistya / README.md
Last active October 23, 2023 14:08
Load environment variables and secrets from `.env` files and Google Secret Manager.

Environment Variables and Secrets

The following demonstrates how to load environment variables and secret values into a software project for local development.

  • [Step 1]: Create secret records in Google Secret Manager
  • [Step 2]: Save environment variables and secret references to .env file(s)
  • [Step 3]: Add a call to loadEnv(environment, options) where you need those variables

Basic Example

Keybase proof

I hereby claim:

  • I am koistya on github.
  • I am koistya (https://keybase.io/koistya) on keybase.
  • I have a public key ASASJaNjk9roFklMXj8X8HgeLDA_sCqiu9xzjv890zVSMQo

To claim this, I am signing this object:

@koistya
koistya / ReactJS-Server-Side-Rendering.md
Last active September 15, 2023 07:32
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@koistya
koistya / twitter-api.md
Last active July 20, 2023 17:05
Twitter API v2 usage example using Got and OAuth-1.0a

Twitter API v2 Usage Example

Install got and oauth-1.0a NPM dependencies.

import { TwitterClient } from "./twitter";

// Initializes a new Twitter client using OAuth 1.0a credentials
const twitter = new TwitterClient({
 // Twitter App credentials (API key and secret)
@koistya
koistya / github-actions-workflows.md
Last active July 10, 2023 11:16
Reusable workflows in GitHub Actions

Reusable Workflows in GitHub Actions

Assuming you have the root-level main.yml and a couple of reusable workflows main-a.yml and main-b.yml.

Your goal is to run the the workflows A and B automatically as part of the main (root) workflow as well as being able to fire up them manually one by one for different environments.

The top-level (root) workflow would looks something like this:

.github/workflows/main.yml

@koistya
koistya / Single-page Application (SPA) Project Structure.md
Created January 30, 2014 05:24
Directory Layout of a Single-page Application built with .NET / F#, AngularJS, TypeScript, LESS...

Single-page Application Project Structure

..with .NET / F# (or Node.js / Express), AngularJS (or Facebook React + RxJS), TypeScript, Gulp.js (or Grunt), NuGet...

Goals

  • Project structure should reflect application's logic (as opposed to regular MVC apps which all look the same)
  • Group assets by feature rather than by type (including views, scripts, documentation, tests etc.)
  • Allow developers to edit client-side and server-side code independently from each other