Skip to content

Instantly share code, notes, and snippets.

@ismaail
ismaail / git.md
Last active November 15, 2019 18:33
GIT
Alias Command
g git
ga git add
gb git branch
gba git branch -a
gbd git branch -d
gc git commit -v
gc! git commit -v --amend
gcb git checkout -b
@ismaail
ismaail / number_to_string.php
Created November 7, 2019 21:48
Convert Number to Text (FR)
<?php
function number_to_string($number): string
{
$whole = floor($number);
$decimal = bcsub($number, $whole, 2);
$decimalPrefix = (-1 === bccomp($decimal, 0.1, 2)) ? 'zéro ' : '';
$decimal = bcmul($decimal, 100, 2);
<?php
class TestCase extends \PHPUnit\Framework\TestCase
{
public function testExample()
{
$refClass = new \ReflectionClass(\App\MyClass::class);
$refMethod = $refClass->getMethod('somePrivateMethod');
$refMethod->setAccessible(true); // make private method accessible
@ismaail
ismaail / datatable.js
Created April 20, 2019 20:21
datatable.js
import numeral from "numeral";
import * as moment from "moment";
import { datatableConfig } from "../config.json";
$(document).ready(() => {
const $datatable = $('#-datatable');
if (! $datatable) return;
numeral.localeData().delimiters.thousands = ' ';
@ismaail
ismaail / ArrayNotEmptyRule.php
Last active March 31, 2019 02:10
Array not empty - Laravel Validation Rule
<?php
namespace App\Rules;
/**
* Class ArrayNotEmpty
*
* @package App\Rules
*
* To register the rule, add in \App\Providers\AppServiceProvider
@ismaail
ismaail / toggle.html
Created June 4, 2018 21:04
toggle checkbox
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.switch {
position: relative;
display: inline-block;
width: 50px;
height: 22px;
@ismaail
ismaail / bs-config.json
Created April 4, 2018 17:03
bs-config.json
{
"port": 3000,
"files": [
"./build/**/*.{html,htm,css,js}"
],
"server": {
"baseDir": "./"
},
"delay": 3000,
"injectChanges": true,
@ismaail
ismaail / select.css
Created April 3, 2018 18:48
Select Input (uniform Browser style)
select.form-control {
padding-right: 20px;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4gMVEx0lHTdoJgAAAEBJREFUOMtjYBgFyICRHLXomv6TagATmoQ9EZrtCClIgroEG04k1o89WDR3kRqoW5A0byI3Zi4wMDCcG02gNAYA79cSVHAU23YAAAAASUVORK5CYII=') 99% center no-repeat;
}
@ismaail
ismaail / ModelTest.php
Last active December 21, 2017 05:27
Test Class
<?php
/**
* Class ModelTest
*
* @package AppTest\Model
*
* @codingStandardsIgnoreFile
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
.PHONY: up start stop down log artisan migrate scrap phone import composer supervisor-update fix-permissions ide-helper
# Set dir of Makefile to a variable to use later
MAKEPATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PWD := $(dir $(MAKEPATH))
CONTAINER_FPM := "container_fpm"
CONTAINER_NGINX := "container_nginx"
CONTAINER_SUPERVISOR := "container_supervisor"
up: