Skip to content

Instantly share code, notes, and snippets.

View NFodrea's full-sized avatar

Nathaniel NFodrea

  • blog.raidbossprogramming.com
  • Indiana
View GitHub Profile
import os
import time
import threading
from datetime import datetime
def updateLoop():
ip = "8.8.8.8"
was_online = True
down_timestamp = datetime.now()
@NFodrea
NFodrea / cloudSettings
Last active February 27, 2020 17:09
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-27T17:09:25.052Z","extensionVersion":"v3.4.3"}
@NFodrea
NFodrea / countdown_time_format_helper.js
Last active June 20, 2017 19:25
Format Days Hours Seconds Minuets for countdown timer
getTimeUntill (deadline) {
let time = Date.parse(deadline) - Date.parse(new Date());
let seconds = Math.floor((time/1000) % 60);
let minuets = Math.floor((time/1000/60) % 60);
let hours = Math.floor(time / (1000*60*60) % 24);
let days = Math.floor(time / (1000*60*60*24));
}
@NFodrea
NFodrea / firebaseAuth.ts
Created April 25, 2017 22:42
Firebase Authentication helpers (change workout app to current app name/firebase collection)
export class AuthData {
fireAuth: any;
constructor(public af: AngularFire) {
af.auth.subscribe( user => {
if (user) { this.fireAuth = user.auth; }
});
}
@NFodrea
NFodrea / priceFormat.js
Created April 25, 2017 22:40
ES6 price format
function formatPrice(cents) {
return `$${(cents / 100).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
}
@NFodrea
NFodrea / slug formatter.js
Created April 25, 2017 22:39
slug formatter
function slugify(text) {
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}