Skip to content

Instantly share code, notes, and snippets.

View shellprog's full-sized avatar
🏠
Working from home

Md Imran shellprog

🏠
Working from home
View GitHub Profile
@shellprog
shellprog / code-review-checklist.md
Created November 11, 2022 10:40 — forked from nerandell/code-review-checklist.md
PHP Code Review Guidelines

Make sure these boxes are checked before submitting/approving the PR

General

  • The code works
  • The code is easy to understand
  • Follows coding conventions
  • Names are simple and if possible short
  • Names are spelt correctly
  • Names contain units where applicable
  • There are no usages of magic numbers
*, :after, :before {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box
}
body, html {
font-family: Arial, sans-serif;
@shellprog
shellprog / number.php
Created November 11, 2018 05:18
Format Number
<?php
$res = preg_replace("/[^0-9]/", "", "0 - 22 1985--324" );
$arr = str_split($res, 3);
if(strlen($arr[sizeof($arr) - 1]) == 1){
$end_str = $arr[sizeof($arr) - 2].$arr[sizeof($arr) - 1];
$end_arr = str_split($end_str, 2);
@shellprog
shellprog / wait.ts
Created October 31, 2018 11:45
Retry Failed Image Load in Angular
waitAndReload(event) {
const originalSrc = event.target.src;
if (parseInt(event.target.getAttribute('data-retry'), 10) !== parseInt(event.target.getAttribute('data-max-retry'), 10)) {
event.target.setAttribute('data-retry', parseInt(event.target.getAttribute('data-retry'), 10) + 1);
event.target.src = '/assets/images/placeholder.png';
@shellprog
shellprog / script.js
Last active April 26, 2018 18:17
Add Edit Handlers
$('#add_task').submit(function(event){
/* Stop form submitting normally */
event.preventDefault();
var title = $('#task_title').val();
if(title)
{
//ajax post the form
@shellprog
shellprog / script.js
Last active April 26, 2018 18:18
Task Edit
function edi_task(id,title) {
$('#edi_task_id').val('id');
$('#edi_task_title').val('title');
show_form('edi_task');
}
@shellprog
shellprog / script.js
Last active April 26, 2018 18:19
Task Delete
function delete_task(id)
{
$.get("/delete/"+id, function(data){
if(data == 'OK')
{
var target = $('#'+id);
target.hide('slow',function(){
target.remove();
});
@shellprog
shellprog / script.js
Last active April 26, 2018 18:19
Task Done
function task_done(id)
{
$.get("/done/"+id, function(data){
if(data == 'OK')
{
$('#'+id).addClass('success');
}
});
}
@shellprog
shellprog / script.js
Last active April 26, 2018 18:19
Show Form
function show_form(form_id)
{
$('form').hide();
$('#'+form_id).show('slow');
}
@shellprog
shellprog / index.html
Last active April 26, 2018 18:20
Task
<div class="panel panel-default">
              <div class="panel-heading">
                <h3 class="panel-title" style="line-height:30px;">Tasks <div class="pull-right"><a href="#" onClick="show_form('add_task');" class="btn btn-info"><i class="icon-white icon-plus"></i> Add Task</a></div></h3>
              </div>
              <div class="panel-body">
                  @foreach($tasks as $task)
                    <table class="table" id="task_list">
                      <thead>                       
                        <tr>Title</tr>
                        <tr></tr>