- 1
https://software.intel.com/sites/billboard/article/simd-javascript-faster-html5-apps
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+159
https://software.intel.com/sites/billboard/article/simd-javascript-faster-html5-apps
Почему нужно выбрать самый говенный язык, и усиленно добавлять в него фичи, с которыми он все равно не может нормально работать? :( Просто пиздец какой-то.
+157
while($row = $this->_db->fetchRow($qry)){
$module_name = stripslashes($row["module_name"]);
$permisos = array();
$permisos["A"]=(($row["permission_value"] & 1)==1)?1:0;
$permisos["E"]=(($row["permission_value"] & 2)==2)?1:0;
$permisos["D"]=(($row["permission_value"] & 4)==4)?1:0;
$permisos["L"]=(($row["permission_value"] & 8)==8)?1:0;
$permisos["W"]=(($row["permission_value"] & 16)==16)?1:0;
$permisos["V"]=(($row["permission_value"] & 32)==32)?1:0;
$access_array[$module_name]=$permisos;
}
Испанский ACL
+161
//Insert record into database
$result = mysql_query("INSERT INTO people(Name, Age, RecordDate) VALUES('" . $_POST["Name"] . "', " . $_POST["Age"] . ",now());");
Из документации к jTable http://www.jtable.org/GettingStarted
+156
function EngineListCtrl($scope, $timeout, $http)
{
$scope.engines = {};
$scope.workers = [];
$scope.checkEngines = function(){
$http.get(engineUrl + '&type=json&jcmd=getClients').success(function(req){
var engines = {};
var workers = {};
$scope.workers = []; // Это в отрисовке не используется.
// Сначала распихиваю всех по местам
angular.forEach(req, function(ob, i){
if( ob.info.type == 'engine' )
engines[ob.info.engine] = ob;
if( ob.info.type == 'worker' ){
if( workers[ob.info.engine] == undefined )
workers[ob.info.engine] = {};
workers[ob.info.engine][ob.info.worker] = ob;
if( ob.task && ob.task.state )
ob.info.state = ob.task.state;
$scope.workers.push(ob);
}
});
// Перебераю уже имеющиеся объекты
angular.forEach($scope.engines, function(engineOb, engineName){
var needRemove = true;
angular.forEach(engines, function(val, key){
if( engineName == key ){
angular.extend($scope.engines[engineName], val);
needRemove = false;
}
});
if( needRemove == false && $scope.engines[engineName] ){
$scope.checkEngineEvents($scope.engines[engineName]);
if( workers[engineName] != undefined ){
if( $scope.engines[engineName].workers == undefined )
$scope.engines[engineName].workers = {};
angular.extend($scope.engines[engineName].workers, workers[engineName]);
}else
$scope.engines[engineName].workers = {};
}
if( needRemove == true ){
delete $scope.engines[engineName];
}
});
// А теперь новые добавляю
angular.forEach(engines, function(engineOb, engineName){
if( $scope.engines[engineName] == undefined ){
$scope.engines[engineName] = engineOb;
if( workers[engineName] != undefined ){
if( $scope.engines[engineName].workers == undefined )
$scope.engines[engineName].workers = {};
angular.extend($scope.engines[engineName].workers, workers[engineName]);
}
$scope.checkEngineEvents($scope.engines[engineName]);
}
});
$timeout($scope.checkEngines, 2000);
});
}
$timeout($scope.checkEngines, 1000);
+13
/////////////////////////////////////////////////////////////////////////////////////////
template< typename TT_multimap_type >
void copy_val_vect_into_multimap_with_mapped_val_ordering_with_comparator
(
T_val_vect const & val_vect,
TT_multimap_type & multimap,
T_rand_rev_compare_val_with_comparators const & swap_compare_val
)
{
T_insert_with_ordering_in_multimap_with_comparator< TT_multimap_type >
insert_with_ordering_in_multimap_with_comparator
(
multimap,
swap_compare_val
);
std::for_each
(
val_vect.begin (),
val_vect.end (),
insert_with_ordering_in_multimap_with_comparator
);
}
/////////////////////////////////////////////////////////////////////////////////////////
http://goo.gl/1oiTBt
вырвиглазный code-style
+1
chunksLst.erase(++it1);
−164
Процедура глЗагрузитьЗаказы() Экспорт
ОткрытьФорму("Отчет",,"\\SQLDSTR\1C\ExtERT\InvoiceLoader.ert");
КонецПроцедуры
Встретил в самописке в клюшках. Если поменяется имя сервера или каталога - всё рухнет).
+108
if (needParce)
{
try
{
count = decimal.Parse(tb_count.Text.Replace(".", ","));
}
catch
{
count = decimal.Parse(tb_count.Text.Replace(",", "."));
}
}
+133
[Serializable]
public class CSScriptCompiler
{
//file name of script including full path
string sFileNameWithPath;
System.Reflection.Assembly m_assembly = null;
public CSScriptCompiler(string ScriptFileName)
{
this.sFileNameWithPath = Path.GetFullPath(ScriptFileName);
try
{
//load Assembly of *.cs file
m_assembly = CSScript.Load(sFileNameWithPath, null, true);
}
catch (Exception ex)
{
m_assembly = null;
MessageBox.Show(ex.Message);
throw (ex);
}
}
public bool Initialize(params object[] InitArgs)
{
if (m_assembly == null)
{
return false;
}
try
{
var InitFuntion = m_assembly.GetStaticMethod("*.Initialize", InitArgs);
//call initialize function
InitFuntion(InitArgs);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
return true;
}
public object CallFunction(String sFunctionName, params object[] args)
{
object result = null;
sFunctionName = "*." + sFunctionName;
try
{
var theFunction = m_assembly.GetStaticMethod(sFunctionName, args);
//call the method with your own arguements
result = theFunction(args);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return result;
}
}
Ну что тут скажешь...
Велосипедист...
+138
public string GetStringOfEnum(object myEnum)
{
string sValue = "";
sValue = Enum.GetName(myEnum.GetType(), myEnum);
return sValue;
}
Nuff said...