- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
private static bool ProductGT10(Point p)
{
if (p.X * p.Y > 100000)
{
return true;
}
else
{
return false;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+121
private static bool ProductGT10(Point p)
{
if (p.X * p.Y > 100000)
{
return true;
}
else
{
return false;
}
}
Классический пример из MSDN
http://msdn.microsoft.com/ru-ru/library/bfcke1bz.aspx
+121
public int sum(final Type type, final int increment) {
switch(type) {
case REDOS:
return redos += increment;
case ONCE:
return onceRedoneOrders += increment;
case TWICE:
return twiceRedoneOrders += increment;
case THRICE:
return thriceRedoneOrders += increment;
case MORE:
return moreRedoneOrders += increment;
default:
break;
}
throw new RuntimeException();
}
Осталось в наследство. Даже не знаю, что хотел изобразить предыдущий оратор...
+121
public class DefaultQueryEngine implements QueryEngine {
private static volatile QueryEngine DEFAULT;
public static QueryEngine getDefault() {
if (DEFAULT == null) {
DEFAULT = new DefaultQueryEngine(new DefaultEvaluatorFactory(CollQueryTemplates.DEFAULT));
}
return DEFAULT;
}
https://github.com/mysema/querydsl/blob/master/querydsl-collections/src/main/java/com/mysema/query/collections/DefaultQueryEngine.java
Ехал дефолт через дефолт...
+121
#Creates an array with the frequencies from C2 to C5, 37 notes in all
for j from 1 to 37
if j = 1
notes [j] = 65.41 # лёгкие пути не нужны
endif
if j = 2
notes [j] = 69.30
endif
# ...дальше понятно...
endfor
# <...>
#Determining whether or not the scale contains C
#This determines how many notes of the 37 possible must be included.
noCList [1] = 3 # опа, а вот тут уже научились числовые индексы использовать
noCList [2] = 5
noCList [3] = 7
noCList [4] = 10
noCList [5] = 12
noC = 0
for n from 1 to 5
if 'starter' = noCList['n']
noC = 1
endif
endfor
#If there is a C...
if noC = 0
#The for loop mathematically selects the scale notes to use
for m from 1 to 22
if 'm' = 1
noteind = 'starter'
endif
if 'm' = 2
noteind = 'starter' + 2
if 'noteind' > 37
noteind = 'noteind' - 36
endif
endif
# ...ага-ага...
scalenotes ['m'] = notes['noteind']
endfor
#If there is not a C...
else
for m from 1 to 21
if 'm' = 1
noteind = 'starter'
endif
if 'm' = 2
noteind = 'starter' + 2
if 'noteind' > 37
noteind = 'noteind' - 36
endif
endif
# ...так точно...
scalenotes ['m'] = notes['noteind']
endfor
endif
# <...>
#Add new pitch information
#For each point, we move the freq to the closest scale note
for q from 1 to 'numPoints'
#The original freq of pitch
currentfreq = pitches['q']
#A starting threhold for difference between original and a musical note
diff = 50
#If there is C in the scale, making 22 possible notes to tune to...
if 'noC' = 0
#For loop finds the lowest difference between original pitch and a musical note
for c from 1 to 22
diff2 = abs('currentfreq' - scalenotes['c'])
if 'diff2' < 'diff'
diff = 'diff2'
noteindex = 'c'
endif
endfor
#Otherwise if there is not a C...
else
for c from 1 to 21
diff2 = abs('currentfreq' - scalenotes['c'])
if 'diff2' < 'diff'
diff = 'diff2'
noteindex = 'c'
endif
endfor
endif
#Add point at the original time with the new pitch
Add point... times['q'] scalenotes['noteindex']
endfor
http://schyzm.wordpress.com/2012/12/05/fun-with-praat-a-script-for-auto-tune/
Скрипт питч-коррекции для речевого анализатора Praat на встроенном языке сценариев. Не знаю, это афтар так жжот или язык располагает к черезжопию, но что-то тут воняет однозначно.
+121
This awesome yet simple and pragmatic PHP library performs an addition of two numbers.
In early stages of Internet, developers were forced to work with poor, dry, functional, horrific languages. Everything had to be done through austere functions and operators. There was no objects. No interfaces. No dependency injection.
For example, to make something as simple as an addition, our dads had to write: 1+1. Yeah, really.
Hopefuly now, we have PHP 5.3 and its solid OOP implementation. SimplePHPEasyPlus lets you make this addition in a more fashionable way, using real OOP. It is fast, simple, flexible and tested. To add 1 to 1, all you have to do is:
use SimplePHPEasyPlus\Number\NumberCollection;
use SimplePHPEasyPlus\Number\SimpleNumber;
use SimplePHPEasyPlus\Number\CollectionItemNumberProxy;
use SimplePHPEasyPlus\Parser\SimpleNumberStringParser;
use SimplePHPEasyPlus\Iterator\CallbackIterator;
use SimplePHPEasyPlus\Operator\AdditionOperator;
use SimplePHPEasyPlus\Operation\ArithmeticOperation;
use SimplePHPEasyPlus\Operation\OperationStream;
use SimplePHPEasyPlus\Engine;
use SimplePHPEasyPlus\Calcul\Calcul;
use SimplePHPEasyPlus\Calcul\CalculRunner;
$numberCollection = new NumberCollection();
$numberParser = new SimpleNumberStringParser();
$firstParsedNumber = $numberParser->parse('1');
$firstNumber = new SimpleNumber($firstParsedNumber);
$firstNumberProxy = new CollectionItemNumberProxy($firstNumber);
$numberCollection->add($firstNumberProxy);
$secondParsedNumber = $numberParser->parse('1');
$secondNumber = new SimpleNumber($secondParsedNumber);
$secondNumberProxy = new CollectionItemNumberProxy($secondNumber);
$numberCollection->add($secondNumberProxy);
$addition = new AdditionOperator('SimplePHPEasyPlus\Number\SimpleNumber');
$operation = new ArithmeticOperation($addition);
$engine = new Engine($operation);
$calcul = new Calcul($engine, $numberCollection);
$runner = new CalculRunner();
$runner->run($calcul);
$result = $calcul->getResult();
$numericResult = $result->getValue(); // 2
This library is now available for production purposes. Enjoy!
[КО]Складывает 2 числа[/КО]
+121
Поздравляю, дамы и господа, крупнейшая электронная библиотека русских книг lib.rus.ec попала в России под запрет.
Искомый ip адрес внесен в реестр
Дата основания для внесения в реестр 05.11.2012
Номер основания для внесения в реестр 2/2/16482
Орган, принявший решение о внесении в реестр ФСКН
Дата внесения в реестр 11.11.2012
zapret-gov.ru
Fatal error: Cannot redeclare get_web_page() (previously declared in /home/u749066976/public_html/parser.php:7) in /home/u749066976/public_html/parser.php on line 35
+121
ignore(MainForm.g.Items.Add
(
if(! $['A'..'Z'].Concat($['а'..'я']).Concat($['А'..'Я']).Concat($['a'..'z']).Contains(tok[0])) $"#$code" else tok
));
+121
try {
repository.saveAll(entities);
} catch (final ConstraintViolationException e) {
throw new SettingsServiceException(ErrorFormatter.formatValidationErrors(
"Errors have been detected when saving", e));
} catch (final PersistenceException e) {
for (val t: Throwables.getCausalChain(e)) {
if (t instanceof EntityExistsException) {
val failedObject = (IEntity) ((ExceptionInfo) t).getFailedObject();
// failedObject is returned with the state in which it is in the database.
// Let's find the version that we tried to save, instead.
for (val entity: entities) {
if (entity.getId() != null && entity.getId().equals(failedObject.getId())) {
throw new SettingsServiceException("Attempted to save duplicate value: " + entity);
}
}
}
}
throw e;
}
Попытка вернуть пользователю человеко-читаемое сообщение о том, где, собственно, дубликат.
Костыли вы мои, костыли...
+121
(set 'b (read))
(eval b)
http://ideone.com/3ImB9
+121
(reverse (butlast ...))
Родное :)