Skip to content

Instantly share code, notes, and snippets.

@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/dashboard') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Dashboard</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>
@endif
@Shelob9
Shelob9 / client.js
Last active December 14, 2022 15:38
Using a WordPress REST API route to proxy request to thrid party API, so api key isn't needed in client https://twitter.com/UpTheIrons1978/status/1602938132244094976
$.post( url_of_wp_endpoint, {email: 'roy@roysivan.com' } );
@Shelob9
Shelob9 / docker-compose.yml
Created December 7, 2022 20:33
Add new environment variable, from .env file, to Laravel sail, in docker-compose file https://laravel.com/docs/9.x/sail
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
<?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