Skip to content

Instantly share code, notes, and snippets.

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

krutarth patel karmadice

🏠
Working from home
View GitHub Profile
@karmadice
karmadice / RegistrationFormRequest.php
Last active April 27, 2022 13:10
Laravel 9 Validation testcase
<?php
namespace App\Http\Requests;
use App\Rules\IsValidPassword;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Validation\ValidationException;
@karmadice
karmadice / Book - Docs
Last active January 27, 2021 05:05
To learn PHP
https://phptherightway.com/
https://github.com/bmorelli25/Become-A-Full-Stack-Web-Developer
https://github.com/marcelgsantos/learning-oop-in-php
https://github.com/kamranahmedse/developer-roadmap
https://github.com/bayandin/awesome-awesomeness
@karmadice
karmadice / add_service.php
Created April 4, 2018 06:18 — forked from buonzz/add_service.php
add service provider in laravel dynamically
App::register('MyApp\Providers\MyServiceProvider');
@karmadice
karmadice / qmn_quiz.js
Created January 31, 2018 13:07
Changes to make in QSM plugin
function qmnDisplayError( message, field, quiz_form_id ) {
jQuery( '#' + quiz_form_id + ' .qmn_error_message_section' ).addClass( 'qmn_error_message' );
jQuery( '#' + quiz_form_id + ' .qmn_error_message' ).text( message );
// Targate Span before Input instead of whole container
field.prev('.mlw_qmn_question').addClass( 'qmn_error' );
//field.closest( '.quiz_section' ).addClass( 'qmn_error' );
}
function qmnValidation( element, quiz_form_id ) {
// Remove Error class before validation start
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Include Required Prerequisites -->
<script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
<?php
function encryptIt($q) {
$cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
$qEncoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), $q, MCRYPT_MODE_CBC, md5(md5($cryptKey))));
return( $qEncoded );
}
function decryptIt($q) {
$cryptKey = 'qJB0rGtIn5UB1xG03efyCp';
$qDecoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($cryptKey), base64_decode($q), MCRYPT_MODE_CBC, md5(md5($cryptKey))), "\0");
@karmadice
karmadice / get_start_end_date_of_current_week.php
Last active August 3, 2017 08:00
Date and time related functions
<?php
//Get current week number
$week = date('W');
//Get current year
$year = date('Y');
//Date time object
$dto = new DateTime();
$week_start = $dto->setISODate($year, $week, 0)->format('d-m-Y');
$week_end = $dto->setISODate($year, $week, 6)->format('d-m-Y');
@karmadice
karmadice / inline_edit.html
Created July 5, 2017 11:26
usefull codes.txt
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
function execute_curl($url = "") {
if ($url == "") {
$url = 'https://codecanyon.net/item/woocommerce-pdf-vouchers-wordpress-plugin/reviews/7392046';
}
https://webrtc.github.io/samples/