Skip to content

Instantly share code, notes, and snippets.

View AugustMiller's full-sized avatar
🌳

August Miller AugustMiller

🌳
View GitHub Profile
@AugustMiller
AugustMiller / Slides
Last active April 27, 2019 10:18
Simple responsive slider with support for touch devices.
<!DOCTYPE html>
<html>
<head>
<title>Slides.js Demo</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://gist.github.com/AugustMiller/7521053/raw/e5900f4a6628719c730c7c3f8acfcc6b28223aa3/Slides.js"></script>
<style>
html , body {
margin: 0;
padding: 0;
@AugustMiller
AugustMiller / Select.js
Last active December 28, 2015 17:39
Stub of a select menu replacement. Currently useless, but will be handy when it can be tied to a form element to change its value, and base its options on an existing <select> menu.
// Implemented like this:
$(document).ready( function ( ) {
var Chooser = new Menu ( "#select", [
{ label : "First Item", value : "1" },
{ label : "Second Item", value : "2" },
{ label : "Your Mother's Item", value : "3" }
]);
})
@AugustMiller
AugustMiller / map.js
Last active October 2, 2021 14:14
Map a number in one range to a number in another.
function mapNumber (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
@AugustMiller
AugustMiller / pick.js
Created June 10, 2014 18:19
Get a random element from an array
Array.prototype.pick = function ( ) {
return this[ Math.floor( Math.random() * this.length ) ];
};
@AugustMiller
AugustMiller / instagram.css
Created September 23, 2014 22:53
Instagrammification of all images on a website
img {
filter: contrast(69%) hue-rotate(-4deg) saturate(90%);
}
@AugustMiller
AugustMiller / kirbytext-resources.php
Last active August 29, 2015 14:07
Kirbytext extension enabling linking of files belonging to other pages
<?
class kirbytextExtended extends kirbytext {
function __construct($text, $markdown=true) {
parent::__construct($text, $markdown);
# A "Resource" as we're calling it needs a filename, scope and link text:
$this->addTags('resource');
@AugustMiller
AugustMiller / sublime-settings.json
Last active March 13, 2017 23:32
Sublime Text 2/3 Preferences
{
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "smooth",
"color_scheme": "Packages/User/SublimeLinter/Birds_of_Paradise (SL).tmTheme",
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
@AugustMiller
AugustMiller / snow.js
Last active August 29, 2015 14:11
Snow Storm!
var Holiday, Snow, Flake;
Snow = function (density, intensity) {
var self = this;
self.flakes = [];
self.options = {
container: $('<div />').attr({'id': 'snow'}).appendTo(document.body),
count: density,
intensity: intensity,
@AugustMiller
AugustMiller / field-json.php
Created May 18, 2015 04:08
Kirby JSON Field Method
<?php field::$methods['json'] = function($field, $property = null) {
$data = (array)json_decode($field->value);
return ($property && isset($data[$property]) ? $data[$property] : $data);
};
@AugustMiller
AugustMiller / field-as-email.php
Created August 28, 2015 18:12
Quickly transform a Kirby email field into a clickable email link
<?php field::$methods['asEmail'] = function($field) {
return html::a('mailto:' . $field->value, $field->value);
};