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
@guillaumegarcia13
guillaumegarcia13 / angular-add-to-home-screen.component.ts
Created May 31, 2020 20:54 — forked from pnutmath/angular-add-to-home-screen.component.ts
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;
@guillaumegarcia13
guillaumegarcia13 / html_forms_cheatsheet.md
Created April 4, 2017 12:21
HTML forms and input tags cheatsheet. All you need to know to write every HTML form possible, including links to good resources on HTML and the new HTML5 form and input options...

HTML Forms

In order that you never go to W3Schools (never go there), here is a basic cheat sheet for writing simple HTML forms.

This is culled from a few sources, [the most important being MDN][MDN]. MDN (the Mozilla Developer Network) should be seen as "the docs" when you are having an issue with HTML.

@guillaumegarcia13
guillaumegarcia13 / sample.html
Created September 4, 2017 15:53
Angular 4 ng-template & ng-container with parameters
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
@guillaumegarcia13
guillaumegarcia13 / rotate_emoji.css
Created October 30, 2021 08:06
Rotating emoji CSS
/* Animating with globe emoji */
@keyframes rotateEmoji {
0% { content: "\01F30D"; }
33% { content: "\01F30E"; }
66% { content: "\01F30F"; }
}
.my-own-tile .nepTileTitle .nepTileClickable::before {
content: "\01F30D";
}
.my-own-tile:hover .nepTileTitle .nepTileClickable::before {
@guillaumegarcia13
guillaumegarcia13 / groupBy.ts
Created January 12, 2018 23:39
groupBy in Typescript (for use in Angular)
declare global {
interface Array<T> {
groupBy(prop: T): Array<T>;
}
}
if (!Array.prototype.groupBy) {
Array.prototype.groupBy = (prop: string) => {
return this.reduce(function(groups, item) {
const val = item[prop];
@guillaumegarcia13
guillaumegarcia13 / elementor_carousel_custom_link.js
Created February 1, 2021 11:28
Elementor - Custom external links for Image Carousel
@guillaumegarcia13
guillaumegarcia13 / linkedin_profiles.js
Last active December 1, 2020 09:40
Retrieve all LinkedIn profiles of people leaving a comment
/*====================================================================================================================
* Author: Guillaume GARCIA (https://www.linkedin.com/in/guillaumegarcia/)
* Date : 30-november-2020
*
* Usage
* -----
*
* Go to a LinkedIn post URL
* such as: https://www.linkedin.com/feed/update/urn:li:activity:6738104526265446400/
* Open Chrome DevTools
@guillaumegarcia13
guillaumegarcia13 / gmail_to_slack.js
Created October 30, 2020 10:38 — forked from andrewmwilson/gmail_to_slack.js
Google Apps Script: Send Gmail emails to Slack
// You will also need to create a gmail filter to add the 'send-to-slack' label
// to any emails you want sent to slack
function sendEmailsToSlack() {
var label = GmailApp.getUserLabelByName('send-to-slack');
var messages = [];
var threads = label.getThreads();
for (var i = 0; i < threads.length; i++) {
messages = messages.concat(threads[i].getMessages())
@guillaumegarcia13
guillaumegarcia13 / inspect.js
Created October 16, 2020 09:58
Inspect object and return getter methods in console.table
var inspect = function(ctrl, prototypeLevel = 1) {
let output = [];
let level = prototypeLevel;
// local auxiliary helper
const _fillDictionary = (subObj, depth, originalObj = subObj) => {
Object.keys(subObj).forEach(key => {
// only consider 'getter' and catch any error (such as mandatory parameters)
if (key.startsWith('get') && typeof originalObj[key] === 'function') {
try {
// See: https://stackoverflow.com/questions/24586110/resolve-promises-one-after-another-i-e-in-sequence/31070150#31070150
// https://decembersoft.com/posts/promises-in-serial-with-array-reduce/
/*
* Serialize promises (or rather tasks because once created, a Promise starts executing immedialtely
*/
const promiseSerializer = (tasks: Array<()=>Promise<any>>) => {
return tasks.reduce((promiseChain: Promise<any>, currentTask: ()=>Promise<any>) => {
return promiseChain.then(chainResults =>
currentTask().then(currentResult =>