Skip to content

Instantly share code, notes, and snippets.

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

Bablu Ahmed bablukpik

🏠
Working from home
View GitHub Profile
//Constraints = a limitation or restriction, discipline
//What is SQL ALTER TABLE statement
-> The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.
-> The ALTER TABLE statement is also used to add and drop various constraints on an existing table.It is also used to rename a table.
--Tables
CREATE TABLE states (
$this->db->query("alter session set nls_date_format='YYYY-MM-DD HH24:MI:SS'");
echo $this->db->last_query();
//Date Save like dd/mm/yy to database as follows:
$date = str_replace('/', '-', $this->input->post('tender_date'));
$date = date('Y-m-d', strtotime($date));
$data['tender_date'] = date("Y-m-d", strtotime(str_replace('/', '-', $this->input->post('tender_date'))));
//Show date like 24th Nov 18, 9:52 AM as follows:
echo date("jS M y, G:i A", strtotime($row1->CRE_DT))
@bablukpik
bablukpik / CI_Model
Last active November 17, 2018 14:36
Shortcut method: https://code.tutsplus.com/tutorials/6-codeigniter-hacks-for-the-masters--net-8308
function updateDataBablu($tableName, $data, $condition)
{
//Data
$arr_data = array_map(function($k, $v){
return "$k='$v'";
}, array_keys($data), array_values($data));
$data_str = implode(", ",$arr_data);
//Condition
// ----------------------- '+!!' operator in an if statement-------------------------------
It is an unary conversion to give a 0/1 number result
+!!true; //this converts true to false, then to true again, and true is 1 when converted
+!!0; //converts 0 (falsy) to true, then false, and then the numeric 0
Technically speaking !! is not its own operator, it's just the NOT (!) operator twice.
//--------------------------What does “!--” do in JavaScript?-----------------------------------------
! inverts a value, and gives you the opposite boolean:
@bablukpik
bablukpik / Jquery
Last active September 24, 2017 11:24
//Form validation:
$(document).ready(function() {
$("#mobile").on("keyup change", function(){
var mobile = $(this).val();
var formURL = "http://nextadmission.com/form/mobile_check";
$.ajax({
url : formURL,
type : "POST",
data : { mobile_no : mobile},
success : function(data){
private function pr($data)
{
echo "<pre>";
print_r($data);
echo "</pre>";
exit;
}
//GD2 for thumb and full size image
//v.01
Head:
HEAD is a ref (reference) to the currently checked out commit. In normal states, it's actually a symbolic ref to the branch you have checked out.
//01// Rollback Using git Reset:
->If you want to fix up your latest commit, you can undo the commit, and unstage the files in it, by doing:
->If you want to uncommit N commits, but keep the code changes in your working directory:
git reset HEAD~N
->If we want to delete commit but file will be not changed
git reset --soft commit_hash
@bablukpik
bablukpik / Forms
Last active January 2, 2017 04:52
These forms are for jquery and javascript
//01//serializeArray() // Here is not submit button hence all fields dada will not go to url
->The serializeArray() method creates an array of objects (name and value) by serializing form values.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var x = $("form").serializeArray();
//i.e.3 Edit
->HTML Edit Button maker_list.php
<button class="action-buyer" onClick="oneditMaker(<?php echo "'".$maker2['id']."'" ?>)">編集</button>
//then (Function Call By button) maker_list.php
function oneditMaker(makerId){
editMaker(makerId);
if(hideViewMessageChoiceBuyer && typeof hideViewMessageChoiceBuyer === 'function'){
hideViewMessageChoiceBuyer();
}
->XMLHttpRequest (XHR) is (an API) an object whose methods transfer data between a web browser and a web server. The object is provided by the browser's JavaScript environment.
i.e $.ajax(), $.get(), $.post()
->Syntax: $.ajax({name:value, name:value, ... })
->The parameters specifies one or more name/value pairs for the AJAX request.
->Possible names/values in the table below:
Name ->Value/Description
async ->A Boolean value indicating whether the request should be handled asynchronous or not. Default is true
beforeSend(xhr) ->A function to run before the request is sent
cache ->A Boolean value indicating whether the browser should cache the requested pages. Default is true