Skip to content

Instantly share code, notes, and snippets.

View moloy666's full-sized avatar

Moloy Pradhan moloy666

View GitHub Profile
@moloy666
moloy666 / gist:4342cf66b7d047bf39f9e45f392ff354
Created April 27, 2024 11:59
convert data to csv in yii
$dataProvider = $this->getPendingBookingsDataProvider();
$models = $dataProvider->getModels();
Yii::$app->response->format = Response::FORMAT_RAW;
Yii::$app->response->headers->set('Content-Type', 'text/csv');
Yii::$app->response->headers->set('Content-Disposition', 'attachment; filename="data.csv"');
Yii::$app->response->send();
$csvHeader = ['#', 'Customer', 'Contact', 'Camp Name', 'Event Name', 'Check In', 'Total Price', 'Created At', 'Status'];
@moloy666
moloy666 / gist:d2724ad08ca5e4d97c87c4fc32c4fa8e
Created April 22, 2024 10:26
get query parameter value from url in javascript
var urlString = "https://example.com/page?param1=value1&param2=value2";
var urlParams = new URLSearchParams(urlString);
var paramValue = urlParams.get('param1');
console.log(paramValue);
{
"registration_ids": [
"c7jaWC54QtOgQscrJLPQCw:APA91bHBvfBHmukpkbV0dd-HC3ML8OEN23MXM1Zc0SKQXNS2sbXSylYsoI4yguMLHRVwZL1D9hqunLk8cI0Q2qpZfcGPeg1zxq56TNEYGw-sVG-4CZoBH_IO_W2qxCQbfXVfGKmZy03D",
"fNMPcor0QD6SRGkYLNT6uf:APA91bH4nfL4HY0maMcq7n6v0hA88275-shzhI8QA-Epq6hBBopluuOIjJwn0Gba5OrW-s4Pv0AnW_oI3I4c68tKCW9ifiB6yjKYoMTuj9fFsP2OcDN7U5frrX89H5csTy2vee02qyxC"
],
"notification": {
"title": "Push Notice from notification",
"body": "Testing Done from Postman(notification)",
"image": "https://i.pravatar.cc/300"
},
@moloy666
moloy666 / gist:281f48ba63500493289d4e0ac59993f6
Created November 7, 2023 10:16
remove index.php from url in ci4
move .htaccess & index.php file from public folder to root folder
index.php changes
This line(Link no 34 or 35) =>
require FCPATH . '../app/Config/Paths.php';
To this => require FCPATH . 'app/Config/Paths.php';
@moloy666
moloy666 / frontend.js
Created November 6, 2023 13:01
search pincode, return locality, officename, district
function get_pincode_details(pincode){
$.ajax({
type: "GET",
url: base_url + controller + '/pincode_details?pincode=' + pincode,
success: function (resp) {
if(resp.success){
// console.log(resp);
let data = resp.data;
let view = ``;
$.each(data, function(i, value){