Skip to content

Instantly share code, notes, and snippets.

View kiendinhkhoi's full-sized avatar
💻
Working

Kiến Đình Khôi kiendinhkhoi

💻
Working
View GitHub Profile
@kiendinhkhoi
kiendinhkhoi / gist:6b8e1b28554f19eaf2d799665d28d8f0
Last active August 14, 2022 04:46
Standard Ecommerce database
USE [master]
GO
/****** Object: Database [BD_LOCAL] Script Date: 8/14/2022 11:46:07 AM ******/
CREATE DATABASE [BD_LOCAL]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'Sirius', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\Sirius.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'Sirius_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\Sirius_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT
@kiendinhkhoi
kiendinhkhoi / gist:6a8e2fd4288a8f288c32c3075ed497e3
Created March 2, 2021 07:26
Fix couldn't find path:... /roslyn.exe
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform -r
@kiendinhkhoi
kiendinhkhoi / gist:a131139926ec10cb12d14e93fdad5a57
Created December 7, 2020 10:32
Remove duplicate elements in array Javascript ES6
const removeDuplicatesFromArray = arr => [...new Set(arr)];
removeDuplicatesFromArray([1,1,2,3,4,4,true,true,false,'foo','foo']);
@kiendinhkhoi
kiendinhkhoi / gist:42f179a3af04b571704bc49d8594d303
Created October 20, 2020 10:04
Inject extra param to JQueryDatatable request
//fnServerData used to inject the parameters into the AJAX call sent to the server-side
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "YourParamName", "value": "YourParamValue" });
$.getJSON(sSource, aoData, function (json) {
fnCallback(json)
});
},
@kiendinhkhoi
kiendinhkhoi / gist:047f7b0e51a42f7cd292039057c7d6f3
Created October 19, 2020 09:12
Custom JQuery validation method
$.validator.addMethod("greaterThanZero", function (value, element) {
if(value > 0)
return true;
else
return false;
}, "Smaller than 0.");
$("#input_field").rules("add", {
required: true,
maxlength: 255,
1) Radar scale
cl_radar_always_centered "0";
cl_radar_scale "0.3";
cl_hud_radar_scale "1.15";
cl_radar_icon_scale_min "1";
cl_radar_rotate "1";
cl_radar_square_with_scoreboard "1";
2) Crosshair
cl_crosshairalpha "255";
- Convert ViewModel to JSON for saving:
ko.toJSON(self.MyViewModel)
- Bind click in ForEach:
data-bind="click: function() {$parent.MyFunction($data)}" // $data is index object in binding context
@kiendinhkhoi
kiendinhkhoi / gist:def0651ee98d031c3b3db386fe13f951
Created June 3, 2020 03:09
Query 2 tables by using Entity Framework
public List<ViewModel> GetAll()
{
List<ViewModel> list = (
from a in context.TableA
join b in context.TableB on a.TableAKey equals b.TableBKey
where a.TableAKey == b.TableBKey
select new
{
a,
b
I) Set up
<script src="https://cdnjs.cloudflare.com/ajax/libs/1000hz-bootstrap-validator/0.11.9/validator.js"></script>
1) Active form validation
$('#myForm').validator()
or
<form data-toggle="validator" role="form">
2) Add this behind control if you want to display error message and feedback icon
Adjust control container:
@kiendinhkhoi
kiendinhkhoi / gist:b82de276ac5b67719fff79d8d480d4f3
Created November 12, 2019 07:59
JQueryUI Datetime picker
$('#in-date').datetimepicker({
formatDate: 'd.m.Y',
formatTime: 'H:i',
format: 'd/m/Y h:i',
startDate: Date.today,
minDate: '01.01.2001',
maxDate: '01.01.2098',
showSecond: false,
step: 30,
defaultTime: '09:00'