Skip to content

Instantly share code, notes, and snippets.

@itsdavidmorgan
itsdavidmorgan / index-registration.php
Last active April 24, 2024 08:22
Register Scripts and Styles Gutenberg Block
<?php
function organic_profile_block() {
// Scripts.
wp_register_script(
'organic-profile-block-script', // Handle.
plugins_url( 'block.js', __FILE__ ), // Block.js: We register the block here.
array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-editor' ), // Dependencies, defined above.
filemtime( plugin_dir_path( __FILE__ ) . 'block.js' ),
true // Load script in footer.
@dkorobtsov
dkorobtsov / Add_WindowsDefender_Exclusions.ps1
Last active April 24, 2024 08:22
PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
# PowerShell script to add Windows Defender exclusions for WSL2 and JetBrains IDE performance issues
#
# For context please read this thread:
# https://github.com/microsoft/WSL/issues/8995
#
# How to use?
# - Save the Script: Open a text editor like Notepad and paste the PowerShell script into it.
# - Save the file with a .ps1 extension, for example, Add_WindowsDefender_Exclusions.ps1.
# - Run PowerShell as Administrator: Search for "PowerShell" in the Start menu, right-click on it, and choose "Run as administrator".
# - Navigate to the Script's Location: Use the cd command to navigate to the directory where you saved the .ps1 file.
@ntjess
ntjess / gantt.typ
Last active April 24, 2024 08:15
Colorful, Date-Aligned Gantt Chart in Typst
#let _records-to-dict(records) = {
let formatted = (:)
for r in records {
for (k, v) in r {
let cur = formatted.at(k, default: ())
cur.push(v)
formatted.insert(k, cur)
}
}
formatted
@rjescobar
rjescobar / extend-trial-jetbrains-windows.bat
Created August 31, 2021 02:53
JetBrains IDE trial reset windows
REM Delete eval folder with licence key and options.xml which contains a reference to it
for %%I in ("WebStorm", "IntelliJ", "CLion", "Rider", "GoLand", "PhpStorm", "Resharper", "PyCharm") do (
for /d %%a in ("%USERPROFILE%\.%%I*") do (
rd /s /q "%%a/config/eval"
del /q "%%a\config\options\other.xml"
)
)
REM Delete registry key and jetbrains folder (not sure if needet but however)
rmdir /s /q "%APPDATA%\JetBrains"
@noelbundick
noelbundick / Dockerfile
Last active April 24, 2024 08:14
Consuming packages from a private Azure Pipelines Python artifact feed
# We set an environment variable in this phase so it gets picked up by pip, but we don't want to bake secrets into our container image
FROM python:3.6-alpine AS builder
ARG INDEX_URL
ENV PIP_EXTRA_INDEX_URL=$INDEX_URL
COPY requirements.txt .
RUN pip install -U pip \
&& pip install --user -r requirements.txt
@JamieMason
JamieMason / unfollow.js.md
Last active April 24, 2024 08:13
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
@sangar82
sangar82 / gist:e83e255da149882582b8
Last active April 24, 2024 08:10
Redis laravel example
Route::get('redis', array('as' => 'cache', 'do' => function()
{
$redis = Redis::connection();
//STRING
$redis->set('name', 'Taylor');
$name = $redis->get('name');
// LIST
// A list is a series of ordered values. Some of the important commands for interacting with lists are RPUSH, LPUSH, LLEN, LRANGE, LPOP, and RPOP.
@sannajammeh
sannajammeh / Parent.tsx
Last active April 24, 2024 08:10
Next.js Loading HLS Video's the performant way.
import dynamic from "next/dynamic";
import Head from "next/head";
import React, { Suspense, useEffect, useRef, useState } from "react";
const HLSPlayer = dynamic(() => import("@components/HLSPlayer"), {
suspense: true,
});
const Parent = () => {
const [video, setVideo] = useState<HTMLVideoElement | null>(null); // use callback state instead of ref due to hydration of SSR stream