Skip to content

Instantly share code, notes, and snippets.

View mehmetsefabalik's full-sized avatar
🐟

Mehmet Sefa mehmetsefabalik

🐟
View GitHub Profile
@mehmetsefabalik
mehmetsefabalik / jsGenerators.js
Created July 24, 2018 11:12
Javascript Generators and Iterators
// Iterators
const alpha = ['a','b','c'];
const it = alpha[Symbol.iterator]();
it.next(); //{ value: 'a', done: false }
it.next(); //{ value: 'b', done: false }
it.next(); //{ value: 'c', done: false }
it.next(); //{ value: undefined, done: true }
// Generate Fibonacci Sequence using Generator Function
def log_on_exception(tag1, tag2):
def deco(func):
def wrapper(*args, **kwargs):
try:
result = func(*args, **kwargs)
except exception as err:
logger(err, tag1, tag2)
else:
return result
return wrapper
@mehmetsefabalik
mehmetsefabalik / jdkonmacos.md
Created June 2, 2019 23:04
Installing JDK on MacOS

Installing JDK on MacOS

brew update

brew tap caskroom/cask

brew install java

@mehmetsefabalik
mehmetsefabalik / launch.json
Created October 25, 2019 07:01
vscode debugger picking process
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"processId": "${command:PickProcess}",
"restart": true,
"protocol": "inspector",
@mehmetsefabalik
mehmetsefabalik / multi-line-overflow.css
Last active January 21, 2020 12:42
css text overflow example with one line and multiple lines
.one-line-overflow {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.multi-line-overflow {
white-space: normal;
display: -webkit-box;
-webkit-box-orient: vertical;
@mehmetsefabalik
mehmetsefabalik / ssl-nginx.md
Last active August 28, 2020 21:58
setup an ngnix proxy server with ssl on linux

install nginx

  • sudo apt install nginx
  • sudo rm /etc/nginx/sites-available/default
  • sudo rm /etc/nginx/sites-enabled/default

setup nginx config for the first time

  • sudo vim /etc/nginx/sites-available/yourdomainname.com
server {
     listen 80;
10minutemail.com
remove.bg
unscreen.com
hemingwayapp.com
idphoto4you.com
myairbridge.com
loader.to
informationisbeautiful.net
nek.istanbul.edu.tr
spik.ai

certbot -d DOMAINNAME --manual --logs-dir certbot --config-dir certbot --work-dir certbot --preferred-challenges dns certonly

Remove local branches except master

git branch | grep -v '^*' | xargs git branch -D

Remove remote branches except master

REMOTE='origin' && MASTER='master' && git branch -r |  grep '^  ${REMOTE}/' | sed 's|^  ${REMOTE}/|:|' | grep -v '^:HEAD' | grep -v '^:${MASTER}$' | xargs git push ${REMOTE}
@mehmetsefabalik
mehmetsefabalik / nginx-https-local.md
Last active September 2, 2024 23:59
Enable https on your local environment with nginx

enable https on your local environment

install mkcert and create certificates

brew install mkcert
mkcert -install