Skip to content

Instantly share code, notes, and snippets.

View gtechsltn's full-sized avatar
🍊

Nguyen Viet Manh gtechsltn

🍊
View GitHub Profile
@gtechsltn
gtechsltn / Script_Template.ps1
Created September 21, 2022 16:08 — forked from 9to5IT/Script_Template.ps1
PowerShell: Script Template
#requires -version 2
<#
.SYNOPSIS
<Overview of script>
.DESCRIPTION
<Brief description of script>
.PARAMETER <Parameter_Name>
<Brief description of parameter input required. Repeat this attribute if required>
@gtechsltn
gtechsltn / XMLHttpHandler.cs
Created November 30, 2022 05:44 — forked from cmatskas/XMLHttpHandler.cs
XmlHttpHandler.cs
public class MySuperDuperHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var configService = new ConfigService();
var page = new OutputCachedPage(new OutputCacheParameters
{
Duration = 300, // in seconds
Location = OutputCacheLocation.Server,
VaryByParam = "None"
@gtechsltn
gtechsltn / clean_code.md
Created December 8, 2022 03:25 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@gtechsltn
gtechsltn / index.html
Created January 3, 2023 17:05 — forked from JoeSz/index.html
Basic HTML5 boilerplate with FontAwesome and Bootstrap.
<!doctype html>
<html lang="en">
<head>
<!--
ToDo: HTML, CSS, JS -> concatenate and minify for production
- JavaScript: https://jscompress.com/
- CSS: http://www.cleancss.com/css-minify/
- HTML: http://www.willpeavy.com/minifier/
@gtechsltn
gtechsltn / index.html
Created January 3, 2023 17:05 — forked from mphome/index.html
Twitter bootstrap boilerplate with fontawesome
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Bootstap 3 &amp; fontawesome boilerplate</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@gtechsltn
gtechsltn / gist:346da6a094064912b67402f4a7a84025
Created March 2, 2023 23:32 — forked from tormodfj/gist:1075744
Binding log4net's ILog using Ninject
Bind<ILog>().ToMethod(context => LogManager.GetLogger(context.Request.Target.Member.DeclaringType));
@gtechsltn
gtechsltn / 1.md
Created March 23, 2023 16:17 — forked from mikegrassotti/1.md
Mike Grassotti's Minimum Viable Ember.js QuickStart Guide This quickstart guide should get you from zero to slightly-more-than-zero in a couple of minutes. When done, you should feel somewhat confident that ember.js actually works and hopefully will be interested enough to learn more. WARNING: Don't just try this guide then think ember-sucks cau…

Mike Grassotti's Minimum Viable Ember.js QuickStart Guide

This quickstart guide should get you from zero to slightly-more-than-zero in a couple of minutes. When done, you should feel somewhat confident that ember.js actually works and hopefully will be interested enough to learn more.

WARNING: Don't just try this guide then think ember-sucks cause "I could write that quickstart-guide better in jQuery or Fortran" or whatever. I am not trying to sell you on ember or anything, this guide is little more than a hello-world.

Step 0 - Check out jsFiddle

this jsFiddle has all the code from this answer

@gtechsltn
gtechsltn / GetAllControllersAndActions.cs
Created March 25, 2023 03:57 — forked from kad1r/GetAllControllersAndActions.cs
Get all controllers and actions in asp.net mvc
public ActionResult GetAllControllerActions()
{
var asm = Assembly.GetAssembly(typeof(MVCCaptcha.MvcApplication));
var controlleractionlist = asm.GetTypes()
.Where(type => typeof(System.Web.Mvc.Controller).IsAssignableFrom(type))
.SelectMany(type => type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public))
.Where(m => !m.GetCustomAttributes(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute), true).Any())
.Select(x => new { Controller = x.DeclaringType.Name, Action = x.Name, ReturnType = x.ReturnType.Name,
Attributes = String.Join(",", x.GetCustomAttributes().Select(a => a.GetType().Name.Replace("Attribute", ""))) })
.OrderBy(x => x.Controller).ThenBy(x => x.Action).ToList();
@gtechsltn
gtechsltn / DbDataReader`.cs
Created March 26, 2023 14:49 — forked from igoventura/DbDataReader`.cs
Map sql query c#
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Reflection;
namespace EFCore.ProceduresSchema.Extensions
{
// ReSharper disable once InconsistentNaming
public static class DbDataReader_