- 1
- 2
- 3
- 4
<select size="1" name="sex" id="sex" class="width_50">
<option value="0">Female</option>
<option value="2">Male</option>
</select>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+135
<select size="1" name="sex" id="sex" class="width_50">
<option value="0">Female</option>
<option value="2">Male</option>
</select>
тонко.
+177
<?PHP
/*
*This Function Is programed By MR-O
*The first arabic Function for crypting
*/
function abo($variable){
$variable =str_replace("1",1 ^ 52 ,$variable);
$variable =str_replace("2",2 ^ 5 ,$variable);
$variable =str_replace("3",3 ^ 8 ,$variable);
$variable =str_replace("4",4 ^ 18 ,$variable);
$variable =str_replace("5",5 ^ 30 ,$variable);
$variable =str_replace("6",6 ^ 42 ,$variable);
$variable =str_replace("7",7 ^ 26 ,$variable);
$variable =str_replace("8",8 ^ 62 ,$variable);
$variable =str_replace("9",9 ^ 1 ,$variable);
$variable =str_replace("0",0 ^ 3 ,$variable);
$variable =str_replace("a","m8" ,$variable);
$variable =str_replace("b","2s" ,$variable);
$variable =str_replace("c","9e" ,$variable);
$variable =str_replace("d","6s" ,$variable);
$variable =str_replace("e","a3" ,$variable);
$variable =str_replace("f","m3" ,$variable);
$variable =str_replace("g","6f" ,$variable);
$variable =str_replace("h","9c" ,$variable);
$variable =str_replace("i","85" ,$variable);
$variable =str_replace("j","32" ,$variable);
$variable =str_replace("k","1a" ,$variable);
$variable =str_replace("l","6e" ,$variable);
$variable =str_replace("m","5f" ,$variable);
$variable =str_replace("n","9r" ,$variable);
$variable =str_replace("o","z0" ,$variable);
$variable =str_replace("p","y6" ,$variable);
$variable =str_replace("q","9i" ,$variable);
$variable =str_replace("r","y9" ,$variable);
$variable =str_replace("s","5g" ,$variable);
$variable =str_replace("t","p3" ,$variable);
$variable =str_replace("u","d5" ,$variable);
$variable =str_replace("v","t8" ,$variable);
$variable =str_replace("w","2x" ,$variable);
$variable =str_replace("x","6w" ,$variable);
$variable =str_replace("y","v9" ,$variable);
$variable =str_replace("z","zv" ,$variable);
$variable =str_replace("A","m8" ,$variable);
$variable =str_replace("B","24d" ,$variable);
$variable =str_replace("C","9e" ,$variable);
$variable =str_replace("D","6s2" ,$variable);
$variable =str_replace("E","qw" ,$variable);
$variable =str_replace("F","oe" ,$variable);
$variable =str_replace("G","0t" ,$variable);
$variable =str_replace("H","o9" ,$variable);
$variable =str_replace("I","74" ,$variable);
$variable =str_replace("J","dd" ,$variable);
$variable =str_replace("K","2b" ,$variable);
$variable =str_replace("L","rt" ,$variable);
$variable =str_replace("M","0c" ,$variable);
$variable =str_replace("N","2w" ,$variable);
$variable =str_replace("O","te" ,$variable);
$variable =str_replace("P","sc" ,$variable);
$variable =str_replace("Q","uy" ,$variable);
$variable =str_replace("R","hp" ,$variable);
$variable =str_replace("S","h1" ,$variable);
$variable =str_replace("T","s5" ,$variable);
$variable =str_replace("U","fs" ,$variable);
$variable =str_replace("V","e1s" ,$variable);
$variable =str_replace("W","1y" ,$variable);
$variable =str_replace("X","dv" ,$variable);
$variable =str_replace("Y","w2" ,$variable);
$variable =str_replace("Z","w5" ,$variable);
$variable = str_replace('1','5b',$variable);
$variable = str_replace('2','b1',$variable);
$variable = str_replace('3','0j',$variable);
$variable = str_replace('4','1e',$variable);
$variable = str_replace('5','z2',$variable);
$variable = str_replace('6','15e',$variable);
$variable = str_replace('7','d2',$variable);
$variable = str_replace('8','e5b',$variable);
$variable = str_replace('9','y8',$variable);
$variable = str_replace('0','g1y7',$variable);
echo $variable ;
}
?>
Это простая функция на str_replace для шифрования пароля и прочих вещей. http://www.php.net/manual/en/function.str-replace.php#104596
+130
Ахтунг!
что за потоп на уютненьком говнокодике?
кто-то всеми виртуалами топит все говнокоды.
извиняюсь, что топик не с кодом, но, наверное, событие масштабное.
просьба высказаться.
+162
javascript:(function () {
var nodes = document.querySelectorAll( 'span.hidden-text' );
for ( var i = 0; i < nodes.length; i++ ) {
/* Opera suck at this
nodes[i].classList.remove( 'entry-comment-hidden' );
*/
var classList = nodes[i].parentNode.className.split( /\s+/ );
var index = classList.indexOf( 'entry-comment-hidden' );
if ( index != -1 ) {
classList.splice( index, 1 );
}
else {
classList.push( 'entry-comment-hidden' );
}
nodes[i].parentNode.className = classList.join( ' ' );
}
})()
Посвящается анону-полуёбку, который нашёл хаккирский скрипт.
Олежка?
+955
static string foo()
{
int i = 0;
//code
return "some string "+ i++;
}
+129
public void ReadFromFile()
{
LoadIntervals = new TimeIntervals(Color.Black);
StreamReader tReader = null;
tReader = File.OpenText("DefaultIntervals");
string income = null;
while ((income = tReader.ReadLine()) != null)
{
// string income = tReader.ReadLine();
string colorR = null; string colorG = null; string colorB = null; string colorA = null; string interval = null;
int i = 0;
for (i = 4; i < income.Length; i++)
{
if (income[i] != ',')
{
interval += income[i];
}
else { break; }
}
for (int a = i + 10; a < income.Length; a++)
{
if (income[a] != ',')
{
colorA += income[a];
}
else
{
for (int r = a + 4; r < income.Length; r++)
{
if (income[r] != ',')
{
colorR += income[r];
}
else
{
for (int g = r + 4; g < income.Length; g++)
if (income[g] != ',')
{
colorG += income[g];
}
else
{
for (int b = g + 4; b < income.Length; b++)
if (income[b] != ',')
{
if (income[b] != ']')
colorB += income[b];
}
else
{
break;
}
break;
}
break;
}
}
break;
}
}
TimePoint tp = new TimePoint(Convert.ToDouble(interval), Color.FromArgb(Convert.ToInt32(colorA), Color.FromArgb(Convert.ToInt32(colorR), Convert.ToInt32(colorG), Convert.ToInt32(colorB))));
LoadIntervals.Add(tp);
}
tReader.Close();
Intervals = LoadIntervals;
}
Так мы парсим файл конфигов вида. (Формат придуман автором кода)
Int=3,Color [A=223, R=253, G=4, B=38]
Int=10,Color [A=255, R=86, G=86, B=185]
Int=20,Color [A=200, R=255, G=215, B=0]
Int=50,Color [A=200, R=255, G=165, B=0]
−357
chislo :: String -> Bool
chislo []=True
chislo (x:xs) =if (x=='1') then chislo xs
else if (x=='2') then chislo xs
else if (x=='3') then chislo xs
else if (x=='4') then chislo xs
else if (x=='5') then chislo xs
else if (x=='6') then chislo xs
else if (x=='7') then chislo xs
else if (x=='8') then chislo xs
else if (x=='9') then chislo xs
else if (x=='0') then chislo xs
else if (x=='.') then chislo xs
else False
haskell
+164
$data_array = file('./dir/file.txt'); //Прочитали файл в массив
$count = count($data_array); //Подсчитали количество элементов массива
$chislo = rand(0,$count-1); //Так как элементы массива имеют ключи с 0 до $count-1
echo $data_array[$chislo]; //Вот вам и произвольная строка из файла
Основная говнистость в том, что это статья, т.е. человек этому учит других, ни в чём не повинных людей.
+141
char *nvram_get(int index, char *name)
{
/* Initial value should be NULL */
char *recv = NULL;
//LIBNV_PRINT("--> nvram_get\n");
nvram_init(index);
recv = nvram_bufget(index, name);
//btw, we don't return NULL anymore!
if (!recv)
recv = "";
//Always need close nvram
nvram_close(index);
return recv;
}
char *nvram_bufget(int index, char *name)
{
int idx;
/* Initial value should be NULL */
static char *ret = NULL;
//LIBNV_PRINT("--> nvram_bufget %d\n", index);
LIBNV_CHECK_INDEX("");
LIBNV_CHECK_VALID();
idx = cache_idx(index, name);
if (-1 != idx) {
if (fb[index].cache[idx].value) {
//duplicate the value in case caller modify it
//Tom.Hung 2010-5-7, strdup() will cause memory leakage
//but if we return value directly, it will cause many other crash or delete value to nvram error.
ret = strdup(fb[index].cache[idx].value);
LIBNV_PRINT("bufget %d '%s'->'%s'\n", index, name, ret);
//btw, we don't return NULL anymore!
if (!ret)
ret = "";
return ret;
}
}
//no default value set?
//btw, we don't return NULL anymore!
LIBNV_PRINT("bufget %d '%s'->''(empty) Warning!\n", index, name);
return "";
}
Кусочек кода из библиотеки работы с nvram для железок на SoC Ralink. Китайцы плакали, кололись о утечки памяти, но продолжали настойчиво мешать указатели на статические строки с указателями на динамически выделенные в куче...
+118
static double SingleToDouble(Single v)
{
return double.Parse(v.ToString());
}
static void Scan()
{
double q = 0.0;
while (q <= 10.0)
{
Single s = (Single)q;
Double d = SingleToDouble(s);
if (d == q)
MessageBox.Show(q.ToString());
q = q + 0.1;
}
}
народ, кто-нибудь знает чем можно заменить код "return double.Parse(v.ToString());" в SingleToDouble?
"return v;" не подходит - на экран выводятся только 0, 0.5 и 4.5. А нужно чтобы все выводились 0, 0.1, 0.2 ... 0.9.