Skip to content

Instantly share code, notes, and snippets.

View ntxinh's full-sized avatar
💭
❤️ .NET & JavaScript

Xinh Nguyen ntxinh

💭
❤️ .NET & JavaScript
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active June 28, 2024 17:42
Minimal APIs at a glance
@sindresorhus
sindresorhus / esm-package.md
Last active June 29, 2024 11:18
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@olivier5741
olivier5741 / FluentValidationAlternative.cs
Last active February 22, 2024 14:31
An alternative library API to FluentValidation
namespace Validation.Tests
{
using System;
using System.Collections.Generic;
using Xunit;
public class User
{
public string Name { get; set; }
public int Age { get; set; }
@wesbos
wesbos / async-await.js
Created February 22, 2017 14:02
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
@rouzbeh84
rouzbeh84 / booklist.md
Last active November 19, 2021 17:47
list of programming books

Coders at Work: Reflections on the Craft of Programming

  • iinpute

If you’re curious about life as a programmer than Coders at Work is the book for you. It’s packed with interesting interviews from 15 accomplished programmers and computer scientists including Joshua Bloch, Peter Norvig, Donald Knuth, Ken Thomson, and Jamie Zawinski. The author, Peter Seibel (a programmer turned writer), got interviewees to open up about the famous projects that they worked on and the inspiring stories behind them. Coders at Work gives a peek into what makes some of the greatest programmers tick and how they think. Definitely a must read!

[Coders at Work Best Programming Books](http://www.amazon.com/gp/

@wojteklu
wojteklu / clean_code.md
Last active June 29, 2024 08:22
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@wesbos
wesbos / commit-msg
Created July 4, 2016 18:55
ESLint 3.0 Git Pre Commit Hook
#!/bin/bash
files=$(git diff --cached --name-only | grep '\.jsx\?$')
# Prevent ESLint help message if no files matched
if [[ $files = "" ]] ; then
exit 0
fi
failed=0
for file in ${files}; do
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@anvaka
anvaka / 00.Intro.md
Last active June 28, 2024 12:23
npm rank

npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active June 4, 2024 10:08
Using Github Deploy Key

What / Why

Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.

As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.

How to

  1. Generate a ssh key