Skip to content

Instantly share code, notes, and snippets.

View abrkof's full-sized avatar

abrkof abrkof

View GitHub Profile
@abrkof
abrkof / jsonToCsv.php
Created November 26, 2020 22:57 — forked from jakebathman/jsonToCsv.php
A function to convert a JSON string (or a PHP array) to a CSV file or CSV string echoed to the browser
<?php
/*
*
* Based on (forked from) the work by https://gist.github.com/Kostanos
*
* This revision allows the PHP file to be included/required in another PHP file and called as a function, rather than focusing on command line usage.
*
* Convert JSON file to CSV and output it.
*
* JSON should be an array of objects, dictionaries with simple data structure
@abrkof
abrkof / gist:61416df9ac84da14269311025692d3a2
Created October 28, 2020 17:10 — forked from BrunoAssis/gist:5558544
Excel macro example in PHP.
<?php
// set up excel
$excel = new COM("excel.application") or die("Unable to instantiate excel");
// run Excel silently, since we don’t want dialog boxes popping up in the background
$excel->DisplayAlerts = false;
// open up Excel file and select the first sheet, which contains the inputs
$excel->Workbooks->Add();
$book = $excel->ActiveWorkbook;
$sheets = $book->Sheets;
$sheet = $book->Worksheets(1);
@abrkof
abrkof / VideoStream.php
Created January 7, 2020 15:23 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@abrkof
abrkof / index.html
Created November 4, 2019 17:56 — forked from johnmellor/index.html
Minimal push notifications demo (sends via XHR)
<!doctype html>
<!-- View this at https://rawgit.com/johnmellor/460bdac0c5b30832df898e67b4b7cedf/raw/ -->
<meta name=viewport content="initial-scale=1">
<a href="https://gist.github.com/johnmellor/460bdac0c5b30832df898e67b4b7cedf">View code</a><br>
<a href="https://rawgit.com/johnmellor/d792819c4faa24a190bb7ea0138fba3e/raw/">cURL variant</a>
<p id="loading">Loading...</p>
<div id="loaded" style="display: none">
<p><strong>Endpoint:</strong> <output id="registration-id"></output>
<p><button id="send-button">Send push</button><br>
@abrkof
abrkof / JSONUtil.php
Created October 11, 2019 17:26 — forked from wrey75/JSONUtil.php
A JSON Diff object
<?php
/**
* This class works on arrays, not on JSON strings
* directly. You have to use json_encode/json_decode
* for doing this.
*
* @author wrey75@gmail.com
*
*/
@abrkof
abrkof / JSONUtil.php
Created October 11, 2019 17:26 — forked from wrey75/JSONUtil.php
A JSON Diff object
<?php
/**
* This class works on arrays, not on JSON strings
* directly. You have to use json_encode/json_decode
* for doing this.
*
* @author wrey75@gmail.com
*
*/
@abrkof
abrkof / OrdenarJSONconJS.html
Created April 11, 2019 13:45 — forked from fmagrosoto/OrdenarJSONconJS.html
Ordenar JSON por medio del valor de una de sus propiedades. La propiedad es pasada como parámetro.
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Ordena JSON</title>
<meta name="description" content="Ordenar un JSON en Javascript">
<meta name="author" content="Fernando Magrosoto V.">
<style>
body {
background-color: white;
@abrkof
abrkof / REST_PHP_set_note_attachment.php
Created September 20, 2018 22:24 — forked from sugarknowledge/REST_PHP_set_note_attachment.php
PHP Example using cURL with the v4 REST API to create a note with an attachement
<?php
$url = "http://{site_url}/service/v4/rest.php";
$username = "admin";
$password = "password";
//function to make cURL request
function call($method, $parameters, $url)
{
ob_start();