Skip to content

Instantly share code, notes, and snippets.

Avatar

Raheel Khan imraheel

View GitHub Profile
@imraheel
imraheel / find-local-ip.js
Last active Nov 10, 2021
Find local IP using WebRTC
View find-local-ip.js
const findLocalIP = () => {
return new Promise((resolve, reject) => {
// compatibility for firefox and chrome
const myPeerConnection = window.RTCPeerConnection ||
window.mozRTCPeerConnection ||
window.webkitRTCPeerConnection
const pc = new myPeerConnection({ iceServers: [] })
const noop = () => {}
const localIPs = {}
const ipRegex = /([0-9]{1,3}(\.[0-9]{1,3}){3}|[a-f0-9]{1,4}(:[a-f0-9]{1,4}){7})/g
View number_to_word.php
// copied form https://stackoverflow.com/a/30299572/5256353
function convertNumberToWord($num = false)
{
$num = str_replace(array(',', ' '), '' , trim($num));
if(! $num) {
return false;
}
$num = (int) $num;
$words = array();
$list1 = array('', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
@imraheel
imraheel / cloudSettings
Last active Jul 29, 2021
vscode-sync-settings
View cloudSettings
{"lastUpload":"2021-07-29T05:57:54.543Z","extensionVersion":"v3.4.3"}
View send_notification.php
<?php
#API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOU_FIREBASE_CLOUD_MESSIGING_API_KEY' );
$registrationIds = "MOBILE_UNIQUE_ID";
#prep the bundle
$msg = array (
'body' => 'Body Of Notification',
'title' => 'Title Of Notification'
View php-file-upload.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>File Upload</title>
<style>
.fileDropArea {
padding-top: 25px;
height: 100px;
@imraheel
imraheel / Rating Stars
Last active Mar 3, 2019
Rating stars with font awesome and simple css :)
View Rating Stars
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Rating Stars</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<style>