Skip to content

Instantly share code, notes, and snippets.

Bilal Haidar bhaidar

  • Remote
View GitHub Profile
@bhaidar
bhaidar / git-helpers.plugin.zsh
Created May 27, 2020 — forked from clauswitt/git-helpers.plugin.zsh
Git zsh aliases and functions
View git-helpers.plugin.zsh
#git aliases
alias gsts='git status --short'
alias c='git commit '
alias gd='git diff '
alias clean='git clean -f'
alias gl='git l'
#git function to add last parameter of last command via git add (used after a diff)
gal() {
@bhaidar
bhaidar / postgres-cheatsheet.md
Created Apr 7, 2020 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
View algo.js
function diffArray(arr1, arr2) {
let arr1UniqueItems = arr1.filter(item => arr2.indexOf(item) < 0);
let arr2UniqueItems = arr2.filter(item => arr1.indexOf(item) < 0);
return [...arr1UniqueItems, ...arr2UniqueItems];
}
@bhaidar
bhaidar / random.js
Created Mar 18, 2020 — forked from kerimdzhanov/random.js
JavaScript: get a random number from a specific range
View random.js
/**
* Get a random floating point number between `min` and `max`.
*
* @param {number} min - min number
* @param {number} max - max number
* @return {number} a random floating point number
*/
function getRandomFloat(min, max) {
return Math.random() * (max - min) + min;
}
@bhaidar
bhaidar / visual-ui-test-script
Last active Feb 25, 2020
Visual UI Test Script Appium Applitools AWS Device Farm
View visual-ui-test-script
"use strict";
;(async () => {
const webdriver = require("selenium-webdriver");
const LOCAL_APPIUM = "http://127.0.0.1:4723/wd/hub";
// Initialize the eyes SDK and set your private API key.
const { Eyes, Target, FileLogHandler, BatchInfo, StitchMode } = require("@applitools/eyes-selenium");
@bhaidar
bhaidar / README.md
Created Feb 8, 2020 — forked from remarkablemark/README.md
Classes - ES5 vs ES6
View README.md

JavaScript Classes - ES5 vs ES6

An example that shows the difference between creating a JavaScript class and subclass in ES5 and ES6.

Reference

@bhaidar
bhaidar / private_fork.md
Created Jan 25, 2020 — forked from 0xjac/private_fork.md
Create a private fork of a public repository
View private_fork.md

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)
    git clone --bare git@github.com:usi-systems/easytrace.git
@bhaidar
bhaidar / circleci-config-yml
Created Dec 23, 2019
.circleci/config.yml
View circleci-config-yml
version: 2
jobs:
build:
working_directory: ~/applitools-github-circleci
docker:
- image: cypress/base:10
steps:
- checkout
- restore_cache:
keys:
@bhaidar
bhaidar / sales-force-contact-form
Last active Dec 24, 2019
sales-force-contact-form
View sales-force-contact-form
/// <reference types="Cypress" />
context('Applitools', () => {
beforeEach(() => {
// Open the Applitools Test
cy.eyesOpen({
appName: 'Applitools CircleCI',
browser: [
{ width: 800, height: 600, name: 'firefox' },
@bhaidar
bhaidar / Postman POST PUT Requests.txt
Created Nov 21, 2019 — forked from ethanstenis/Postman POST PUT Requests.txt
How to make Postman work with POST/PUT requests in Laravel...
View Postman POST PUT Requests.txt
To make Postman work with POST/PUT requests...
https://laravel.com/docs/5.2/routing#csrf-x-csrf-token
In addition to checking for the CSRF token as a POST parameter, the Laravel VerifyCsrfToken middleware will also check for the X-CSRF-TOKEN request header.
1. Store the token in a "meta" tag at the top of your root view file (layouts/app.blade.php)...
<meta name="csrf-token" content="{{ csrf_token() }}">
** If using jQuery, you can now instruct it to include the token in all request headers.
$.ajaxSetup({
You can’t perform that action at this time.