Skip to content

Instantly share code, notes, and snippets.

View FabienDehopre's full-sized avatar

Fabien Dehopré FabienDehopre

View GitHub Profile
@FabienDehopre
FabienDehopre / esm-package.md
Created February 18, 2025 09:02 — forked from sindresorhus/esm-package.md
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.
@FabienDehopre
FabienDehopre / tslint.json
Created February 15, 2019 10:59
My Angular Project TsLint configuration
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rulesDirectory": ["codelyzer", "rxjs-tslint"],
"rules": {
"member-access": [true, "no-public"],
"member-ordering": [
true,
{
"order": ["static-field", "instance-field", "static-method", "instance-method"]
}
@FabienDehopre
FabienDehopre / install.sh
Last active September 29, 2020 03:57
My Ubuntu Install Script (install all my needed packages)
#!/bin/bash
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install -y curl
release=$(lsb_release -cs)
pkg_list=(git git-flow zsh zsh-doc openssh-server net-tools mc dotnet-sdk-2.1.105 nodejs yarn)
echo "Configuring APT repositories..."
if [[ $release == "trusty" ]]
@FabienDehopre
FabienDehopre / dynamically-size-elements-with-pure-css.markdown
Last active December 19, 2016 08:31
Dynamically Size Elements with Pure CSS
@FabienDehopre
FabienDehopre / HarlemShakeScript.js
Last active April 21, 2022 17:53
Make an unsecure website dance
/*
(from Troy Hunt's article https://www.troyhunt.com/understanding-csp-the-video-tutorial-edition/)
1. Go to Google Chrome
2. Go to any website (works cool on facebook)
3. Right click anywhere -> Inspect Element
4. Click on the rightmost "Console" tab.
5. Copy paste the following * into the console.
6. Make sure the volume isn't too loud!
6. Press Enter.
@FabienDehopre
FabienDehopre / IPAddressExtensions.cs
Last active April 6, 2016 12:03
IPAddress class extension method which indicates whether an IP address is routable or not.
public static class IPAddressExtensions
{
/// <summary>
/// Indicates whether the <see cref="IPAddress"/> is a routable address or not.
/// </summary>
/// <param name="ipAddress"></param>
/// <remarks>A null or empty string passed as the ipAddress will return true. An invalid ipAddress will be returned as true. </remarks>
/// <returns><c>true</c> if the <see cref="IPAddress"/> is a private (non-routable) address; <c>false</c> otherwise.</returns>
public static bool IsNonRoutableIpAddress(this IPAddress ipAddress)
{
@FabienDehopre
FabienDehopre / Identifier.cs
Last active March 17, 2025 22:19
Validate C# identifier name
using System;
using System.Linq;
using System.Text.RegularExpressions;
public static class IdentifierExtensions
{
// definition of a valid C# identifier: http://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx
private const string FORMATTING_CHARACTER = @"\p{Cf}";
private const string CONNECTING_CHARACTER = @"\p{Pc}";
private const string DECIMAL_DIGIT_CHARACTER = @"\p{Nd}";