- 1
rates = rates.Join(filter, _=> filterItem.ToString(_), _ => _.ToString(), (_, _2) => _).ToList();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
rates = rates.Join(filter, _=> filterItem.ToString(_), _ => _.ToString(), (_, _2) => _).ToList();
Не надо так.
+48
(selectedChessman ?: selected)->unselect();
да уж
+158
<?php if( !Yii::app()->user->checkAccess('Manager')){ ?><td class="text-center"><?php if($project->c1Projects->stat_id==23){
echo '|';
}elseif($project->c1Projects->stat_id==496){
echo '||';
}else{
echo '-';
}
?></td><?php } ?>
Вюха одного проекта
+162
taras@host ~/host/sites/default $ drush phpsh-console
php> var_dump(eval('array()'));
bool(false)
PHP Parse error: syntax error, unexpected end of file in /usr/local/lib/python2.7/dist-packages/phpsh/phpsh.php(591) : eval()'d code(1) : eval()'d code on line 1
О мой мозг...! А Python здесь причем?
−92
path = Rails.env == 'development' ? '/Users/Razumovskiy/RubymineProjects/repetitor-js/' : '/var/www/apps/repetitor2-front-end/'
+80
public class лаба22 {
int i;
лаба22(int k){
i=k;}
int [] a = new int [i];
void длина(){
System.out.println(a.length);
}
public static void main(String[] args) {
лаба22 s = new лаба22(5);
s.длина();
}
}
Студеньтики... тупоголовые как и их преподы
+133
HTTP referer (originally a misspelling of referrer) is an HTTP header field that identifies the address of the webpage
(i.e. the URI or IRI) that linked to the resource being requested.
Originally a misspelling of referrer...
+133
public string GenerateWinCode(String PrefixWinCode, String Name, String LastName, String NameCompany, bool IsCompany = false)
{
string _NormalWinCode = "";
if (!IsCompany)
_NormalWinCode = (PrefixWinCode + Name[0] + LastName[0]).ToUpper();
else
{
var i = 1;
try
{
while (String.IsNullOrWhiteSpace(NameCompany[i].ToString()))
{
i++;
}
_NormalWinCode = (PrefixWinCode + NameCompany[0] + NameCompany[i]).ToUpper();
}
catch (Exception)
{
_NormalWinCode = (PrefixWinCode + NameCompany[0] + NameCompany[0]).ToUpper();
}
}
if (PrefixWinCode == "IN")
throw new RuleException("ErrorWincode", Resources.Accounts.Account.WincodeInvalid);
try
{
using (var context = db)
{
var _WincodesSim =
(from q in context.UserPartners.Where(m => m.WinCode.ToUpper().StartsWith(_NormalWinCode))
where q.WinCode.Length > 4
select q.WinCode).ToList();
var _Sufix = _WincodesSim.Select(m => Convert.ToInt32(m.Substring(4))).Max();
return _NormalWinCode + (_Sufix + 1);
}
}
catch (InvalidOperationException)
{
return _NormalWinCode + 1;
}
}
Генерация уникальных ключей
+77
public static void main(String[] args) {
testIndiaLazy();
}
private static void testIndiaLazy() {
LazyInstantiator lazyInstantiator = new LazyInstantiator();
lazyInstantiator.getInstance();
lazyInstantiator.getInstance();
}
public static class LazyInstantiator {
private Object instance;
public Object getInstance() {
System.out.println("getInstance");
if (instance != null || create());
return instance;
}
private boolean create() {
System.out.println("create");
instance = new Object();
return true;
}
}
Out:
getInstance
create
getInstance
+137
#include <time.h>
int rrand(int start, int end)
{
int range=end-start+1;
int speed=1;
int base=0;
int rez=start;
if(range>200) speed=range/100;
while(range>=0)
{
srand(clock());
if(rand()%2) base=base+speed+1;
else base--;
rez=rez+base;
rez=(rez < start)? end-rez : rez;
rez=(rez > end)? (rez%end)+start : rez;
range=range-speed;
}
return rez;
}
случайные числа в определенном диапазоне...