Skip to content

Instantly share code, notes, and snippets.

View guillaumegarcia13's full-sized avatar
๐Ÿ’ญ
Building awesome things ๐Ÿš€

GARCIA Guillaume guillaumegarcia13

๐Ÿ’ญ
Building awesome things ๐Ÿš€
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active April 21, 2025 02:29
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.
@malcolmocean
malcolmocean / fix_google_app_icons.user.js
Created October 27, 2020 22:54
Fix Godawful New Google app icons
// ==UserScript==
// @name Google - restore old favicons
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Google fucked up its icons. This unfucks them. See this tweet:
// https://twitter.com/Malcolm_Ocean/status/1316828432483979272
// @author @Malcolm_Ocean
// @match https://mail.google.com/*
// @match https://drive.google.com/*
// @match https://calendar.google.com/*
/**
* Peer 1 (Sender)
* Peer 2 (Receiver)
* This example has both the peers in the same browser window.
* In a real application, the peers would exchange their signaling data for a proper connection.
* The signaling server part is omitted for simplicity
*/
const peer1 = new SimplePeer({ initiator: true });
const peer2 = new SimplePeer();
@aliostad
aliostad / stockfish-interface.txt
Created August 17, 2019 10:41
stockfish - Description of the universal chess interface (UCI)
COPIED FROM https://build.opensuse.org/package/view_file/games/stockfish/stockfish-interface.txt?expand=1
Description of the universal chess interface (UCI) April 2006
=================================================================
* The specification is independent of the operating system. For Windows,
the engine is a normal exe file, either a console or "real" windows application.
* all communication is done via standard input and output with text commands,
@pnutmath
pnutmath / angular-add-to-home-screen.component.ts
Last active March 12, 2021 20:15
Angular - Add to home screen POC (app.component.ts)
import { Component, HostListener } from '@angular/core';
@Component({
selector: 'app-root',
template: '<button (click)="addToHomeScreen()" *ngIf="showButton">Add to Home Scree</button>',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
deferredPrompt: any;
@john-auld
john-auld / ssh-agent-windows10.md
Created June 7, 2019 11:10
SSH Agent for Visual Studio Code on Windows 10

Using ssh-agent with Visual Studio Code on Windows 10

Enable the ssh-agent service

To enable SSH Agent automatically on Windows, start PowerShell as an Administrator and run the following commands:

# Make sure you're running as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
@guillaumegarcia13
guillaumegarcia13 / button-masking.js
Created November 25, 2018 22:18
Wrapping and masking a button with jQuery
$('input#checkout').wrap('<div id="bf"><div>');
var $cloneInput = $('input#checkout').clone();
$cloneInput
.attr('id', 'bf_checkout')
.attr('name', 'bf_checkout')
.appendTo('div#bf')
.on('click', function(e) {
doSomething().always(function() {
$('input#checkout').click(); // call underlying button
});
@guillaumegarcia13
guillaumegarcia13 / myresponsive.decorator.ts
Last active July 17, 2018 14:38
Angular Responsive Decorator
/* Disclaimer:
* This snippet is provided โ€œAS ISโ€ and could contain technical inaccuracies, typographical errors and out-of-date information.
* Use of the information is therefore at your (very) own risk.
*/
/*_____________________________________________________________________________________________________________________
* Aim
* Provide some solution in case of complex constructs to manage layout from an Angular point-of-view (ex: ngx-datatable)
* See: https://github.com/swimlane/ngx-datatable/issues/423
*
@guillaumegarcia13
guillaumegarcia13 / formatFileSize.js
Last active October 17, 2017 08:03
Format File Size (0,98 KB, 1,5 GB, ...)
let formatFileSize = (bytes) => {
if (bytes === 0) {
return '0 B';
}
const k = 1024,
dm = 3,
sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
i = Math.floor(Math.log(bytes) / Math.log(k));
window.i18n = window.i18n || {};
i18n._langCache = {}
i18n._availableLangs = [
'en',
'zh-TW',
'ja'
]