Skip to content

Instantly share code, notes, and snippets.

View alexiscolin's full-sized avatar
🧑‍🚀

Alexis Colin alexiscolin

🧑‍🚀
View GitHub Profile
@alexiscolin
alexiscolin / gist:45f6f5b639a5a6d4c62f58d29e9a2aca
Created May 12, 2020 18:37
CORS PHP Access-Control-Allow-Origin
// Allow from any origin
if (isset($_SERVER['HTTP_ORIGIN'])) {
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
// Access-Control headers are received during OPTIONS requests
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
@alexiscolin
alexiscolin / generateUuid.js
Created November 13, 2018 10:13
Generate UUID
function generateUuid () {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
)
}
@alexiscolin
alexiscolin / uniqueID.js
Created October 31, 2018 17:04
Unique ID
return (new Date().getTime() + Math.floor((Math.random()*10000)+1)).toString(16);
@alexiscolin
alexiscolin / arraySorting.js
Created October 25, 2018 16:05
Sorting Array ES6
const reorderArray = (array, payload) => {
const movedItem = array.find((item, index) => index === payload.oldIndex);
const remainingItems = array.filter((item, index) => index !== payload.oldIndex);
return [
...remainingItems.slice(0, payload.newIndex),
movedItem,
...remainingItems.slice(payload.newIndex)
];
@alexiscolin
alexiscolin / ffmpeg-gif-to-mp4.txt
Last active October 29, 2018 14:20
FFMPEG Gif to mp4
ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4
@alexiscolin
alexiscolin / mailjet-smtp-ports-check.php
Last active January 26, 2022 12:54
PHP mailjet SMTP port check
<?php
echo (@fsockopen("in-v3.mailjet.com", 25, $errno, $errstr, 2))?'port 25 ouvert<br /><br />':'port 25 ferme<br />'.$errno.' '.$errstr.'<br /><br />';
echo (@fsockopen("in-v3.mailjet.com", 587, $errno, $errstr, 2))?'port 587 ouvert<br /><br />':'port 587 ferme<br />'.$errno.' '.$errstr.'<br /><br />';
echo (@fsockopen("ssl://in-v3.mailjet.com", 465, $errno, $errstr, 2))?'port 465 securise ssl ouvert<br /><br />':'port 465 securise ssl ferme<br />'.$errno.' '.$errstr.'<br /><br />';
echo (@fsockopen("tls://in-v3.mailjet.com", 465, $errno, $errstr, 2))?'port 465 securise tls ouvert<br /><br />':'port 465 securise tls ferme<br />'.$errno.' '.$errstr.'<br /><br />';
?>

Good Morning Danbo

Animation full CSS / HTML about Danbo, the Yotsuba&! & Amazon's famous character. In a 3D environment, totally realised by using LESS, attends the Danbo's awakening.

A Pen by Alexis Colin on CodePen.

License.

@alexiscolin
alexiscolin / Hidden Clock.markdown
Last active August 29, 2015 14:25
Hidden Clock