Skip to content

Instantly share code, notes, and snippets.

View sambello247's full-sized avatar
🎯
Focusing

Sam Bello sambello247

🎯
Focusing
View GitHub Profile
@sambello247
sambello247 / PHP Contact
Last active June 21, 2023 12:19
PHP Contact #Contact
<?php
===============================================================================//
$to = "devsam247@gmail.com";
//===============================================================================//
$firstname = $_POST['firstname'];
@sambello247
sambello247 / how to subtract two time string (HH:MM) in javascript
Created January 28, 2023 12:59
how to subtract two time string (HH:MM) in javascript
var time1= "03:01";
var time2= "01:19";
function strToMins(t) {
var s = t.split(":");
return Number(s[0]) * 60 + Number(s[1]);
}
function minsToStr(t) {
return Math.trunc(t / 60)+':'+('00' + t % 60).slice(-2);
@sambello247
sambello247 / Props
Created August 31, 2020 09:53 — forked from mynameispj/Props
Estimated reading time in PHP, by Brian Cray
Total props to Brian Cray: http://briancray.com/posts/estimated-reading-time-web-design/
@sambello247
sambello247 / gist:64730ff0ea870e03a03a446e0a0f53e1
Created January 28, 2019 13:48 — forked from molovo/gist:5514490
A simple AJAX download counter. Count is stored in a json file, and updated via PHP.
// jQuery to update counter when button is clicked
$('#download').click(function(event) {
event.preventDefault();
var redirectUrl = $(this).attr('href');
$.ajax({
url: "downloads.php",
success: function(response) {
if (response = 'success') {
// The counter file has been updated in the background, but we should update the results on screen to tell the user
var count = $('#count').html();
@sambello247
sambello247 / 0_reuse_code.js
Created February 1, 2017 22:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console