Skip to content

Instantly share code, notes, and snippets.

@berkesayin
berkesayin / .yml
Created November 30, 2023 10:19
graylog-password
graylog:
image: graylog/graylog:5.1
container_name: graylog
environment:
# Password: admin
GRAYLOG_ROOT_PASSWORD_SHA2: "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918"
@berkesayin
berkesayin / .yml
Last active December 31, 2023 16:00
docker-compose
version: '3'
networks:
graynet:
driver: bridge
# This is how you persist data between container restarts
volumes:
mongo_data:
driver: local
@berkesayin
berkesayin / gist:f5754a045225a588c8aa1236245ec057
Last active November 28, 2023 12:53
compose folder tree
my-app
├── Dockerfile
├── docker-compose.yml
├── node_modules/
├── package.json
├── spec
├── src
├── yarn.lock
const validateCreditCardNumber = require('./luhn-algorithm');
// Bu tool ile Credit Card Numarası Üretip Fonksiyonu Test Edebiliriz
// https://www.creditcardvalidator.org/generator
console.log(validateCreditCardNumber("4532201414641731")); // Visa = true
console.log(validateCreditCardNumber("5316400776001851")); // MasterCard = true
console.log(validateCreditCardNumber("379727417901957")); // Amex = true
console.log(validateCreditCardNumber("6222021199044319")); // UnionPay = true
console.log(validateCreditCardNumber("3016364233432398")); // Diners = true
// Validation For Credit Card Numbers Using Luhn Algorithm
const validateCreditCardNumber = (input) => {
// Kredi kartı numarasını sayısal bir diziye dönüştürme
let creditCardInt = input.split("").map(Number);
// Luhn Algoritması gereği her ikinci basamağı sondan başlayarak ikiyle çarparız
for (let i = creditCardInt.length - 2; i >= 0; i = i - 2) {
// Seçilen her ikinci basamağı geçici bir değişkende saklarız
let tempValue = creditCardInt[i];
dev
├── build
│ └── logs
│ │ └── debug_a.log
│ │ └── debug_b.log
│ │ └── debug_c.log
├── tests
│ └── test1.js
│ └── test2.js
@berkesayin
berkesayin / state-hook.js
Created July 15, 2022 13:01
React Hooks
import React, { useState } from 'react';
function Example() {
// Declare a new state variable, which we'll call "count"
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
@berkesayin
berkesayin / key.js
Last active June 27, 2022 14:22
Key
import { Component } from "react";
class Tweet extends Component {
render() {
return (
<div>
{this.props.tweet.map(tweet =>
<div key={tweet.tweet_id}>
{tweet.tweet_topic}
<br />
{tweet.tweet_detail}
@berkesayin
berkesayin / app.js
Last active May 8, 2024 15:09
props
import React, { Component } from 'react';
import Tweet from '../component/Tweet';
const tweet = [
{
tweet_id: 1,
tweet_topic: "Sports",
tweet_detail: "Liverpool, Manchester City ile arasındaki puan farkını 1'e düşürdü."
},
{
tweet_id: 2,
@berkesayin
berkesayin / .js
Created March 18, 2022 16:16
State
constructor(props) {
super(props);
this.state = {
categories:
[
{categoryId: 1, categoryName: "Sports" },
{categoryId: 2, categoryName: "Economy"}
]
};
}