Skip to content

Instantly share code, notes, and snippets.

View TimeBandit's full-sized avatar
💭
Waiting to breath

Imrān Nazir TimeBandit

💭
Waiting to breath
View GitHub Profile
@TimeBandit
TimeBandit / index.pug
Last active September 19, 2018 18:15
Focus selector #html #css #styling
/* The tab index is needed tomake an element */
/* navigable from the keyboard */
div.container
div.output(tabindex="0")
@TimeBandit
TimeBandit / responsive-images.css
Last active September 19, 2018 18:25
Responsive Images #css #style
/* To make them 'retina' set width, height to half
original file size
*/
img {
max-width: 100%;
display: block;
height: auto;
}
@TimeBandit
TimeBandit / package.json
Created September 22, 2018 09:21
auto starting dev server & babel parsing #dev #package #workflow
{
"name": "indecision-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "concurrently \"live-server public\" \"babel src/app.js --out-file=public/scripts/app.js --presets=env,react --watch\""
},
"keywords": [],
@TimeBandit
TimeBandit / slanted-edge.css
Created September 29, 2018 12:29
create a slanted edge #css
#hero {
background: #834d9b; /* fallback for old browsers */
background: -webkit-linear-gradient(
to right,
#d04ed6,
#834d9b
); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(
to right,
#d04ed6,
@TimeBandit
TimeBandit / README.md
Last active October 2, 2018 07:16
good default fonts #css #style

These are a good set of default fonts to use

  • font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"
@TimeBandit
TimeBandit / error_pattern.js
Created October 2, 2018 07:15
using string return values to signal errors #patterns #js
// reurn a string message to signal an error
handleAddOption(option) {
if (!option) {
return "Enter valid value";
} else if (this.state.options.indexOf(option) > -1) {
return "This option already exists";
} else {
this.setState((prevState, props) => {
return {
options: [...prevState.options, option]
@TimeBandit
TimeBandit / clearfix.scss
Created October 29, 2018 09:44
clearfix hack for floats #css
/* floating collapses the containg div to height:0 this hack fixes that*/
.clearfix::after {
content: "";
clear: both;
display: table;
}
@TimeBandit
TimeBandit / trunk_array.js
Last active March 19, 2019 06:29
truncating an array #js #patterns
// truncate the array if too many
if (data.length > MAX_ENTRIES) {
data = data.slice(0, MAX_ENTRIES);
}
@TimeBandit
TimeBandit / cv19.js
Last active March 11, 2020 22:18
get cv19 tabular data
infectionCount = [];
timeString = document.querySelector('.govspeak > p:nth-child(4)').innerText.split(' on ')[1].slice(0, -1).replace(/(\r\n|\n|\r)/gm,"");
isoTimeString = new Date(timeString).toISOString();
document.querySelectorAll('tbody > tr').forEach((row) => {
let [authority, numberOfCases] = row.cells;
infectionCount.push({
authority: authority.innerText,
numberOfCases: numberOfCases.innerText
})
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.