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 / machine.js
Created January 19, 2021 10:52
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@TimeBandit
TimeBandit / faqs.json
Last active August 24, 2020 16:15
DL Faq Json
[
{
"id": "1",
"question": "What vehicles are covered?",
"answer": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
},
{
"id": "2",
"question": "Can anyone drive a vehicle covered by a business policy?",
"answer": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
})
@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 / 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 / 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 / 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 / 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,