Skip to content

Instantly share code, notes, and snippets.

Avatar

Suhendra Y Putra hendrasyp

View GitHub Profile
@hendrasyp
hendrasyp / SwaggerOperationFilter.cs
Created Jun 20, 2022
Swagger Custom Header Parameter
View SwaggerOperationFilter.cs
// Swagger Init..
service.AddSwaggerGen(opts =>
{
// Custom header for authorization on swagger
opts.OperationFilter<SwaggerOperationFilter>();
opts.OrderActionsBy((apiDesc) => $"{apiDesc.ActionDescriptor.RouteValues["controller"]}_{apiDesc.RelativePath}");
opts.ExampleFilters();
//jangan dipake, malah bikin versioning ga jalan
@hendrasyp
hendrasyp / ki-underscore.js
Created Jan 22, 2022
Underscore JS By KiNET - Konsultan IT Bandung
View ki-underscore.js
function clearForms($form) {
$form.find('textarea').val(null);
$form.find(':input').not(':button, :submit, :reset, :checkbox, :radio').val(null);
$form.find(':checkbox, :radio').prop('checked', false);
}
function _isReadOnlyByClass(el) {
return $('.' + el).prop('readonly');
}
@hendrasyp
hendrasyp / jscore.js
Created Jan 22, 2022
JSCore By KiNET - Suhendra Yohana Putra
View jscore.js
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
/* CONSTANTS, GLOBAL VARIABLES */
let isSuperAdmin;
let max_char_in_byte = 3915;
let notyErr = 'error';
let notyOK = 'success';
@hendrasyp
hendrasyp / foo.js
Last active Dec 2, 2021
Json To CSharp Object
View foo.js
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Reflection;
namespace Netester
{
class Program
@hendrasyp
hendrasyp / BrowserInfo.js
Created Nov 25, 2020
Check Client Browser Detail
View BrowserInfo.js
function browserClientInfo() {
"undefined" != typeof jQuery ? console.log("jQuery Version", jQuery.fn.jquery) : console.log("jQuery library is not found!");
navigator.appVersion;
var n, e, r, o = navigator.userAgent, a = navigator.appName, i = "" + parseFloat(navigator.appVersion),
s = parseInt(navigator.appVersion, 10);
-1 != (e = o.indexOf("OPR/")) ? (a = "Opera", i = o.substring(e + 4)) : -1 != (e = o.indexOf("Opera")) ? (a = "Opera", i = o.substring(e + 6), -1 != (e = o.indexOf("Version")) && (i = o.substring(e + 8))) : -1 != (e = o.indexOf("MSIE")) ? (a = "Microsoft Internet Explorer", i = o.substring(e + 5)) : -1 != (e = o.indexOf("Chrome")) ? (a = "Chrome", i = o.substring(e + 7)) : -1 != (e = o.indexOf("Safari")) ? (a = "Safari", i = o.substring(e + 7), -1 != (e = o.indexOf("Version")) && (i = o.substring(e + 8))) : -1 != (e = o.indexOf("Firefox")) ? (a = "Firefox", i = o.substring(e + 8)) : (n = o.lastIndexOf(" ") + 1) < (e = o.lastIndexOf("/")) && (a = o.substring(n, e), i =
@hendrasyp
hendrasyp / quartz.properties
Last active Jul 15, 2020
Java Quartz Propertiez
View quartz.properties
# ==================================================================================================================== #
# QUARTZ
# Configure JobStore
#============================================================================
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.useProperties=true
org.quartz.jobStore.misfireThreshold=25000
org.quartz.jobStore.tablePrefix=QRTZ_
org.quartz.jobStore.isClustered=false
@hendrasyp
hendrasyp / Foo.java
Last active Feb 28, 2020
Formatting java.sql.Timestamp
View Foo.java
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Date;
import java.sql.Timestamp;
@AllArgsConstructor
@NoArgsConstructor
@Data
@hendrasyp
hendrasyp / .htaccess
Created Dec 9, 2019
HotLink Protection
View .htaccess
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yourdomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://yourdomain.com$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^https://www.yourdomain.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
@hendrasyp
hendrasyp / Foo.cs
Created Nov 28, 2019
How to Check Property on Dynamic Data type
View Foo.cs
/// <summary>
/// Check any property on dynamic data type whether id exists or not
/// </summary>
/// <param name="settings">your object</param>
/// <param name="name">key to search</param>
/// <returns>True or False</returns>
/// <example>
/// bool isExists = IsPropertyExists(Dictionary<string, dynamic>, string);
/// <example>
public bool IsPropertyExists(dynamic settings, string name)
@hendrasyp
hendrasyp / CommonHelper.cs
Last active Nov 21, 2019
Formatted Sequence Number
View CommonHelper.cs
// db = Instance of Entities Object
public static void StoreLastSequence(int lastSequence, string prefix)
{
applicationoption applicationoption = db.applicationoption.Where(m => m.CODE == "NOMOR_INVOICE").Single();
applicationoption.VALUE = lastSequence.ToString();
db.Entry(applicationoption).State = System.Data.EntityState.Modified;
db.SaveChanges();
}