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
@bablukpik
bablukpik / gist:68a10f55a6ba87433685d9f1ab17d5de
Last active November 15, 2018 05:55 — forked from irazasyed/gist:4340722
PHP: Remove directory and its contents
/**
* Remove the directory and its content (all files and subdirectories).
* @param string $dir the directory name
*/
function rmrf($dir) {
foreach (glob($dir) as $file) {
if (is_dir($file)) {
rmrf("$file/*");
rmdir($file);
} else {
//Datatable Refresh
$('.dataTables').DataTable().ajax.reload();
// or
$('#example-select').on('change', function(){
$('#example').DataTable().ajax.reload();
});
//Destroy the old datatable
$('.dataTables').dataTable().fnDestroy();
What is sequence?
To generate sequential integers/numbers in database.
all sequences are maintain in system table called user_sequences;
desc user_sequences;
To check all sequences in the table as follows:
select sequence_name from user_sequences;
//Datatable
++++++++++++Datatable JS+++++++++++
$('#dataTable').DataTable(
{
"processing": true, // Show processing
"serverSide": true, // Server side processing
"ajax":{
url : '<?= route("dataProcessing")?>',
type : "POST",
@bablukpik
bablukpik / ReactJS
Last active September 12, 2017 11:02 — forked from sakukode/sublimetext.md
ReactJS
//Simple Application
<div id="myReactApp1"></div>
<div id="myReactApp2"></div>
<div id="myReactApp3"></div>
<script type="text/babel">
class Man extends React.Component {
render() {
return <h1>{"Name: "+this.props.name+", Age: "+this.props.age}</h1>
}
The top 3 JavaScript templating engines:
https://www.npmjs.com/package/underscore
https://www.npmjs.com/package/handlebars
https://www.npmjs.com/package/ejs
//v.01
//var express = require('express');
//var app = express();
var app = require('express')(); //server creation
Runtime vs Compile time:
-> In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads.
-> The source code must be compiled into machine code in order to become and executable program. This compilation process is referred to as compile time.(think of a compiler as a translator) A compiled program can be opened and run by a user. When an application is running, it is called runtime
-> In computer science, asynchronous I/O, or "Non-sequential I/O" is a form of input/output processing that permits other processing to continue before the transmission has finished. Input and output (I/O) operations on a computer can be extremely slow compared to the processing of data.
What is a CGI Script?
A CGI script is any program that runs on a web server.
//There is no window object like browser console. We can use like this as global.
-> A multidimensional array is an array containing one or more arrays. A two-dimensional array is an array of arrays (a three-dimensional array is an array of arrays of arrays).
//Array Functions:
array_pop() ->pops an element off end of the array.
array_push() ->pushes an element into the end of the array.
array_shift() ->pops an element off the beginning of the array.
array_unshift() ->pushes an element into the beginning of the array.
array_key_exists($key, $array2)
array_diff(array1,array2,array3...);
array_intersect($array1, $array2);
array_search("red",$a);
//Refresh particular element with jQuery
1. $("#printablediv").load(location.href + " #printablediv"); // Add space between URL and selector.
Or
$("#MainForm").load(location.href+" #MainForm", function() {
$(".select2").select2();
});
2. $('#showDetaildModalBody').load("<?php echo base_url('setup/OrganizationSetup/create')?>");
3. $("#find_gen_sdl").trigger("click");
4. Another Ajax Request inside Success Method
5. location.reload();
//JSON is a light-weight, language independent, data interchange format.
-> JSON Encode and Decode
-> JSON Encode:
->PHP json_encode() function is used for encoding JSON in PHP. Objects in PHP can be converted into JSON by using the PHP function json_encode().
i.e,
$myObj->name = "John";
$myObj->age = 30;
$myObj->city = "New York";
$myJSON = json_encode($myObj);
echo $myJSON;