Skip to content

Instantly share code, notes, and snippets.

@heyfletch
heyfletch / make-elementor-default-editor.php
Last active September 26, 2021 14:50
Make Elementor the Default Editor, Not the WordPress Editor (Gutenberg or Classic)
<?php
/**
* Make Elementor the default editor, not the WordPress Editor (Gutenberg or Classic)
* Clicking the page title will take you to the Elementor editor directly
* Even non-Elementor-edited pages will become Elementor-edited pages now
* You can revert by clicking the "Back to WordPress Editor" button
*
* Author: Joe Fletcher, https://fletcherdigital.com
* URL: https://gist.github.com/heyfletch/7c59d1c0c9c56cbad51ef80290d86df7
@pjobson
pjobson / plex_media_permissions_4_noobies.md
Last active April 21, 2024 21:37
Plex Media Permissions for Linux Noobies

Plex Media Permissions for Linux Noobies

There is no problem with being a noobie and I do not use the term to sligtht or disparage anyone.

This is a way to setup your permissions for running Plex in Linux. Different folks may use different methods.

The permissions concepts provided here apply to OSX, but the users and groups are controlled and modified differently, so much of this will not work properly. I think the command is dscl, but that could be out of date.

There are many ways to setup your permissions scheme in Linux, this methodology describes a way to do it, not everyone will like it, but it works for me, so whatever.

Comparison of ASP.NET and Node.js for Backend Programming

We will compare ASP.NET and Node.js for backend programming.
Source codes from examples.

Updates

This document was published on 21.09.2015 for a freelance employer. Some changes since then (14.02.2016):

  1. Koa.js no longer uses co-routines, it has switched to Babel's async/await. yield and await are used almost in the same way, so I see no point to rewrite the examples.
@JamesMessinger
JamesMessinger / IndexedDB101.js
Last active April 4, 2024 02:00
Very Simple IndexedDB Example
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;
// Open (or create) the database
var open = indexedDB.open("MyDatabase", 1);
// Create the schema
open.onupgradeneeded = function() {
var db = open.result;
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"});
@nicolasembleton
nicolasembleton / restart_bluetooth.sh
Last active October 21, 2022 20:10
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@tompazourek
tompazourek / feathericons.less
Last active February 2, 2019 23:34
Feather icons (http://colebemis.com/feather/) for Bootstrap
@charset "UTF-8";
@font-face {
font-family: "feather";
src: ~"url('@{icon-font-path}feather-webfont.eot')";
src: ~"url('@{icon-font-path}feather-webfont.eot?#iefix') format('embedded-opentype')",
~"url('@{icon-font-path}feather-webfont.woff') format('woff')",
~"url('@{icon-font-path}feather-webfont.ttf') format('truetype')",
~"url('@{icon-font-path}feather-webfont.svg#featherregular') format('svg')";
font-weight: normal;
@fritzy
fritzy / spinner.js
Last active July 18, 2022 11:03
Use Mutation Observers to place image placeholders (spinners) on loading images within a target element.
//whenever uncached images are added to the dom tree within target,
//replace them with a spinner gif until they're loaded
function replaceImages(target, spinner_src) {
var spinner, observer;
//detect support
if (window.MutationObserver) {
//preload spinner (probably a gif)
//if it's not ready for first use, oh well
spinner = new Image();
@agrueneberg
agrueneberg / client.html
Last active March 19, 2023 06:48
HMAC-SHA256 example for verifying both the data integrity and the authentication of a request in Node.js and web browsers.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HMAC-SHA256 Example</title>
</head>
<body>
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script>
<script>
var sharedSecret, query, signature, hmac, xhr;
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@kaizhu256
kaizhu256 / gist:2853704
Created June 1, 2012 17:11
javascript uuid4 generator
my.uuid4 = function() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, my._uuid4);
};
//// OPTIMIZATION - cache callback
my._uuid4 = function(cc) {
var rr = Math.random() * 16 | 0; return (cc === 'x' ? rr : (rr & 0x3 | 0x8)).toString(16);
};