Skip to content

Instantly share code, notes, and snippets.

View Dilden's full-sized avatar
🏠
Working from home

Dylan Hildenbrand Dilden

🏠
Working from home
View GitHub Profile
@Dilden
Dilden / index.php
Created May 11, 2015 19:21
Three functions that compute the sum of the numbers in a given list using a for-loop, a while-loop, and recursion using PHP
<?php
function one($a) {
$count = count($a);
$total = 0;
for ($i=0; $i < $count; $i++) {
$total = $total + $a[$i];
}
echo $total;
}
from espeak import espeak
import time
while True:
response = input(">> ")
espeak.synth(response)
time.sleep(1)
@Dilden
Dilden / flashing-police-light-button-thing.markdown
Created September 15, 2016 22:04
Flashing Police Light Button thing
@Dilden
Dilden / html-artwork.markdown
Created September 15, 2016 22:05
HTML artwork

HTML artwork

Use the buttons on the top of the screen to add different shapes with different colors, rotate the shapes, or remove them. Build whatever you can imagine.

A Pen by Dylan Hildenbrand on CodePen.

License.

@Dilden
Dilden / custom_plugin_WC_templates.php
Created September 28, 2016 19:39
Useful snippet for overriding WooCommerce templates in your custom WordPress plugin. Just follow the same directory structure as if you were overriding the templates from a theme.
// Override woocommerce templates with the templates in my plugin
add_filter( 'woocommerce_locate_template', 'custom_plugin_templates');
function custom_plugin_templates ( $template, $template_name, $template_path ) {
$check_dis = str_replace('woocommerce', 'your-plugin-name-goes-here/woocommerce', $template);
if(file_exists($check_dis)) {
$template = $check_dis;
}
return $template;
};
@Dilden
Dilden / functions.php
Last active November 21, 2016 17:16
Restrict dates on jQuery UI Datepicker within WordPress/WooCommerce checkout
<?php
if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
// AJAX request to disable days on calendar in checkout
add_action( 'wp_ajax_company_holidays', 'company_holidays_callback' );
add_action( 'wp_ajax_nopriv_company_holidays', 'company_holidays_callback' );
function company_holidays_callback() {
$holidays = [];

Keybase proof

I hereby claim:

  • I am dilden on github.
  • I am dilden (https://keybase.io/dilden) on keybase.
  • I have a public key whose fingerprint is 69DD D9DC 99EE E5FE 46CC B181 99F3 66A4 E861 BFA1

To claim this, I am signing this object:

@Dilden
Dilden / wpbak.sh
Last active March 3, 2023 15:51
WordPress Backup script
#!/bin/sh
THESITENAME=""
THEDB=""
THEDBUSER=""
THEDBPW=""
THEDATE=`date +%d%m%y%H%M`
# There is a space between the first `/` and the rest of the path in this variable
# It needs to be there for the TAR command to work for some reason
SITE_PATH="/ var/www/"
@Dilden
Dilden / .storj_aliases
Last active February 23, 2018 15:27
Handy Storj-CLI aliases + Update script
alias storjstart='storjshare start -c ~/.config/storjshare/configs/STORJ_NODE_ID_HERE.json'
alias storjstop='storjshare stop -i STORJ_NODE_ID_HERE'
alias storjstat='storjshare status'
# mkdir ~/storjstuff and place bash script there
alias storjupdate='cd ~/storjstuff/ && ./storjupdate.sh && cd -'
@Dilden
Dilden / factorial.js
Created May 1, 2018 02:10
JS Factorial w/Recursion
function factorial(n) {
if(n > 0) {
return n * factorial(n - 1);
}
else return 1;
}
console.log(factorial(4));
console.log(factorial(5));
console.log(factorial(6));