Skip to content

Instantly share code, notes, and snippets.

View bayareawebpro's full-sized avatar
✔️
Available for Consulting

Dan Alvidrez bayareawebpro

✔️
Available for Consulting
View GitHub Profile
@chasecmiller
chasecmiller / Plugin.php
Last active February 6, 2018 00:08
Wordpress - Materialized Path for Custom Post Types ( CPT ) and Built In Post Types
<?php
/*
Plugin Name: Materialized Paths
Plugin URI: http://crumbls.com
Description: Implement materialized paths for WordPress to enable simple searching for child and parent paths.
Author: Chase C. Miller
Version: 2.0.1a
Author URI: http://crumbls.com
Text Domain: Crumbls\Plugins\Materialized
*/
@gocanto
gocanto / .travis.yml
Last active September 29, 2018 08:06
MySQL 5.7 Travis CI configuration
language: php
php:
- 7.0
- 7.1
services:
- mysql
addons:
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC
@savelee
savelee / gist:6701c707b8f5805c9cf7
Created July 10, 2015 14:36
Setup php mail Ubuntu digital ocean
//login to your droplet.
//1. output the hostname
hostname
//2. modify the hosts
nano /etc/host
//3. the first line in this file, should use the hostname on the end. For example: "Lee"
127.0.0.1 localhost localhost.domainname Lee
<?php
namespace App;
use Closure;
class CommandEventsListener
{
protected $startCallbacks = [];
protected $finishCallbacks = [];
<template>
<div>
<label id="listbox-label" class="block text-sm font-medium text-gray-700">
Assigned to
</label>
<input type="hidden" :value="selectedValues" name="name">
<div class="mt-1 relative">
<button @click="selected = !selected" type="button" aria-haspopup="listbox" aria-expanded="true"
aria-labelledby="listbox-label"
class="bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<template>
<div>
<label id="listbox-label" class="block text-sm font-medium text-gray-700" v-text="label"/>
<input type="hidden" :value="selectedValues" :name="name">
<div class="mt-1 relative">
<button @click="selected = !selected" type="button" aria-haspopup="listbox" aria-expanded="true"
aria-labelledby="listbox-label"
class="bg-white relative w-full border border-gray-300 rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm">
<span class="block truncate" v-text="selectedText"/>
@TheDeadCode
TheDeadCode / JsonModelStreamWriter.php
Created March 3, 2021 22:04
JsonModelStreamWriter
<?php
/**
* Stream-write arrays onto a file on disk as JSON format, to avoid memory leaks.
* Written expressly for /u/devourment77 of reddit.
*
* Copyright (C) 2021 by Vynatu Cyberlabs, Inc. and Felix Lebel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
@elawad
elawad / format-size.js
Last active March 29, 2021 10:03
Format file size like macOS
function formatSize(size) {
const base = 1000; // 1000 or 1024
const kb = base ** 1;
const mb = base ** 2;
const gb = base ** 3;
let num;
num = (size / 1).toFixed(0);
if (num < base) return Number(num) + ' B';
@FrostyX
FrostyX / FacebookDebugger.php
Last active February 9, 2022 11:15
Facebook API - Force facebook to reload cache from your website
<?php
class FacebookDebugger
{
/*
* https://developers.facebook.com/docs/opengraph/using-objects
*
* Updating Objects
*
* When an action is published, or a Like button pointing to the object clicked,
* Facebook will 'scrape' the HTML page of the object and read the meta tags.