Create a new directory.
$ mkdir micro-api
$ cd micro-api
@mixin spacing($type: 'xl', $property: 'margin-top') { | |
#{$property}: map-get($margins, $type); | |
#{$property}: var(--margin-#{$type}); | |
} |
app.configure(function(){ | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'jade'); | |
// use this to let express know it is on a encrypted connection | |
app.use(function(req, res, next) { | |
var schema = req.headers["x-forwarded-proto"]; | |
if (schema === "https") { |
<!-- | |
<form autocomplete="off"> will turn off autocomplete for the form in most browsers | |
except for username/email/password fields | |
--> | |
<form autocomplete="off"> | |
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields --> | |
<input id="username" style="display:none" type="text" name="fakeusernameremembered"> | |
<input id="password" style="display:none" type="password" name="fakepasswordremembered"> | |
Download slt.py python script (supports multiple build) from this repository.
python slt.py <"sublime_text file path">
"use strict" | |
const request = require('request') | |
const fs = require('fs'); | |
const zlib = require('zlib'); | |
const opts = { | |
url: "https://iptvx.one/epg/epg.xml.gz", | |
headers: { | |
"User-Agent": "request" | |
} |
Английская версия: https://evilmartians.com/chronicles/bootstrap-an-intervention
У CSS есть несколько базовых проблем, которые позволяют очень быстро отстрелить себе ногу при неправильном использовании:
Глобальный неймспейс – в серверном программировании все что написано в файле, в файле и остается. Все же что написано в css и js засирает глобальное пространство имен со всеми вытекающими. В JS эту проблему сейчас побороли всякими модульными системами, а вот с css сложнее. В идеальном мире это должен починить Shadow DOM и настоящие Web Components, но пока их нет единственный способ с этим бороться – следовать какой-то системе именований селекторов, которая по возможности уменьшает и исключает возможные конфликты.
Каскадность – если на один элемент может сработать несколько правил, то они все и сработают последовательно. Если есть элемент h1.title
, на него сработают все правила для тегов h1
и все правила для класса .title
. Так как весь html состоит из тегов, то правил которые п
/** | |
* Use this reducer enhancer to store specific control instance state by key. | |
* The key will be resolved using the controlInstanceKeyResolver function parmeter which defaults to use the controlInstanceKey member of the action's meta object (i.e action.meta.controlInstanceKey) | |
* If the key is not a string then the action will be ignored and will not pass to the enhanched reducer. | |
* @param {function} reducer - the reducer to enhance | |
* @param {function} controlInstanceKeyResolver - an optional function to get the instance key from the action | |
*/ | |
export function instanceMapReducerEnhancer( | |
reducer: Redux.Reducer, | |
controlInstanceKeyResolver: ((action) => string) = defaultKeyResolver) { |
// in reusable feature instance | |
import createActions from '../reusable-feature/actions'; | |
import selectors from './selectors'; | |
import { createAction } from 'redux-actions'; | |
const actions = createActions('INSTANCE_1', selectors); | |
actions['additionalAction'] = createAction(...); |
// Option 1: a thunk action creator using redux-thunk middleware | |
function myThunkActionCreator(someValue) { | |
return (dispatch, getState) => { | |
dispatch({type : "REQUEST_STARTED"}); | |
myAjaxLib.post("/someEndpoint", {data : someValue}) | |
.then( | |
// Use the (resolve, reject) form of .then() instead of .catch(), | |
// so that we don't accidentally dispatch REQUEST_FAILED on a reducer error | |
response => dispatch({type : "REQUEST_SUCCEEDED", payload : response}), |