Skip to content

Instantly share code, notes, and snippets.

# How to consume Github Package private registry with yarn?
Create an .npmrc file in the same location as the package.json with this content.
```
registry=https://registry.yarnpkg.com/
@<username>:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<your auth token>
always-auth=true
@0xkohe
0xkohe / Clean-Architecture-with-InversifyJS.ts
Last active August 24, 2024 07:07
Clean Architecture with InversifyJS
import { firestore } from 'firebase'
import { injectable, inject, Container } from 'inversify'
import { db } from '@/plugins/firebase'
import 'reflect-metadata'
class RestaurantDataModel {
constructor(init: any) {
this.id = init.id || this.id
this.clientUID = init.clientUID || this.clientUID
this.content = init.content || this.content
@straker
straker / README.md
Last active May 4, 2025 10:35
Basic Snake HTML and JavaScript Game

Basic Snake HTML and JavaScript Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When the snake eats an apple, the score should increase by one. Use context.fillText() to display the score to the screen
@vlucas
vlucas / encryption.ts
Last active May 8, 2025 12:51
Stronger Encryption and Decryption in Node.js
import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
const ENCRYPTION_KEY: string = process.env.ENCRYPTION_KEY || ""; // Must be 256 bits (32 characters)
const IV_LENGTH: number = 16; // For AES, this is always 16
/**
* Will generate valid encryption keys for use
* Not used in the code below, but generate one and store it in ENV for your own purposes
*/
export function keyGen() {
@lneveu
lneveu / iso-3166_country_french.json
Last active April 22, 2025 03:33
ISO-3166-1 (ALPHA 2) countries list french / liste des pays français
{
"AD" : "Andorre",
"AE" : "Émirats Arabes Unis",
"AF" : "Afghanistan",
"AG" : "Antigua-Et-Barbuda",
"AI" : "Anguilla",
"AL" : "Albanie",
"AM" : "Arménie",
"AO" : "Angola",
"AP" : "Région Asie/Pacifique",
@0xjac
0xjac / private_fork.md
Last active May 9, 2025 19:49
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@HarishChaudhari
HarishChaudhari / passwordRegex.js
Created August 1, 2016 13:29
Password validation RegEx for JavaScript
/**
* Password validation RegEx for JavaScript
*
* Passwords must be
* - At least 8 characters long, max length anything
* - Include at least 1 lowercase letter
* - 1 capital letter
* - 1 number
* - 1 special character => !@#$%^&*
*
@anubhavshrimal
anubhavshrimal / CountryCodes.json
Last active May 9, 2025 13:37 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@ssskip
ssskip / ISO3166-1.alpha2.json
Last active April 25, 2025 18:21
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
@nodesocket
nodesocket / gist:3919205
Created October 19, 2012 16:33
All world timezones in an HTML select element
<select name="timezone_offset" id="timezone-offset" class="span5">
<option value="-12:00">(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11:00">(GMT -11:00) Midway Island, Samoa</option>
<option value="-10:00">(GMT -10:00) Hawaii</option>
<option value="-09:50">(GMT -9:30) Taiohae</option>
<option value="-09:00">(GMT -9:00) Alaska</option>
<option value="-08:00">(GMT -8:00) Pacific Time (US &amp; Canada)</option>
<option value="-07:00">(GMT -7:00) Mountain Time (US &amp; Canada)</option>
<option value="-06:00">(GMT -6:00) Central Time (US &amp; Canada), Mexico City</option>
<option value="-05:00">(GMT -5:00) Eastern Time (US &amp; Canada), Bogota, Lima</option>