Skip to content

Instantly share code, notes, and snippets.

View miladganjali's full-sized avatar
🎯
Focusing

Milad miladganjali

🎯
Focusing
View GitHub Profile
@miladganjali
miladganjali / DarkModeDetactor.js
Created November 17, 2021 23:03
Simple Dark mode detector
let matched = window.matchMedia('(prefers-color-scheme: dark)').matches;
if(matched) {
console.log('User has Dark mode');
}
else {
console.log('User has not enable Dark mode');
}
@miladganjali
miladganjali / linkify.php
Created October 11, 2019 23:03 — forked from jasny/linkify.php
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @return string
*/
public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array())