Skip to content

Instantly share code, notes, and snippets.

@trdev7
trdev7 / SignLoanDocument.js
Created June 8, 2020 20:51
SignLoanDocument on LUSA merchant portal
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {
Card,
CardHeader,
CardBody,
ButtonGroup,
Button,
} from 'reactstrap';
@trdev7
trdev7 / LargeDataTable.js
Last active June 8, 2020 20:51
LargeDataTable in LUSA merchant portal.
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import classNames from 'classnames';
import { withRouter } from 'react-router-dom';
import {
SortingState,
GroupingState,
IntegratedGrouping,
@trdev7
trdev7 / product_form.js.jsx
Created June 8, 2020 20:46
ProductForm on Bookthatapp
import React, { Component } from 'react';
import FormSelect from '../common/form_select.js.jsx';
import FormInput from '../common/form_input.js.jsx';
import FormNumberInput from '../common/form_number_input.js.jsx';
import FormInputWithTime from './form_input_with_time.js.jsx';
import FormNested from './form_nested.js.jsx';
import LocationInventories from './location_inventories.jsx';
import ProductVariantsForm from './product_variants_form.js.jsx';
import RoomTime from './room_time.js.jsx';
import FormCheckbox from '../common/form_checkbox.js.jsx';
@trdev7
trdev7 / product_serializer.rb
Created June 8, 2020 20:43
Product Serializer on Bookthatapp
class ProductSerializer < ActiveModel::Serializer
attributes :id,
:external_id,
:excerpt,
:profile,
:product_id, :product_handle, :product_title, :product_image_url,
:capacity_type, :capacity, :capacity_option1, :capacity_option2, :capacity_option3,
:duration_type, :duration_option_external_id, :duration_option_position, :duration_option, :duration_option_range_variant,
:duration, :max_duration, :min_duration,
:lead_time, :lag_time, :mindate, :maxdate, :range_count_basis,
@trdev7
trdev7 / user.rb
Created June 8, 2020 20:41
User model on Bookthatapp
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(255) default("")
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
@trdev7
trdev7 / GetLogitudeLatitudeViaGoogleMapAPI.php
Created November 12, 2018 11:59
This is php script that get longitude and latitude via google map api
<?php
ini_set( 'max_execution_time', 33600 );
$m = new Mongo( "mongodb://nosavn.net:27018" );
// print_r($m->getConnections());
// var_dump($m);
$db = $m->selectDB( 'Nosa' );
$db->authenticate( "nosavnnet", "nsvn6688" );
//connect collection
@trdev7
trdev7 / division_bignumber.c
Last active December 24, 2019 13:16
This application is C console application that substraction, division and remainder between two bigNumbers is implemented.
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef signed short int_least16_t;
// swapping two charaters
void swap( char* a, char* b ) {
char p = *a;
*a = *b;
@trdev7
trdev7 / calcChecksum.rb
Last active December 24, 2019 13:15
This Ruby file includes Ruby functions that Luhn algorithm is implemented. Function ,"checkLuhn1 check if current barcode(included check digit) validates. Function, "checkLuhn2" returns value that current barcode join with its checkdigit as suffix. /********************************************/ [note] Here, I have used Bitwise Operator instead o…
def sumLuhn (barcode, nParity)
checksum = 0
for i in 0..barcode.length - 1
nDigit = barcode[i].to_i
if nParity == ( i & 1 ) # i % 2
nDigit = ( nDigit << 1 ) # nDigit * 2
end
checksum = checksum + nDigit / 10 + nDigit % 10
end
return checksum % 10