Skip to content

Instantly share code, notes, and snippets.

<?php
class Tribe__Debug {
/**
* constructor
*/
public function __construct() {
add_action( 'tribe_debug', [ __CLASS__, 'render' ], 10, 2 );
}
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
twitter: {
type: "app",
app: "twitter",
}
},
async run({steps, $}) {
let q = `${encodeURIComponent('from:@josh412 gm -filter:replies')}`;
<?php
/**
* Static accessor for plugin container
*
* @return array
*/
function wordpress_plugin()
{
static $container;
if (!$container) {
<?php
namespace App\Services;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile as HttpUploadedFile;
use Illuminate\Support\Facades\Http;
@Shelob9
Shelob9 / api.js
Created August 19, 2022 14:55
Using fetch to PUT data to a Laravel API that uses Laravel Sanctum. Sending the `X-XSRF-TOKEN` token to avoid error "CSRF token mismatch" with Laravel Sanctum
//https://stackoverflow.com/a/56071867/1469799
export const getAllCookies = () => document.cookie.split(';').reduce((ac, str) => Object.assign(ac, {[str.split('=')[0].trim()]: str.split('=')[1]}), {});
export const getCookie(name, defaultValue = null) => {
let cookies = getAllCookies();
return cookies.hasOwnProperty(name) ? cookies[name] : defaultValue;
}
fetch('/api/v1/rocks, {
method: "PUT",
body: JSON.stringify({
@Shelob9
Shelob9 / 1-vscode-server-ec2-install.md
Last active August 3, 2022 23:39
Setting up vsCode remote on AWS ec2 instance and connecting via ssh to desktop vsCode worked out pretty well, doing this. https://twitter.com/Josh412/status/1554600427261394948 https://www.sitepoint.com/vs-code-remote-development-amazon-ec2/

Go to ec2 console

  • "Launch Instance"
  • Name:
  • Ami: Ubuntu in quickstart
    • Defaults are fine
  • Instance type:
    • t2.micro is free tier
  • Key pair:
    • Can create one (make sure to download and save)
  • Save to .ssh config or something

Install PHP 8.1, node 16 and Docker in Ubuntu.

These scripts can be run with the following commands, by a super user. This installs a lot of stuff, read first.

You can add -s -- --dry-run to then end to do a dry run first.

These are tested on an ec2 instance running vscode remote

Usage

@Shelob9
Shelob9 / NewFile.php
Last active August 10, 2022 21:13
Call one artisan command, from another command, echo or stream its output
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class Name extends Command
{
protected $signature = 'something';
protected $description = 'Calls other commands';
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '@vitejs/plugin-vue2'
export default defineConfig({
plugins: [
laravel([
'resources/js/app.js',
]),
vue({