Skip to content

Instantly share code, notes, and snippets.

View radist2s's full-sized avatar

Alex Batalov radist2s

  • Georgia, Tbilisi
  • 12:57 (UTC +04:00)
View GitHub Profile
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
const SCRIPT_TAG = '<script async src="/feedback-bootstrap.js"></script>';
export async function middleware(request: NextRequest) {
// Skip requests not looking for html.
const accept = request.headers.get("accept") || "";
if (!accept) {
console.log("Request headers", request.headers);
@MichaelCurrin
MichaelCurrin / README.md
Last active September 9, 2024 23:53
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

@johndevs
johndevs / get-all-files.gql
Last active March 19, 2022 20:54
Github GraphQL - Get all file contents in repository
# Provide $query as a variable.
# The query is the same as you would enter into the search field e.g. "org:johndevs in:name feedreader"
query GetFilesQuery($branch: GitObjectID, $query: String!) {
search(first: 1, type: REPOSITORY, query: $query) {
edges {
node {
... on Repository {
object(expression: "master:", oid: $branch) {
... on Tree {
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@zmts
zmts / tokens.md
Last active November 14, 2024 15:57
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@antonagestam
antonagestam / CMakeLists.txt
Created February 14, 2017 23:28 — forked from adrien-f/CMakeLists.txt
CLion and Arduino via Platform.io
cmake_minimum_required(VERSION 3.2)
project(YourProject)
add_subdirectory(src)
add_subdirectory(lib)
@fyrebase
fyrebase / .svgo.yml
Created October 1, 2016 10:34
Convert dimensions to viewBox - SVGO Plugin
plugins:
...
- convertDimensions
...
@lopezjurip
lopezjurip / README.md
Last active September 10, 2023 06:27
Write to NTFS on OSX Yosemite and El Capitan

OUTDATED, see comments below

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update Homebrew formulae:

brew update
@Vestride
Vestride / encoding-video.md
Last active November 15, 2024 17:57
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@benlk
benlk / 0-toc.md
Last active July 29, 2024 21:58
Collection of notes on WP_UnitTestCase
  1. Table of contents
  2. General information
    1. Terms
    2. General structure of a test
    3. WordPress-specific assertions and test functions
      • enqueues
      • creating posts
      • creating terms
      • attaching images
  • ?