- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
const breakpointChecker = function() {
if ( breakpoint.matches === true ) {
//...
return;
} else if ( breakpoint.matches === false ) {
//...
}
};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
const breakpointChecker = function() {
if ( breakpoint.matches === true ) {
//...
return;
} else if ( breakpoint.matches === false ) {
//...
}
};
Источник: https://medium.com/@networkaaron/swiper-how-to-destroy-swiper-on-min-width-breakpoints-a947491ddec8
0
class HelloRooster implements EditorPlugin {
getName() {
return 'HelloRooster';
}
initialize(editor: Editor) {}
dispose() {}
onPluginEvent(e: PluginEvent) {
if (e.eventType == PluginEventType.KeyPress && e.rawEvent.which == 65) {
alert('Hello Rooster');
}
}
}
https://github.com/microsoft/roosterjs
0
<img alt="[object Object]" title="[object Object]" loading="lazy">
https://beru.ru/catalog/avtotovary/76688?hid=90402 , когда смог в жс на бэкэнде
+1
Чем пакеты "npm" лучше старых добрых плагинов "jQuery"?
Плагины зависели только от самого "jQuery", а пакеты волокут за собою десятки и сотни левых говен.
−1
// https://habr.com/ru/company/ruvds/blog/515676/
Разбор худшего в мире куска кода.
−1
$(document).on('click','.head__loginw a',function() {
//реачгоал и гугл для клика по ссылке кабинете
return true;
})
$(document).on('click','.prc__it__bt openModal',function() {
id = $(this).attr('tid');
if(id == 387) {
//мир - 30
}
if(id == 388) {
//мир - 60
}
if(id == 389) {
//мир - 100
}
if(id == 391) {
//МИР-ДОМ-30
}
if(id == 392) {
//мМИР-ДОМ-60
}
if(id == 393) {
//мМИР-ДОМ-100
}
return true;
})
−1
updateTimer() {
requestAnimationFrame(() => {
this.timeLeft = this.resendTimeDuration - (Date.now() * 0.001 - this.lastTimeLeft);
if (this.timeLeft <= 0) {
this.resetTimer();
return;
} else {
this.lastTimeLeft = this.timeLeft;
this.updateTimer();
}
});
}
А как сделать таймер обратного отсчета?
+1
var xc = /^true$/.test("false");
var yc = xc;
google ad manager (gpt.js)
0
import { combineEpics, ofType } from 'redux-observable'
import { map, switchMap, catchError, filter, mergeAll } from 'rxjs/operators'
import { of, from } from 'rxjs'
import * as R from 'ramda'
import * as TICKETS_ACTION_TYPES from './tickets.types'
import * as TicketsActions from './tickets.actions'
import * as TicketsSelectors from './tickets.selectors'
import { /* TICKET_TYPES,*/ TICKET_STEPS } from './constants'
import mockAPI from 'services/mockAPI'
export const getTicketsEpic = (action$, state$) =>
from(
R.map(
(step) =>
action$.pipe(
filter(
R.either(
R.both(R.propEq('type', TICKETS_ACTION_TYPES.GET_TICKETS_BY_STEP), R.pathEq(['payload', 'step'], step)),
R.propEq('type', TICKETS_ACTION_TYPES.GET_ALL_TICKETS)
)
),
switchMap((action) => {
if (
action.type !== TICKETS_ACTION_TYPES.GET_ALL_TICKETS &&
TicketsSelectors.ticketsAllDirtySelector(state$.value)
) {
return of(TicketsActions.getAllTickets())
} else if (!TicketsSelectors.ticketsByStepDirtySelector(step, state$.value)) {
return of(TicketsActions.getTicketsByStepSuccess(step, null, true))
}
return from(
// Mocks tickets API
// TODO: Replace by real request
mockAPI.getTicketsByStep(step)
).pipe(
map((data) => TicketsActions.getTicketsByStepSuccess(step, data)),
catchError((err) => of(TicketsActions.getTicketsByStepError(step, err)))
)
})
),
R.values(TICKET_STEPS)
)
).pipe(mergeAll())
Редукс нам уже не интересен, нам с поподвыподвертами подавай, чтоб тупо болванку показать.
+1
const regExp = new RegExp(filterValue.toLowerCase())
return templates.filter((tmpl) => regExp.test(tmpl.title.toLowerCase()))
Высрал "синьор", "тимлид" с большим опытом и головой.