Skip to content

Instantly share code, notes, and snippets.

body {
background: linear-gradient(45deg, #16a596, #1f2d44, #e4566e);
background-size: 600% 600%;
height: 100%;
-webkit-animation: animbackground 30s ease infinite;
-moz-animation: animbackground 30s ease infinite;
animation: animbackground 30s ease infinite;
}
@ronaldgreeff
ronaldgreeff / HTML base
Created March 26, 2021 16:03
Good base for html template - removes margin and padding from tags; sets defaults for font size and display, line-heights and some more
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
const docReady = (fn) => {
document.readyState === 'complete' || document.readyState === 'interactive' ? setTimeout(fn, 1) : document.addEventListener('DOMContentLoaded', fn);
}
docReady(function() {
});
@ronaldgreeff
ronaldgreeff / how-to-extract-tar-git-linux
Last active July 8, 2020 09:06
Extract tar tar.gz tar.gz2 using Linux / Git-Windows
Tar is an archiving utility in Linux. Extract various archived files in Linux using this utility.
Type the following commands in terminal (Keyboard short cut: Ctrl+Alt+T in Ubuntu):
Extracting .tar.bz2:
tar xvjf filename.tar.bz2 location
Extracting .tar.gz:
tar xvzf filename.tar.gz location
Where:
x — extract
# note that in __init__ method, I have updated an HTML class attribute with form-control to every field of the
# form so that Bootstrap gets enabled on every field.
from .models import Friend
from django import forms
import datetime
class FriendForm(forms.ModelForm):
## change the widget of the date field.
dob = forms.DateField(
JavaScript Wildcard
- doesn't exist, but can use starts with and ends with:
elem = document.querySelectorAll('form[id^="form"][id$="-s"]');
queryselector mathcing one id but excluding the other
document.querySelectorAll('[id^="primary_container"]:not([id="primary_container-__prefix__"])')
nCols = 4;
for (var c=0; c<nCols; c++) {
iStart = (c/nCols).toFixed(1)
iEnd = ( (c+1) /nCols).toFixed(1)
console.log(
iStart, iEnd
)
$( document ).ready()
document.addEventListener('DOMContentLoaded', function() {});
class MetaInfo(models.Model):
AVAILABLE_DATATYPES = (('int', 'Integer'),
('floa', 'float'),
('str', 'string'),)
key = models.CharField(max_length=25)
value = models.CharField(max_length=100)
datatype = models.CharField(max_length=4, choices=AVAILABLE_DATATYPES, default='int')
description = models.CharField(max_length=200)
// for loops are the most performant, but these methods are useful given specific tasks
const items = [
{ name: 'Bike', price: 100 },
{ name: 'TV', price: 200 },
{ name: 'Album', price: 10 },
{ name: 'Book', price: 5 },
{ name: 'Phone', price: 500 },
{ name: 'Computer', price: 1000 },
{ name: 'Keyboard', price: 25 },