Skip to content

Instantly share code, notes, and snippets.

View Super-Chama's full-sized avatar
🍊
Back to office

Chamara Abesinghe Super-Chama

🍊
Back to office
View GitHub Profile
@Super-Chama
Super-Chama / -
Created December 27, 2017 17:09 — forked from anonymous/-
System: Host: batputer Kernel: 4.10.0-38-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.6.6 (Gtk 3.18.9-1ubuntu3.3) dm: lightdm Distro: Linux Mint 18.3 Sylvia
Machine: System: LENOVO (portable) product: 80XL v: Lenovo ideapad 320-15IKB
Mobo: LENOVO model: LNVNB161216 v: NO DPK Bios: LENOVO v: 4WCN37WW date: 12/04/2017
Chassis: type: 10 v: Lenovo ideapad 320-15IKB
CPU: Dual core Intel Core i3-7100U (-HT-MCP-) cache: 3072 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 9600
clock speeds: min/max: 400/2400 MHz 1: 699 MHz 2: 699 MHz 3: 699 MHz 4: 699 MHz
Graphics: Card: Intel Device 5916 bus-ID: 00:02.0 chip-ID: 8086:5916
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
@Super-Chama
Super-Chama / ticket_count_shortcode.php
Created September 20, 2018 18:29
WP-Eventer Plugin shortcode to get remaining tickets.
//Product Sales Shortcode
function ticket_count_shortcode( $atts ) {
$atts = shortcode_atts( array( 'id' => null, 'count' => 0), $atts, 'bartag' );
if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){
$_product = wc_get_product( $atts['id'] );
$tickets_left = $atts['count']-($_product->get_total_sales());
}
return $tickets_left;
}
@Super-Chama
Super-Chama / simple_fizzbuzz.js
Created January 26, 2019 19:00
Just tried a fizzbuzz. i guess i pass.
function fizzBuzz() {
var number = 1;
for (var i = 0; i < 100; i++) {
var bool = true;
if (number%3 ===0 && number%5 !==0){
console.log('fizz');
bool = false;
}
@Super-Chama
Super-Chama / functions.php
Created April 18, 2019 15:01
WooCommerce - How to Remove a Shipping Method from Checkout
add_filter('woocommerce_package_rates', 'hide_shipping_method', 100, 2);
function hide_shipping_method($rates, $package){
// Additional conditions can be set
unset( $rates['local_pickup:12']); // This can be any shipping method, you'll have to use browser tools to see the name
return $rates;
}
@Super-Chama
Super-Chama / info.sh
Created September 9, 2020 17:08
Get Device Battery & Temps over SSH In an Android chroot environment.
#!/bin/bash
dt=`date +"%Y-%m-%d %T"`
bCap=`cat /sys/class/power_supply/battery/capacity`
bTemp=`cat /sys/class/power_supply/battery/temp`
bStatus=`cat /sys/class/power_supply/battery/status`
bHealth=`cat /sys/class/power_supply/battery/health`
cTemp=`cat /sys/class/thermal/thermal_zone10/temp`
echo $cap
@Super-Chama
Super-Chama / debain.motd
Last active June 26, 2022 02:14 — forked from rojenzaman/dynmotd
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# config
USER=`whoami`
HOSTNAME=`uname -n`
ROOT=`df -Ph / | grep / | awk '{print $4}' | tr -d '\n'`
HOME=`df -Ph | grep home | awk '{print $4}' | tr -d '\n'`
BACKUP=`df -Ph | grep backup | awk '{print $4}' | tr -d '\n'`
MNT=`df -Ph | grep mnt | awk '{print $4}' | tr -d '\n'`
@Super-Chama
Super-Chama / fixup.sh
Created November 12, 2021 13:58
GIT !fixup
git commit --fixup=HASH
git rebase -i --autosquash HASH^
git push -f origin BRANCH
import {ConcreteComponent, CSSProperties} from 'vue';
export const TYPE_BUTTON = 'button';
export const TYPE_INPUT = 'input';
export const TYPE_FILE_INPUT = 'file';
export const TYPE_TEXTAREA = 'textarea';
export const TYPE_DROPDOWN = 'dropdown';
export const TYPE_PASSWORD = 'password';
export const TYPE_CHECKBOX = 'checkbox';
export const TYPE_SWITCH = 'switch';
import {ConcreteComponent, CSSProperties} from 'vue';
export const TYPE_BUTTON = 'button';
export const TYPE_INPUT = 'input';
export const TYPE_FILE_INPUT = 'file';
export const TYPE_TEXTAREA = 'textarea';
export const TYPE_DROPDOWN = 'dropdown';
export const TYPE_PASSWORD = 'password';
export const TYPE_CHECKBOX = 'checkbox';
export const TYPE_SWITCH = 'switch';

Date format in OHRM Application

Date format for the application can be configured within Admin - Localisation screen via a Admin user. this format is universal for the application and once changed all places should be updated. This format is only used for the display purposes and all the communication between BE/FE via API is carried out via single date format that is not user changeable. (Hence the distinction display format and io format)

Difference between BE/FE date format.

The tokens (symbols) that is used between PHP and JavaScript languages are different when using date format.

Consider date with format 2022-05-11 (Year-month-date)

  • PHP Format - Y-m-d