Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Takes in a filename and an array associative data array and outputs a csv file
* @param string $fileName
* @param array $assocDataArray
*/
public function outputCsv($fileName, $assocDataArray)
{
ob_clean();
@AucT
AucT / Simple API.md
Last active November 30, 2022 04:46

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 January 13, 2020 12:04
css bootstrap 4 social buttons color
.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 December 12, 2019 10:03
decompact - replace php compact with array
<?php
function decompact(...$params)
{
$minimumParamsForNewLines = 4;
$newLine = "\n";
if (count($params) < $minimumParamsForNewLines) {
$newLine = '';
}
<?
$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';
<?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 December 7, 2016 09:08
jquery Ajax example
<!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 September 3, 2016 16:57
simple page generation time
<?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 August 23, 2016 15:54
Youtube Iframe load on thumb click
<!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 January 12, 2016 15:24
Youtube API js example
<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>