This will give you complete intellisense and type safety within your app and CSS modules
🚨 NOTE
- refactoring className from ts file wont update your css/scss className, to change class names you have to change it within your
.module.scss
file
def make_readable_size(size_in_bytes) | |
suffix = %W(B KB MB) | |
idx = 0 | |
rest = 0 | |
size = size_in_bytes | |
while size / 1024 > 1 | |
idx += 1 | |
new_size = size / 1024 | |
rest = size - new_size * 1024 |
const signs = { | |
topLeft: '┌', | |
topVert: '┬', | |
topRight: '┐', | |
bottomLeft: '└', | |
bottomVert: '┴', | |
bottomRight: '┘', | |
horizLeft: '├', | |
horizRight: '┤', | |
vert: '│', |
WEBVTT | |
1 | |
00:00:03.643 --> 00:00:07.514 | |
You know, we should all do? | |
2 | |
00:00:07.557 --> 00:00:10.086 | |
Go | |
see a musical. |
const languages = [ | |
{ | |
"code": "af", | |
"langEnglishName": "Afrikaans" | |
}, | |
{ | |
"code": "ak", | |
"langEnglishName": "Akan" | |
}, | |
{ |
module.exports = { | |
'ar-AR': { | |
'nativeName': 'العربية', | |
'englishName': 'Arabic' | |
}, | |
'cs': { | |
'nativeName': 'Čeština', | |
'englishName': 'Czech' | |
}, | |
'uk': { |
// How to test something with Jest and process.env | |
// Details link to original author's response on SO | |
// https://stackoverflow.com/questions/48033841/test-process-env-with-jest | |
describe('environmental variables', () => { | |
const OLD_ENV = process.env; | |
beforeEach(() => { | |
// MOST IMPORTANT THING IS 👇 | |
jest.resetModules() // Most important - it clears the cache |
class PersistData { | |
storageName: string | |
constructor(storageName: string) { | |
this.storageName = storageName | |
} | |
get() { | |
try { | |
const value = window.localStorage.getItem(this.storageName) || '' |
const _isEmpty = require('lodash/isEmpty') | |
module.exports = (news, prevResults) => { | |
const recordsToSave = [] | |
if (_isEmpty(news) || _isEmpty(prevResults)) { | |
return recordsToSave | |
} | |
// some loop over values |
import React from 'react' | |
import axios, { post } from 'axios'; | |
class SimpleReactFileUpload extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state ={ | |
file:null | |
} |