Skip to content

Instantly share code, notes, and snippets.

@votemike
votemike / sun.css
Created July 3, 2015 09:14
Shining sun in pure CSS/HTML, no images
body {
background-color: deepskyblue;
padding: 10px;
}
div.sunholder {
display: inline-block;
animation: spin 8s linear 0s infinite;
}
div.sun {
display: block;
@votemike
votemike / colors.json
Created July 11, 2015 18:52
Basic W3C CSS Colours in json format (it pains me to spell the file colors)
{
"aqua": {
"hex": "#00FFFF",
"rgb": "0,255,255"
},
"black": {
"hex": "#000000",
"rgb": "0,0,0"
},
"blue": {
@votemike
votemike / colors.json
Created July 11, 2015 20:59
X11 W3C CSS Colours in json format (including rebeccapurple)
{
"aliceblue": {
"hex": "#F0F8FF",
"rgb": "240,248,255"
},
"antiquewhite": {
"hex": "#FAEBD7",
"rgb": "250,235,215"
},
"aqua": {
@votemike
votemike / arrayDocBlocks.php
Last active August 16, 2017 11:01
This is how array params or return types should be doc-blocked. The same goes if the arrays are keyed or not.
/**
* @param int[] $theParam
* @return int[]
*/
function ints(array $theParam): array
{
return [
1,
2,
3,
function add(string) {
if (!string) {
return 0;
}
let delimiter = /[\n,]+/;
if (string.startsWith('//[')) {
const lines = string.split('\n');
delimiter = lines[0].replace(/\/\/\[|\]/g, '');
// const things = lines[0].replace('//', '');
// const delimiters = things.match(/\[(.*?)\]/g); // Can't quite nail the regex on this one
@votemike
votemike / property.json
Last active April 28, 2020 16:06
A WiP property schema. Mainly relating to the finance of a property whether for renting or flipping.
{
"name": "A nickname for the property",
"currency": "GBP",
"value": 654321, // The value of the property at the moment, subject to change
"leasehold": true,
"leaseExpiry": 2147483647,
"sale": {
"date": "1999-12-31",
"price": 123456,
"currency": "GBP",
@votemike
votemike / placeholder-fill.js
Created July 3, 2020 11:14
Fill in all empty inputs with their placeholder
var inputs = document.getElementsByTagName('input');
for (index = 0; index < inputs.length; ++index) {
if (!inputs[index].value) {
inputs[index].value = inputs[index].getAttribute("placeholder");
}
}