Skip to content

Instantly share code, notes, and snippets.

View biplobice's full-sized avatar
🖥️
while (success!==true) { keepMovingForward(); }

Md Biplob Hossain biplobice

🖥️
while (success!==true) { keepMovingForward(); }
View GitHub Profile
@biplobice
biplobice / rest-api-response-format.md
Created September 9, 2022 04:54 — forked from igorjs/rest-api-response-format.md
REST API response format based on some of the best practices
@biplobice
biplobice / User.php
Created August 22, 2022 06:34 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@biplobice
biplobice / ssh-tutorial.md
Created May 20, 2022 06:58 — forked from slowkow/ssh-tutorial.md
ssh to a server without typing your password

How to ssh to a remote server without typing your password

Save yourself a few keystrokes. Follow the steps below:

  1. Run this Bash script on your laptop:

    #!/usr/bin/env bash
    

The hostname of your remote server.

@biplobice
biplobice / git-zip-changed-files.md
Created March 31, 2022 03:33 — forked from ciases/git-zip-changed-files.md
Git: zip changed files + diff

GIT: zip changed files + diff

Create zip archive with changed files

git archive -o update.zip HEAD $(git diff --name-only <starting SHA> HEAD)

or

@biplobice
biplobice / git-archive-patch.sh
Created March 31, 2022 02:58 — forked from josh-taylor/git-archive-patch.sh
Creates an archive of all files changed in a git repository since a given commit.
#!/bin/bash
# Explains how to use the script
usage()
{
cat << EOF
usage: $0 options
$0 -o output_file.zip commit_from [commit_to]
@biplobice
biplobice / gist:bd11c0fa5cb5ca08c043c8a42faa7f72
Created May 31, 2021 05:36 — forked from samarpanda/gist:4125105
Test your php code execution time and Memory usage
<?php
// from http://php.net/manual/en/function.filesize.php
function formatBytes($bytes, $precision = 2) {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
@biplobice
biplobice / curl.md
Created October 19, 2020 08:41 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@biplobice
biplobice / app.php
Created May 13, 2020 06:08 — forked from katzueno/app.php
concrete5 Environment switch according to host name
<?php
// /application/bootstrap/app.php
Route::register('/ccm/request_test', function() {
header("Pragma: no-cache");
echo '<dl>';
?><dt>Application environment:</dt><dd><?php echo ($this->app->environment()) ? $this->app->environment() : 'default'; ?></dd><?php
$request = \Concrete\Core\Http\Request::getInstance();
?><dt>Client IP:</dt><dd><?php echo $request->getClientIp(); ?></dd><?php
?><dt>Host:</dt><dd><?php echo $request->getHost(); ?></dd><?php
?><dt>Port:</dt><dd><?php echo $request->getPort(); ?></dd><?php
@biplobice
biplobice / sphp.sh
Last active January 9, 2019 11:58 — forked from rhukster/sphp.sh
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
brew_prefix=$(brew --prefix | sed 's#/#\\\/#g')
brew_array=("5.5","5.6","7.0","7.1","7.2", "7.3")
php_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
valet_support_php_version_array=("php@5.5" "php@5.6" "php@7.0" "php@7.1" "php@7.2" "php@7.3")
php_installed_array=()
php_version="php@$1"
@biplobice
biplobice / git-cheat-sheet.md
Created February 22, 2018 10:21 — forked from iansheridan/git-cheat-sheet.md
A cheat sheet for GIT

Setup

git clone <repo>

clone the repository specified by ; this is similar to "checkout" in some other version control systems such as Subversion and CVS

Add colors to your ~/.gitconfig file: