Skip to content

Instantly share code, notes, and snippets.

View ngnam's full-sized avatar

Nguyen Van Nam ngnam

View GitHub Profile
@ngnam
ngnam / IIS Rewrite Cheat Sheet
Created September 18, 2023 08:22 — forked from developerdizzle/IIS Rewrite Cheat Sheet
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />
@ngnam
ngnam / IIS Rewrite Cheat Sheet
Created September 18, 2023 08:22 — forked from developerdizzle/IIS Rewrite Cheat Sheet
IIS Rewrite Cheat Sheet
<rewrite>
<!-- Have a bunch of redirects? Put them in a separate file -->
<rules configSource="Rewrites.config" />
<rules>
<!-- Simple rewrite -->
<rule name="Simple rewrite" stopProcessing="true">
<match url="^path/sub path/page\.aspx$" />
<action type="Rewrite" url="/newpath.aspx" />

Pull and run the SQL Server Linux container image

Choose your command shell PowerShell or Cmd

  1. Pull the SQL Server 2022 (16.x) Linux container image from the Microsoft Container Registry.

docker pull mcr.microsoft.com/mssql/server:2022-latest

  1. run linux container image
@ngnam
ngnam / Countdown.js
Created June 14, 2023 10:07 — forked from chriskonnertz/Countdown.js
Simple JavaScript Countdown Snippet
<div class="countdown" data-datetime="<?php echo time() ?>">
<span class="days">0</span> days
<span class="hours">0</span> hours
<span class="minutes">0</span> minutes
<span class="seconds">0</span> seconds
</div>
<script>
(function()
{
@ngnam
ngnam / Category.sql
Created December 19, 2022 04:37 — forked from ticean/Category.sql
A series of queries for selecting Magento entity EAV attributes, and their values. Lots of union here...
SET @entityid = '3';
SELECT ea.attribute_id, ea.attribute_code, eav.value AS 'value', 'varchar' AS 'type'
FROM catalog_category_entity e
JOIN catalog_category_entity_varchar eav
ON e.entity_id = eav.entity_id
JOIN eav_attribute ea
ON eav.attribute_id = ea.attribute_id
WHERE e.entity_id = @entityid
UNION
@ngnam
ngnam / rest-api-cheatsheet.md
Created November 27, 2021 17:25 — forked from jahe/rest-api-cheatsheet.md
REST API Cheatsheet

REST API Cheatsheet

Source: https://www.youtube.com/watch?v=5WXYw4J4QOU

  • POST, GET, PUT, DELETE != CRUD
  • no verbs -> just nouns for Resources: /applications or /applications/123
  • Possible Responses: Collection of Resources (e.g. with Links) or One instance of a Resource
  • Keep your API course grained to be scaleble to future requirements
  • For Resources: Be as specific as possible: /customers vs. /newsletter-customers and /registered-customers
  • PUT for Create: Can be used when the Client has the ability to create an identifier for the Resource himself. But it has to contain a full replacement of the dataset: PUT /applications/123
@ngnam
ngnam / http-statuscodes.ts
Created May 19, 2021 11:20
http-statuscodes.ts
import { Injectable } from "@angular/core";
/**
* A collection of constants for HTTP status codes. Status Codes listed at http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
*/
@Injectable({ providedIn: 'root' })
export class StatusCodes {
//
// Summary:
// HTTP status code 100.
/**
*
* @param {*} word
* input: Công Tằng Tôn Nữ Nguyễn Thị Huyền Thương
* output: Công T. T. N. N. Thị Huyền Thương
*/
function generateCardName(word) {
if (!word) { return; }
let words = word.split(' '),
first = '',
@ngnam
ngnam / menu.js
Created September 16, 2020 17:46
menu.js
'use strict';
(function () {
// add style sheet
var cssMenu =
'.menu-page{position:fixed;top:0;left:0;margin-top:1%;margin-left:1%;background:#fff;border-radius:5px;border:1px solid #ddd;width:320px;padding:5px;font-size:14px;min-height:500px;max-height:500px;overflow:auto} .menu-page .menu-item {color: #333; line-height: 1.5em; padding-bottom: 10px;}@media only screen and (max-width:700px){.menu-page{display:none;}.btnmenu{display: block!important;}}.btnmenu{display: none;position:fixed;top:0;left:0;width:20px;height:20px;border:10px solid #ddd;border-radius:50px;background:#b57e19;margin-top:10px;margin-left:10px;cursor:pointer}',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');