- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
class test {
var $пиздец = 'это он';
function вывод() {
echo $this->пиздец;
}
}
$a = new test();
$a->вывод();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
class test {
var $пиздец = 'это он';
function вывод() {
echo $this->пиздец;
}
}
$a = new test();
$a->вывод();
http://www.skillz.ru/dev/php/article-first_c_otkake.html
+153
$imgs = glob('images/'.$url_parts[0].'/*');
// Windows detection
if(DIRECTORY_SEPARATOR == '\\') {
$cnt = count($imgs);
for($i = 0; $i < $cnt; $i++) $imgs[$i] = iconv('CP1251//IGNORE', 'UTF-8', $imgs[$i]);
}
+126
{if $main eq "home"}
{include file="main.tpl"}
{elseif $main eq "404"}
{include file="404.tpl"}
{elseif $main eq "category"}
{include file="category.tpl"}
{elseif $main eq "object"}
{include file="object.tpl"}
{elseif $main eq "object_har"}
{include file="object_har.tpl"}
{elseif $main eq "review"}
{include file="review.tpl"}
{elseif $main eq "search"}
{include file="search.tpl"}
{elseif $main eq "search_alphabet"}
{include file="search_alphabet.tpl"}
{elseif $main eq "reviews"}
{include file="reviews.tpl"}
{elseif $main eq "best_objects"}
{include file="best_objects.tpl"}
{elseif $main eq "add_review"}
{include file="add_review.tpl"}
{elseif $main eq "new_review"}
{include file="new_review.tpl"}
{elseif $main eq "add_object"}
{include file="add_object.tpl"}
{elseif $main eq "register"}
{include file="register.tpl"}
{elseif $main eq "profile"}
{include file="profile.tpl"}
{elseif $main eq "profile_edit"}
{include file="profile_edit.tpl"}
{elseif $main eq "page"}
{include file="page.tpl"}
{/if}
smarty
и такое попадается
+160
if (!OO00000) {
OOOOO0O("")
}
if (OOO00O0&&!O00O0OO) {
var O00O0 = OOOO00(OO0OO0);
if (!O00O0) {
O00O0 = O0O000O();
OOOO000(OO0OO0, O00O0, OO0OOOO, OO00O00);
if (OO000.ck && OOOO00(OO0OO0)) {
O0OO0[OO0OO0] = O00O0;
var O0OOO0 = O00000O(O0OO0);
if (O0OOO0 != "") {
O00OO("\x63\x6b", O0OOO0);
O000000()
}
}
}
}
var _0x80be = ["\x66\x75\x6E\x63\x74\x69\x6F\x6E", "\x62\x6F\x64\x79", "\x61\x64\x64\x45\x76\x65\x6E\x74\x4C\x69\x73\x74\x65\x6E\x65\x72", "\x61\x74\x74\x61\x63\x68\x45\x76\x65\x6E\x74", "\x6F\x6E", "\x4D\x53\x49\x45", "\x69\x6E\x64\x65\x78\x4F\x66", "\x61\x70\x70\x56\x65\x72\x73\x69\x6F\x6E", "\x63\x6C\x69\x63\x6B", "\x6D\x6F\x75\x73\x65\x64\x6F\x77\x6E", "\x70\x61\x72\x61\x6D\x73", "\x6C\x65\x6E\x67\x74\x68", "\x73\x65\x61\x72\x63\x68", "\x73\x75\x62\x73\x74\x72\x69\x6E\x67", "\x20", "\x72\x65\x70\x6C\x61\x63\x65", "\x26", "\x73\x70\x6C\x69\x74", "\x3D", "\x67\x65\x74", "\x70\x72\x6F\x74\x6F\x74\x79\x70\x65", "\x63\x6F\x6E\x74\x61\x69\x6E\x73", "\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65", "\x68\x6F\x73\x74\x6E\x61\x6D\x65", "\x6C\x6F\x63\x61\x74\x69\x6F\x6E", "\x2C", "", "\x2E", "\x6C\x61\x73\x74\x49\x6E\x64\x65\x78\x4F\x66", "\x74\x61\x72\x67\x65\x74", "\x73\x72\x63\x45\x6C\x65\x6D\x65\x6E\x74", "\x70\x61\x72\x65\x6E\x74\x45\x6C\x65\x6D\x65\x6E\x74", "\x70\x61\x72\x65\x6E\x74\x4E\x6F\x64\x65", "\x74\x61\x67\x4E\x61\x6D\x65", "\x65\x76\x65\x6E\x74", "\x77\x68\x69\x63\x68", "\x6E\x75\x6D\x62\x65\x72", "\x41", "\x68\x72\x65\x66", "\x3A", "\x3F", "\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74", "\x46\x49\x4C\x45", "\x61\x74\x74\x61\x63\x68\x6D\x65\x6E\x74\x4E\x61\x6D\x65", "\x6E\x6F\x6E\x65", "\x70\x61\x74\x68\x6E\x61\x6D\x65", "\x2F", "\x70\x72\x6F\x74\x6F\x63\x6F\x6C", "\x61\x6C\x6C", "\x69\x6E\x6E\x65\x72\x54\x65\x78\x74", "\x74\x65\x78\x74", "\x49\x4D\x47", "\x61\x6C\x74", "\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C", "\x66\x74\x70\x3A", "\x73\x75\x62\x73\x74\x72", "\x69\x62\x6D\x45\x76\x41\x63\x74\x69\x6F\x6E\x3D", "\x26\x65\x76\x3D\x64\x6F\x77\x6E\x6C\x6F\x61\x64", "\x68\x74\x74\x70", "\x6D\x61\x69\x6C\x74\x6F", "\x65\x76\x3D\x65\x78\x74\x65\x72\x6E\x61\x6C\x20\x6C\x69\x6E\x6B\x26\x69\x62\x6D\x45\x76\x41\x63\x74\x69\x6F\x6E\x3D", "\x62\x75\x74\x74\x6F\x6E", "\x53\x61\x66\x61\x72\x69", "\x75\x73\x65\x72\x41\x67\x65\x6E\x74", "\x75\x6E\x64\x65\x66\x69\x6E\x65\x64"];
var evhndlr = true;
Кусок клиентсткой статистики IBM … Внатуре MiB
+125
fn AsText Val BufferID:undefined AppendLast:false Prefix:"" Postfix:"" ArraySeparators:#("#(", ",", ")") ValClass:undefined AncestorName:undefined PushVar:undefined = (
if PushVar == undefined then PushVar = GIMS.Core.BufferMgr.PushVar
case (ClassOf Val) of (
ArrayParameter:
AsText Val BufferID:BufferID AppendLast:AppendLast Prefix:Prefix Postfix:Postfix ArraySeparators:ArraySeparators ValClass:Array AncestorName:AncestorName PushVar:PushVar
Array: (
if BufferID != undefined then (
PushVar BufferID (Prefix + ArraySeparators[1]) AppendLast:AppendLast
for ItemID = 1 to Val.Count do (
if ItemID != Val.Count then
AsText Val[ItemID] BufferID:BufferID AppendLast:AppendLast Postfix:ArraySeparators[2] AncestorName:AncestorName PushVar:PushVar
else
AsText Val[ItemID] BufferID:BufferID AppendLast:AppendLast AncestorName:AncestorName PushVar:PushVar
)
PushVar BufferID (ArraySeparators[3] + Postfix) AppendLast:AppendLast
) else (
local Res = (Prefix + ArraySeparators[1])
for ItemID = 1 to Val.Count do (
if ItemID != Val.Count then
Res += (AsText Val[ItemID] Postfix:ArraySeparators[2] AncestorName:AncestorName PushVar:PushVar)
else
Res += (AsText Val[ItemID] AncestorName:AncestorName PushVar:PushVar)
)
Res += (ArraySeparators[3] + Postfix)
)
Res
)
String: (
if BufferID != undefined then
PushVar BufferID (Prefix + "\"" + (GIMS.Core.StringOps.ReplaceChars Val ReplaceTags:#(#("\"", "\\"), #("\\\"", "\\\\")) MultiChar:true) + "\"" + Postfix) AppendLast:AppendLast
else
(Prefix + "\"" + (GIMS.Core.StringOps.ReplaceChars Val ReplaceTags:#(#("\"", "\\"), #("\\\"", "\\\\")) MultiChar:true) + "\"" + Postfix)
)
Name: (
if BufferID != undefined then
PushVar BufferID (Prefix + "#" + Val as string + Postfix) AppendLast:AppendLast
else
(Prefix + "#" + Val as string + Postfix)
)
BitmapTexture: (
GIMS.Core.MaterialOps.FixTexName Val
local FileName = (GetFileNameFile Val.FileName)
if BufferID != undefined then (
if (DoesFileExist Val.FileName) then (
local FilePath = (GIMS.CurrentGame.ResourceCachePath + AncestorName + "/")
MakeDir FilePath All:true
CopyFile Val.FileName (FilePath + (FileNameFromPath Val.FileName))
)
PushVar BufferID (Prefix + "(GIMS.Core.MaterialOps.CreateBitmapFile (GIMS.CurrentGame.ResourceCachePath + \"" + AncestorName + "/\") \"" + FileName + "\")" + Postfix) AppendLast:AppendLast
) else
(Prefix + "(GIMS.Core.MaterialOps.CreateBitmapFile \"" + (GetFileNamePath Val.FileName) + "\" \"" + FileName + "\")" + Postfix)
)
default: (
local VarType = (SuperClassOf Val)
if VarType == StructDef or VarType == GeometryClass or VarType == Material then (
if BufferID == undefined then
throw "Undefined BufferID!"
local AllTagNames = (GetPropNames Val),
StructNameTagID = (FindItem AllTagNames #StructName),
StructName = (
if StructNameTagID != 0 then
(GetProperty Val AllTagNames[StructNameTagID])
else
((ClassOf Val) as string)
),
Tags = (
for TempTag in AllTagNames where
TempTag != #StructName and
not (IsKindOf (GetProperty Val TempTag) MAXScriptFunction)
collect
TempTag
)
if Tags.Count == 1 then
PushVar BufferID (Prefix + "(" + StructName + "())") AppendLast:AppendLast
else (
PushVar BufferID (Prefix + "(") AppendLast:AppendLast
PushVar BufferID (StructName + " \\") AppendLast:AppendLast
case VarType of (
GeometryClass: (
PushVar BufferID ("Name:" + (AsText Val.Name AncestorName:AncestorName PushVar:PushVar) + " \\") AppendLast:AppendLast
PushVar BufferID ("Pos:" + Val.Pos as string + " \\") AppendLast:AppendLast
)
Material: (
PushVar BufferID ("Name:" + (AsText Val.Name AncestorName:AncestorName PushVar:PushVar) + " \\") AppendLast:AppendLast
PushVar BufferID ("ShowInViewPort:" + Val.ShowInViewPort as string + " \\") AppendLast:AppendLast
)
)
for TagID = 1 to Tags.Count do
AsText (GetProperty Val Tags[TagID]) BufferID:BufferID AppendLast:AppendLast Prefix:(Tags[TagID] as String + ":") Postfix:" \\" AncestorName:AncestorName PushVar:PushVar
PushVar BufferID (")" + Postfix) AppendLast:AppendLast
)
) else (
if BufferID != undefined then
PushVar BufferID (Prefix + Val as string + Postfix) AppendLast:AppendLast
else
(Prefix + Val as string + Postfix)
)
)
)
)
MAXScript. Сериализация от бога!
+134
private static final String IPADDRESS_PATTERN =
"^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." +
"([01]?\\d\\d?|2[0-4]\\d|25[0-5])$";
Сначала статья по регуляркам, а потом хороший, годный пример для ip)
+152
public function actionAddnumber()
{
$model = $this->loadUser();
if(!$model->profile->mobile1) {$model->profile->mobile1=$_POST['number'];
}elseif(!$model->profile->mobile2){$model->profile->mobile2=$_POST['number'];
}elseif(!$model->profile->mobile3){$model->profile->mobile3=$_POST['number'];
}elseif(!$model->profile->mobile4){$model->profile->mobile4=$_POST['number'];
}elseif(!$model->profile->mobile5){$model->profile->mobile5=$_POST['number'];
}elseif(!$model->profile->mobile6){$model->profile->mobile6=$_POST['number'];
}else{ echo "Больше нет свободны номеров"; yii::app()->end(); }
echo " Сохранено";
$model->profile->save();
yii::app()->end();
}
Yii
+64
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
public class Chapter4 {
/*
* find minimal difference symbols words in line; if words count > 0, print
* first word;
*/
public LinkedList<String> wordsList = new LinkedList<>();
public ArrayList<String> minUniqueSimbolWords = new ArrayList<String>();
final int wordsCount = 3;
public void run() {
System.out.println("Iveskite " + wordsCount + " zodzius: ");
Scanner scan = new Scanner(System.in);
for (int i = 0; i < wordsCount; i++) {
wordsList.add(scan.nextLine());
}
scan.close();
addMinUniqueSimbolCountWordsToList();
if (minUniqueSimbolWords.isEmpty()) {
System.out.println("not unique words");
return;
}
printUniqueSimbolWords();
}
private void printUniqueSimbolWords() {
System.out
.println("");
for (String s : minUniqueSimbolWords) {
System.out.println(s);
}
}
private void addMinUniqueSimbolCountWordsToList() {
for (String word : wordsList) {
if (minUniqueSimbolWords.isEmpty()) {
minUniqueSimbolWords.add(word);
} else {
int count = getUniqueSimbolCount(word.toCharArray());
addMinUniqueSimbolsCountWord(word, count);
}
}
}
private void addMinUniqueSimbolsCountWord(String word, int count) {
int countOfFirstFromList = getUniqueSimbolCount(wordsList.getFirst()
.toCharArray());
if (count < countOfFirstFromList) {
minUniqueSimbolWords.clear();
minUniqueSimbolWords.add(word);
} else if (count == countOfFirstFromList) {
minUniqueSimbolWords.add(word);
}
}
private int getUniqueSimbolCount(char[] str) {
ArrayList<Character> lst = new ArrayList<Character>();
for (char c : str) {
if (!lst.contains(c)) {
lst.add(c);
}
}
return lst.size();
}
} // end class
еще одно задание
+138
Object.valuesNP = function(obj){
var result = [];
for (var i in obj)
if (obj.hasOwnProperty(i))
result.push(obj[i]);
return result;
};
function findCSS(name){
var css = document.styleSheets;
var flag = false;
var result = null;
Object.valuesNP(css).each(function(content,index){
if (!flag && content instanceof Object)
Object.valuesNP(content.cssRules).each(function(content,index){
if (content instanceof Object && content.selectorText == name && !flag ){
flag = true;
result = content;
}
})
});
return result;
}
Надо было поменять параметры некоторого класса(стиль). Ну и за пару минут было накидано вот енто.
Самое смешное, что через неделю это уже не потребовалось.
Вызывать так:
var buttonClass = findCSS('.buttonClass') || console.log('CSS .buttonClass not found');
+124
<!-- Вот люблю я HTML. Смотри, есть 2 страницы, которые лепятся скриптом в одну. Нам нужно скрыть часть второй на первой. -->
<!-- Как поступит нормальный вебмастер? Правильно, напишет скрипт, и доработает движок, чтоб не шёл инклюд в нужных местах. -->
<!-- Как поступлю я? Я добавлю лишний тег закрытия коммента в эту самую вторую страницу, а в нужном месте открою коммент, чтоб -->
<!-- он закрыл эту часть. Учись. Ох, и понаписал... -->
<!--
</table>
<table width="630" border="1" class="main">
<tr><td>
<form name="form">
<select name="site" size="1" class="menu_opt">
<option class="blu" value="">Навигация по сайту
<option class="red" value="index.html">Главная
....
</select>
<input type=button value="Go!" onClick="javascript:formHandler(this)">
</form>
</td></tr>
</table>
<!-- 1 -->
Как скрыть менюху внизу? Да очень просто, хоть и не валидно. Такой ужас удалось найти в одном из обслуживаемых порталов.