- 1
- 2
- 3
- 4
- 5
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+139
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const /* note: need a more gentle solution here */
# endif
#endif
Совместимость
+157
$('.file_work .left .content a.create').bind('click', function(){
show.in_question(strings.question[2], {
0:strings.question[2].buttons[0],
1:strings.question[2].buttons[1]
}, function(action, string){
if(action !='ok'){
return;
}
if(string.length<4){
show.error(strings.error[7], '');
return;
}
CreateTag(cache.current, string);
});
});
+58
int (o)(0);
http://ideone.com/9JL6K4
+50
#include <iostream>
void koko() { return throw "kook"; }
int main() try {
koko();
} catch(const char * e) {
std::cout << e;
}
когда никто не видит, throw возвращает void
http://ideone.com/VDMPwE
+155
express_static = express.static(static_files.file_path)
app.use('/files', (req, res, next) ->
if Math.random() > app.failureProbability
express_static.handle(req, res, next)
else
# server failure or timeout
if Math.random() < 0.5
console.log('\x1B[31mRandom failure\x1B[0m')
res.send(500, 'Fuck you')
else
console.log('\x1B[31mRandom timeout\x1B[0m')
)
а вот так мы тестируем сетевую нагрузку (нода, кофе)
+159
anim.object.strokeWidthEnd = _.distance((end.replace(/(#[0-9a-f]{6})|(#[0-9a-f]{3})|(rgba?\((\d{1,3})\,\s*(\d{1,3})\,\s*(\d{1,3})(\,\s*([0-9\.]{1,4}))?\))|(rgba?\((\d{1,3})\%?\,\s*(\d{1,3})\%?\,\s*(\d{1,3})\%?(\,\s*([0-9\.]{1,4}))?\))/, '').match(/(\d+|(\d+)?\.\d+)(em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|px|pt|pc)?/) || [])[0]);
if(end.indexOf('transparent') > -1)
anim.object.strokeColorEnd = [anim.object.strokeColor[0], anim.object.strokeColor[1], anim.object.strokeColor[2], 0];
else
anim.object.strokeColorEnd = _.color((end.match(/(#[0-9a-f]{6})|(#[0-9a-f]{3})|(rgba?\((\d{1,3})\,\s*(\d{1,3})\,\s*(\d{1,3})(\,\s*([0-9\.]{1,4}))?\))|(rgba?\((\d{1,3})\%?\,\s*(\d{1,3})\%?\,\s*(\d{1,3})\%?(\,\s*([0-9\.]{1,4}))?\))/) || end.match(new RegExp(Object.keys(_.colors).join('|'))) || [])[0]);
одна-проблема-и-регулярка.jpg
+78
public static void create(String title, int width, int height) {
if (isWindowCreated())
throw new RuntimeException("Window created.");
if (title == null)
throw new NullPointerException("Window title == null.");
if (width <= 0 || height <= 0)
throw new IllegalArgumentException("Window size <= 0.");
if ((window = GLFW.glfwCreateWindow(width, height, title, MemoryUtil.NULL, MemoryUtil.NULL)) == MemoryUtil.NULL)
throw new RuntimeException("Failed to create the GLFW window.");
}
+132
var resultList = new List<CentralBankRateData>();
using (var resultSet = m_Service.GetCursOnDate(request.Date))
using (var reader = new DataTableReader(resultSet.Tables["ValuteCursOnDate"]))
while (reader.Read())
resultList.Add(new CentralBankRateData
{
Name = (string) reader["Vname"],
Nominal = (decimal) reader["Vnom"],
Rate = (decimal) reader["Vcurs"],
NumberCode = (int) reader["Vcode"],
StringCode = (string) reader["VchCode"]
});
Какой Центробанк, такая и валюта. m_Service типа DailyInfoSoap, это сервис отдачи курсов валют. А еще у них получение актуального списка БИКов возможно только в древнейшем формате dBASE.
−107
****@****:~$ python
>>> import this
The Zen of Python, by Tim Peters
<....>There should be one-- and preferably only one --obvious way to do it.<...>
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
preferably only one
+129
CN-1489: Commit tests to isolate the bug (sadly, they pass)