This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const docReady = (fn) => { | |
document.readyState === 'complete' || document.readyState === 'interactive' ? setTimeout(fn, 1) : document.addEventListener('DOMContentLoaded', fn); | |
} | |
docReady(function() { | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__"])') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nCols = 4; | |
for (var c=0; c<nCols; c++) { | |
iStart = (c/nCols).toFixed(1) | |
iEnd = ( (c+1) /nCols).toFixed(1) | |
console.log( | |
iStart, iEnd | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$( document ).ready() | |
document.addEventListener('DOMContentLoaded', function() {}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 }, |
NewerOlder