Skip to content

Instantly share code, notes, and snippets.

Avatar

Ali Raza a1iraxa

View GitHub Profile
@a1iraxa
a1iraxa / async-await-forEach-alternatives.md
Created October 15, 2021 15:27 — forked from joeytwiddle/async-await-forEach-alternatives.md
Do not use forEach with async-await
View async-await-forEach-alternatives.md

Do not use forEach with async-await

TLDR: Use for...of instead of forEach in asynchronous code.

The problem

Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)

For example, the following forEach loop might not do what it appears to do:

View gist:008ffbb804a7319d875f93833e7148ce
You could just make your own pg_dump directly from your Heroku database.
First, get your postgres string using `heroku config:get DATABASE_URL`.
Look for the Heroku Postgres url (example: `HEROKU_POSTGRESQL_RED_URL: postgres://user3123:passkja83kd8@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398`), which format is `postgres://<username>:<password>@<host_name>:<port>/<dbname>`.
Next, run this on your command line:
pg_dump --host=<host_name> --port=<port> --username=<username> --password --dbname=<dbname> > output.sql
@a1iraxa
a1iraxa / SSL-certs-OSX.md
Created June 28, 2021 16:45 — forked from croxton/SSL-certs-OSX.md
Generate ssl certificates with Subject Alt Names
View SSL-certs-OSX.md

Generate ssl certificates with Subject Alt Names on OSX

Open ssl.conf in a text editor.

Edit the domain(s) listed under the [alt_names] section so that they match the local domain name you want to use for your project, e.g.

DNS.1   = my-project.dev

Additional FQDNs can be added if required:

@a1iraxa
a1iraxa / copy.js
Created April 15, 2021 23:08 — forked from GarySwift/copy.js
5 ways copy text to clipboard using jQuery (+ JavaScript)
View copy.js
jQuery(document).ready(function($) {
// If a copy clickable input is clicked
// input value will be highlighted and copied to clipboard
$('body').on('click', 'input.js-click-to-copy-input', function(e) {
copy_input( this );
});
// If a button to copy an input is clicked
// associated input value will be highlighted and copied to clipboard
$('body').on('click', 'a.js-click-to-copy-link', function(e) {
@a1iraxa
a1iraxa / List.md
Created July 24, 2020 16:50 — forked from msurguy/List.md
List of open source projects made with Laravel
View List.md

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

View mysql cheatsheet.md

MySQL Cheatsheet

This is a collection of the most common commands I run while administering Mysql databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Mysql has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu 14.04

https://help.ubuntu.com/14.04/serverguide/mysql.html

sudo apt-get update
View mysql_cheat_sheet.md

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@a1iraxa
a1iraxa / app-1.js
Created March 31, 2020 17:06 — forked from igorbenic/app-1.js
Using React to Render Content from WP REST API | https://ibenic.com/react-render-content-wp-rest-api
View app-1.js
class App extends React.Component {
render() {
return (
bla
)
}
}
const element = <App />
@a1iraxa
a1iraxa / Component.jsx
Created March 29, 2020 16:57 — forked from krambertech/Component.jsx
ReactJS: Input fire onChange when user stopped typing (or pressed Enter key)
View Component.jsx
import React, { Component } from 'react';
import TextField from 'components/base/TextField';
const WAIT_INTERVAL = 1000;
const ENTER_KEY = 13;
export default class TextSearch extends Component {
constructor(props) {
super();