Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making things. All the things. Ahh!

Macario James macariojames

💭
Making things. All the things. Ahh!
View GitHub Profile
View delete-google-passwords.js
/*
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 Sep 2, 2020
Tips for processing Quick, Draw! data with ndjson-cli
View ndjson.md

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.:

{
View electoral-college.md

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 Sep 28, 2020
Require post title at backend WordPress editor
View require-post-title.php
<?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 Jan 25, 2020
WordPress auto-complete post search by title with typeahead-bootstrap
View functions.php
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 Nov 21, 2020
Sample Nginx config with sane caching settings for modern web development
View sane-caching.nginx.conf
# 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 Mar 1, 2016
Display ACF field names
View acf-field-names.php
/**
* Display ACF field names for development
*/
function action_function_name( $field ) {
echo $field['_name'];
}
add_action( 'acf/render_field', 'action_function_name', 10, 1 );
@PurpleBooth
PurpleBooth / README-Template.md
Last active Nov 30, 2020
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@paaljoachim
paaljoachim / welcome-panel-php
Last active Jan 23, 2020
Creating a new welcome Dashboard panel. I made a tutorial on adding a Dashboard widget: http://easywebdesigntutorials.com/creating-a-custom-dashboard-widget/
View welcome-panel-php
/*****************************
*Add a custom Welcome Dashboard Panel
*****************************/
function my_welcome_panel() {
?>
<div class="top-welcome-panel-content">
<div class="top-welcome-panel-logo" style="height: 120px; padding: 5px;text-align: center;">
<!-- Adds a logo top left-->
@mediabeastnz
mediabeastnz / Staging&ProductionUsingGit
Last active Oct 20, 2020
Staging and Production Server using Git.
View Staging&ProductionUsingGit
If you are running a large website where you will need to test new features on a seperate url before pushing them live then the following instructions are for you ;)
For this example imagine your url is apple.com and you want a development/staging site on a subdomain which is dev.apple.com
#Setup#
1. First thing you'll want to do is go ahead and create your website in plesk and add the subdomain dev.apple.com at the same time.
2. ssh into the server e.g. $ ssh username@ipaddress
3. Once logged in cd into the private directory (this will be where all git repos are stored) e.g. $ cd ~/private
4. Create the main repo e.g. $ git init --bare apple.git
5. Now to clone this new repo on your local machine. $ git clone ssh://username@ipaddres/~/private/apple.com
You can’t perform that action at this time.