<?
if (ini_get('register_globals') != 1){
if ((isset($_POST) == true) && (is_array($_POST) == true)) extract($_POST, EXTR_OVERWRITE);
if ((isset($_GET) == true) && (is_array($_GET) == true)) extract($_GET, EXTR_OVERWRITE);}
function clean(toClean, source){
if (typeof(toClean) !== 'string') return true;
if (typeof(source) !== 'string') return true;
return source.replace(toClean, String('CLEANED')).toString();
}
Found this in a project at work and someone clearly doesn't trust JavaScripts typeof function
@Override
public String toString() {
List<Integer> accountLevels = new ArrayList<>();
List<String> accountIds = new ArrayList<>();
for (SelectedHierarchyLevel selectedHierarchyLevel : selectedHierarchyLevels) {
accountLevels.add(selectedHierarchyLevel.getLevel());
accountIds.add(selectedHierarchyLevel.getAccountRowId());
}
vetoAreValidIds(accountIds);
StringBuilder converterString = new StringBuilder();
convert(accountLevels, converterString);
converterString.append("$");
convert(accountIds, converterString);
return converterString.toString();
}
Just because you can, doesn’t mean you should.
// IsFooBar being a boolean, we check if it's different from true and from false
if (x.IsFooBar != true && x.IsFooBar != false)
{
return "error";
}
x.IsFooBar is juste a regular bool
Path path = FileSystems.getDefault().getPath("../../../../../../../../../../EmailResults.csv");
Files.deleteIfExists(path);
div.body:first-child:nth-last-child(n+12),
div.body:first-child:nth-last-child(n+12) ~ div.body {
padding: 3px 5px 2px !important;
div.rect {
top: 6px !important;
}
div.legend-action {
top: 3px !important;
}
}
if ((&inactiveSlot)->GetFirstSlot() == RuntimeLib::INVALID_SLOT) {
Dot dude...
public void sleep(long duration) {
long start = System.currentTimeMillis();
while(true) {
if (System.currentTimeMillis() - start >= duration)
break;
}
}
return [word for word in words if any(all(ch in row for ch in word.lower()) for row in rows)]
Filtering words that can be typed using only one row of the keyboard.
/// <summary>
/// Returns true if any component of of Vector3 v is negative
/// </summary>
public static bool Ext_IsNegative(this Vector3 v)
{
return v.x < 0f && v.y < 0f && v.z < 0f;
}
Either the description is wrong or the method in itself
/**
* Deserializes the contents of the incoming message buffer {@code b}.
*
* @return deserialised object
* @throws UnsupportedEncodingException If the named charset is not supported
*/
Object r() throws UnsupportedEncodingException{
int i=0, n, t=b[j++];
if(t<0)
switch(t){
case -1:
return rb();
case (-2):
return rg();
case -4:
return b[j++];
case -5:
return rh();
case -6:
return ri();
case -7:
return rj();
case -8:
return re();
case -9:
return rf();
case -10:
return rc();
case -11:
return rs();
case -12:
return rp();
case -13:
return rm();
case -14:
return rd();
case -15:
return rz();
case -16:
return rn();
case -17:
return ru();
case -18:
return rv();
case -19:
return rt();
}
if(t>99){
if(t==100){
rs();
return r();
}
if(t<104)
return b[j++]==0&&t==101?null:"func";
if(t>105)
r();
else
for(n=ri();i<n;i++)
r();
return "func";
}
if(t==99)
return new Dict(r(),r());
j++;
if(t==98)
return new Flip((Dict)r());
n=ri();
switch(t){
case 0:
Object[] L=new Object[n];
for(;i<n;i++)
L[i]=r();
return L;
case 1:
boolean[] B=new boolean[n];
for(;i<n;i++)
B[i]=rb();
return B;
case 2: {
UUID[] G=new UUID[n];
for(;i<n;i++)
G[i]=rg();
return G;
}
case 4:
byte[] G=new byte[n];
for(;i<n;i++)
G[i]=b[j++];
return G;
case 5:
short[] H=new short[n];
for(;i<n;i++)
H[i]=rh();
return H;
case 6:
int[] I=new int[n];
for(;i<n;i++)
I[i]=ri();
return I;
case 7:
long[] J=new long[n];
for(;i<n;i++)
J[i]=rj();
return J;
case 8:
float[] E=new float[n];
for(;i<n;i++)
E[i]=re();
return E;
case 9:
double[] F=new double[n];
for(;i<n;i++)
F[i]=rf();
return F;
case 10:
char[] C=new String(b,j,n,encoding).toCharArray();
j+=n;
return C;
case 11:
String[] S=new String[n];
for(;i<n;i++)
S[i]=rs();
return S;
case 12:
Timestamp[] P=new Timestamp[n];
for(;i<n;i++)
P[i]=rp();
return P;
case 13:
Month[] M=new Month[n];
for(;i<n;i++)
M[i]=rm();
return M;
case 14:
Date[] D=new Date[n];
for(;i<n;i++)
D[i]=rd();
return D;
case 15:
java.util.Date[] Z=new java.util.Date[n];
for(;i<n;i++)
Z[i]=rz();
return Z;
case 16:
Timespan[] N=new Timespan[n];
for(;i<n;i++)
N[i]=rn();
return N;
case 17:
Minute[] U=new Minute[n];
for(;i<n;i++)
U[i]=ru();
return U;
case 18:
Second[] V=new Second[n];
for(;i<n;i++)
V[i]=rv();
return V;
case 19:
Time[] T=new Time[n];
for(;i<n;i++)
T[i]=rt();
return T;
}
return null;
}
Manually maintained open-source code on GitHub. Looks like decompiled from obfuscated binary, they just reformatted it, added some comments and now are making manual changes. Current version: https://github.com/KxSystems/javakdb/blob/master/src/kx/c.java Original version: https://github.com/KxSystems/javakdb/blob/c9afe6fa32d7d3e3cddabdc9bd43f0155a5d2a1b/src/kx/c.java
Select * from Order --doesn't work
select * from [order] --works
--it's planning module in our system...
I think, it's really bad idea to use reserved words in names of tables. I'm surprised, that this db doesn't contain table named like [select]...
isCreatedUser : !this.isEdit ? true : false
Vue.js project, someone wanted to verify if the user was being edited or created...
request.get_something = (something_id) => {
return new Promise((resolve, reject) => {
database.find_all('something', { where: {something_id: something_id, is_deleted:0} }).then(function(res){
let result = {};
res = JSON.stringify(res);
res = JSON.parse(res);
res.forEach(function(element){
if(typeof element.is_deleted != "undefined"){
delete element.is_deleted;
}
let key = 'something_' + element.id;
result[key] = element;
});
resolve(result);
}, reject);
});
}
I LOVE MY JOB!
void winner(int score[4])
{
if (score[0] > score[1] > score[2] > score[3])
cout << "The winner is the Player 1 with " << score[0] << " points.";
else if (score[1] > score[0] > score[2] > score[3])
cout << "The winner is the Player 2 with " << score[1] << " points.";
else if (score[2] > score[0] > score[1] > score[3])
cout << "The winner is the Player 3 with " << score[2] << " points.";
else if (score[3] > score[2] > score[1] > score[0])
cout << "The winner is the Player 4 with " << score[3] << " points.";
}