- 1
- 2
- 3
- 4
http://www.ubuntu.com/download/desktop
1. Открыть страницу в Firefox/Google-Chrome.
2. Сверху над кнопкой "Download" сменить с 32 бит на 64 бит.
3. Посмотреть внимательно на URL, откуда будет загружатся имидж.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
http://www.ubuntu.com/download/desktop
1. Открыть страницу в Firefox/Google-Chrome.
2. Сверху над кнопкой "Download" сменить с 32 бит на 64 бит.
3. Посмотреть внимательно на URL, откуда будет загружатся имидж.
Код, который это делает трудно понять без контекста.
+118
filename_size = strlen(dest_dir) + strlen(basename) + 6;
ctx.mtl_file = (char *) malloc(filename_size);
ctx.obj_file = (char *) malloc(filename_size);
sprintf(ctx.mtl_file, "%s/%s.mtl", dest_dir, basename);
Долго соображали, почему вылезает сегфолт во free...
+103
digits n = reverse $ map (`mod` 10) (takeWhile (/= 0) (iterate (`div` 10) n))
fromDigits l = sum $ zipWith (*) (reverse l) (map (10^) [0..])
isPalindromic x = digits x == (reverse $ digits x)
f :: Integer -> [[Integer]] -> [Integer] -> Int -> [[Integer]]
f x founded lookedup niter
| niter > 50 = [notlychers, [x] ++ lychers ++ lookedup, zs]
| nextX `elem` notlychers = [[x] ++ notlychers ++ lookedup, lychers, zs]
| nextX `elem` lychers = [notlychers, [x] ++ lychers ++ lookedup, zs]
| isPalindromic nextX = [[x] ++ notlychers ++ lookedup, lychers, zs]
| otherwise = f nextX founded (x : lookedup) (niter+1)
where nextX = x + fromDigits (reverse $ digits x)
notlychers = founded !! 0
lychers = founded !! 1
zs = founded !! 2
g :: [[Integer]] -> [[Integer]]
g founded = f (x-1) [xs, ys, [x-1]] [] 0
where x = zs !! 0
xs = founded !! 0
ys = founded !! 1
zs = founded !! 2
gg n = g [[],[],[n+1]]
isLycher n = null $ (gg n) !! 0
http://projecteuler.net/problem=55
http://projecteuler.net/thread=55
>i even haven't understood why it works :(
+1002
template<class _CharType>
bool check_arith(const _CharType* str)
{
for(; *str ; ++str)
for(unsigned long long j = 0x6165696F7579ull; j; j >>= 8)
if(((j & 0xFF) | 0x20) == (*str | 0x20))
return true;
return false;
}
Функция, которая проверяет, есть ли в слове гласные буквы латинского алфавита с учетом регистра.
+961
private class LinkedAction
{
public Action<Action<bool>> Action { get; set; }
public LinkedAction Next { get; set; }
public void Execute()
{
Action(s =>
{
if (s && Next != null) Next.Execute();
});
}
}
private static LinkedAction NewLinkedAction(LinkedAction link, Action<Action<bool>> action)
{
return new LinkedAction
{
Action = action,
Next = link
};
}
var action = GetCopytoTestActions(parameter)
.Reverse()
.Aggregate<Action<Action<bool>>, LinkedAction>(null, NewLinkedAction);
action.Execute();
+1006
class Worker
{
private:
char name[15];
double salary;
...
public:
Worker(char* n, double s)
{
...
if (s < 0)
salary = verSal(s);
else
salary = s;
...
}
char* getName()
{
char* t = new char[15];
strcpy(t, name);
return t;
}
private:
double verSal(double s)
{
do
{
cout << "Ошибка при вводе зарплаты. Введите зарплату: ";
cin >> s;
}
while (s < 0);
return s;
}
}
Вот ещё один пример из конспекта (это уже от другого преподавателя). Он, заявил, что в getName() о t "позаботится сборщик мусора". Просто он Java тоже читает...
−116
/*
Часть библиотеки MathUtilsLib (c) Sergey ( FlexMaster ), 2008
*/
function shuffle( a:Array ):void{
if( a ){
a.map( function ( val:*, index:int, o:Array ){ o[index] = {v:val, r:int( 1000*Math.random())} }, a );
a.sortOn( 'r');
a.map( function ( val:*, index:int, o:Array ){ o[index] = val['v']} );
}
}
К сожалению, в Actionscript нет функции, которая позволила бы получить случайным образом перестановку массива. Иногда это бывает очень нужно.
функция shuffle перемешивает содержимое исходного массива случайным образом.
−102
/ _jquery.haml
- unless Rails.env.development?
/ Require jQuery
= javascript_include_tag 'http://yandex.st/jquery/1.7.1/jquery.min.js'
/ Require Google's jQuery if Yandex is down
:javascript
window.jQuery || document.write('<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js">\x3C/script>')
/ Require local jQuery if Google is down / is development env
:javascript
window.jQuery || document.write('<script src="#{asset_path('jquery.js')}">\x3C/script>')
Отсюда: https://gist.github.com/1543189
−119
public function checkDrop (pos: Array): Array
{
checkItem ();
var res: Array = [];
var item: Array
var mc: MovieClip
for (var i: int = 0; i < pos.length; i++)
{
item = pos[i];
if (itemList[item[0]])mc = itemList[item[0]][item[1]] as MovieClip;
if (mc)
{
if (mc.blcd != 0 && ((item[2] == 2 && mc.blcd == 2) || (item[2] == 1 && mc.blcd == 2) || (item[2] == 2 && mc.blcd == 1))) res[i] = 1;
}
}
return res;
}
Проверка проходимости сетки. И, да, эти мувики не в дисплейлисте, они просто хранят информацию.
+132
System.Console.WriteLine(System.String.Concat(System.Security.Cryptography.MD5.Create().ComputeHash(System.Text.Encoding.UTF8.GetBytes("hello world!")).ToList().ConvertAll(b => b.ToString("x2"))));
страшно?