- 1
- 2
https://i.imgur.com/kMVofCA.png
ооооонейросетьоооотвечайрррооооооооооооооооооооооооооооооооооооооооооооооооввоооооооооооо
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
https://i.imgur.com/kMVofCA.png
ооооонейросетьоооотвечайрррооооооооооооооооооооооооооооооооооооооооооооооооввоооооооооооо
по какому блядь принципу работает этот гугловский говнопереводчик?
+8
$data['age_range'] = array(
'18' => '18', '19' => '19', '20' => '20',
'21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25',
'26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30',
'31' => '31', '32' => '32', '33' => '33', '34' => '34', '35' => '35',
'36' => '36', '37' => '37', '38' => '38', '39' => '39', '40' => '40',
'41' => '41', '42' => '42', '43' => '43', '44' => '44', '45' => '45',
'46' => '46', '47' => '47', '48' => '48', '49' => '49', '50' => '50',
'51' => '51', '52' => '52', '53' => '53', '54' => '54', '55' => '55',
'56' => '56', '57' => '57', '58' => '58', '59' => '59', '60' => '60',
'61' => '61', '62' => '62', '63' => '63', '64' => '64', '65' => '65',
'66' => '66', '67' => '67', '68' => '68', '69' => '69', '70' => '70',
'71' => '71', '72' => '72', '73' => '73', '74' => '74', '75' => '75',
'76' => '76', '77' => '77', '78' => '78', '79' => '79', '80' => '80',
'81' => '81', '82' => '82', '83' => '83', '84' => '84', '85' => '85',
'86' => '86', '87' => '87', '88' => '88', '89' => '89', '90' => '90',
'91' => '91', '92' => '92', '93' => '93', '94' => '94', '95' => '95',
'96' => '96', '97' => '97', '98' => '98', '99' => '99', '100' => '100',
'101' => '101', '102' => '102', '103' => '103', '104' => '104', '105' => '105',
'106' => '106', '107' => '107', '108' => '108', '109' => '109', '110' => '110', '111' => '111', '112' => '112'
);
Hahaha classic
+2
#define max(x, y) ((x) > (y) ? (x) : (y)) // Вводим макрос
#define MAX(x, y) max(x, y) // Чтобы не конфликтовал со стандартным max
#define Std namespace std // Так короче
#include <iostream>
#include <vector>
#include <algorithm>
using Std;
int main()
{
bool vvedeno = false;
int kolichestvo;
cin >> kolichestvo;
vector<char> A(kolichestvo);
A: if (vvedeno){goto B;}else{
while(kolichestvo != 0){vvedeno = true; cin >> A[kolichestvo - 1]; kolichestvo = kolichestvo - 1;} // вводим
}
reverse (A.begin(), A.end()); // для определённости развернём
B:
vector<int> B; // Массив из цифр
try{
for (char tipachislo : A)
B.push_back(int(tipachislo) - 48); // преобразуем char к int
}catch(errc){vvedeno = false; kolichestvo = A.size(); goto A;} // ну что-то же ввести надо
C:
int maxim = B[1];
int dlina = B.size();
D:
maxim = MAX(B[dlina - 1], maxim);
dlina--;
if(dlina == -1){cout << maxim;}else{goto D;} // ищем
}
+2
var CodeMirror = require("codemirror");
var Thrift = require("thrift.js");
require("./src/my.css");
include(`gen-js/test_types.js')
include(`gen-js/TestServ.js')
include(`src/main.js')
Против m4 нет приёма.
0
public function hasSubscriptionLot(int $lotId) : bool
{
foreach ($this->getSubscriptionLotIds() as $subLotId => $quantity) {
if ($lotId == $subLotId) {
return true;
}
}
return false;
}
array_key_exists?.. не, не слышали
+5
function getadminuserid(){
global $wpdb;
//Get all users in the DB
$wp_user_search = $wpdb->get_results("SELECT ID, display_name FROM $wpdb->users ORDER BY ID");
//Blank array
$adminArray = array();
//Loop through all users
foreach ( $wp_user_search as $userid ) {
//Current user ID we are looping through
$curID = $userid->ID;
//Grab the user info of current ID
$curuser = get_userdata($curID);
//Current user level
$user_level = $curuser->user_level;
//Only look for admins
if($user_level >= 8){//levels 8, 9 and 10 are admin
//Push user ID into array
$adminArray[] = $curID;
}
}
return $adminArray;
}
1) Get IDs for all users
2) Iterate over result set to find admin `get_userdata` function = 1 DB call
outcome:
1) full RAM
2) dead DB
===
official woocommerce plugin by company
+1
function CountBack_slider(secs,iid,j_timer) {
if (secs < 0) {
document.getElementById(iid).innerHTML = FinishMessage;
document.getElementById('caption'+j_timer).style.display = "none";
document.getElementById('heading'+j_timer).style.display = "none";
return;
}
DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000));
DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24));
DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60));
DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60));
var elems = document.getElementsByTagName('*'), i;
for (i in elems) {
if((' ' + elems[i].className + ' ').indexOf(' ' + iid + ' ')
> -1) {
elems[i].innerHTML = DisplayStr;
}
}
jQuery('.'+iid).innerHTML = DisplayStr;
if (CountActive)
setTimeout(function(){CountBack_slider((secs+CountStepper),iid,j_timer)}, SetTimeOutPeriod);
}
Работаю с купленным html5-шаблоном.
В шаблоне jq (и еще куча всякого хлама) подключен.
Кодили с мыслью "работает и *уй с ним".
+2
import os
import argparse
import sys
parser = argparse.ArgumentParser(description='tree')
parser.add_argument('path',type=str,)
parser.add_argument('-fo','--folders_only',action='store_true',)
parser.add_argument('-i','--include',type=str,action='store',)
parser.add_argument('-e','--exclude',type=str,action='store',)
parser.add_argument('-a','--all',action='store_true',)
parser.add_argument('-f','--full_name',action='store_true',)
args = parser.parse_args()
print(sys.argv[1])
if args.include:
itext = args.include
if args.exclude:
etext = args.exclude
def divine_crutch(path, n):
dir = os.listdir(path)
for i in range(len(dir)):
if os.path.isfile(path + '\\' + dir[i]):
if not(args.folders_only):
if not(args.include and itext not in dir[i]):
if not(args.exclude and etext in dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
if os.path.isdir(path + '\\' + dir[i]):
if not(not(args.all) and dir[i][0] == '.') and not(args.full_name):
print(n*' ', dir[i])
elif args.full_name and not(not(args.all) and dir[i][0] == '.'):
print(n*' ' ,path + '\\' + dir[i])
n += 4
divine_crutch(path + '\\' + dir[i], n)
n -= 4
divine_crutch(sys.argv[1], 4)
Рекурсивный велосипед на костыльной тяге. Сей экземпляр является "аналогом системной утилиты tree под линукс". При подходящей фазе луны и выполнении условий ритуала чёрной магии, способен захавать 16 гигов оперативки и крашнуть систему. Прекрасный способ выстрелить в ногу на питоне. Достойное место в моей кунсткамере.
+1
https://s1.postimg.org/9ay7hrf7fj/js-love-forever.png
heart, heart, JavaScript!
+1
while (1):
for iterator in range(len(posts)):
# Для прозрачности вычислений
time_post_a = datetime.now()
time_post_a = int(time.mktime(time_post_a.timetuple()))
time_post_b = posts[iterator]['time']
time_post_b = int(time.mktime(time_post_b.timetuple()))
# Выполнить действие, в случае, если "время пришло" по массиву posts
if ((time_post_a - time_post_b) == 0):
print ('Итератор: ' + str(iterator) + ', Новая публикация: ' + str(posts[iterator]['time']))
time.sleep(1) # Если его убрать, то начинаются дикие пляски
break
Планировщик постов