Skip to content

Instantly share code, notes, and snippets.

View agronom81's full-sized avatar

Pavlo Petrenko agronom81

  • WebDesignSun
  • Ukraine, Mykolaiv
View GitHub Profile
@agronom81
agronom81 / Dividers
Created January 13, 2023 08:10
Dividers in pdfkit-table
// create document
const doc = new PDFDocument({ margin: 30, });
// to save on server
doc.pipe(fs.createWriteStream("./document-5.pdf"));
const table01 = {
"headers" : ["A", "B", "C"],
"rows": [
[ "Version 0.1.74", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id est ipsum. Fusce scelerisque maximus justo, lacinia ornare felis iaculis nec.", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id est ipsum. " ],
@agronom81
agronom81 / getType
Created July 4, 2022 08:29
get type
function getType(obj) {
const type = typeof obj;
if(type !== 'object') {
return type;
}
return Object.prototype.toString.call(obj).replace(/^\[object (\S+)\]$/, '$1').toLowerCase();
}
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@agronom81
agronom81 / Google-Sheet-Form-Post.md
Created April 29, 2022 08:58 — forked from laptrinhcomvn/Google-Sheet-Form-Post.md
Post to google spreadsheet from html form

Overview

This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey

Depreciation Warning: This code is not maintained, and should be seen as reference implementation only. If you're looking to add features or update, fork the code and update as needed.

Run example

You should be able to just open index.html in your browser and test locally.

@agronom81
agronom81 / gist:8da889bdf5a6b85bb07d12515226bc94
Created October 5, 2021 18:51
multiple GitHub accounts
$ ssh-add -D //removes all ssh entries from the ssh-agent
$ ssh-add ~/.ssh/id_rsa // Adds the relevant ssh key
@agronom81
agronom81 / gist:b70572c7cc8e607d7242fd6eda8374ad
Created June 2, 2021 19:35
How to manage multiple GitHub accounts on a single machine with SSH keys
How to manage multiple GitHub accounts on a single machine with SSH keys
Bivil M Jacob
7-9 minutes
The need to manage multiple GitHub accounts on the same machine comes up at some point in time for most developers. Every single time I happen to change my Mac or need to Git push with a new work account, I end up surfing for the how to’s of something I have done over half a dozen times.
My laziness in not documenting the process and inability to remember the steps makes me spent a decent amount of time getting the bits and pieces from all over the web and then somehow making it work.
I’m sure there are many of you who have been there, done that and many more of you who are just waiting for the next time the same thing occurs (myself included!). This endeavor is meant to help us all out.
1. Generating the SSH keys
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-app.js");
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-messaging.js");
try {
firebase.initializeApp({
apiKey: "AIzaSyAZW895vVsq-sGPPRm52fQI3V3j6yvylRc",
authDomain: "push-project-e1ffa.firebaseapp.com",
projectId: "push-project-e1ffa",
storageBucket: "push-project-e1ffa.appspot.com",
messagingSenderId: "237926722474",
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-app.js");
importScripts("https://www.gstatic.com/firebasejs/8.2.6/firebase-messaging.js");
try {
firebase.initializeApp({
apiKey: "AIzaSyAZW895vVsq-sGPPRm52fQI3V3j6yvylRc",
authDomain: "push-project-e1ffa.firebaseapp.com",
projectId: "push-project-e1ffa",
storageBucket: "push-project-e1ffa.appspot.com",
messagingSenderId: "237926722474",
@agronom81
agronom81 / firebase.js
Created February 18, 2021 20:47
Fiebase.js
import firebase from "firebase/app";
import "firebase/analytics";
import "firebase/messaging";
import axios from "axios";
let firebaseInit = {
methods: {
firebaseInit: function () {
const firebaseConfig = {
apiKey: "AIzaSyAZW895vVsq-sGPPRm52fQI3V3j6yvylRc",
@agronom81
agronom81 / mysqldump.php
Created March 6, 2020 11:41 — forked from micc83/mysqldump.php
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';