Skip to content

Instantly share code, notes, and snippets.

<?php
// Database configuration
$dbHost = 'localhost'; // Change this to your database host
$dbName = 'your_database_name'; // Change this to your database name
$dbUser = 'your_username'; // Change this to your database username
$dbPass = 'your_password'; // Change this to your database password
// PDO connection
try {
@shiv122
shiv122 / docker-digitalocean
Created October 18, 2023 08:36
CI Docker, GH Action & Digital ocean
name: CI
# 1
# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for the master branch
push:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
@shiv122
shiv122 / CI_LARAVEL
Created October 18, 2023 07:14
Laravel CI (GH Action)
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
@shiv122
shiv122 / cookies_concent
Created March 27, 2023 06:24
cookie_consent
cookieconsent.run({
current_lang: 'en',
autoclear_cookies: true, // default: false
page_scripts: true, // default: false
// mode: 'opt-in' // default: 'opt-in'; value: 'opt-in' or 'opt-out'
// delay: 0, // default: 0
// auto_language: null // default: null; could also be 'browser' or 'document'
// autorun: true, // default: true
// force_consent: false, // default: false
@shiv122
shiv122 / gradient-text
Created March 23, 2023 06:13
gradient-test
background: -webkit-linear-gradient(300deg, #93f5ec 20%, #a77bf3 70%);
-webkit-background-clip: text;
background-clip: text;
-webkit-text-fill-color: transparent;
-webkit-box-decoration-break: clone;
@shiv122
shiv122 / new_user_mysql
Created March 16, 2023 13:01
new_user_mysql
create user 'remote_shiv'@'157.245.102.197' identified by 'Shiv_123';
alter user 'remote_shiv'@'157.245.102.197' identified with mysql_native_password by 'Shiv_123';
create database database_name;
flush privileges;
@shiv122
shiv122 / calculate dice
Created March 14, 2023 12:46
calculate dice
function calculateDiceProbabilities(history) {
const counts = [0, 0, 0, 0, 0, 0];
// Count the occurrences of each number in the history
for (let i = 0; i < history.length; i++) {
const roll = history[i];
if (roll >= 1 && roll <= 6) {
counts[roll - 1]++;
}
}
@shiv122
shiv122 / doble-click and batatable row values
Created February 16, 2023 08:54
doble-click and batatable row values
$(document).on('dblclick', 'tr', function() {
const data = $('#report-table').DataTable().row(this).data();
console.log(data);
});
@shiv122
shiv122 / someOfRequired
Created January 25, 2023 04:51
if-some-of-array-required
// 'prices.*.duration' => 'string|required_if:prices.*.for,call,video,consultation',
@shiv122
shiv122 / drop-all-tables
Created January 13, 2023 12:55
drop all tables
SET FOREIGN_KEY_CHECKS = 0;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_schema, '`.`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = 'curvicare'; -- specify DB name here.
SET @tables = CONCAT('DROP TABLE ', @tables);
PREPARE stmt FROM @tables;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;