Skip to content

Instantly share code, notes, and snippets.

View craigiswayne's full-sized avatar

Craig Wayne craigiswayne

View GitHub Profile
@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.
@MichaelCurrin
MichaelCurrin / README.md
Last active October 26, 2023 18:47
Jekyll - how to build a REST API

Jekyll - how to build a REST API

Serve your data as static JSON

How to make a read-only JSON REST API using Jekyll.

This doesn't need any Ruby plugins - you just use some built-in templating features in Jekyll 3 or 4.

You will end up with a single JSON file contains data for all pages on the site, and another JSON file of just posts. Alternatively, you can replace every HTML page and post with a JSON version.

@imath
imath / post-taxonomy-panel.js
Created March 1, 2020 03:52
Example of use of the filter to replace the PostTaxonomy panel of the WordPress Block Editor
const { createElement, Component } = wp.element;
const { compose } = wp.compose;
const { RadioControl } = wp.components;
const { withSelect, withDispatch } = wp.data;
const { addFilter } = wp.hooks;
const { apiFetch } = wp;
const { __ } = wp.i18n;
class RiskDomain extends Component {
constructor() {
@craigiswayne
craigiswayne / setup.md
Last active June 12, 2021 23:50
How to Compile Sass \ Scss via NPM - Simple

How to Setup npm and scss \ sass

npm init
npm install node-sass --save
mkdir -p src/styles
touch src/styles/style.scss

In your generated package.json add the following to your scripts entry

@craigiswayne
craigiswayne / cssFromElement.js
Last active April 18, 2019 08:44
Extract all computed css from an element
function getAllCSS(element){
if( !element instanceof HTMLElement ){
console.warn("Select a valid HTML Element before proceeding");
return '';
}
let cssString = '';
const cssObj = window.getComputedStyle(element);
let cssAttributes = [];
@LayZeeDK
LayZeeDK / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Last active March 17, 2024 13:40
Angular CLI, Angular, Node.js, TypeScript, and RxJS version compatibility matrix. Officially part of the Angular documentation as of 2023-04-19 https://angular.io/guide/versions
Angular CLI version Angular version Node.js version TypeScript version RxJS version
~16.0.0 ~16.0.0 ^16.13.0 || ^18.10.0 >=4.9.5 <5.1.0 ^6.5.5 || ^7.4.0
~15.2.0 ~15.2.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.1.0 ~15.1.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.0.5 ~15.0.4 ^14.20.0 || ^16.13.0 || ^18.10.0 ~4.8.4 ^6.5.5 || ^7.4.0
~14.3.0 ~14.3.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.2.0 ~14.2.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.1.3 ~14.1.3 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~14.0.7 ~14.0.7 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~13.3.0 ~13.3.0 ^12.20.2 || ^14.15.0 || ^16.10.0 >=4.4.4 <4.7.0 ^6.5.5 || ^7.4.0
@AndroxxTraxxon
AndroxxTraxxon / MyClass.php
Last active June 18, 2022 09:28
PHP Generic class constructor
<?php
/**
* The important part here isn't the class structure itself, but the
* __construct(...) function. This __construct is generic enough to be placed into any
* data model class that doesn't preprocess its variables,
*
* Even if you want processing on the variables,
* but simply want an initial value from the get-go,
* you can post-process the values after the if($group){...} statement.
*
@ebidel
ebidel / coverage.js
Last active September 24, 2023 10:25
CSS/JS code coverage during lifecycle of page load
Moved to https://github.com/ebidel/puppeteer-examples
@asharirfan
asharirfan / eslint.js.md
Last active January 23, 2023 10:45
Introducing ESLint in your JS workflow

Introducing ESLint in Your JS Workflow

👀 TL;DR

  1. ESLint is a modern linting tool for JS development to make your code consistent and bug free.
  2. Use npm install eslint --global to install ESLint globally.
  3. Go to your project in the terminal and run eslint --init to initiate and setup linting for your project.
  4. Install and automate your workflow in VSCode using ESLint extension.

📦 Step 1: Installation

To install ESLint, you need Node — version greater or equal to 4.0 — and npm — version greater or equal to 2. Open the terminal and enter npm install eslint --global. This command will install ESLint globally in your computer.

@NuroDev
NuroDev / raspbian_setup_pms.sh
Last active February 9, 2020 16:56
Script to download and install Plex Media Server for Raspberry Pi
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install apt-transport-https -y && wget -O - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add - && echo "deb https://dev2day.de/pms/ jessie main" | sudo tee /etc/apt/sources.list.d/pms.list && sudo apt-get update && sudo apt-get install -t jessie plexmediaserver && sudo rm -rf /etc/default/plexmediaserver && echo
# default script for Plex Media Server
# the number of plugins that can run at the same time
PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
# where the mediaserver should store the transcodes