Skip to content

Instantly share code, notes, and snippets.

View treighton's full-sized avatar

Treighton Mauldin treighton

View GitHub Profile
@wiledal
wiledal / template-literals-1-if-statements.js
Last active May 4, 2022 14:18
Template Literal Examples: if-statement
/*
Template literals if-statement example
Using a single-line conditional, we can create an if-statements within template literals.
*/
function makeHTML(title) {
return `
${title ? `
This element has a title, and it is "${title}"
` : `
@maxkostinevich
maxkostinevich / functions.php
Last active February 11, 2023 20:03
WordPress: Export custom data to CSV
<?php
/**
* Export Data to CSV file
* Could be used in WordPress plugin or theme
*/
// A sample link to Download CSV, could be placed somewhere in plugin settings page
?>
<a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a>
@cferdinandi
cferdinandi / README.md
Last active May 22, 2020 13:24
Two simple functions for getting the ID of next and previous pages (not posts) in Wordpress. Forked from the "Next Page, Not Next Post" plugin by Matt McInvale. http://wordpress.org/plugins/next-page-not-next-post/

Functions

Next Page: next_page_ID($id) Previous Page: previous_page_ID($id)

$id: The ID of the page you're trying to get the next or previous page for.

Examples

@qmmr
qmmr / tdee.js
Last active April 10, 2021 03:56
Calculate your BMR & TDEE
// Total Daily Energy Expenditure
function TDEE (data) {
this.weight = data.weight || 60
this.height = data.height || 180
this.age = data.age || 20
this.sex = data.sex || 'male'
this.bodyType = data.bodyType || 'ectomorph'
this.numberOfWorkouts = data.numberOfWorkouts || 3
this.durationOfWorkout = data.durationOfWorkout || 45
this.ratios = data.ratios || {
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@awshout
awshout / foundation4-topbar-menu.php
Last active August 19, 2023 02:44
WordPress Menu & Walker for ZURB's Foundation 4 Top Bar
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu