Skip to content

Instantly share code, notes, and snippets.

View rhukster's full-sized avatar

Andy Miller rhukster

View GitHub Profile
@rhukster
rhukster / gist:befd2a439b10d53d1e3f
Created October 19, 2014 15:41
Grav ignore temp files
# Grav Specific
cache/*
!cache/.*
assets/*
!assets/.*
logs/*
!logs/.*
images/*
!images/.*
function max_by($array, $fieldname = null)
{
$field_array = array();
foreach ($array as $i => $befree) {
$field_array[$i] = $array[$i][$fieldname];
}
return max($field_array);
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Vagrant Grav</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<style>
/* Space out content a bit */
@rhukster
rhukster / conditional.yaml
Last active March 19, 2017 23:15
Conditional Field in Use
conditional_new_entries:
type: conditional
condition: "id ? 'false' : 'true'"
classes: overlay bottom
fields:
field-a:
label: New Field A
type: text
@rhukster
rhukster / gist:6df3bdb106e2b06242b10ae549e5e021
Last active April 14, 2017 16:42
new Parents field for pages
route:
type: parents
show_root: true
show_all: true
show_fullpath: false
show_slug: true
start_route: '/test'
limit_levels: 3
label: PLUGIN_ADMIN.PARENT
classes: fancy
@rhukster
rhukster / better-discord.css
Created November 22, 2018 18:57
Custom discord stylesheet with tighter spacing and better contrast
[class*="membersGroup-"] {
height: 28px;
padding-top: 8px;
padding-left: 12px;
}
[class*="member-"] {
height: 40px;
}
[class*="member-"] [class*="avatarWrapper"] [class*="small-"] {
width: 25px;
@rhukster
rhukster / htaccess_tester.php
Created January 7, 2019 20:28
htaccess_tester.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Grav .htaccess Tester</title>
<link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">
<style>
body { padding: 2rem; }
textarea.form-input { height: 500px; }
@rhukster
rhukster / gist:e8f5f3676c38dde29624734ea99bf837
Created September 5, 2020 16:33 — forked from yehgdotnet/gist:6353e367cb1178017980d2437417d6a5
.htaccess (allow only cloudflare IP range) Raw
<Files 403.shtml>
order allow,deny
allow from all
</Files>
# https://www.cloudflare.com/ips-v4
# https://www.cloudflare.com/ips-v6
deny from all
allow from 103.21.244.0/22
@rhukster
rhukster / test-ldap-2.php
Created May 5, 2018 04:36 — forked from leftclickben/test-ldap-2.php
Open a connection to an LDAP server, query it for a given user, and check group membership for that user (test script)
#!/usr/bin/php
<?php
# Parse options
$opts = getopt('h:n:u:p:b:s:', array( 'help' ));
if (isset($opts['help']) && $opts['help']) {
echo <<<ENDHELP
Usage:
$argv[0] [-h HOSTNAME] [-n PORTNUM] [-u USERNAME] [-p PASSWORD] [-b BASEDN] [-s SEARCH]
@rhukster
rhukster / ender5-firmware-update.md
Last active January 23, 2021 19:25
Upgrade Creality Ender 5 firmware for Mac