Skip to content

Instantly share code, notes, and snippets.

View projektorius96's full-sized avatar
🐢
Turtles do code

LG projektorius96

🐢
Turtles do code
View GitHub Profile
@projektorius96
projektorius96 / wpgulp.config.js
Created March 19, 2021 18:53 — forked from linkdigitaluk/wpgulp.config.js
[WP Setup - wpgulp config file] For setting Up WPGulp, make sure yourProject URL matches a virual host set up in Wordpress or you'll have a bad time #wpGulp #NPM
/**
* WPGulp Configuration File
*
* 1. Edit the variables as per your project requirements.
* 2. In paths you can add <<glob or array of globs>>.
*
* @package WPGulp
*/
module.exports = {
@projektorius96
projektorius96 / pdo_db.php
Created August 10, 2020 16:27 — forked from bradtraversy/pdo_db.php
PDO Class
<?php
/*
* PDO DATABASE CLASS
* Connects Database Using PDO
* Creates Prepeared Statements
* Binds params to values
* Returns rows and results
*/
class Database {
private $host = DB_HOST;
@projektorius96
projektorius96 / pdocrash.php
Created July 2, 2020 21:12 — forked from bradtraversy/pdocrash.php
PDO & Prepared Statements Snippets
<?php
$host = 'localhost';
$user = 'root';
$password = '123456';
$dbname = 'pdoposts';
// Set DSN
$dsn = 'mysql:host='. $host .';dbname='. $dbname;
// Create a PDO instance
const x = 'abc'; // Coerces to true in a boolean context
const y = null; // Coerces to false in a boolean context
// "!" Creates a boolean context and returns the opposite.
const a = !x; // Value a is opposite of x, false.
const b = !y; // Value a is opposite of y, true.
if (a) {
// NOT executed.
}
if (b) {
// Executed.
@projektorius96
projektorius96 / post.md
Created April 20, 2020 15:20 — forked from chrisguttandin/post.md
What else can we do with the Web Audio API?

What else can we do with the Web Audio API?

Of course the Web Audio API is meant for synthesizing and processing audio data. It is tailored for that use case. But at least in our digital world audio data is just a series of numbers, which are typically somewhere between +1 and -1. So why can't we use the Web Audio API for general computations?

Almost a year ago I had the pleasure to give a talk at the Web Audio Conference in Atlanta. The conference featured a lot of great talks, which I really appreciated as an attendee. However, as a speaker it was tough to reduce my own talk until it was short enough to fit into the schedule. I had the feeling that I had to rush through my slides. Since then I planned to write down my findings in a more detailed way, but I never got around to it. Luckily I was asked to repeat my talk at our local Web Audio Meetup here in

@projektorius96
projektorius96 / ajaxspreadsheet.js
Created March 28, 2020 21:35 — forked from mgamini/ajaxspreadsheet.js
How to receive ajax data and store it in a Google spreadsheet
// Follow the instructions here: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/
//
// That'll get you 80% of the way there. Unfortunately, you'll run into CORS and MIMETYPE errors, so make the following changes.
// ============================================================
// Your clientside script should actually look like this (jquery example):
// ============================================================
var data = {email: "email@address.com"}
// Solution to this: https://www.chromestatus.com/features/6662647093133312
window.addEventListener("wheel", function (e) {e.preventDefault()}, {passive: false}); // no more mouse wheel scrolling [both sides]
// window.addEventListener("wheel", function (e) {e.preventDefault()}, {passive: true}); this is default behaviour
// https://stackoverflow.com/questions/32518615/skip-arguments-in-a-javascript-function
// A WAY
function skipSomeParams(undefined, undefined, undefined, arg4, arg5) {
console.log(undefined, undefined, undefined, arg4, arg5)
}
const skip = (num) => new Array(num);
skipSomeParams(...skip(3), "a", "b")
// undefined, undefined, undefined, "a", "b"
// Thanks for answer by drinchev on https://stackoverflow.com/questions/10470926/making-an-array-with-2-digit-numbers-in-javascript
fnGenToArray_ver1.js
var myArray = [];
var ommitArr = [4, 6];
function getInterval (start, step, end /* , skip parameter is defined within ommitArr globally */){
skip = this.ommitArr; // a must be preference (passed/failed)
// console.log(skip); passed successfully global array to function level
loop1:
for (start; start <= end; start += step) {