Skip to content

Instantly share code, notes, and snippets.

@codyogden
codyogden / index.js
Last active February 14, 2017 18:21
Thing for josnow
var guests = require('./guests.json');
// console.log('guests', JSON.parse(guests));
var companies = require('./companies.json');
console.log('companies', companies);
function Hotel(company, city, timeZone) {
this.company = company;
this.city = city;
this.timeZone = timeZone;
this.toJson = function() {
@codyogden
codyogden / wp-config.php
Last active February 8, 2017 23:31
WordPress Config Snippets
<?php
// Turn on error messages
define( 'WP_DEBUG', true );
// Disable File Editing via WordPress Dashboard
define( 'DISALLOW_FILE_EDIT', true );
@codyogden
codyogden / .htaccess
Created January 3, 2017 11:00
Force HTTPS
RewriteCond %{HTTP:X-Forwarded-Proto} !=https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
@codyogden
codyogden / functions.php
Last active December 3, 2016 07:14
Add a stylesheet and/or Google Font to the WordPress admin editor.
<?php
// Register Editor Stylesheet
function text_domain_add_editor_styles() {
// Easily add a Google Font to the Editor
$font_url = str_replace( ',', '%2C', '//fonts.googleapis.com/css?family=Indie+Flower' );
add_editor_style( $font_url );
add_editor_style('editor-styles.css');
}
add_action('admin_init', 'text_domain_add_editor_styles');
@codyogden
codyogden / functions.php
Last active November 18, 2019 04:37
Responsive/Fluid oEmbed YouTube/Vimeo WordPress Videos
/* Add responsive container to embeds
/* ------------------------------------ */
function slug_embed_html( $html ) {
return '<div class="video-container">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'slug_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'slug_embed_html' ); // Jetpack

‘Hello World’ with a Digital Ocean Node.js droplet.

This walkthrough assumes you have previously setup a public SSH key on your Digital Ocean account. If you have not setup an SSH key. Replace Step 3 with the alternative directions underneath the main tutorial.

  1. Create a New Droplet
    1. Choose “Once-click apps”
    2. “Node on 16.04”
    3. Choose the $5/month option ( $0.007/hour )
    4. Choose the desired SSH Key you’d like to use to login.
    5. Click “Create”

Keybase proof

I hereby claim:

  • I am codyogden on github.
  • I am codyogden (https://keybase.io/codyogden) on keybase.
  • I have a public key ASBe05VfUzPnzE2gQV2rT08JtPGW8JCGr1dl9ODvsHwsBQo

To claim this, I am signing this object:

@codyogden
codyogden / client-server-data-structure.js
Last active September 21, 2016 21:44
For a group project at Prime.
{
action: "start"
}
// Send back a true/false that a number is generated and the server is ready to play.
// What Client sends to server
{
action: "guess",
@codyogden
codyogden / drawer-click-logic.js
Created September 3, 2016 20:00
jQuery logic for a menu drawer to slide in and slide out, if click outside of the drawer, it will slide out. (Uses CSS3 Trnsition / Classes)
// When the hamburger is clicked
$("MENUICON").on("click", function() {
// Add the show class to the menu
$("DRAWER").addClass("show");
// Add one event listener
$("DRAWER").one("mouseleave", function() {
// When the mouse leaves
@codyogden
codyogden / countItemInOjbect.js
Last active September 2, 2016 22:06
Return count of objects in array with a specific key & value.
var countItemInObject = function ( arr, item, search ) {
return arr.filter(function( obj ){
return obj[item] === search;
}).length;
};