Skip to content

Instantly share code, notes, and snippets.

View Slinjez's full-sized avatar
🌴
On vacation

Mwangi Thiga Slinjez

🌴
On vacation
View GitHub Profile
@Slinjez
Slinjez / numberstotext.js
Last active June 28, 2019 12:46
Convert numbers to words
var a = ['','one ','two ','three ','four ', 'five ','six ','seven ','eight ','nine ','ten ','eleven ','twelve ','thirteen ','fourteen ','fifteen ','sixteen ','seventeen ','eighteen ','nineteen '];
var b = ['', '', 'twenty','thirty','forty','fifty', 'sixty','seventy','eighty','ninety'];
function inWords (num) {
if ((num = num.toString()).length > 9) return 'overflow';
n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
if (!n) return; var str = '';
str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + 'hundred thousand ' : '';
str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + 'thousand ' : '';
str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + 'hundred ' : '';
@Slinjez
Slinjez / numbertowords.js
Created June 28, 2019 11:05
Convert numbers to English words
var th = ['', 'Thousand', 'Million', 'Billion', 'Trillion'];
var dg = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'];
var tn = ['Ten', 'Eleven', 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen'];
var tw = ['Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety'];
function toWords(s) {
s = s.toString();
s = s.replace(/[\, ]/g, '');
if (s != parseFloat(s)) return 'not a number';
<div class="wizard">
<div data-title="Advert Basics" class="wizardPanel">
<h1>Advert Basics</h1>
<div class="row">
<div class="col-sm-3">Company</div>
<div class="col-sm-9"><input/></div>
</div>
<div class="row">
<div class="col-sm-3">Manager(s)</div>
<div class="col-sm-9"><input/></div>
@Slinjez
Slinjez / index.html
Last active June 17, 2019 08:15
Nutanix Loading Screen
<div id="particles-background" class="vertical-centered-box"></div>
<div id="particles-foreground" class="vertical-centered-box"></div>
<div class="vertical-centered-box">
<div class="content">
<div class="loader-circle"></div>
<div class="loader-line-mask">
<div class="loader-line"></div>
</div>
<svg width="36px" height="24px" viewBox="0 0 36 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
@Slinjez
Slinjez / Google Maps Simple Multiple Marker Example
Last active July 19, 2017 13:29 — forked from parth1020/Google Maps Simple Multiple Marker Example
Google Maps Simple Multiple Marker Example
<!-- Edits by Mwangi Thiga-->
<html>
<head>
<title>Google Maps Multiple Markers</title>
<!--The 'sensor' thing could cause issues, so, -->
<!-- <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>-->
<script src="http://maps.google.com/maps/api/js?key=your api key" type="text/javascript"></script>
<!-- For more on api keys, pay this guy a visit: https://developers.google.com/maps/documentation/javascript/get-api-key -->
</head>