Skip to content

Instantly share code, notes, and snippets.

View ridvanaltun's full-sized avatar
🐴
prostagma?

Rıdvan Altun ridvanaltun

🐴
prostagma?
View GitHub Profile
@ridvanaltun
ridvanaltun / README.md
Last active November 2, 2021 23:08
Bugsnag React-Native bundle uploader

manual

# use for production
node bugsnag.upload.js

# use for development
node bugsnag.upload.js --dev
@ridvanaltun
ridvanaltun / README.md
Created September 28, 2021 07:24
Commitlint limit scopes per type via scope-enum
@ridvanaltun
ridvanaltun / esm-package.md
Created September 25, 2021 10:58 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ridvanaltun
ridvanaltun / README.md
Created September 9, 2021 08:09
Metasyntactic Variables
@ridvanaltun
ridvanaltun / README.md
Created September 1, 2021 22:29
Rare JS Tips
// nullish coalescing
// if foo is null or undefined use bar, otherwise use foo
// not all browsers supported, it is a new feature
const value = foo ?? bar;

// if foo is falsy ('', "", ``, , 0, -0, 0n, null, undefined, NaN, false) use bar, otherwise use foo
const value = foo || bar;

// styling console.log
@ridvanaltun
ridvanaltun / README.md
Created August 25, 2021 20:23
useState Lazy initialization
@ridvanaltun
ridvanaltun / App.js
Last active August 25, 2021 19:26
Error Boundaries in React Native
import React, {Component} from 'react';
import {Text, View} from 'react-native';
import CounterApp from '../Components/CounterApp';
import ErrorBoundries from '../Components/ErrorBoundries';
export default class AppContainer extends Component {
render() {
return (
<>
<Text style={{alignSelf: 'center', marginTop: 20}}>Counter App</Text>
@ridvanaltun
ridvanaltun / random-git-message.md
Last active August 25, 2021 19:23
Random Git Message from whatthecommit.com
# tested on linux and macOS
echo $(wget whatthecommit.com -q -O -) | tr -d '\n' | sed -e 's/.*<p>\(.*\)<\/p>.*/\1/' | awk '{split($0,a,"</p>"); print a[1]}'
@ridvanaltun
ridvanaltun / db-connect-test.md
Created August 14, 2021 20:34
DB test in PHP

before start

  • open your php.ini file
  • remove semicolon from ;extension=mysqli like extension=mysqli

code

<?php
# Fill our vars and run on cli
@ridvanaltun
ridvanaltun / docker-compose.yaml
Last active August 14, 2021 19:40
OpenCart Docker Compose
version: '2'
services:
mariadb:
image: docker.io/bitnami/mariadb:10.3
container_name: opencart-db
volumes:
- 'mariadb_data:/bitnami/mariadb'
env_file:
- production.env
phpmyadmin: