- 1
- 2
- 3
Global Install
Installing Yarn 2.x globally is discouraged as we're moving to a per-project install strategy.
We advise you to keep Yarn 1.x (Classic) as your global binary by installing it via the instructions you can find here.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
Global Install
Installing Yarn 2.x globally is discouraged as we're moving to a per-project install strategy.
We advise you to keep Yarn 1.x (Classic) as your global binary by installing it via the instructions you can find here.
https://yarnpkg.com/getting-started/install
Мы выпустили вторую версию приложеньки, в которой исправили все недочёты первой.
Именно поэтому запускать вы её будете через первую версию, которая с вами навсегда.
Мы проработали другие варианты и пришли к решению, что они все неправильные.
Сердечно ваши,
джаваскриптеры.
+1
function isVowel(char){
return "аоэиуыеёюя".indexOf(char.toLocaleLowerCase())>=0 ? 1 : 0;
}
function vorefy(text)
{
// Г => C 0.85
// Г => Г 0.15
// С => С 0.30
// С => Г 0.70
var markov = [[0.3,0.7],[0.85,0.15]];
var mCorr = [ 1/Math.sqrt(0.3*0.7), 1/Math.sqrt(0.85*0.15) ];
//степень влияния марковских вореантностей
var pow = x => Math.pow(x,2);
var prev=null;
return text.replace(/./g,(char,offset,text) =>
{
if (E2R[char]){
var replace = Object.entries(E2R[char]);
if (1==replace.length) {
prev = replace[0][0];
return prev;
}
var r = Math.random()*200, probability=0;
for (const [k, v] of replace) {
vowel = isVowel(k);
probability += v * ((null==prev) ? 1
: pow(
mCorr[vowel]*2*markov[isVowel(prev)][vowel]
));
if (r<=probability) {
prev = k;
return prev;
}
}
}
prev=null;
return char;
});
}
Марковым отмечена еще одна устойчивая закономерность открытых текстов, связанная с чередованием гласных и согласных букв. Им были подсчитаны частоты встречаемости биграмм вида гласная-гласная (г, г), гласная-согласная (г, с), согласная-гласная (с, г), согласная-согласная (с, с)
[color=blur]https://ideone.com/VpkwXT[/color]
0
// sorry, I don't want to use any JS templater
// so I'll concatenate html as strings, which is the worst practice
// but my IntelliJ IDEA highlights html in strings well :)
// and I write this code just4fun
//
// but to respect production I'll leave here something that will never be fixed
// TODO: rewrite in Angular.js
//
// done!
// ...
// u still read this spaghetti?
let evaluate = (s) => {
completion = [];
hist = [];
let tokens = s.split(' ').filter((s) => s !== '');
if (!tokens[0]) return;
histfile.push(s);
if (tokens[0] === 'clear') clear();
else if (tokens[0] === 'aplay') aplay();
else if (tokens[0] === 'man') try {
template(tokens.slice(0, 2).join('_'))();
} catch {
stdout('No manual entry for <span class="red">' + tokens[1] + '</span>')
}
Сайт-визитка на plain js для подкаста в виде эмулятора терминала с пасхалками
https://deveeps.prost.host/
0
$('#search-map').on('click', '.v-card-prev', function () {
var v_next = $(this)
.parent()
.find('.v-card-img-block .v-card-img-hidden.active')
.prev();
if ($(v_next).length == 0) {
$(this)
.parent()
.find('.v-card-img-hidden.active')
.removeClass('active');
$(this)
.parent()
.find('.v-card-img-hidden:last')
.addClass('active');
} else {
$(this)
.parent()
.find('.v-card-img-hidden.active')
.removeClass('active');
$(this)
.parent()
.find(v_next)
.addClass('active');
}
$(this)
.parent()
.find('.v-card-img-hidden.active')
.click();
});
$('#search-map').on('click', '.offers-favorite', function () {
var favorID = $(this)
.closest('.js__product')
.attr('data-item');
if ($(this).hasClass('active')) var doAction = 'delete';
else var doAction = 'add';
updateFavorite(favorID, doAction);
return false;
});
+1
//Use this to convert OffSet to postive:
var offset = new Date().getTimezoneOffset();
console.log(offset);
this.timeOffSet = offset + (-2*offset);
console.log(this.timeOffSet);
Это такой особый JS way, или я чего-то не понимаю?
0
let randomHexColor = (g = () => (a => (a < 16 ? '0' : '') + a.toString(16))(~~(Math.random() * 255)))() + g() + g();
+3
onst addAdjacencies = (
nodes,
) => (
nodes
.map(({
colorId,
id,
x,
y,
}) => ({
color: colors[colorId],
eastId: (
getNodeAtLocation({
nodes,
x: x + 1,
y,
})
),
id,
northId: (
getNodeAtLocation({
nodes,
x,
y: y - 1,
})
),
southId: (
getNodeAtLocation({
nodes,
x,
y: y + 1,
})
),
westId: (
getNodeAtLocation({
nodes,
x: x - 1,
y,
})
),
}))
.map(({
color,
id,
eastId,
northId,
southId,
westId,
}) => ({
adjacentIds: (
[
eastId,
northId,
southId,
westId,
]
.filter((
adjacentId,
) => (
adjacentId !== undefined
))
),
color,
id,
}))
)
https://medium.com/free-code-camp/bet-you-cant-solve-this-google-interview-question-4a6e5a4dc8ee
джаваскриптер натужно пытается решить простейшую задачу "гугл уровня" с обходом, для увеличения кринжа прилагается поехавший кодстайл и решение на RxJS
+3
var words=
[
{
'тупая русня ':1/10
,'на бутылку':1/8
,'у тебя же прыщи':1/12
,'руснявый':1/8
,'прыщеблядский':1/8
,',обоссался':1/10
,'обоссал':1/10
,', маму твою ебал,':1/12
,'стекломойная русня':1/8
,'гермашка': 1/10
,'туши пердак':1/8
}
,{
'садись на бутылку':1/8
}
,{'стекломойный русачок':1/11,' пуйло':1/7,'ко-ко-ко':1/6,'рашка':1/10,', пидорахен':1/10}
,{'пидораха,': 1/6,', пидораха полыхнула,': 1/12
,'козлодойч': 1/12
,'гермашка': 1/10
}
,{
'свинособака':1/6
,', мамку ебал,':1/12
,'бамп отсосу ':1/13
,', маму твою,':1/12
,'скрепы':1/11
,' пидораха,':1/8
,'cтекломойный':1/8
,'стекломоя наебнул':1/8
,'садись на бутылку':1/10
,'днище':1/7
,'русня':1/9
,'кремлебот ':1/6
,'порватка':1/10
,'порвался':1/15
,'руснявая пидараха': 1/11
,'бубарех': 1/10
,'хуйня': 1/10
,'залупин': 1/13
,'хуйло': 1/12
}
];
Словарь слов-маркеров анона с /po для склейки крупных кусков кобенады и твердой мелкой психозы.
Даже простейший скрипт, рандомно вставляющий данные фразы показывает весьма аутентичный результат.
0
for (var i = 0; i < self.Collection().length; i++) {
///НЕ УДАЛЯЙТЕ ОТОРВУ РУКИ!!!!!
if (self.Collection()[i].IsSecuringApplications() == true) {
continue;
}
TotalContractSumm = Math.round((TotalContractSumm + parseFloat(self.Collection()[i].ContractGuarantee)) * 100) / 100;
TotalApplicationSumm = Math.round((TotalApplicationSumm + parseFloat(self.Collection()[i].ApplicationGuarantee)) * 100) / 100;
}
Вот что бывает, когда нет code review.
0
$('#calculator').on('change', clr);
$('#calculator').on('change', total_sum);
$('#calculator').on('click', '.title', add_block);
$('#calculator').on('change', total_kg);
$("input[name='group1']").on('click', total_sum);
$("input[name='pack']").on('click', total_sum);
$('#calculator').on('click', '.title', total_sum);
$('#dop_block_0').html(
'<select size="1" name="paper" class="paper" id="paper_0">' +
'<option selected="" disabled="">Вид макулатуры</option>' +
'<option value="Картон">Картон</option>' +
'<option value="Книги, журналы">Книги, журналы</option>' +
'<option value="Архив">Архив</option>' +
'<option value="Полиэтилен">Полиэтилен</option>' +
'<option value="Газеты">Газеты</option>' +
'</select>' +
'<input type="text" placeholder="Вес в килограммах" name="weight" class="masa" id="masa_0" min="0">' +
'<p>' +
'Цена (руб/кг): <input type="text" class="price" value="0" disabled=""><input type="hidden" class="cur" id="cur_0" value="0" disabled="">' +
'</p>'
);
function total_kg() {
var i = 0;
var kg_ol = 0;
while (i < 6) {
var t = +$("#masa_" + i).val();
if (t !== t) { t = 0 };
kg_ol += t;
i++;
}
if (kg_ol >= 300) {
$('#test').attr('disabled', false);
}
else {
$('#test').attr('disabled', true);
$('#test').attr('checked', false);
$('#test').attr('checked', true);
}
};
function total_sum() {
var i = 0;
var pri0 = $("#test_block_" + i).find('.cur').val();
var price_ol = 0;
if (pri0 !== pri0) { pri0 = 0 };
while (i < 6) {
var t = +$("#test_block_" + i).find('.cur').val();
if (t !== t) { t = 0 };
price_ol += t;
i++;
}
$('.cur_ol').text(price_ol);
};
function add_block() {
var parent_id = $(this).parent().attr('id');
if ($('#' + parent_id + ' .block_dop').text() == "") {
$('#' + parent_id + ' .block_dop').html('<select size="1" name="paper" class="paper">' +
'<option selected disabled>Вид макулатуры</option>' +
'<option value="Картон">Картон</option>' +
'<option value="Книги, журналы">Книги, журналы</option>' +
'<option value="Архив">Архив</option>' +
'<option value="Полиэтилен">Полиэтилен</option>' +
'<option value="Газеты">Газеты</option>' +
'</select>' +
'<input type="text" placeholder="Вес в килограммах" name="weight" class="masa" id="masa_' + colum + '" min="0">' +
'<p>Цена (руб/кг): <input type="text" class="price" value="0" disabled><input type="hidden" class="cur" value="0" disabled></p>' +
'<script>jQuery(function($){$("#masa_' + colum + '").mask("999999",{placeholder:"",autoclear: false});});</script>');
$('#' + parent_id + ' .block_dop').slideDown();
$(this).html('Убрать вид макулатуры');
if (colum < 5) {
console.log("1=2");
var st = colum + 1;
$('#calculator .param').append('<div id="dop_block_' + st + '" class="dop">' +
'<p class="title">Добавить вид макулатуры</p>' +
' <div class="block_dop"></div>' +
'</div>');
colum++;
};
}
else {
if (colum == 1) {
console.log("2=1");
$('#' + parent_id + ' .block_dop').slideUp();
$('#' + parent_id + ' .block_dop').html("");
$(this).html('Добавить вид макулатуры');
console.log("сolum=" + colum);
}
else {
console.log("2=2");
$('#' + parent_id).slideUp();
$('#' + parent_id).remove();
colum--;
};
function clr() {
var i = 0;
while (i < 6) {
var price = 0;
var x = $("#dop_block_" + i).find('.paper').val();
if ($('input[name=group1]:checked').val() == 2 && $('input[name=pack]:checked').val() == 1){
switch (x) {
case '1'://Картон
Кокой "Java Script"