This Web Components keeps the year in your copyright notice up-to-date.
export { CopyrightYearElement }
const name = "copyright-year";
class CopyrightYearElement extends HTMLSpanElement {
// sh.mjs: javascript shorthand | |
// array helpers (apl/j/k) | |
export const id=x=>x | |
export const af=(n,x)=>Array(n).fill(x) // TODO: make this 'afl' or 'fil' (aa?) | |
export const ii=(n,f)=>{for(let i=0;i<n;i++)f(i)} | |
export const im=(n,f)=>af(n,0).map((_,i)=>f(i)) | |
export const ia=(n,f)=>im(n,id) | |
export const at=(a,ixs)=>ixs.map(i=>a[i]) | |
export const io=(xs,ys)=>ys.map([].indexOf.bind(xs)) |
<?php | |
use Illuminate\Support\Str; | |
function generateReferralCode($str) { | |
// get random number min & max 4 digit | |
$randomNumber = rand(1000, 9999); | |
// get the first 4 character and trim whitespace | |
$strName = trim(substr($str, 0, 4)); | |
// get str length |
// time and time end | |
console.time("This"); | |
let total = 0; | |
for (let j = 0; j < 10000; j++) { | |
total += j | |
} | |
console.log("Result", total); | |
console.timeEnd("This"); | |
// Memory |
<?php | |
if(isset($_POST['login'])) { | |
if(!isset($_POST['g-recaptcha-response']) || empty($_POST['g-recaptcha-response'])) { | |
echo 'reCAPTHCA verification failed, please try again.'; | |
} else { | |
$secret = 'google_secret_key'; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
/** | |
* Validate if a Unix timestamp is valid. | |
* | |
* @param $unixtimestamp | |
* @return bool | |
*/ | |
function datetime_IsUnixTimeStampValid($unixtimestamp) { | |
// | |
// | |
/////////////////////////////////////////////////////////////////////// |
public class FirebasePlayerMatchMaker { | |
public static interface OnMatchMadeCallback { | |
public void run(FirebasePlayerMatchMaker c); | |
} | |
public static final String RANDOM_ROOM_ID = "/Globl"; | |
public static final String ROOM_ID = "/GameRooms"; | |
public static final String GAMES_RECORD = "/OpenGameMoves"; |
{ | |
"fas fa-address-book","fas fa-address-card","fas fa-adjust","fas fa-align-center","fas fa-align-justify","fas fa-align-left","fas fa-align-right","fas fa-allergies","fas fa-ambulance","fas fa-american-sign-language-interpreting","fas fa-anchor","fas fa-angle-double-down","fas fa-angle-double-left","fas fa-angle-double-right","fas fa-angle-double-up","fas fa-angle-down","fas fa-angle-left","fas fa-angle-right","fas fa-angle-up","fas fa-archive","fas fa-arrow-alt-circle-down","fas fa-arrow-alt-circle-left","fas fa-arrow-alt-circle-right","fas fa-arrow-alt-circle-up","fas fa-arrow-circle-down","fas fa-arrow-circle-left","fas fa-arrow-circle-right","fas fa-arrow-circle-up","fas fa-arrow-down","fas fa-arrow-left","fas fa-arrow-right","fas fa-arrow-up","fas fa-arrows-alt","fas fa-arrows-alt-h","fas fa-arrows-alt-v","fas fa-assistive-listening-systems","fas fa-asterisk","fas fa-at","fas fa-audio-description","fas fa-backward","fas fa-balance-scale","fas fa-ban","fas fa-band-aid","fas fa-barcode","fas fa-bars", |
// Google Play API Key | |
// ref: http://stackoverflow.com/questions/35127086/android-inapp-purchase-receipt-validation-google-play | |
// ref: https://developers.google.com/android-publisher/authorization | |
// ref: http://google.github.io/google-api-nodejs-client/18.0.0/index.html#toc14__anchor | |
// | |
// install npm package | |
// ref: https://github.com/google/google-api-nodejs-client | |
// $ npm install googleapis --save | |
// | |
const google = require('googleapis'); |
<?php | |
// Converts a number into a short version, eg: 1000 -> 1k | |
// Based on: http://stackoverflow.com/a/4371114 | |
function number_format_short( $n, $precision = 1 ) { | |
if ($n < 900) { | |
// 0 - 900 | |
$n_format = number_format($n, $precision); | |
$suffix = ''; | |
} else if ($n < 900000) { |