Skip to content

Instantly share code, notes, and snippets.

Avatar

Abdul Rahman the7th

View GitHub Profile
@the7th
the7th / method.php
Created Apr 24, 2019
proof of payment
View method.php
add_action( 'woocommerce_checkout_order_review', 'method_proof_of_payment', 10, 1 );
add_action( 'woocommerce_checkout_order_review', 'check_order', 10, 1 );
function method_proof_of_payment() {
echo "<script>
jQuery( document ).ajaxComplete(function() {
if(jQuery('#payment_method_cod').is(\":checked\")){
jQuery('label[for=\"wccf_checkout_field_proof_payment\"]').show();
@the7th
the7th / sanitize_phone_number_malaysia.php
Created Jun 5, 2018
Sanitize phone number for Malaysia
View sanitize_phone_number_malaysia.php
<?php
$prepare_phone_num = $phone_num;
$phone = $prepare_phone_num;
$phone = str_replace(["-", "–", " ", "+"], '', $phone);
if ("0" == substr($phone, 0, 1))
{
$phone = "6" . $phone;
}
@the7th
the7th / fpdf-image.php
Last active Apr 18, 2018 — forked from timneutkens/fpdf-image.php
Insert base64 image data into fpdf
View fpdf-image.php
<?php
// load the 'fpdf' extension
require('fpdf.php');
// just for demonstration purpose, the OP gets the content from a database instead
$h_img = fopen('img.jpg', "rb");
$img = fread($h_img, filesize('img.jpg'));
fclose($h_img);
// prepare a base64 encoded "data url"
@the7th
the7th / LimitController.php
Last active Mar 6, 2018
Laravel Eloquent LIMIT
View LimitController.php
<?php
// below is just a sample code
$specificProject = DB::table('projects')
->select('projects.id', 'projects.project_name', 'projects.progress_percent', 'projects.project_note_id', 'projects.project_status', 'project_notes.notes', 'project_timeline.start_date', 'project_timeline.end_date', 'assigned_project.id', 'assigned_project.project_assigned_to_user', 'users.name')
->join('project_notes', 'projects.id', '=', 'project_notes.project_id')
->join('project_timeline', 'projects.id', '=', 'project_timeline.project_id')
->join('assigned_project', 'projects.id', '=', 'assigned_project.project_id')
->join('users', 'assigned_project.project_assigned_to_user', '=', 'users.id')
->orderBy('project_notes.id', 'DESC')
@the7th
the7th / .gitignore
Last active Aug 15, 2017
gitignore for Gradle based Project in IntelliJ
View .gitignore
# Cache of project
.gradletasknamecache
# Ignore Gradle GUI config
gradle-app.setting
## File-based project format:
*.iws