npm install --save-dev node-sass
- Add script to package.json:
node-sass --watch INPUTFOLDER -o OUTPUTFOLDER
- Run script, enjoy
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
/** | |
* Draws a poligon - can draw anything from a triangle to a star. | |
* Source and demo: http://jsfiddle.net/tohan/8vwjn4cx/ | |
*/ | |
function drawShape(ctx, x, y, points, radius1, radius2, alpha0) { | |
//points: number of points (or number of sides for polygons) | |
//radius1: "outer" radius of the star | |
//radius2: "inner" radius of the star (if equal to radius1, a polygon is drawn) | |
//angle0: initial angle (clockwise), by default, stars and polygons are 'pointing' up | |
var i, angle, radius; |
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 React from 'react'; | |
import PropTypes from 'prop-types'; | |
const propTypes = { | |
firstName: PropTypes.string, | |
lastName: PropTypes.string, | |
birthDay: PropTypes.number, | |
gender: PropTypes.number, | |
} |
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
# With SASS | |
create-react-app APPNAME --scripts-version custom-react-scripts | |
# With typescript | |
create-react-app APPNAME --scripts-version=react-scripts-ts |
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 myObject = ['a', 'b', 'c'].reduce((obj, key) => (obj[key] = key, obj), {}); |
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 {promisify} = require('util'); | |
const promisifyModuleFunctions = (inModule) => Object | |
.entries(inModule) | |
.reduce((outModule, [key, property]) => { | |
outModule[key] = (typeof property === 'function') | |
? promisify(property) | |
: property; | |
return outModule; |
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
// The normal async programming flow in nodeJS can get hairy, quickly: | |
function readAndParse(filename, callback){ | |
fs.readFile(filename, 'utf8', (err, data) => { | |
if(err){ | |
callback(err, null); | |
return; | |
} | |
myParser.doParsing(data, (err, result) => { |
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
# This will start a apache server and maps it to the local port 80 | |
# It will assume your hosted content in the folder ./src | |
version: '2' | |
services: | |
apache2: | |
image: webdevops/apache:latest | |
volumes: | |
- ./src:/app | |
ports: | |
- 80:80 |
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
/** | |
* Chalk powered color log | |
* ======================= | |
* This module is a wrapper around the chalk package to provide | |
* simpler log message formatting. | |
* To switch a color inside your log message, simply use ´X where | |
* X is one of the color names in the chalkMap below. | |
* | |
* Example: | |
* |