Skip to content

Instantly share code, notes, and snippets.

View motyar's full-sized avatar
🎯
Focusing

Motyar motyar

🎯
Focusing
View GitHub Profile
@motyar
motyar / gist:9e45e8270c2d2614bfa96ace886ef392
Created May 26, 2017 02:48
Verifying that "motyar.id" is my Blockstack ID. https://onename.com/motyar
Verifying that "motyar.id" is my Blockstack ID. https://onename.com/motyar
An array, slice, or map composite literal of the form:
[]T{T{}, T{}}
will be simplified to:
[]T{{}, {}}
A slice expression of the form:
s[a:len(s)]
will be simplified to:
s[a:]
@motyar
motyar / db.php
Last active December 23, 2017 11:47
PHP database class.
<?php
class db {
var $host;
var $db_name;
var $username;
var $password;
var $res;
var $query;
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Test js-yaml</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/3.11.0/js-yaml.min.js"></script>
<script type="text/javascript">
// YAML string to Javascript object
<h1>Hello</h1>
@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)) {
<?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;

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:

@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>