Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View michaelNgiri's full-sized avatar
🏠
Working from home

Ngiri Michael michaelNgiri

🏠
Working from home
View GitHub Profile
@michaelNgiri
michaelNgiri / media.service.ts
Created November 15, 2023 07:52 — forked from AngelMunoz/media.service.ts
a simple typescript class that deals with the HTML Media API for camera stuff
export interface ISwitchCameraArgs {
deviceId?: string
}
export interface IStartCameraArgs {
constraints?: MediaStreamConstraints;
retryCount?: number;
}
export interface ICameraDevice extends MediaDeviceInfo {
[
{
"logo": "https://www.car-logos.org/wp-content/uploads/2011/09/abarth1.png",
"brandName": "Abarth",
"models":[
{
"model": "204 A Roadster",
"startYear": 1949,
"endYear": 1950,
"nameTags": "",
@michaelNgiri
michaelNgiri / stuns
Created October 25, 2021 15:24 — forked from zziuni/stuns
STUN server list
# source : http://code.google.com/p/natvpn/source/browse/trunk/stun_server_list
# A list of available STUN server.
stun.l.google.com:19302
stun1.l.google.com:19302
stun2.l.google.com:19302
stun3.l.google.com:19302
stun4.l.google.com:19302
stun01.sipphone.com
stun.ekiga.net
//initialize the function once the page loads
window.onload = function() {
activateTimer();
}
//show the popup if the user is idle for more than 15 seconds
// the user is considered idle if he doesn't actively interact
//with the page by either moving his cursor or pressing any button on the keyboard
const activateTimer = ()=> {
import os
def removeQuotesFromValue(value):
value = value.replace("'", '"')
# value = value.replace('"', "")
return value
def splitLineIntoParts(line):
line = line.lstrip()
line = line.rstrip()
@michaelNgiri
michaelNgiri / paginated.js
Created January 16, 2020 20:35 — forked from jstott/paginated.js
lodash paginated items
function getPaginatedItems(items, page, pageSize) {
var pg = page || 1,
pgSize = pageSize || 100,
offset = (pg - 1) * pgSize,
pagedItems = _.drop(items, offset).slice(0, pgSize);
return {
page: pg,
pageSize: pgSize,
total: items.length,
total_pages: Math.ceil(items.length / pgSize),
@michaelNgiri
michaelNgiri / index.html
Last active March 5, 2019 17:30
hackerbay test, stock analyser, array flattener
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.action-btn-group{
margin: 4px; margin-left: 40vw; padding: 10px; cursor: grab; font-size: 1.4em;
}
</style>
</head>
try {
//perform the action here
}
catch(err) {
//do something when an error occurs e.g console.log();
}