Skip to content

Instantly share code, notes, and snippets.

View meftunca's full-sized avatar
🏠
Working from home

muhammed burak şentürk meftunca

🏠
Working from home
  • A developer who suffers from the disease of selectivity in learning from unnecessary real-life experience.
  • İstanbul
  • 15:17 (UTC +03:00)
View GitHub Profile
@meftunca
meftunca / matris.c
Created February 28, 2019 10:00
C ile matriste en kısal yolu bulan program
#include <stdio.h>
void kisayol(int, int);
int labirent[8][6] = {
{1, 0, 0, 0, 0, 0},
{1, 1, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 0},
{0, 1, 1, 0, 0, 0},
{0, 0, 1, 1, 1, 0},
@meftunca
meftunca / factoriel.c
Last active February 28, 2019 15:34
c ve cpp faktoriyel fonksiyonu
int fak(int a)
{
int i = 1;
int count = 1;
for (i; i <= a; i++)
count = count * i;
return count;
}
@meftunca
meftunca / mask.js
Last active April 18, 2019 19:23
Javascript number mask
const mask = (res = "", regex) => {
if (res.replace(/\D+/gim, "").length == 0) return "";
if (res.replace(/\D+/gim, "").length > regex.replace(/\D+/gim, "").length)
return res.slice(0, regex.replace(/\[|\]/gim, "").length);
let regexNumber = regex.match(/\d+/gim, ""), //sadece sayılar
totalLen = res.match(/\d+/gim, "").join("").length, //gelen değerin uzunluğu
number = res.match(/\d+/gim, "").join("") + new Array(regexNumber.join("").length - totalLen).fill("_").join(""),
len = 0,
rlen = 0;
let match = regex.replace(/\[\d+\]/gim, (m, k) => m.replace(/\[\d+\]/gim, "$" + rlen++));
@meftunca
meftunca / uniqid.js
Created April 21, 2019 16:45
JS uniqid generator
export default (key = "key") => {
let ts = String(new Date().getTime()),
i = 0,
out = "";
for (i = 0; i < ts.length; i += 2) {
out += Number(ts.substr(i, 2)).toString(36);
}
return key + out;
};
const camelize = camelize(str) => {
return str.replace(/\W+(.)/g, (match, chr) =>
{
return chr.toUpperCase();
});
};
console.log(camelize("javaScript-Exercises"));
console.log(camelize("JavaScript exercises"));
@meftunca
meftunca / resp.php
Last active July 3, 2019 11:18
resp.php
<?php
$service_url = 'https://ronesis.com/API/api/v1/uye-bilgileri.php?uye_id=2087';
$curl = curl_init($service_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
if ($curl_response === false) {
$info = curl_getinfo($curl);
curl_close($curl);
die('error occured during curl exec. Additioanl info: ' . var_export($info));
<form action="path/to/server/script" method="post" id="my_form">
<label>Name</label>
<input type="text" name="name" />
<label>Email</label>
<input type="email" name="email" />
<label>Website</label>
<input type="url" name="website" />
<button type="submit" class="submit_button">Submit Form <button/>
</form>
@meftunca
meftunca / callClass.js
Last active July 7, 2019 12:57
js Class
class Basic {} // Basic Sınıfını oluşturalı...
const basicClass = new Basic();//Basic Sınıfını çağıralım...
export default listenerFunc => {
Object.defineProperty(window.globalStore, "onChangeListener", {
value: listenerFunc
});
};
@meftunca
meftunca / iFetch.js
Created August 6, 2019 21:55
Fetch Api With Es6 Class
class fetchApi {
// method = "GET";
defaultConfig = {
method: "GET", // *GET, POST, PUT, DELETE, etc.
mode: "*same-origin", // no-cors, cors, *same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
credentials: "*same-origin", // include, *same-origin, omit
headers: {
"Content-Type": "application/json",
Accept: "application/json"