Skip to content

Instantly share code, notes, and snippets.

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

Barış Esen barisesen

🏠
Working from home
View GitHub Profile
@barisesen
barisesen / verify.js
Created January 18, 2019 08:34
Tc kimlik numarası doğrulama - javascript
function verify(tcno) {
if (!tcno.match(/^[1-9]{1}[0-9]{9}[0,2,4,6,8]{1}$/)) {
return false;
}
tcno = tcno.split('').map(Number);
var odd = tcno[0] + tcno[2] + tcno[4] + tcno[6] + tcno[8];
var even = tcno[1] + tcno[3] + tcno[5] + tcno[7];
var digit10 = (odd * 7 - even) % 10;
var total = (odd + even + tcno[9]) % 10;
return !(digit10 !== tcno[9] || total !== tcno[10]);
package main
import (
"crypto/hmac"
"crypto/md5"
"encoding/hex"
"fmt"
"sort"
"strconv"
)
@barisesen
barisesen / parse.php
Last active May 29, 2018 07:53
Geriye dönük olarak dolar kurunu TCMB sitesinden parse eder.
<?php
/* @barisesen
* http://www.tcmb.gov.tr/kurlar/201805/25052018.xml
*/
public function oldExchangeRate($date)
{
$dt = Carbon::parse($date);
if ($dt->isWeekend()) {
return $this->oldExchangeRate($dt->subDay());
}
<?php
// bloomberght anlık
$ch = curl_init();
curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com');
curl_setopt($ch, CURLOPT_URL, "http://www.bloomberght.com/doviz/dolar/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$site = curl_exec($ch);
curl_close($ch);
@barisesen
barisesen / TaxNumber.php
Created April 12, 2018 11:45
Vergi kimlik numarası doğrulama
<?php
namespace Libraries;
class TaxNumber
{
public static function check($tax)
{
$tax = str_replace(' ', '', trim($tax));
if (strlen($tax) != 10) {
@barisesen
barisesen / cumsum.m
Created March 28, 2018 22:30
matlab cumsum function source code !
function X = cumSumFunc(image)
[m,n] = size(image);
X = zeros(m,n);
X(1,:) = image(1,:);
for i=2:m
for j=1:n
X(i,j) = image(i,j) + X(i-1,j);
end
end
end
<template>
<f7-page>
<f7-navbar :title="title" class="target-name" back-link="Back" sliding></f7-navbar>
<f7-messages>
<ul>
{{this.$route.params.username}}
<li v-for="(value, key) in $route.params" :key="'param-' + key"><b>{{key}}:</b> {{value}}</li>
</ul>
<f7-message v-for="message in messages"
:text="message.text"
@barisesen
barisesen / Admin.php
Created June 13, 2017 21:22
Laravel admin login with guard
<?php
//model
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Admin extends Authenticatable
{
@barisesen
barisesen / md5-decrypt.txt
Created February 18, 2017 07:26
md5-decrypt
1847f2fa2a8e97293b0db3201ecafc34 -> pau_{37.7387013,29.092491}
= truncate(@text, :length => 100, :omission => '', :separator => ',')