Skip to content

Instantly share code, notes, and snippets.

@tnrn9b
tnrn9b / submit.md
Created February 17, 2021 03:42 — forked from tanaikech/submit.md
Creating Multiple Buttons on Google Spreadsheet using Google Apps Script

Creating Multiple Buttons on Google Spreadsheet using Google Apps Script

This is a sample script for creating the multiple buttons on Google Spreadsheet using Google Apps Script.

Recently, I have got several contacts about this. I thought that when this is published, it might be useful for other users. So I published this sample script.

Sample script

@tnrn9b
tnrn9b / submit.md
Created February 17, 2021 03:37 — forked from tanaikech/submit.md
Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button

Downloading Active Sheet in Google Spreadsheet as CSV and PDF file by Clicking Button

This is a sample script for downloading the active sheet in Google Spreadsheet to the local PC as a CSV file and a PDF file when a button on the side bar and the dialog is clicked. This is created with Google Apps Script and HTML&Javascript. In this post, the script of the previous post was modified.

Sample script

Please create new Google Spreadsheet and copy and paste the following scripts to the script editor. And please run openSidebar(). By this, the side bar is opened to the Spreadsheet.

@tnrn9b
tnrn9b / RouteMaker.php
Last active March 17, 2020 17:47
Automatically generate ZF3/Laminas route config from a controller factory key
$factories = array(
'Your\Namespace\ControllerName' => 'Your\Namespace\Factory\ControllerNameControllerFactory',
...
);
$writeRouteFromControllerKey = static function (array $factories, $namespace)
{
$createRoute = static function (string $controller, array $actions) use ($namespace) {
$controller = lcfirst($controller);
$childRoutes = "";
@tnrn9b
tnrn9b / html_trim_whitespace.php
Created August 4, 2018 06:44 — forked from gskema/html_trim_whitespace.php
HTML whitespace trim RegEx (regular expression) for PHP. Useful for trimming HTML content before TCPDF processing.
<?php
// Trims whitespaces after any tags. Assumes that a tag ends with '/>', '\w>', '">'.
$html = preg_replace('#(["|\/|\w]>)(\s+)#', '$1', $html);
// Trims whitespaces before any tags. Assumes that tags start with '<\w+'
$html = preg_replace('#(\s+)(<\/?\w+)#', '$2', $html);
// Trims spaces between tags (both opening and closing).
// Assumes that a tag ends with '/>', '\w>', '">' and starts with '<\w+'
public static function generateInvoicePDF($row)
{
self::loadLanguage();
require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/tcpdf.php';
require_once JPATH_ROOT . '/components/com_osmembership/tcpdf/config/lang/eng.php';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$config = self::getConfig();
@tnrn9b
tnrn9b / __upload_file.md
Created July 30, 2018 15:32 — forked from dlgg/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");;
@tnrn9b
tnrn9b / __upload_file.md
Created July 29, 2018 19:42 — forked from maxivak/__upload_file.md
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");;
/**
* Sample of serverside generation of Highcharts using an extension to jsdom in node.js.
*
* Usage:
* npm install jsdom
* npm install highcharts
* node highcharts-jsdom
*/
/* eslint-env node */
@tnrn9b
tnrn9b / setup.md
Created February 18, 2018 18:00 — forked from shashankmehta/setup.md
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
(* author: Dimitur Krustev *)
(* started: 20130616 *)
(* based on: http://siek.blogspot.com/2013/05/type-safety-in-three-easy-lemmas.html *)
Require Import Arith List Bool.
Set Implicit Arguments.
Section Lang.