Skip to content

Instantly share code, notes, and snippets.

View macariojames's full-sized avatar
💭
Making things. All the things. Ahh!

Macario James macariojames

💭
Making things. All the things. Ahh!
View GitHub Profile
const MY_DOMAIN = 'rezaarkan.com';
const SLUG_TO_PAGE = {
'': '882cd6dd6e1e482d823b464f326213e5',
'now': '25b7df64071d420d8f609bf76d9f4114',
'portfolio': '6000547bed0d441793bfba1498c063e2',
'resume': '0934b80d2d1544f99dedadb00be9d146',
'recommendations': '29115129efa44f1a870f390dd2c0a6c0',
'photos': 'e78c0492a5ec486aa51f4cdb2c6f4603',
'blog': '29bb193c1a104ba2b832788b57d58cd6',
@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
/*
Google currently don't offer a way to easily delete all the passwords that you have saved with them.
So if you need to do that, here is a thing that does that.
Just browse to passwords.google.com, log in, and paste the following into the console.
Of course, posting things you found on the internet into the console is usually a bad idea.
*/
(() => {
let currentButton
@enjalot
enjalot / ndjson.md
Last active December 15, 2021 04:10
Tips for processing Quick, Draw! data with ndjson-cli

Quick, Draw! ndjson data

The Quick, Draw! dataset uses ndjson as one of the formats to store its millions of drawings.

We can use the ndjons-cli utility to quickly create interesting subsets of this dataset.

The drawings (stroke data and associated metadata) are stored as one JSON object per line. e.g.:

{

Electoral college history stolen from someone on Slashdot that I forgot to get their name to credit them. Felt it was a unique historical perspective and wanted to share it:

[T]he Electoral College operated differently at the beginning, and if you read the various proposals and debates among the Founders, it's very clear that their motivations were quite different.

I'll try to sum it up briefly. There were some of the Founders who wanted Congress to choose the President. There were others who wanted more diverse voices from state government representatives. Few really wanted to entrust it to "the people," because they had all read their ancient Greek and Roman history and knew that democracies were largely disasters that eventually ended up putting tyrants into power.

There is NOTHING in the Constitution saying how Electoral College members are chosen, only that the state legislatures decide how. In the majority of states for the first few decades of the U.S., Electors were mostly chosen by state governmen

@elvismdev
elvismdev / require-post-title.php
Last active November 2, 2022 12:08
Require post title at backend WordPress editor
<?php
add_action( 'edit_form_advanced', 'force_post_title' );
function force_post_title( $post ) {
// List of post types that we want to require post titles for.
$post_types = array(
'post',
'report',
// 'event',
@itzikbenh
itzikbenh / functions.php
Last active January 25, 2020 00:20
WordPress auto-complete post search by title with typeahead-bootstrap
function theme_styles()
{
wp_enqueue_style( 'boostrap_css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css' );
wp_enqueue_style( 'theme_css', get_template_directory_uri() . '/css/theme.css' );
}
add_action( 'wp_enqueue_scripts', 'theme_styles' );
function theme_js()
{
@philipstanislaus
philipstanislaus / sane-caching.nginx.conf
Last active April 11, 2024 03:35
Sample Nginx config with sane caching settings for modern web development
# Sample Nginx config with sane caching settings for modern web development
#
# Motivation:
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools.
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh
# and juicy version of your assets available.
# At some point, however, you want to show your work to testers, your boss or your client.
# After you implemented and deployed their feedback, they reload the testing page – and report
# the exact same issues as before! What happened? Of course, they did not have developer tools
# open, and of course, they did not empty their caches before navigating to your site.
@jcallery
jcallery / acf-field-names.php
Created March 1, 2016 17:34
Display ACF field names
/**
* Display ACF field names for development
*/
function action_function_name( $field ) {
echo $field['_name'];
}
add_action( 'acf/render_field', 'action_function_name', 10, 1 );
@octalmage
octalmage / roles.md
Last active May 14, 2023 17:43
Default WordPress user roles and capabilities.

WordPress v4.3.1

Admin wp_capabilities wp_user_level 10

a:1:{s:13:"administrator";b:1;}

Contributor wp_capabilities wp_user_level 1