- 1
- 2
- 3
- 4
- 5
- 6
while($r=mysql_fetch_array($q)){
$buf[$r['id']]['image_file']=$r['file'];
$r=null;
$r['id']=null;
}
return $buf;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+4
while($r=mysql_fetch_array($q)){
$buf[$r['id']]['image_file']=$r['file'];
$r=null;
$r['id']=null;
}
return $buf;
+3
class TM
{
function TM()
{
$this->startBuffering();
register_shutdown_function(array($this, 'endBuffering'));
}
public function startBuffering()
{
ob_start();
}
public function endBuffering()
{
if(ob_get_level() > 1)
{
$data = ob_get_contents();
ob_end_clean();
$this->insertBufferedContent($data);
echo $data;
}
}
function insertBufferedContent(&$data)
{
if(!empty($this->buffered))
{
foreach($this->buffered as $contentID => $contentData)
{
$search[] = ' <!--'.$contentID.'--> ';
}
$data = str_replace($search, $this->buffered, $data);
}
}
function showBuffered($contentID)
{
if(ob_get_level() > 1)
{
echo '<!--'.$contentID.'-->';
}
}
function setBuffered($contentID, $data)
{
$this->buffered[$contentID] = $data;
}
}
$tm = new TM();
даже комментировать не хочется
Взято отсюда:
http://blog.kpitv.net/article/how-to-set-title/
Автор:
http://govnokod.ru/user/13961
+1
string tempFolder = DateTime.Now.Year.ToString("0000")
+ DateTime.Now.Month.ToString("00")
+ DateTime.Now.Day.ToString("00")
+ "-" + DateTime.Now.Hour.ToString("00")
+ DateTime.Now.Minute.ToString("00")
+ DateTime.Now.Second.ToString("00");
+5
private string GetMinutes()
{
string minute = (DateTime.Now.Minute < 10) ? "0" + DateTime.Now.Minute.ToString() : DateTime.Now.Minute.ToString();
return minute;
}
private string LogPath(string minute)
{
string logPath = Param.directory + @"\log(" + DateTime.Now.ToShortDateString() + " "
+ DateTime.Now.Hour.ToString() + "." + minute + ").txt";
return logPath;
}
string minute = GetMinutes(); //Минуты формата "мм" для имени файла ЛОГа.
return LogPath(minute); //Путь файла ЛОГа
−3
{ "destination_addresses" : [ "Seattle, Washington, USA" ], "origin_addresses" : [ "Vancouver, Britisch-Kolumbien, Kanada" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "229 km", "value" : 229112 }, "duration" : { "text" : "2 Stunden, 35 Minuten", "value" : 9311 }, "status" : "OK" } ] } ], "status" : "OK" }
+5
//Collisions
static float collisionradius;
if(numplayers>1)
for(k=0;k<numplayers;k++){
for(i=k;i<numplayers;i++){
if(i==k)i++;
if(i<numplayers)
if((animation[player[i].targetanimation].attack!=reversed&&animation[player[i].targetanimation].attack!=reversal&&animation[player[k].targetanimation].attack!=reversed&&animation[player[k].targetanimation].attack!=reversal)||(i!=0&&k!=0))
if((animation[player[i].currentanimation].attack!=reversed&&animation[player[i].currentanimation].attack!=reversal&&animation[player[k].currentanimation].attack!=reversed&&animation[player[k].currentanimation].attack!=reversal)||(i!=0&&k!=0))
if(player[i].howactive<=typesleeping&&player[k].howactive<=typesleeping)
if(player[i].howactive!=typesittingwall&&player[k].howactive!=typesittingwall)
if(i!=k&&player[i].whichpatchx==player[k].whichpatchx&&player[i].whichpatchz==player[k].whichpatchz&&player[k].skeleton.oldfree==player[k].skeleton.free&&player[i].skeleton.oldfree==player[i].skeleton.free&&player[i].targetanimation!=climbanim&&player[i].targetanimation!=hanganim&&player[k].targetanimation!=climbanim&&player[k].targetanimation!=hanganim)
if(player[i].coords.y>player[k].coords.y-3)
if(player[i].coords.y<player[k].coords.y+3)
if(player[i].coords.x>player[k].coords.x-3)
if(player[i].coords.x<player[k].coords.x+3)
if(player[i].coords.z>player[k].coords.z-3)
if(player[i].coords.z<player[k].coords.z+3){
if(findDistancefast(&player[i].coords,&player[k].coords)<3*((player[i].scale+player[k].scale)*2.5)*((player[i].scale+player[k].scale)*2.5)){
if(player[i].onfire||player[k].onfire){
if(!player[i].onfire)player[i].CatchFire();
if(!player[k].onfire)player[k].CatchFire();
}
}
...
http://hg.icculus.org/icculus/lugaru/file/97b303e79826/Source/GameTick.cpp#l7276
−1
handleNewConfigRuleLoaded: function(
this.handleConfigRuleLoaded0({rule: event.configRule}, true, false);
},
handleConfigRuleLoaded: function(event) {
this.handleConfigRuleLoaded0(event.configRule, false, false);
},
Старый добрый бэкбон и не знания карринга
0
$.get( '/scripts/ajax/popup/add_to_favorite.php', { id: productID, ajax_call: 'Y' }, function ( data ) {
data = JSON.parse( data );
$.getJSON
http://www.sapato.ru/js/ajax/widgets/baseAjaxes.js?bust=208
+5
private void sendCommand(Hi1Command command)
{
var aCommand = command as Hi1Command;
...
}
На случай если Microsoft откажется от строгой типизации С#
+1
<?php
/*
> 60 seconds - "s"
> 60 minutes - "m"
> 24 hours - "h"
> 30 days - "d"
< 30 days - "5 sep 2010"
*/
class Date {
public static function DateAgo($DateTime) {
$s = s; $m = m; $h = h; $d = d;
$Now = date('Y-m-d H:i:s');
$Now = time();
$Year = substr($DateTime, 0, 4);
$Month = substr($DateTime, 5, 2);
$Day = substr($DateTime, 8, 2);
$Hour = substr($DateTime, 11, 2);
$Minute = substr($DateTime, 14, 2);
$Second = substr($DateTime, 17, 2);
$Time = mktime($Hour, $Minute, $Second, $Month, $Day, $Year);
$Difference = $Now - $Time;
if($Difference < 60) {
$Ago = $Difference.$s;
} elseif($Difference < (60 * 60)) {
$Ago = floor($Difference / 60).$m;
} elseif($Difference < (60 * 60 * 24)) {
$Ago = floor($Difference / (60 * 60)).$h;
} elseif($Difference < (60 * 60 * 24 * 30)) {
$Ago = floor($Difference / (60 * 60 * 24)).$d;
} else {
$Ago = $Day.'.'.$Month.'.'.$Year;
}
return $Ago;
}
} // End class
?>
Забирайте целиком! Нашёл в CMS от http://fn85.ru/ охрененный класс для работы с датами!