Skip to content

Instantly share code, notes, and snippets.

View imraheel's full-sized avatar

Raheel Khan imraheel

View GitHub Profile
@imraheel
imraheel / find-local-ip.js
Last active November 10, 2021 14:27
Find local IP using WebRTC
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
// 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 July 29, 2021 05:58
vscode-sync-settings
{"lastUpload":"2021-07-29T05:57:54.543Z","extensionVersion":"v3.4.3"}
<?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'
@imraheel
imraheel / php-file-upload.html
Last active November 3, 2016 04:38
php file upload
<!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 March 3, 2019 03:33
Rating stars with font awesome and simple css :)
<!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>