// We have this enum.
enum Formula {
case proposition(String)
indirect case negation(Formula)
indirect case operation(op: String, lhs: Formula, rhs: Formula)
var nnf: Formula { /* ... */ }
}
// And now ...
switch formula.nnf {
case .proposition(_):
return formula.nnf
case .negation(_):
return formula.nnf
case .operation(_, _, _):
return formula.nnf
}
StartCoroutine(Patrol());
public IEnumerator Patrol() {
while(true) {
dt.Walk();
yield return new WaitForSeconds(reactionTime);
}
}
cd /some/directory
rm -rf *
I regularly see these two lines in Bash scripts I don't understand but some programmers think you need a CD command before any command, and they also don't know that paths can be part of parameters (which explains why they use many CD commands)
case (RSel)
4'b0000:begin
R1e = 1'b0; R2e = 1'b0; R3e = 1'b0; R4e = 1'b0;
end
4'b0001:begin
R1e = 1'b0; R2e = 1'b0; R3e = 1'b0; R4e = 1'b1;
end
4'b0010:begin
R1e = 1'b0; R2e = 1'b0; R3e = 1'b1; R4e = 1'b0;
end
4'b0011:begin
R1e = 1'b0; R2e = 1'b0; R3e = 1'b1; R4e = 1'b1;
end
4'b0100:begin
R1e = 1'b0; R2e = 1'b1; R3e = 1'b0; R4e = 1'b0;
end
4'b0101:begin
R1e = 1'b0; R2e = 1'b1; R3e = 1'b0; R4e = 1'b1;
end
4'b0110:begin
R1e = 1'b0; R2e = 1'b1; R3e = 1'b1; R4e = 1'b0;
end
4'b0111:begin
R1e = 1'b0; R2e = 1'b1; R3e = 1'b1; R4e = 1'b1;
end
4'b1000:begin
R1e = 1'b1; R2e = 1'b0; R3e = 1'b0; R4e = 1'b0;
end
4'b1001:begin
R1e = 1'b1; R2e = 1'b0; R3e = 1'b0; R4e = 1'b1;
end
4'b1010:begin
R1e = 1'b1; R2e = 1'b0; R3e = 1'b1; R4e = 1'b0;
end
4'b1011:begin
R1e = 1'b1; R2e = 1'b0; R3e = 1'b1; R4e = 1'b1;
end
4'b1100:begin
R1e = 1'b1; R2e = 1'b1; R3e = 1'b0; R4e = 1'b0;
end
4'b1101:begin
R1e = 1'b1; R2e = 1'b1; R3e = 1'b0; R4e = 1'b1;
end
4'b1110:begin
R1e = 1'b1; R2e = 1'b1; R3e = 1'b1; R4e = 1'b0;
end
4'b1111:begin
R1e = 1'b1; R2e = 1'b1; R3e = 1'b1; R4e = 1'b1;
end
endcase
case (TSel)
4'b0000:begin
T1e = 1'b0; T2e = 1'b0; T3e = 1'b0; T4e = 1'b0;
end
4'b0001:begin
T1e = 1'b0; T2e = 1'b0; T3e = 1'b0; T4e = 1'b1;
end
4'b0010:begin
T1e = 1'b0; T2e = 1'b0; T3e = 1'b1; T4e = 1'b0;
end
4'b0011:begin
T1e = 1'b0; T2e = 1'b0; T3e = 1'b1; T4e = 1'b1;
end
4'b0100:begin
T1e = 1'b0; T2e = 1'b1; T3e = 1'b0; T4e = 1'b0;
end
4'b0101:begin
T1e = 1'b0; T2e = 1'b1; T3e = 1'b0; T4e = 1'b1;
end
4'b0110:begin
T1e = 1'b0; T2e = 1'b1; T3e = 1'b1; T4e = 1'b0;
end
4'b0111:begin
T1e = 1'b0; T2e = 1'b1; T3e = 1'b1; T4e = 1'b1;
end
4'b1000:begin
T1e = 1'b1; T2e = 1'b0; T3e = 1'b0; T4e = 1'b0;
end
4'b1001:begin
T1e = 1'b1; T2e = 1'b0; T3e = 1'b0; T4e = 1'b1;
end
4'b1010:begin
T1e = 1'b1; T2e = 1'b0; T3e = 1'b1; T4e = 1'b0;
end
4'b1011:begin
T1e = 1'b1; T2e = 1'b0; T3e = 1'b1; T4e = 1'b1;
end
4'b1100:begin
T1e = 1'b1; T2e = 1'b1; T3e = 1'b0; T4e = 1'b0;
end
4'b1101:begin
T1e = 1'b1; T2e = 1'b1; T3e = 1'b0; T4e = 1'b1;
end
4'b1110:begin
T1e = 1'b1; T2e = 1'b1; T3e = 1'b1; T4e = 1'b0;
end
4'b1111:begin
T1e = 1'b1; T2e = 1'b1; T3e = 1'b1; T4e = 1'b1;
end
endcase
Just write assign {R1e, R2e, R3e, R4e} = Rsel assign {T1e, T2e, T3e, T4e} = Tsel
const handleBoolean = value => {
switch (value) {
case "true":
return true;
case true:
return "true";
case "false":
return false;
case false:
return "false"
default:
return null;
}
}
if "[trait]" in lines[i]:
in_trait = True
elif "[/trait]" in lines[i]:
in_trait = False
elif "[object]" in lines[i]:
in_object = True
elif "[/object]" in lines[i]:
in_object = False
elif "[stage]" in lines[i]:
in_stage = True
elif "[/stage]" in lines[i]:
in_stage = False
elif "[cfg]" in lines[i]:
in_cfg = True
elif "[/cfg]" in lines[i]:
in_cfg = False
elif "[goal]" in lines[i]:
in_goal = True
elif "[/goal]" in lines[i]:
in_goal = False
#... 150 more lines of this
Basically, linting a config file with a DOM tree, using Python
int true = 0;
while (true)
{
//do something
}
true = false
if (!response ||
!response.data ||
!response.data.success ||
response.data.success == false ) {
//process stuff
}
Not talking about the '===' warning, here
<h1 className="sidebar-text">
<h1 className="sidebar-text">My Applauses</h1>
</h1>
How do you even miss this... the Console will literally complain in red to you...
if((strtotime(date("Y-m-d"))-strtotime(date("Y-m-d", filemtime($filename))))/(3600)<=$config->hourDiff) return true; else return false;
please notice the brackets around 3600
ngOnInit() {
this._FunctionService.getSicksList().then(res => {
let resf:any = res;
if (resf.err) {
} else {
this.diagnosticAll = resf.data
}
}, err => { })
}
/*
ngOnInit() {
this._FunctionService.getSicksList().then(res => {
this.diagnosticAll = res.data
}, err => { })
}
*/
public static class DecimalHelpers
{
/// <summary>
/// Format a decimal XX.XX to XX,XX%.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string FormatToStringPercentageValue(this decimal value)
{
return value.ToString().Replace(".", ",").FormatToPercentageValue();
}
}
public static class StringHelpers
{
/// <summary>
/// Add % at the end of the string.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public static string FormatToPercentageValue(this string value)
{
return string.Concat(value, "%");
}
}
local Plr = game.Players.LocalPlayer
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].AccessoriesList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].StanceList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].RunningList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].FlyingList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].FightingStyles:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].MoveList:GetChildren()) do
v.Value = "Unlocked"
end
for i,v in pairs(game.ReplicatedStorage.DataStorage[Plr.Name].Data["Slot1"].ClothingList:GetChildren()) do
v.Value = "Unlocked"
end
Bad unlock script for Roblox
double func_atof(char *p){
double integer = 0.0, div = 1.0 , fract = 0.0 , sign = 1.0;
if( *p == 45 ){sign = -1.0, *p++ ; }
while ( isdigit(*p) ) {
integer = ( *p++ ) + (10.0 * integer) - 48.0 ;
}
if(*p == 46 ){
(*p++ ) ;
while ( isdigit(*p) ) {
fract = ( *p++ ) + (10.0 * fract) - 48.0 ;
div *= 10;
}
}
return (integer + fract / div ) * sign ;
}
function sortUsers(a, b) {
return a.last_name.localeCompare(b.last_name) * -1;
}