Skip to content

Instantly share code, notes, and snippets.

@jmccall75
jmccall75 / functions.php
Last active January 9, 2024 03:15
Locking down Gutenberg...
<?php
/**
* Gutenberg Block customization for this theme.
*/
// gutenberg disable for posts
//add_filter('use_block_editor_for_post', '__return_false', 10);
// gutenberg disable for post types
//add_filter('use_block_editor_for_post_type', '__return_false', 10);
<?php
/**
* Displays the post modified date.
*
* @package There is no package.
*/
/**
* Returns the last modified date for the post with the <time> tag and the
* time zone.
@alirezamika
alirezamika / autoscraper-examples.md
Last active July 3, 2024 21:02
AutoScraper Examples

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)
@maxkostinevich
maxkostinevich / worker.js
Created June 29, 2020 11:25
Serverless Geolocation Service
/*
* Serverless Geolocation Service, hosted on Cloudflare Workers.
*
* Learn more at https://maxkostinevich.com/blog/serverless-geolocation
*
* (c) Max Kostinevich / https://maxkostinevich.com
*/
// https://gist.github.com/maephisto/9228207
@gigkokman
gigkokman / jq csv with header
Created March 17, 2020 01:29
Export json to csv with header via jq script
echo '{"a":"aa", "b":"bb"}' | jq -r -s '. | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[]'
@cezarneaga
cezarneaga / local-ssl-certificates-that-work.md
Last active October 17, 2019 21:20
ssl ceritificates that work

local ssl certificates that work

motivation

in web dev sometimes you are constrained to develop from behind a https:// local server. i spent two days making this work and i want to write it down here, so that next time apple upgrades OS X and i decide to do a clean install (forgetting to backup certain things) i dont waste this amount of time anymore (i hope).

maybe it helps someone else too. that would make me very happy too.

forget openssl

major pita to remember commands. i don't think there is anything better that makes your mom feel like you are a hacker, than showing her how to type:

@labnol
labnol / file-upload-forms
Created January 22, 2019 07:36
File Upload Forms for Google Drive
File Upload Forms for Google Drive
----------------------------------
With the File Upload forms, you can upload files of any size and the files are sent directly to the owner’s Google Drive while the form data is saved in a Google Spreadsheet.
A [Pen](https://codepen.io/labnol/pen/QYWvwV) by [Amit Agarwal](https://codepen.io/labnol) on [CodePen](https://codepen.io).
[License](https://codepen.io/labnol/pen/QYWvwV/license).
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active June 9, 2024 19:08
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@heroheman
heroheman / ranger-cheatsheet.md
Last active July 8, 2024 08:16
Ranger Cheatsheet

Ranger Cheatsheet

General

Shortcut Description
ranger Start Ranger
Q Quit Ranger
R Reload current directory
? Ranger Manpages / Shortcuts
@andyrbell
andyrbell / scanner.sh
Last active July 9, 2024 16:43
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf