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
$breakpoints: ( | |
'medium': (min-width: 200px), | |
'large': (min-width: 400px), | |
'huge': (min-width: 600px), | |
); | |
@mixin respond-to($breakpoint) { | |
@if map-has-key($breakpoints, $breakpoint) { | |
@media #{inspect(map-get($breakpoints, $breakpoint))} { | |
@content; |
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 proxyOptional(obj, evalFunc, def) { | |
const handler = { | |
get: function(target, prop, receiver) { | |
const res = Reflect.get(...arguments); | |
return typeof res === "object" ? proxify(res) : res != null ? res : def; | |
} | |
}; | |
const proxify = target => { | |
return new Proxy(target, handler); |
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
var gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
autoprefixer = require('gulp-autoprefixer'), | |
csso = require('gulp-csso'), | |
rename = require("gulp-rename"), | |
plumber = require('gulp-plumber'), | |
notify = require("gulp-notify"), | |
watch = require('gulp-watch'), | |
browserSync = require('browser-sync').create(), | |
imagemin = require('gulp-imagemin'), |
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 gulp = require('gulp'), | |
sass = require('gulp-sass'), | |
postcss = require('gulp-postcss'), | |
autoprefixer = require('autoprefixer'), | |
mqpacker = require('css-mqpacker'), | |
sourcemaps = require('gulp-sourcemaps'), | |
debug = require('gulp-debug'), | |
gulpIf = require('gulp-if'), | |
del = require('del'), | |
newer = require('gulp-newer'), |
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
{ | |
"name": "webpack-starter", | |
"version": "1.0.0", | |
"description": "simple webpack config", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"prebuild": "npm install", | |
"build": "cross-env production=true webpack --config webpack.config.js --progress --colors", | |
"prestart": "npm install", |
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 isEven = x => x%2 === 0 | |
const isBigThan = size => int => int > size | |
const pluceValue = value => int => value + int | |
const isInInterval = (start, end) => int => start < int && end > int | |
let res = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
.filter(isEven) | |
.filter(isBigThan(5)) | |
.map(pluceValue(2)) | |
.filter(isInInterval(7, 10)) |
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
new Vue({ | |
el: "#app", | |
mounted() { | |
this.state = this.lightMachine.initial; | |
setInterval(() => { | |
this.state = this.lightMachine.transition(this.state, "TIMER").value; | |
}, 3000); | |
}, |
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 result = document.querySelector('#result'); | |
const render = line => result.innerHTML = `${ result.innerHTML }<br />${ line }` | |
const service = { | |
getData() { | |
return Promise.resolve('{"answer":42}'); | |
} | |
} | |
const machine = { | |
dispatch(actionName, ...payload) { |
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
let data = { price: 5, quantity: 2 } | |
let target = null | |
class Dep { | |
constructor () { | |
this.subscribers = [] | |
} | |
depend () { | |
if (target && !this.subscribers.includes(target)){ | |
this.subscribers.push(target) |
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 getTag(any) { | |
if (typeof any === 'object' && any !== null) { | |
if (typeof any[Symbol.toStringTag] === 'string') { | |
return any[Symbol.toStringTag]; | |
} | |
if (typeof any.constructor === 'function' | |
&& typeof any.constructor.name === 'string') { | |
return any.constructor.name; | |
} | |
} |
OlderNewer