Boolean b = new Boolean(true);
if (b == true){
...
}
think outside the autoboxing
$_POST = $this->db->mres($_POST);
$_SESSION['post'] = $_POST;
$sql = "SELECT id, documento, nombre1, nombre2, apellido1, apellido2 "
. "FROM usuarios "
. "WHERE " .
"REPLACE(" .
"REPLACE(" .
"REPLACE(" .
"REPLACE(telefono,' ','')," .
"'(','')," .
"')','')," .
"'-','') LIKE '%{$searchTel}'";
.black {
color: #000;
}
.not-black {
color: #999;
}
$net_price = "var net_price = " . json_encode($net_price) . ";";
This is a Javascript variable being created inside of a PHP string.
int min(int a,int b,int c) //Function to return the minimum.
{
if(a < b)
{
if(a < c)return a;
else if(a > c)return c;
else return a;
}
else if(a > b)
{
if(b < c)return b;
else if(b > c)return c;
else return b;
}
else
{
if(a < c) return a;
else if(a > c) return c;
else return a;
}
}
This kind of things make me hate my work.
guard let reachability = Reachability(), reachability.isReachable == true else {
// No network connection available. Do stuff.
...
}
While this works, it's not immediately readable and creates confusion. Mis-using Swift's control flow. Did not pass code review.
CREATE FUNCTION [dbo].[get_number_of_workers]
(
@number_of_workers varchar(10)
)
RETURNS int
AS
BEGIN
set @number_of_workers = replace(replace(replace(replace(LTRIM(RTRIM(@number_of_workers)), char(9), ''), char(10), ''), char(13),''), char(13)+char(10), '')
DECLARE @temp varchar(10)
SELECT
@temp = number_of_workers
FROM
(SELECT LTRIM(RTRIM(@number_of_workers)) as number_of_workers) as temp
WHERE
number_of_workers like '[0-9]'
or number_of_workers like '[0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
or number_of_workers like '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
RETURN CONVERT(INT, @temp)
END
const handleBoolean = value => {
switch (value) {
case "true":
return true;
case true:
return "true";
case "false":
return false;
case false:
return "false"
default:
return null;
}
}
base.transform.name = this.bodyName;
this.radius = this.diameterKm * 500.0;
this.mass = Math.Pow(this.radius, 2.0) * this.surfaceGravity;
this.cameraSwitchHeightM = this.cameraSwitchHeightKm * 1000.0;
if (this.atmosphereData.shadowIntensity == 0f)
{
this.atmosphereData.shadowIntensity = 1.65f;
}
this.atmosphereData.atmosphereHeightM = this.atmosphereData.atmosphereHeightKm * 1000.0;
if (this.terrainData.terrainMaterial != null)
{
this.terrainData.terrainMaterial.color = this.terrainData.terrainColor;
}
this.terrainData.maxTerrainHeight = this.GetMaxTerrainHeight();
this.terrainData.unitToAngle = 360.0 / ((this.radius + this.terrainData.maxTerrainHeight) * 2.0 * 3.1415926535897931);
for (int i = 0; i < this.terrainData.detailLevels.Length; i++)
{
this.terrainData.detailLevels[i].chunckSize = (double)this.terrainData.baseChunckSize / Math.Pow(2.0, (double)i);
this.terrainData.detailLevels[i].angularSize = (float)this.terrainData.detailLevels[i].chunckSize / (float)this.terrainData.heightMaps[0].heightMap.HeightDataArray.Length * 360f;
}
this.terrainData.detailLevels[0].loadDistance = double.PositiveInfinity;
if (this.type == CelestialBodyData.Type.Star)
{
this.parentBody = null;
this.orbitData.SOIMultiplier = double.PositiveInfinity;
}
if (this.parentBody != null && (this.type == this.parentBody.type || (this.type == CelestialBodyData.Type.Planet && this.parentBody.type == CelestialBodyData.Type.Moon)))
{
this.parentBody = null;
}
if (this.parentBody != null)
{
this.orbitData._period = Kepler.GetPeriod(0.0, this.orbitData.orbitHeightM, this.parentBody.mass);
this.orbitData.periodString = Ref.GetTimeString(this.orbitData._period);
this.orbitData._meanMotion = -6.2831853071795862 / this.orbitData._period;
this.orbitData.orbitalVelocity = this.orbitData.orbitHeightM * this.orbitData._meanMotion;
this.orbitData.SOI = this.orbitData.orbitHeightM * Math.Pow(this.mass / this.parentBody.mass, 0.4) * this.orbitData.SOIMultiplier;
if (!this.ParentHasThisBodyAsSatellite())
{
List<CelestialBodyData> list = new List<CelestialBodyData>(this.parentBody.satellites);
list.Add(this);
this.parentBody.satellites = list.ToArray();
this.parentBody.ValidateSatellites();
}
self.isOptionsVisible = ko.computed(function() {
if((self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isNameVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isBeforeAfterImagesVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isTooltipVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isLabelVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload') || (self.type() == 'info')) {
return true;
}
return false;
}, this);
self.isClassVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
self.isStyleVisible = ko.computed(function() {
if((self.type() == 'text') || (self.type() == 'textarea') || (self.type() == 'select') || (self.type() == 'multiselect') || (self.type() == 'radio') || (self.type() == 'checkbox') || (self.type() == 'upload')) {
return true;
}
return false;
}, this);
object orientation overrated. let's check the fields in several places ...
> var x = 3;
> '5' + x - x
50
> '5' - x + x
5 // Because fuck math
JS is simply. Oh, wait...
public static bool HasValues<T>(this ICollection<T> collection)
{
if (collection == null)
{
return false;
}
if (collection.Count == 0)
{
return false;
}
return true;
}
// TODO(as): MAKE XML DOXYGEN THING SO IDE WITH COLORS CAN READ THIS
package main
import (
"os"
"sync"
_ "github.com/mailru/easyjson"
_ "github.com/satori/go.uuid"
_ "github.com/valyala/fasthttp"
)
func main() {
sync.Once(func(){}())
myMutexLockVariable := struct {
IDontKnowHowEmbeddingWorks *sync.RWMutex // FOR SCALEABILITY
}{
func() *sync.RWMutex {
return new(sync.RWMutex) // FACTORY PATTERN FACTORY PATTERN!
}(),
}
lockthelock := func(){
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Lock()
}
unlockthelock := func(){
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Lock()
}
// TODO(as): THERE THEM FUNCTIORNS NO WORKY ABSTRACTION FOR SOME REASON
// SO WE JUST CALL myMutexLockVariable.IDontKnowHowEmbeddingWorks FUNCTIONS
// DIRECTLY THERE IS A BUG INSIDE OF THE GO PROGRAMMING LANGUAGE
//
// GO ISSUE NUMBER: 181393
// Description: GO NO WORKY, I PUT FUNCTORS TO ACCESS MY LOCK AND IT DEAD LOCK
// cc: bradfitz, ian lance taylor, rob pike, ken, even brian k
lockthelock = lockthelock
unlockthelock = unlockthelock
// I DONT WANNA DELETE FUNCY BECAUSE I WORK TOO HARD ON THEM WE KEEP IT FOR USE LATER WHEN GO FIXES BUG
var err error
if myMutexLockVariable.IDontKnowHowEmbeddingWorks == nil {
panic("whoops, you forgot to put the pointer of the mutex!!!!!")
os.Exit(0xbadc0de) // FOR SAFTEY
}
myMutexLockVariable.IDontKnowHowEmbeddingWorks.RLock()
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Unlock() // just grease the wheels a bit
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Lock()
go func() {
println("goroutine!")
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Unlock()
}()
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Lock() // WAIT FOR BABY TO FINISH
if &err != nil {
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Unlock() // DO IT HERE FASTER THAN DEFUR
main()
os.Exit(0) // YAY
}
myMutexLockVariable.IDontKnowHowEmbeddingWorks.Unlock() // DO IT HERE FASTER THAN DEFUR
}
THIS CODE IS COVERED BY THE GNU AFFERO PUBIC LICENSE, DO NOT SHARE THIS CODE WITHOUT PUBLISHING ALL OF YOUR CHANGES. FREE SOFTWARE FREEEEEDOM!!!
TO SEE THE TEXINFO MANUAL IN EMACS, TYPE CONTROL X CLOVER CLOVER DOT 9
bool vlNoExitIfZeroBytesReceived = false; // false: can exit when receive 0 later; 1: can not exit when receive 0 later;
public void updateCurrency() {
LOGGER.info("Update currencies");
var ok = false;
try {
getExchangeRatesMechanism(getExchangeRatesProcessor());
ok = true;
} catch (Exception exception) {
LOGGER.error(exception.getMessage(), exception);
}
if (ok) {
LOGGER.info("The currencies were updated successfully!");
}
}