- 1
Итого байт: 205812872340
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−4
Итого байт: 205812872340
Результат прошлого кода! А давайте письками померяемся?
−7
#include <stdio.h>
// Бесконечный дождик на экране! Ахуенчик ёпта
int main()
{
char c = '\\';
while(1)
{
for(int i=0; i<20; i++)
{
usleep(1000);
for(int sp=0;sp<i;sp++) printf(" "); //печатаем пробелы
printf("%c", c);
}
}
}
−2
Возврат;
КонецПроцедуры
Процедуры!!!
−2
public static function GenerateMenu()
{
$item = [];
$section = self::find()->all();
$count_section = 0;
foreach ($section as $model_section) {
$item[] = ['label' => $model_section->name, 'url' => '#'];
$category = \common\models\Category::find()->where(['id_section' => $model_section->id])->all();
$count_category = 0;
foreach ($category as $model_category) {
$item[$count_section]['items'][$count_category] = ['label' => $model_category->name, 'url' => '#'];
$subcategory = \common\models\Subcategory::find()->where(['id_category' => $model_category->id])->all();
$count_subcategory = 0;
foreach ($subcategory as $model2) {
$item[$count_section]['items'][$count_category]['items'][$count_subcategory] = ['label' => $model2->name, 'url' => '#'];
$count_subcategory++;
}
$count_category++;
}
$count_section++;
}
return $item;
}
Феерическое решение для вывода tree из трех категорий.
−19
let countries = ``
missingCountries.map((c, i) => {
countries += ` '${c.country}'`
if (i !== missingCountries.length - 1) countries += `,`
})
map? Ara.
−15
github.com/mpak2/mpak.su/tree/master/include/mail
В mpak завезли composer.json
+2
var L = {
'Рђ': 'A',
'Р°': 'a',
'Р‘': 'B',
'Р±': 'b',
'Р’': 'V',
'РІ': 'v',
'Р“': 'G',
'Рі': 'g',
'Р”': 'D',
'Рґ': 'd',
'Р•': 'E',
'Рµ': 'e',
'РЃ': 'Yo',
'С‘': 'yo',
'Р–': 'Zh',
'Р¶': 'zh',
'Р—': 'Z',
'Р·': 'z',
'Р': 'I',
'Рё': 'i',
'Р™': 'Y',
'Р№': 'y',
'Рљ': 'K',
'Рє': 'k',
'Р›': 'L',
'Р»': 'l',
'Рњ': 'M',
'Рј': 'm',
'Рќ': 'N',
'РЅ': 'n',
'Рћ': 'O',
'Рѕ': 'o',
'Рџ': 'P',
'Рї': 'p',
'Р ': 'R',
'СЂ': 'r',
'РЎ': 'S',
'СЃ': 's',
'Рў': 'T',
'С‚': 't',
'РЈ': 'U',
'Сѓ': 'u',
'Р¤': 'F',
'С„': 'f',
'РҐ': 'Kh',
'С…': 'kh',
'Р¦': 'Ts',
'С†': 'ts',
'Р§': 'Ch',
'С‡': 'ch',
'РЁ': 'Sh',
'С€': 'sh',
'Р©': 'Sch',
'С‰': 'sch',
'РЄ': '',
'СЉ': '',
'Р«': 'Y',
'С‹': 'y',
'Р¬': "",
'СЊ': "",
'Р': 'E',
'СЌ': 'e',
'Р®': 'Yu',
'СЋ': 'yu',
'РЇ': 'Ya',
'СЏ': 'ya'
};
+2
#!/usr/bin/env python
import jinja2
import contextlib
import os.path
import shutil
import subprocess
import sys
import tempfile
@contextlib.contextmanager
def rm_dir(d):
yield d
shutil.rmtree(d)
def main():
if len(sys.argv) < 2:
return
if os.path.basename(sys.argv[1]) != "compile":
subprocess.call(sys.argv[1:])
return
command = sys.argv[1:]
preprocessed_files = []
with rm_dir(tempfile.mkdtemp()) as tmpdir:
print "Temp dir is", tmpdir
while len(command) > 0 and not command[-1].startswith("-") and command[-1].endswith(".go"):
tmpfile = os.path.join(tmpdir, str(len(command)) + ".go")
with open(command[-1]) as input:
with open(tmpfile, "wb") as preprocessed:
print "Preprocess", command[-1], "into", tmpfile
preprocessed.write(jinja2.Template(input.read()).render())
preprocessed_files.append(tmpfile)
command.pop()
subprocess.call(command + preprocessed_files)
if __name__ == "__main__":
main()
Прикручиваем шаблонизатор jinja к го, чтобы копипастить с комфортом. Использовать так:
go build -toolexec '/path/to/preprocess.py' package_na_go
0
Телефон Страйкера: +79653583864
Скоро на всех гей-порталах страны.
Админ, можешь уже выбрасывать симку.
−1
Сишечные строки для printf-подобной параши из прошивки ESP8266 (для веб-сервера):
....
method="POST">Login: <INPUT size=10 NAME='login' value="%s"> Password: <INPUT size=10 NAME='pass' value="%s"></td></tr><br><INPUT TYPE='checkbox' NAME='fls'%s> Full Security.
<input type="hidden" name="st" value=5><br>%s
<hr><b>Config module:</b><br><div class="spH2"></div><form method="GET">Host name: <INPUT size=12 NAME='hn' value="%s">
<input type="hidden" name="st" value=7><br>%s
<hr><b>WiFi options:</b><br><div class="spH2"></div><form method="GET"><input type="radio" name="sm" value="0" %s>Station mode.<input type="radio" name="sm" value="7" %s>AP mode.<br>AP name: <input size=20 name="stname" value="%s"> <br>AP pass: <input size=20 type='password' name="stpass" value="%s"><br>
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>%s</title><meta http-equiv="REFRESH" content="60"><meta name="viewport" content="width=480" /><meta name="mobile-web-app-capable" content="yes" /><link rel="stylesheet" href="main.css"></head><body><br><div style="text-align: center"><div style="display: inline-block"><div class="name fll">%s<div class="www">MaksMS <a href="http://wifi-iot.com" target="_blank">wifi-iot.com</a><br>
... и никакого пхп
http://wifi-iot.com/ вот тут можно генерировать такие говнопрошивки