Skip to content

Instantly share code, notes, and snippets.

View Simple API.md

Simple API - a mix of rest and RPC

There are a lot of time when you need a ton of actions but rest API docs with noun doesn't help much, and implementing proper RPC style will need a lot of changes and will not work for simple HTML forms.

Simple API spec

  1. HTTP GET for queries. GET requests are made in REST style.
@AucT
AucT / bootstrap4-social-button-colors.css
Created Jan 13, 2020
css bootstrap 4 social buttons color
View bootstrap4-social-button-colors.css
.btn-google {
color: #fff;
background-color: #dc4639;
border-color: #dc4639;
}
.btn-google:hover {
color: #fff;
background-color: #cb3124;
border-color: #c02f22;
}
@AucT
AucT / decompact.php
Last active Dec 12, 2019
decompact - replace php compact with array
View decompact.php
<?php
function decompact(...$params)
{
$minimumParamsForNewLines = 4;
$newLine = "\n";
if (count($params) < $minimumParamsForNewLines) {
$newLine = '';
}
View pageGenerationTime.php
<?
$time_start = microtime(true);
//Your Content (i use sleep 2 seconds to for demo)
sleep(2);
$time_end = microtime(true);
$time = $time_end - $time_start;
echo 'Page generated in: '.$time.' seconds';
View addYear.php
<?php
//Add 1 year
$future = date('Y-n-j', mktime(0,0,0, date('m'), date('d'), date('Y')+1));
echo $future;
@AucT
AucT / index.html
Created Dec 7, 2016
jquery Ajax example
View index.html
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Simple Ajax Send Form</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
@AucT
AucT / page_generation_time.php
Last active Sep 3, 2016
simple page generation time
View page_generation_time.php
<?php
$time_start = microtime(true);
//Your Content (i use sleep 2 seconds to for demo)
sleep(2);
$time_end = microtime(true);
@AucT
AucT / youtube_iframe.html
Created Aug 23, 2016
Youtube Iframe load on thumb click
View youtube_iframe.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Youtube Iframe load on thumb click</title>
<style>
.youtube {
position: relative;
padding-bottom: 56.25%;
@AucT
AucT / youtube-api-js.html
Created Jan 12, 2016
Youtube API js example
View youtube-api-js.html
<iframe id="player" type="text/html" width="640" height="390"
src="https://www.youtube.com/embed/8tEyAAniu5U?enablejsapi=1"
frameborder="0"></iframe>
<iframe id="player2" type="text/html" width="640" height="390"
src="https://www.youtube.com/embed/pt8VYOfr8To?enablejsapi=1"
frameborder="0"></iframe>
<script>
@AucT
AucT / event.video.youtube.js
Created Jan 12, 2016 — forked from benwong/event.video.youtube.js
YouTube iFrame API wrapper for event videos
View event.video.youtube.js
var EventYouTubeVideo = (function(){
var module = {};
module.init = function(){
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
};
You can’t perform that action at this time.