Skip to content

Instantly share code, notes, and snippets.

View JeanDavidDaviet's full-sized avatar

Jean-David Daviet JeanDavidDaviet

View GitHub Profile
@JeanDavidDaviet
JeanDavidDaviet / doctrine_live_templates.xml
Created November 23, 2022 12:43 — forked from Nemo64/doctrine_live_tempaltes.xml
Live templates for common doctrine fields
<template name="bool:default" value="/**&#10; * @var bool&#10; * @ORM\Column(type=&quot;boolean&quot;, options={&quot;default&quot;: $default$})&#10; */&#10;private bool $$$name$ = $default$;&#10;&#10;$END$&#10;&#10;public function is$method$(): bool&#10;{&#10; return $this-&gt;$name$;&#10;}&#10;&#10;public function set$method$(bool $$$name$): void&#10;{&#10; $this-&gt;$name$ = $$$name$;&#10;}" description="boolean column" toReformat="false" toShortenFQNames="true">
<variable name="name" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="default" expression="enum(&quot;false&quot;, &quot;true&quot;)" defaultValue="" alwaysStopAt="true" />
<variable name="method" expression="capitalize(name)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>
<template name="bool:nullable" value="/**&#10; * @var bool|null&#10; * @ORM\Column(type=&quot;boolean&quot;, nullable=true)&#10; */&#10;private ?bool $$$name$ = nul
element.addEventListener('animationend', function(event){
if(event.target !== element) return;
element.classList.remove('error');
});
/**
* @param {HTMLElement} element
* @param {Keyframe[] | PropertyIndexedKeyframes} to
* @param {KeyframeAnimationOptions} options
*/
export function animateTo(element, keyframes, options) {
const anim = element.animate(
keyframes,
{ ...options, fill: 'both' },
);
@JeanDavidDaviet
JeanDavidDaviet / git-search-all-commits.sh
Created October 29, 2020 08:28
Search in all commit of a Git repository
git rev-list --all | xargs git grep -F 'code_to_search'
@JeanDavidDaviet
JeanDavidDaviet / git-backup-untracked.sh
Created October 29, 2020 08:26
Take a backup of untracked files
# Most of the time, it's safe to delete all the untracked files. But many times, there is a situation wherein you want to delete, but also to create a backup of your untracked files just in case you need them later.
# Git, along with some Bash command piping, makes it easy to create a zip archive for your untracked files.
git ls-files --others --exclude-standard -z | xargs -0 tar rvf ~/backup-untracked.zip
# The above command makes an archive (and excludes files listed in .gitignore) with the name backup-untracked.zip
@JeanDavidDaviet
JeanDavidDaviet / easings.css
Created July 24, 2020 14:51 — forked from argyleink/easings.css
Handy CSS properties for easing functions
:root {
--ease-in-quad: cubic-bezier(0.55, 0.085, 0.68, 0.53);
--ease-in-cubic: cubic-bezier(0.55, 0.055, 0.675, 0.19);
--ease-in-quart: cubic-bezier(0.895, 0.03, 0.685, 0.22);
--ease-in-quint: cubic-bezier(0.755, 0.05, 0.855, 0.06);
--ease-in-expo: cubic-bezier(0.95, 0.05, 0.795, 0.035);
--ease-in-circ: cubic-bezier(0.6, 0.04, 0.98, 0.335);
--ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
--ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
--ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
# UNIX
date -d @1577836800
# OSX
date -r 1577836800
@JeanDavidDaviet
JeanDavidDaviet / sql-command.sql
Created October 18, 2018 16:43 — forked from BFTrick/sql-command.sql
A SQL command to delete all orphaned post meta data
DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
@JeanDavidDaviet
JeanDavidDaviet / countries.iso-3166-1.inc.php
Created October 12, 2018 14:37 — forked from jchatard/countries.iso-3166-1.inc.php
ISO-3166-1 (ALPHA 2) countries list in french
<?php
/**
* Country list ISO-3166-1 (ALPHA 2) in french
*/
function countries() {
$countries = array(
'AF' => 'Afghanistan',
'ZA' => 'Afrique Du Sud',
'AX' => 'Åland, Îles',
// Linear Interpolation
// Also known as "lerp" or "mix"
function lerp (start, end, t) {
return start * (1 - t) + end * t;
}
// Examples:
lerp(0, 100, 0.5); // 50
lerp(20, 80, 0); // 20
lerp(30, 5, 1); // 5