- 1
select 7-(8-datepart(weekday,getDate())) % 7
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−108
select 7-(8-datepart(weekday,getDate())) % 7
Написал для конвертации дней недели начинающихся с SUNDAY=1, в привычные Пн-1, Вс-7
−92
var num = 100000;
function setArray(num){
var arr = new Array();
var i:Number = 0;
for (i=0;i<num;i++){
arr[i] = 'ytrjnjht pyfxtybt';
}
}// 422
function setArray2(num){
for (i=0;i<num;i++){
arr[i] = 'ytrjnjht pyfxtybt';
}
}//562
function setArray3(num){
for (var i=0;i<num;i++){
arr[i] = 'ytrjnjht pyfxtybt';
}
}//344
function setArray4(num){
var arr:Array = new Array();
var i:Number = 0;
for (i=0;i<num;i++){
arr.push('ytrjnjht pyfxtybt');
}
}//516
function setArray5(num){
var arr:Array = new Array();
for (var i=0;i<num;i++){
arr.push('ytrjnjht pyfxtybt');
}
}//531
function setArray6(num){
for (var i=0;i<num;i++){
arr.push('ytrjnjht pyfxtybt');
}
}//188
function setArray7(num){
arr = null;
for (var i=0;i<num;i++){
arr.push('ytrjnjht pyfxtybt');
}
}//141
Любопытный тест производительности.
−112
public class BaseEntity extends Entity
{
public function BaseEntity()
{
name = 'inctanse' + _ii++ + '-' + name ? name : '';
super();
}
...
}
лулзы продолжаются )
+147
<xsl:text disable-output-escaping="yes"><![CDATA[ ]]></xsl:text>
Такое ещё надо придумать
+168
$_SESSION['lang_code'] = isset($_GET['lang_code']) ? file_exists("languages/lang_".$_GET['lang_code'].".php") ? $_GET['lang_code'] : isset($_SESSION['lang_code']) ? $_SESSION['lang_code'] : 'ru' : 'ru';
+146
<a href="javascript:void(0);" onclick="suspend(8)">
<input type="checkbox" value="Suspend Listing" name="" id="id8">
</a>
ревьювил код нового джуниора, который пришёл к нам из достаточно крупной компании. Строилось через JS поэтому и запостил в JS
+147
Thread thread1 = new Thread();
Thread thread1 = new Thread();
thread1.start();
thread2.start();
while(thread1.isAlive() || thread2.isAlive()){}
+145
if c = 'y' then
begin
Writeln('Yes');
end else
if c = 'n' then
begin
Writeln('No');
end;
Вот это кака... http://delphisources.ru/forum/showthread.php?t=19000
+82
private static void createFile(File f) {
try {
f.createNewFile();
FileOutputStream fs = new FileOutputStream(f);
Long time = new Date().getTime();
int b = 0;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
b = (int) (time % 256);
fs.write(b);
time /= 256;
fs.flush();
fs.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Сохранение даты в файл :)
+122
@SuppressWarnings("unused")
// Sure it's used. By Guice. So stop complaining.
protected ColQueryProvider() {
try {
// Exhibit one: ye olde dependency hell.
// We *should* be able to just use new EclipseCompiler(), but GWT complains
// in dev mode when ECJ is in the Eclipse classpath. So it's not.
// ECJ is still loaded by the servlet container, so this is not an issue in deployment.
final JavaCompiler compiler = (JavaCompiler)
Class.forName("org.eclipse.jdt.internal.compiler.tool.EclipseCompiler").newInstance();
// Tweaked based on QueryEngine.DEFAULT
final DefaultEvaluatorFactory evaluatorFactory = new DefaultEvaluatorFactory(ColQueryTemplates.DEFAULT,
(URLClassLoader) DefaultEvaluatorFactory.class.getClassLoader(), compiler);
queryEngine = new DefaultQueryEngine(evaluatorFactory);
} catch (final ClassNotFoundException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
} catch (final InstantiationException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
} catch (final IllegalAccessException e) {
throw new ProvisionException("Eclipse compiler cannot be loaded", e);
}
}