Skip to content

Instantly share code, notes, and snippets.

View ercumentlacin's full-sized avatar
👨‍💻
developing

ercüment ercumentlacin

👨‍💻
developing
View GitHub Profile
@ercumentlacin
ercumentlacin / createDiagram.js
Created April 28, 2022 17:55
createDiagram.js
/*
createDiagram(7, 3) return should be:
'* '
' * '
' *'
' *'
' * '
'* '
' * '
*/
@ercumentlacin
ercumentlacin / sassas.md
Created March 22, 2022 16:30 — forked from AdamMarsden/sassas.md
Sass Architecture Structure

Sass Architecture Structure

sass/
|
|– base/
|   |– _reset.scss       # Reset/normalize
|   |– _typography.scss  # Typography rules
|   ...                  # Etc…
|
@ercumentlacin
ercumentlacin / myArray.js
Created January 8, 2022 13:25
Array methods implementation
class MyArrayConstructor {
constructor() {
this.length = 0;
}
push(value) {
this[this.length] = value;
this.length += 1;
return this.length;
}
@ercumentlacin
ercumentlacin / getFunctionArgs.js
Created January 5, 2022 07:00
get function arguments as array
/**
* get function arguments as array
* @param {Function} fn
* @returns {String[]} arguments as array
*/
function getFunctionArgs(fn) {
if (typeof fn !== 'function') throw new Error('fn must be a function');
if (fn.length === 0) return [];
const STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm;
// usage like this: <div class="mt20">Content</div> to give you margin-top: 10px
.make-margins(@size: 50, @decrement: 5) when (@size >= 0) {
.make-margins(@size - @decrement);
@size-px: ~'@{size}px';
.m@{size} {
margin: @size-px;
}
/* değiştirilebilir ve yalnızca bir defa tanımlanabilir bir ifade */
let number = 10;
console.log(number); // Çıktı: 10
number = 20;
console.log(number); // Çıktı: 20
let number = 30; // Hata, Uncaught SyntaxError: Unexpected number
/* block scope'tur bulunduğu yerden ulaşılabilirdir sadece */
let foo='outside';
const number = 10;
console.log(number); // Çıktı: 10
const number = 20; // Identifier 'number' has already been declared
// gördüğünüz üzere değeri değiştirmek istediğimiz hata aldık
const fruit = "banana";
console.log(fruit); // Çıktı: banana
furit = apple; // Uncaught ReferenceError: apple is not defined
// gördüğünüz üzere değeri değiştirmek istediğimizde yine hata aldık
// var kullanırken değişkenleri tekrar tekrar tanımlayabiliriz.
var number = 10;
var number = 20;
var number = 0;
number = 5;
var number = 18;
console.log(number); // Çıktı: 18
function var02() {
var x = 1;
function bar() {
var y = 2;
console.log(x); // 1 ("x" bar fonksiyonunu kapsar)
console.log(y); // 2 ("y" function scope)
}
bar();
console.log(x); // Çıktı: 1
console.log(y); // Çıktı: Uncaught ReferenceError: y is not defined, "y" sadece bar içinde çalışır
var x = 1;
if (x === 1) {
var x = 2;
var y = 8
console.log(x);
// Çıktı: 2
}