Skip to content

Instantly share code, notes, and snippets.

@ayoubzulfiqar
ayoubzulfiqar / folder_structure.md
Created September 5, 2023 06:12
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@alexedwards
alexedwards / Makefile
Last active July 19, 2024 18:35
Boilerplate Makefile for Go projects
# Change these variables as necessary.
MAIN_PACKAGE_PATH := ./cmd/example
BINARY_NAME := example
# ==================================================================================== #
# HELPERS
# ==================================================================================== #
## help: print this help message
.PHONY: help
@EvanBacon
EvanBacon / withVideoImportSupport.js
Created October 13, 2022 19:26
An Expo Config Plugin that enables opening any video file type in your iOS app
// https://gist.github.com/EvanBacon/98858a341e2da209587455bbad465931
const includesEverything = {
CFBundleDocumentTypes: [
{
CFBundleTypeExtensions: ["*"],
CFBundleTypeName: "All files",
CFBundleTypeOSTypes: ["*"],
},
{
CFBundleTypeExtensions: ["mov"],
@leecannon
leecannon / std_log.md
Last active December 14, 2023 07:29
Quick overview of Zig's `std.log`

Out of date

This is an updated fork of this gist.

A simple overview of Zig's std.log

Logging functionality that supports:

  • If a log message should be printed is determined at comptime, meaning zero overhead for unprinted messages (so just leave the code peppered with debug logs, but when it makes sense scope them; so downstream users can filter them out)
  • Scoped log messages
  • Different log levels per scope
  • Overrideable log output (write to file, database, etc.)
@Ifihan
Ifihan / app.py
Last active August 19, 2020 03:32
Using Flask-RESTful to build a basic REST API
from flask import Flask
from flask_restful import Resource, Api
app = Flask(__name__)
api = Api(app)
class Student(Resource):
def get(self, name):
return {"student": name}
@papidb
papidb / aliases.sh
Last active May 28, 2020 18:46
Helpful shell aliases
# aliases are basically nicknames
# they are used to represent commands or function with a string
alias babe="yarn"
# usage:
# babe --version
# babe add node-sass
# Print my public IP
alias myip="curl ipinfo.io/ip"
@slikts
slikts / advanced-memo.md
Last active April 27, 2024 02:40
Advanced memoization and effects in React

nelabs.dev

Advanced memoization and effects in React

Memoization is a somewhat fraught topic in the React world, meaning that it's easy to go wrong with it, for example, by [making memo() do nothing][memo-pitfall] by passing in children to a component. The general advice is to avoid memoization until the profiler tells you to optimize, but not all use cases are general, and even in the general use case you can find tricky nuances.

Discussing this topic requires some groundwork about the technical terms, and I'm placing these in once place so that it's easy to skim and skip over:

  • Memoization means caching the output based on the input; in the case of functions, it means caching the return value based on the arguments.
  • Values and references are unfortunately overloaded terms that can refer to the low-level implementation details of assignments in a language like C++, for example, or to memory
//
// YeetJSIUTils.h
// yeet
//
// Created by Jarred WSumner on 1/30/20.
// Copyright © 2020 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <jsi/jsi.h>
@helenaford
helenaford / 1: App.js
Last active March 20, 2024 09:16
useNotificationService
import { useNotificationService } from './hooks';
function App() {
useNotificationService();
...
}
@573
573 / Dockerfile
Created March 12, 2018 08:13
git clone when using docker-compose.yml
FROM alpine/git:1.0.4
CMD ["git", "version"]