This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getRelativeTime($timestamp) { | |
$difference = strtotime(date('Y-m-d H:i:s')) - strtotime($timestamp); | |
$periods = ['second', 'minute', 'hour', 'day', 'week', 'month', 'year', 'decade']; | |
$lengths = [60, 60, 24, 7, 4.35, 12, 10]; | |
// This was in the past | |
if ($difference >= 0) { | |
$ending = 'ago'; | |
// This was in the future |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
:: Clear Microsoft version notice displayed by an | |
:: Administrator CMD & shells opened by Fork | |
cls | |
:: Enable unicode support | |
chcp 65001 >NUL | |
if exist .\laravel cd laravel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>Particles</title> | |
<style>body { background-color: #1a252f }</style> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple function for formatting strings. | |
* | |
* Replaces placeholders with values passed as extra arguments | |
* | |
* @param {string} format the base string | |
* @param ...args the values to insert | |
* @return {string} the replaced string | |
*/ | |
function sprintf(format, ...args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isNumeric(n) { | |
return !isNaN(parseFloat(n)) && isFinite(n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Removes empty paragraphs, ordered and unordered lists | |
* Reconciles spacing | |
* Replaces curly quotes with straight equivalent | |
* | |
* @param $html | |
* @return string | |
*/ | |
public static function sanitizeWysiwygInput($html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var c = document.getElementsByTagName('canvas')[0]; | |
var x = c.getContext('2d'); | |
x.fillStyle = '#' + ('00000' + (Math.random() * (1 << 24) | 0).toString(16)).slice(-6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var secondsRemaining; | |
let run_function = () => { | |
// | |
} | |
$(document).ready(function(){ | |
run_function(); | |
var time = new Date(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const names = [{'0':'zero','1':'one','2':'two','3':'three','4':'four','5':'five','6':'six','7':'seven','8':'eight','9':'nine' },{'0':'ten','1':'eleven','2':'twelve','3':'thirteen','4':'fourteen','5':'fifteen','6':'sixteen','7':'seventeen','8':'eighteen','9':'nineteen'},{'2':'twenty','3':'thirty','4':'forty','5':'fifty','6':'sixty','7':'seventy','8':'eighty','9':'ninety'},['','thousand','million','billion','trillion','quadrillion','quintillion','sextillion','septillion','octillion','nonillion','decillion','undecillion','duodecillion','t#000ecillion','quattuordecillion', 'quindecillion','sexdecillion','septdecillion','octdecillion','novemdecillion','vigintillion']]; | |
let to_words = (s) => { | |
n = 0; | |
s = '' + s.split('').reverse(); | |
var ns = s.slice(0, 3); | |
return (ns.length < 1)?'':to_words(s.slice(3,s.length),n+1)+((ns.length>1)?((ns.length==3&&ns[2]!='0')?names[0][ns[2]]+' hundred '+((ns[1]=='1')?names[1][ns[0]]+' ':(ns[1]!='0')?names[2][ns[1]]+' '+((ns[0]!='0')?names[0][ns[0]]+' ':''):(ns[0]!='0' |