- 1
- 2
- 3
- 4
ng-include="'views/partials/header.html'"
- class="navbar navbar-static-fixed-top nav"></div>
+ /*class="navbar navbar-static-fixed-top nav"*/></div>
<ui-view id="main" class="container" id="mainContainer"></ui-view>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+128
ng-include="'views/partials/header.html'"
- class="navbar navbar-static-fixed-top nav"></div>
+ /*class="navbar navbar-static-fixed-top nav"*/></div>
<ui-view id="main" class="container" id="mainContainer"></ui-view>
GIT commit diff for Angular template
+57
#include "TrayIcon.h"
// ----------------------------------------------------------------------------
TrayIcon::TrayIcon(QObject* parent) : QSystemTrayIcon(parent),
INTERVAL(1000),
WIDTH_ICON(30), HEIGHT_ICON(30)
{
currentDate = QDate(0, 0, 0);
defaultIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
defaultIcon.fill(Qt::black);
reminderIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
reminderIcon.fill(Qt::yellow);
thousandthDayIcon = QPixmap(WIDTH_ICON, HEIGHT_ICON);
thousandthDayIcon.fill(Qt::green);
dialogBoxIsActive = false;
readSettings();
wasReminder = false;
wasCongratulation = false;
wasSetNewDate = false;
slotUpdateDate();
QMenu* contextMenu = new QMenu;
contextMenu->addAction("Set date of birth...",
this, SLOT(slotSetDateOfBirth()));
QAction* autorunAction = contextMenu->addAction("Autorun",
this, SLOT(slotSetAutorun(bool)));
autorunAction->setCheckable(true);
autorunAction->setChecked(autorun);
contextMenu->addSeparator();
contextMenu->addAction("About...", this, SLOT(slotAboutMyProgram()));
contextMenu->addSeparator();
contextMenu->addAction("Quit", qApp, SLOT(quit()));
setContextMenu(contextMenu);
QTimer* timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), SLOT(slotUpdateDate()));
timer->start(500);
}
// ----------------------------------------------------------------------------
void TrayIcon::slotUpdateDate()
{
if((currentDate != QDate::currentDate()) || wasSetNewDate)
{
currentDate = QDate::currentDate();
daysToThousandthDay
= INTERVAL - dateOfBirth.daysTo(currentDate) % INTERVAL;
wasCongratulation = false;
wasReminder = false;
wasSetNewDate = false;
if((daysToThousandthDay != INTERVAL) && (daysToThousandthDay != 1))
{
setIcon(QIcon(defaultIcon));
setToolTip("Until next thousandth day in " +
QString().number(daysToThousandthDay) + " days.");
}
else
{
if(daysToThousandthDay == 1)
{
if(!wasReminder)
reminderBeforeDay();
}
else
{
if(!wasCongratulation)
congratulation();
}
}
}
}
Описание конструктора и одного из методов класса иконки в системном трее из программы, которая должна оповещать пользователя о каждом тысячном дне его жизни. Написано на Qt.
Полная версия:
main: http://pastebin.com/DEKiMWdb
хедер класса иконки трея: http://pastebin.com/rN9NwBPB
.cpp класса иконки трея: http://pastebin.com/uuyf5uxX
хедер класса окна ввода даты рождения: http://pastebin.com/bmfAbFwg
.cpp класса окна ввода даты рождения: http://pastebin.com/3R8BaPFC
+118
if (operator instanceof TUOperatorStacker) {
dump.put("operator_type", "TUOperatorStacker");
} else if (operator instanceof TUOperatorDestacker) {
dump.put("operator_type", "TUOperatorDestacker");
} else if (operator instanceof TUOperatorTargetedStacker) {
dump.put("operator_type", "TUOperatorTargetedStacker");
} else if (operator instanceof TUOperatorTargetedDestacker) {
dump.put("operator_type", "TUOperatorTargetedDestacker");
}
<...>
String typeString = (String) dump.get("operator_type");
TUOperator operator = null;
if (typeString.equals("TUOperatorStacker")) {
operator = new TUOperatorStacker(simElement);
} else if (typeString.equals("TUOperatorDestacker")) {
operator = new TUOperatorDestacker(simElement);
} else if (typeString.equals("TUOperatorTargetedStacker")) {
operator = new TUOperatorTargetedStacker(simElement);
} else if (typeString.equals("TUOperatorTargetedDestacker")) {
operator = new TUOperatorTargetedDestacker(simElement);
}
+154
if (d_min < 0) {
// push out by normal * |d_min|
x = x - d_min * T[t_min];
y = y - d_min * T[t_min + 1];
y = z - d_min * T[t_min + 2];
Сука, блядь, пиздец, два часа убил.
+70
* Calculates the minimum number of bits necessary to represent the given number. The
* number should be given in its unsigned form with the starting bits equal to 1 if it is
* signed. Repeatedly compares number to another unsigned int called x.
* x is initialized to 1. The value of x is shifted left i times until x is greater
* than number. Now i is equal to the number of bits the UNSIGNED value of number needs.
* The signed value will need one more bit for the sign so i+1 is returned if the number
* is signed, and i is returned if the number is unsigned.
* @param number the number to compute the size of
* @param bits 1 if number is signed, 0 if unsigned
*/
public static int minBits(int number, int bits)
{
int val = 1;
for (int x = 1; val <= number && !(bits > 32); x <<= 1)
{
val = val | x;
bits++;
}
if (bits > 32)
{
assert false : ("minBits " + bits + " must not exceed 32");
}
return bits;
}
Адоб, как обычно, порадовал (условие окончания цикла).
[color=blue]https://git-wip-us.apache.org/repos/asf/flex-sdk/repo?p=flex-sdk.git;a=blob;f=modules/swfutils/src/java/flash/swf/SwfEncoder.java;h=03a100dda92989d537b00b 96033d614c73c47801;hb=HEAD#l320[/code]
+63
renderer->SetBackground(.0, .0, .0); // Background color green
+124
quicksort [] = []
quicksort (h:t) = (quicksort(filter (=h) t))
quicksort на хаскель. лаба. масло. 2014
+153
public function indexAction()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
Zend_Auth::getInstance()->getIdentity();
}
}
+128
isParallel :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Bool
isParallel x1 y1 x2 y2 x3 y3 x4 y4 = if (((x1-x2)*(y3-y4)-(y1-y2)*(x3-x4)) == 0) then True else False
лаба по хаски
параллельны ли 2 прямые?
+155
const WCT_SYMBOLS = new Buffer('ABCDEFGO'); /*задаём строку для поиска
в ней символов*/
const WCT_LENGTH = 3;
const fs = require('fs');
/*функция для перевода целой части числа из 10-й в любую сс*/
function Cel(number, c, out, offset, length){
var pos = offset + length - 1;
number |= 0; /*берём целую часть от числа*/
do {
out[pos--] = WCT_SYMBOLS[number % c | 0]; /*повторяем пока число не будет равно нулю берём целую часть при
делении числа на основание и берём остаток + 1 от деления целой части на 16, записываем
результат посимвольно в строку out*/
number = number / c | 0;
} while (number != 0);
while(pos >= offset)
out[pos--] = WCT_SYMBOLS[0];
}
(function wctEditor() {
const argv = process.argv;
if(argv.length < 4) {
console.log('Not enough parameters!');
process.exit(1);
}
const input = argv[2], output = argv[3];
if(!fs.existsSync(input)) {
console.log('File not exist!');
process.exit(2);
}
const BUFFER_SIZE = 1024;
const f1 = fs.openSync(input, 'r');
const f2 = fs.openSync(output, 'w');
const I = new Buffer(BUFFER_SIZE);
const O = new Buffer(WCT_LENGTH * BUFFER_SIZE);
while(1) {
var readBytes = fs.readSync(f1, I, 0, I.length, null);
if(!readBytes) break;
for(var i=0; i<readBytes; ++i)
Cel(I[0], WCT_SYMBOLS.length, O, i * WCT_LENGTH, WCT_LENGTH);
fs.writeSync(f2, O, 0, readBytes * WCT_LENGTH, null);
}
fs.closeSync(f1);
fs.closeSync(f2);
})();
/* TODO -oUser -cConsole Main : Insert code here */
По следам http://programmersforum.ru/showthread.php?t=264223. Ну тормозит же!
Я долго боролся с собой, и всё же от авторского стиля остались только комментарии и имена f1, f2 и I...
WCT editor: теперь и под Node.