- 1
- 2
- $pending = $this->$tag['callback']($open['data'], $open['option']);
+ $pending = $this->{$tag['callback']}($open['data'], $open['option']);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
- $pending = $this->$tag['callback']($open['data'], $open['option']);
+ $pending = $this->{$tag['callback']}($open['data'], $open['option']);
Копаюсь в сорцах говнокода.
В PHP 7 поменяли приоритет, пол часа не мог понять что за хуйня.
+139
class MainClass
{
public static char[,] titato = new char[3, 3] { { ' ', ' ', ' ' }, { ' ', ' ', ' ' }, { ' ', ' ', ' ' } };
static bool CheckWin(char s)
{
if ((titato[0, 0] == titato[1, 1] & titato[1, 1] == titato[2, 2] & titato[0, 0] != ' ') ||
(titato[0, 1] == titato[0, 2] & titato[0, 2] == titato[0, 0] & titato[0, 1] != ' ') ||
(titato[1, 1] == titato[1, 2] & titato[1, 2] == titato[1, 0] & titato[1, 1] != ' ') ||
(titato[2, 1] == titato[2, 2] & titato[2, 2] == titato[2, 0] & titato[2, 1] != ' ') ||
(titato[1, 0] == titato[2, 0] & titato[2, 0] == titato[0, 0] & titato[1, 0] != ' ') ||
(titato[1, 1] == titato[2, 1] & titato[2, 1] == titato[0, 1] & titato[1, 1] != ' ') ||
(titato[1, 2] == titato[2, 2] & titato[2, 2] == titato[0, 2] & titato[1, 2] != ' ') ||
(titato[2, 0] == titato[1, 1] & titato[1, 1] == titato[0, 2] & titato[2, 0] != ' '))
{
return true;
}
return false;
}
public static void PrintTicTacToe(char s)
{
Console.Clear();
Console.Write(" ");
Console.BackgroundColor = ConsoleColor.White;
for (int i = 0; i < titato.GetLength(0); i++) {
Console.Write(" {0} ", i);
}
Console.WriteLine();
for (int i = 0; i < titato.GetLength(0); i++) {
Console.BackgroundColor = ConsoleColor.White;
Console.Write("{0}", i);
for (int j = 0; j < titato.GetLength(1); j++) {
Console.BackgroundColor = ConsoleColor.Black;
if (titato[i, j] == 'x') {
Console.ForegroundColor = ConsoleColor.Red;
}
else if (titato[i, j] == 'o') {
Console.ForegroundColor = ConsoleColor.Green;
}
else {
Console.ForegroundColor = ConsoleColor.Black;
}
Console.Write(" {0} ", titato[i, j]);
}
Console.WriteLine();
}
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Black;
if (CheckWin(s)) {
Console.WriteLine(s + " win!!!");
}
}
public static void PushXO(int i, int j, char s)
{
titato[i, j] = s;
}
public static void Main(string[] args)
{
bool symbolX = true;
char s = 'x';
int i = 0, j = 0;
do {
Console.WriteLine("TIC TAC TOE!");
PrintTicTacToe(s);
if (symbolX == true) {
Console.WriteLine("Ходит Х");
Console.WriteLine("Введите номер столбца а затем введите номер строки:");
s = 'x';
symbolX = false;
}
else {
Console.WriteLine("Ходит О");
Console.WriteLine("Введите номер столбца а затем введите номер строки:");
s = 'o';
symbolX = true;
}
i = int.Parse(Console.ReadLine());
j = int.Parse(Console.ReadLine());
PushXO(j, i, s);
// Console.ReadLine();
PrintTicTacToe(s);
} while (true);
}
Крестики-нолики
+61
<html>
<head>
<title>В Контакте | Страницы юзера</title>
<style type="text/css">
body{
background: black;
color: #D1D1D1;
font-family: "Trebuchet MS", Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 1.2em;
}
div.body{
margin-left: auto;
margin-right: auto;
width: 520px;
}
a{color: #D1D1D1; text-decoration: none;}
a:hover{color: #3e9af2; text-decoration: underline;}
li{white-space: nowrap; list-style: none;}
input{
background: black;
color: #D1D1D1;
border:none;
border-bottom: 1px dotted #D1D1D1;
font-family: "Trebuchet MS", Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 1.2em;
margin-bottom: -2px;
}
</style>
<script type="text/javascript">
<!--//
function set_id(){
var user_id_1 = document.getElementById('user_id').value.replace(/[^\d]/g, "");
var user_id_2 = user_id_1 + '&' + Math.round(Math.random() * 999999);
var user_links = '';
user_links += '<ul>';
user_links += ' <li><a href="http://vkontakte.ru/id' + user_id_1 + '?' + Math.round(Math.random() * 999999) + '" target="_blank">Главная страница</a></li>';
user_links += ' <li>';
user_links += ' <a href="http://vkontakte.ru/wall.php?id=' + user_id_2 + '" target="_blank">Стена</a>';
user_links += ' <ul>';
user_links += ' <li><a href="http://vkontakte.ru/wall.php?act=write&id=' + user_id_2 + '" target="_blank">Оставить сообщение</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/graffiti.php?act=draw&to_id=' + user_id_2 + '" target="_blank">Оставить графити</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/photos.php?to_id=' + user_id_2 + '" target="_blank">Оставить фото</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/video.php?to_id=' + user_id_2 + '" target="_blank">Оставить видио</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/audio.php?to_id=' + user_id_2 + '" target="_blank">Оставить аудио</a></li>';
user_links += ' </ul>';
user_links += ' </li>';
user_links += ' <li><a href="http://vkontakte.ru/mail.php?act=write&to=' + user_id_2 + '" target="_blank">Отправить сообщение</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/friend.php?id=' + user_id_2 + '" target="_blank">Друзья</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/photos.php?id=' + user_id_2 + '" target="_blank">Альбомы</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/photos.php?act=user&id=' + user_id_2 + '" target="_blank">Фото с юзером</a></li>';
user_links += ' <li><a href="http://pda.vkontakte.ru/taggedphotos' + user_id_1 + '" target="_blank">Фото с юзером, если надо посмотреть скрытые фото</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/video.php?id=' + user_id_2 + '" target="_blank">Видeо</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/questions.php?mid=' + user_id_2 + '" target="_blank">Вопросы</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/notes.php?id=' + user_id_2 + '" target="_blank">Заметки</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/apps.php?mid=' + user_id_2 + '" target="_blank">Приложения</a></li>';
user_links += ' <li><a href="http://vkontakte.ru/groups.php?mid=' + user_id_2 + '" target="_blank">Группы</a></li>';
user_links += '</ul>';
document.title = 'В Контакте | Страницы юзера id' + user_id_1;
document.getElementById('user_id').value = user_id_1;
document.getElementById('user_pages').innerHTML = user_links;
}
//-->
</script>
</head>
<body onLoad="set_id()">
<div class="body">
Страницы юзера id<input name="user_id" id="user_id" type="text" value="1" onKeyUp="set_id()" onKeyPress="set_id()" onPaste="set_id()">
<div id="user_pages"></div>
<noscript><p align="center">Ипать))) ... ктож а таком старье сидит)....<br />Включи JavaScript!</p></noscript>
<p align="center">by Dr.Freez</p>
</div>
</body>
</html>
говницо)))
+1
function foo(arg: any) {
if (typeof arg === "string") {
// We know this is a string now.
print(<string>arg);
}
}
function main() {
foo("Hello");
foo(1);
print("done.");
}
я вам новый говнокодец притарабанил.... вот будете как настоящие жабаскриптеры в нативе
0
namespace Ifaces {
interface IFoo {
foo(): number;
bar(x: number): string;
twoArg(x: number, y: number): number;
baz: string;
}
class A implements IFoo {
constructor() {
this.baz = "Q" + "A";
}
foo(): number {
return 12;
}
bar(v: number) {
return v.toString();
}
twoArg(x: number, y: number) {
return x;
}
baz: string;
}
class B extends A {
foo(): number {
return 13;
}
}
function foo(f: IFoo) {
return "" + f.foo() + f.baz + f.bar(42);
}
export function run() {
print("Ifaces.run");
let a = new A();
assert("" + foo(a) + "X" == "12.QA42.X");
assert((a as IFoo).twoArg(1, 2) == 1, "t");
a = new B();
assert("" + foo(a) + "X" == "13.QA42.X", "b");
let q = a as IFoo;
q.baz = "Z";
assert("" + foo(q) + "X" == "13.Z42.X", "x");
print("Ifaces.runDONE");
}
}
function main() {
Ifaces.run();
print("done.");
}
хотел оставить вас в покое. но не смог. Ловите - fields в интерфейсах
+4
def generate_set(max_size, base_images, samples_per_image=100):
assert len(base_images) == CHARS_NUM
input_vec_len = max_size[0] * max_size[1]
output_vec_len = CHARS_NUM
set_size = samples_per_image * CHARS_NUM
x_set = np.empty(shape=(set_size, input_vec_len))
y_set = np.empty(shape=(set_size, output_vec_len))
sample_num = 0
for c, img in base_images.items():
for _ in range(samples_per_image):
x_set[sample_num] = generate_distorted_sample(img)
y_set[sample_num] = char_to_onehot(c)
sample_num += 1
# LOL
rng_state = np.random.get_state()
np.random.shuffle(x_set)
np.random.set_state(rng_state)
np.random.shuffle(y_set)
return x_set, y_set
ТУРЕЛЬ: 1-1 сорцовый кобенный генератор по мотивам: https://govnokod.ru/26434#comment527875.
https://github.com/gost-gk/turel
Принцимп мухи: берём символы русского алфамита с цифрами/пуньктуацией, генерируем из них слегка искажённые картинки, тренируем элементарную модельку —
optimizer = keras.optimizers.Adagrad(learning_rate=0.02)
model = Sequential()
model.add(Dense(units=CHARS_NUM * 2, activation='relu', input_dim=input_vec_len))
model.add(Dense(units=CHARS_NUM, activation='softmax'))
model.compile(loss='categorical_crossentropy',
optimizer=optimizer,
metrics=['accuracy'])
−4
static Singleton * g_pInstance = NULL;
Singleton* Singleton::sharedInstance()
{
if (g_pInstance)
return g_pInstance;
else {
g_pInstance = new Singleton();
if (g_pInstance->init()) {
return g_pInstance;
} else {
delete g_pInstance;
g_pInstance = NULL;
}
return g_pInstance;
}
}
Ещё из жизни синглтонов. Даёшь больше return'ов!
+124
using System;
class Example
{
static void Main()
{
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
for (a = 0; a < 2; a++)
{
for (b = 0; b < 2; b++)
{
for (c = 0; c < 2; c++)
{
for (d = 0; d < 2; d++)
{
for (e = 0; e < 2; e++)
{
for (f = 0; f < 2; f++)
{
for (g = 0; f < 2; g++)
{
for (h = 0; h < 2; h++)
{
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
{
for (k = 0; k < 2; k++)
{
for (l = 0; l < 2; l++)
{
for (m = 0; m < 2; m++)
{
for (n = 0; n < 2; n++)
{
for (o = 0; o < 2; o++)
{
for (p = 0; p < 2; p++)
{
for (q = 0; q < 2; q++)
{
for (r = 0; r < 2; r++)
{
for (s = 0; s < 2; s++)
{
for (t = 0; t < 2; t++)
{
for (u = 0; u < 2; u++)
{
for (v = 0; v < 2; v++)
{
for (w = 0; w < 2; w++)
{
for (x = 0; x < 2; x++)
{
for (y = 0; y < 2; y++)
{
for (z = 0; z < 2; z++)
Console.WriteLine(a + "|" + b + "|" + c + "|" + d + "|" + e + "|" + f + "|" + g + "|" + h + "|" + i + "|" + j + "|" + k + "|" + l + "|" + m + "|" + n + "|" + o + "|" + p + "|" + q + "|" + r + "|" + s + "|" + t + "|" + u + "|" + v + "|" + w + "|" + x + "|" + y + "|" + z);
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
Только начал изучать шарп и делать было нечего. Знаю что заминусуют но такой "тупейший шедевр" не могу сюда не скинуть
−87
Программа на цикл.
Мы запускаем цикл, который можно остановить только если прописать слово "Стоп" :
Dim Slovo As String
Do
Slovo = InputBox("Введите слово", "Слово")
MsgBox(Slovo & "!", , "Слово")
Loop Until Slovo = "Стоп"
Автор: Release
E-mail: [email protected]
Сайт: ds-release.ru
http://vbbook.ru/vb.net/programma-na-cikl/
Вначале было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
Потом тоже было слово.
application halted with error
−11
Point ReadPoint ()
{
Fixed x = ReadFixed();
Fixed y = ReadFixed();
return Point(x,y);
}
Как же меня бесит отсутствие чётко определённого стандартом порядка вычисления аргументов!!!!!!!