Skip to content

Instantly share code, notes, and snippets.

Avatar

MDMCDC anovsiradj

View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active March 26, 2023 06:46
Pure ESM package
View esm-package.md

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.
@yidas
yidas / js-encode-decode.md
Last active April 6, 2022 15:26
JavaScript HTML Entities Encode & Decode
View js-encode-decode.md
@azyobuzin
azyobuzin / Dockerfile
Last active November 19, 2020 04:20
Wine 上で Mono を動かすやつ
View Dockerfile
FROM ubuntu:17.04
# apt-get update がクソ遅いので日本サーバーに変更
RUN sed -i 's|//archive\.ubuntu\.com|//jp\.archive\.ubuntu\.com|g' /etc/apt/sources.list
RUN dpkg --add-architecture i386 && \
apt-get update -y && \
apt-get install -y wget apt-transport-https software-properties-common && \
wget -O - https://dl.winehq.org/wine-builds/Release.key | apt-key add - && \
apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && \
anonymous
anonymous / overpass.geojson
Created April 26, 2017 05:21
data exported by overpass turbo
View overpass.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active March 12, 2023 21:31
SQLite3 PHP Quickstart Tutorial
View SQLite-PHP-quickstart.php
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@hikari-no-yume
hikari-no-yume / example.php
Created March 20, 2017 20:02
function chaining for PHP 7
View example.php
<?php declare(strict_types=1);
require_once "✨.🐘";
✨($_)->strlen("foo")->var_dump($_);
@shakee93
shakee93 / .htaccess
Created January 31, 2017 17:45
Laravel Apache hide .env and several security settings via .htaccess
View .htaccess
# Disable Directory listing
Options -Indexes
# block files which needs to be hidden // in here specify .example extension of the file
<Files ~ "\.(env|json|config.js|md|gitignore|gitattributes|lock)$">
Order allow,deny
Deny from all
</Files>
# in here specify full file name sperator '|'
@aaronpk
aaronpk / canonical.php
Created December 20, 2016 01:47
Given an input URL, find the canonical URL after following redirects and looking at rel=canonical
View canonical.php
<?php
if(!isset($_GET['url'])) {
?>
<form action="" method="get">
<input type="url" name="url">
<input type="submit" value="Go">
</form>
<?
die();
}
@freekrai
freekrai / demo.php
Last active February 19, 2023 19:19
PHP session-based rate limiter for APIs
View demo.php
<?php
date_default_timezone_set('America/Los_Angeles');
session_start();
include("ratelimiter.php");
// in this sample, we are using the originating IP, but you can modify to use API keys, or tokens or what-have-you.
$rateLimiter = new RateLimiter($_SERVER["REMOTE_ADDR"]);
$limit = 100; // number of connections to limit user to per $minutes
$minutes = 1; // number of $minutes to check for.