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
#!/usr/bin/env node | |
const scanner = require("react-scanner"); | |
const os = require("os"); | |
const path = require("path"); | |
const getLastItemFromPath = (thePath) => thePath.substring(thePath.lastIndexOf("/") + 1); | |
const userHomePath = os.homedir(); | |
const projectPath = process.cwd(); |
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
Fri Feb 26 21:21:58 UTC 2021 |
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
{ | |
"styles": { | |
"prefix": "muistyles", | |
"body": [ | |
"import { Theme, makeStyles } from '@material-ui/core/styles';", | |
"", | |
"export const useStyles = makeStyles((theme: Theme) => ({", | |
" container: {},", | |
"}));", | |
"" |
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
{ | |
"useStateHook": { | |
"prefix": "s", | |
"body": [ | |
"const[$1, use${1/(.*)/${1:/capitalize}/}] = useState($2);", | |
"$0" | |
], | |
"description": "Create useState hook" | |
}, | |
"useStateHookVariables": { |
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
import { createGlobalStyle } from 'styled-components'; | |
export default createGlobalStyle` | |
@import url('https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap'); | |
* { | |
margin: 0; | |
padding: 0; | |
outline: 0; | |
box-sizing: border-box; |
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
import { createGlobalStyle } from 'styled-components'; | |
export default createGlobalStyle` | |
@import url('https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap'); | |
* { | |
margin: 0; | |
padding: 0; | |
outline: 0; | |
box-sizing: border-box; |
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
function randomTimeout() { | |
const t = Math.floor(Math.random() * 3000 + 1); | |
return t; | |
} | |
// SetTimeout does not return a promise, so we can't await for it. This funcion promisify it mannualy. | |
function timeout(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} |
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
function randomTimeout() { | |
const t = Math.floor(Math.random() * 3000 + 1); | |
return t; | |
} | |
const method1 = new Promise(resolve => { | |
timeout = randomTimeout(); | |
setTimeout(() => resolve("method1"), timeout); | |
}); |
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 (var i = 0; i <= 3; i++) { | |
delay(i); | |
} | |
function delay(i) { | |
setTimeout(function() { | |
console.log(i); | |
}, 100); | |
} |
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
/** | |
* FizzBuzz algorithm | |
*/ | |
function checkMultiples(n) { | |
let result = ""; | |
result = n % 3 === 0 ? "Fizz" : result; | |
result = n % 5 === 0 ? result + "Buzz" : result; | |
return result !== "" ? result : n; | |
} |
NewerOlder