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

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

@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 );
@paaljoachim
paaljoachim / welcome-panel-php
Last active January 23, 2020 13:46
Creating a new welcome Dashboard panel. I made a tutorial on adding a Dashboard widget: http://easywebdesigntutorials.com/creating-a-custom-dashboard-widget/
/*****************************
*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-->
@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()
{
@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.:

{
@nseo
nseo / upload2facebook
Created June 11, 2012 14:07
A sample code to upload an image file to facebook using Facebook javascript sdk
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Hello FB</title>
</head>
<body>
<div id="fb-root"></div>
<div id="fb-content"></div>
<div>
@ryansechrest
ryansechrest / .htaccess
Last active September 30, 2022 19:53
Sample configuration files for WordPress as Git submodule.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Prevent requests to index.php from being rewritten
RewriteRule ^index\.php$ - [L]
# Prefix specified PHP files with 'wordpress'
RewriteRule ^((wp-login|xmlrpc)\.php) wordpress/$1 [R=301,L]
@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',
@mediabeastnz
mediabeastnz / Staging&ProductionUsingGit
Last active December 1, 2022 14:47
Staging and Production Server using Git.
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
@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