Skip to content

Instantly share code, notes, and snippets.

View motyar's full-sized avatar
🟢
I may be slow to respond.

Motyar motyar

🟢
I may be slow to respond.
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<script>
(function(){
var username = prompt("What is your Github username?");
if(username){
var api = 'https://api.github.com/users/'+username;
var template = 'https://img.bruzu.com/?bg=%23f0f3ff&h=500&w=500&a.tp=image&a.ox=center&a.oy=center&a.x=250&a.y=126&a.w=460&a.h=460&a.sx=0.4&a.sy=0.4&a.src=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F517371%3Fv%3D4&a.circleFrame=true&b.tp=textbox&b.ox=center&b.oy=center&b.x=250&b.y=273&b.w=416&b.h=57&b.t=&b.ta=center&b.fs=50&b.lh=1&b.fw=700&b.ff=Montserrat&b.fontStyle=normal&b.maxHeight=50&c.tp=textbox&c.ox=center&c.oy=center&c.x=250&c.y=317&c.w=416&c.h=23&c.fill=%23555&c.t=&c.ta=center&c.fs=20&c.lh=1&c.fw=400&c.ff=Inter&c.fontStyle=normal&c.maxHeight=20&d.tp=textbox&d.oy=center&d.x=42&d.y=411&d.w=83&d.h=68&d.fill=%23555&d.t=&d.ta=center&d.fs=60&d.lh=1&d.fw=900&d.ff=Inter&d.fontStyle=normal&d.ox=left&d.maxHeight=60&e.tp=textbox&e.ox=center&e.oy=center&e.x=250&e.y=410&e.w=83&e.h=68&e.fill=%23555&e.t=&e.ta=center&e.fs=60&e.lh=1&e.fw=9
@motyar
motyar / index.html
Last active September 8, 2021 15:48
<!DOCTYPE html>
<html>
<head>
<script>
(function(){
var api = 'https://api.quotable.io/random';
var template = 'https://img.bruzu.com/?backgroundColor=black&backgroundImage=https://source.unsplash.com/500x800?wallpaper&backgroundImage.opacity=0.5&height=800&a.fontSize=60&a.fontFamily=Poppins&a.fontWeight=800&a.width=400&a.color=white&b.originY=bottom&b.top=770&b.width=400&b.color=white&b.fontFamily=Lora&b.fontSize=30';
var imgUrl = '';
var api = 'https://api.quotable.io/random';
var template = 'https://img.bruzu.com/?backgroundColor=black&backgroundImage=https://source.unsplash.com/500x800?wallpaper&backgroundImage.opacity=0.5&height=800&a.fontSize=60&a.fontFamily=Poppins&a.fontWeight=800&a.width=400&a.color=white&b.originY=bottom&b.top=770&b.width=400&b.color=white&b.fontFamily=Lora&b.fontSize=30';
var imgUrl = '';
// Fetch the data from JSON API
fetch(api)
.then(response => response.json())
.then(data => {
@motyar
motyar / sheet2json.js
Created September 5, 2021 16:24
Google sheet to JSON link and accessing that data with JavaScript
const spreadsheetId = '1bPt3cGhnfvqASOmcpvBQglPqg_fnU6aZktlYA8gqEdw'
fetch(`https://docs.google.com/spreadsheets/d/${spreadsheetId}/gviz/tq?tqx=out:json`)
.then(res => res.text())
.then(text => {
const json = JSON.parse(text.substr(47).slice(0, -2));
console.log(json);
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/jsonata/jsonata.min.js"></script>
<script>
let word = "code";
let url = 'https://api.dictionaryapi.dev/api/v2/entries/en/'+word;
let expression = '[word, phonetic, meanings[0].partOfSpeech, meanings[0].definitions[0].definition]';
theme highlight progress controls slideNumber editor
night
vs
false
false
false
hidden
true
@motyar
motyar / index.html
Last active June 11, 2020 06:09 — forked from tonyfast/index.html
A simple example that dynamically adds slides to a Reveal.js
<head>
<link rel="stylesheet" href="//cdn.jsdelivr.net/g/reveal.js(css/reveal.min.css)">
<script src="//cdn.jsdelivr.net/g/reveal.js,zepto"></script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section data-markdown data-separator-vertical="^===" data-separator="^---">
<script type="text/template" id="md"></script>

Keybase proof

I hereby claim:

  • I am motyar on github.
  • I am motyar (https://keybase.io/motyar) on keybase.
  • I have a public key whose fingerprint is 8612 6F70 5C64 BF88 1375 9DFB 2A8C 12E8 0FBD 7DC0

To claim this, I am signing this object:

<?php
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', 1);
// define the path and name of cached file
$cachefile = 'cache/'.date('M-d-Y').'.php';
// define how long we want to keep the file in seconds. I set mine to 5 hours.
$cachetime = 18000;
@motyar
motyar / cache.php
Created August 11, 2018 11:34
Simple caching with PHP
<?php
// define the path and name of cached file,
$cachefile = 'cache/'.urlencode($_SERVER['REQUEST_URI']).'.txt';
// define how long we want to keep the file in seconds.
//$cachetime = 60*60*24;
$cachetime = 4;
// Check if the cached file is still fresh. If it is, serve it up and exit.
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {