- 1
- 2
- 3
- 4
- 5
- 6
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')
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+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
Планировщик постов
+1
#if ( clang_major==7 && clang_minor==3 )
public std::enable_shared_from_this<CryptoContainer>
#else
public std::enable_shared_from_this<CryptoContainerInterface>
#endif
Во первых непонятно зачем, а во вторых clang > 6 на момент написания даже в проекте не было.
0
echo -ne '10\n11\n12\n' | POST 'http://localhost:8123/?query=INSERT INTO t FORMAT TabSeparated'
cat file.csv | clickhouse-client --database=test --query="INSERT INTO test FORMAT CSV";
https://clickhouse.yandex/docs/en/single/index.html#format-clause
+1
private SharedPreferences longCache;
private String email;
public void updateEmail(String newLogin) {
if(newLogin != null) {
email = newLogin;
if(longCache.contains("email")) {
longCache.edit().remove("email").apply();
}
longCache.edit().putString("email", email).apply();
}
}
Проект под Android.
Стаж разработчика - 5 лет.