Skip to content

Instantly share code, notes, and snippets.

Avatar

Mat Gargano matgargano

View GitHub Profile
View random.js
/**
*
* Returns a random element from an array
*
*/
function random_item(items) {
return items[Math.floor(Math.random()*items.length)];
}
@matgargano
matgargano / index.html
Last active Nov 17, 2020
Bootstrap Starter
View index.html
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
View margin.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PADDING!</title>
<link href="/margin.css" rel="stylesheet">
</head>
<body>
<div class="example-1">
View mutlsite instructions
add to wp-config:
Config::define('WP_ALLOW_MULTISITE', true);
deploy site
go to tools > network setup, select subdomains
save , etc.
add to wp-config
Config::define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', true);
Config::define('PATH_CURRENT_SITE', '/wp/');
View index.html
Aenean malesuada nunc magna, in luctus elit lobortis ut. Cras odio turpis, accumsan eu rutrum fermentum, commodo vitae nulla. Maecenas dui erat, ullamcorper in tortor at, sollicitudin cursus ante. Aliquam eu libero molestie, viverra risus vitae, fermentum nisi. Sed id neque eget dolor lobortis venenatis eget efficitur tellus. Nullam nisi eros, semper vel pharetra at, eleifend sagittis risus. Etiam porttitor auctor nisl id tempus. Duis fringilla diam arcu, eu faucibus lorem gravida eget. In hac habitasse platea dictumst.
@matgargano
matgargano / API.jsx
Last active Feb 18, 2020
React Persisters
View API.jsx
import Persister from './Persister';
import { HttpClient } from '../HttpClient';
export default class API extends Persister {
constructor(keyObject) {
super(keyObject);
this.LS_KEY = 'api';
}
async get() {
View index.html
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<style>
View sideload.php
<?php
namespace VHC;
class Sideload {
public static function get( $image_url, $post_id = null ) {
$tmp = \download_url( $image_url );
if ( ! $post_id ) {
$post_id = md5( time() );
}
View gist:c691858820582c9e6f1360c28cd316d3
[xdebug]
zend_extension="/Applications/MAMP//bin/php/php7.2.20/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.profiler_output_dir=/Applications/MAMP/tmp
xdebug.idekey=VAGRANT
View gist:1fa24ddb48fde071b1ca793b897742d5
[
{
title: 'Node1',
value: '0-0',
key: '0-0',
children: [
{
title: 'Child Node1',
value: '0-0-0',
key: '0-0-0',