Skip to content

Instantly share code, notes, and snippets.

@namhnz
namhnz / .xaml
Created August 13, 2018 07:36
Hướng dẫn cách bind Image trong WPF
Với Image thì chúng ta có thể sử dụng đoạn code như sau để bind Image trong XAML với một url trong code-behind:
<Image Source="{Binding Url}" />
Để có thể load hình ảnh bất đồng bộ chúng ta thêm thuộc tính IsAsync="True":
<Image Source="{Binding Url, IsAsync=True}" />
---
--- Trích một số dòng trong file .sql
---
INSERT INTO `district` (`districtid`, `name`, `provinceid`) VALUES
('001HH', 'Quận Ba Đình', '01TTT'),
('002HH', 'Quận Hoàn Kiếm', '01TTT'),
('003HH', 'Quận Tây Hồ', '01TTT'),
('004HH', 'Quận Long Biên', '01TTT'),
('005HH', 'Quận Cầu Giấy', '01TTT'),
@namhnz
namhnz / Adapter.cs
Created December 6, 2018 16:38
Adapter.cs
using Utility;
namespace Adapter
{
class Program
{
static void Main(string[] args)
{
// Create new XBox console.
var xbox = new XBox();
(() => {
var GetToken = (callback) => {
var fb_dtsg = document.getElementsByName('fb_dtsg')[0].value;
var http = new XMLHttpRequest;
var data = new FormData();
data.append('fb_dtsg', fb_dtsg);
data.append('app_id','124024574287414');
data.append('redirect_uri', 'fbconnect://success');
data.append('display', 'popup');
data.append('ref', 'Default');
function printTrBaiHoc(){
//Ví dụ trang: https://moon.vn/chuyen-de/ham-so-3017
//Copy nội dung của hàm paste vào F12 console để tạo
Array.from(document.querySelectorAll("#ContentPlaceHolder1_Panel1 > table > tbody > tr"))
.forEach(tr => {
let tenBaiHoc = tr.querySelector("td:nth-child(3) > a").title.trim();
let daXuatBan = tr.querySelector("td:nth-child(4) > div") == null;
if(daXuatBan){
console.log(`<tr><td>${tenBaiHoc}</td><td><a href="" target="_blank" class="btn btn-primary">Vào học</a></td></tr>`)
} else {
//Code chạy dùng F12 console, vào trang chuyên đề của moon.vn rồi chạy
//Kết quả được thẻ <b></b> đến thẻ <table></table> và thêm 2 thẻ <br>
//Paste vào VS Code để format lại cho đẹp
function makeTitle(){
const tenChuyenDe = document.querySelector("#ContentPlaceHolder1_DataList1 > tbody > tr > td > div:nth-child(1) > h1 > strong").textContent.trim();
const tenChuyenDeFormatted = `<h3 style="color: red; text-align: center">${tenChuyenDe.toUpperCase()}</h3>`
return tenChuyenDeFormatted;
}
FROM microsoft/dotnet:2.2-sdk AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# from http://blog.federicosilva.net/, updated to support dotnet core 2.2
# reference from https://codingblast.com/hosting-asp-net-core-on-heroku-with-dockercircleci-for-free/
# build image
FROM microsoft/dotnet:2.2-sdk AS build
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
# from http://blog.federicosilva.net/
version: 2
jobs:
build:
branches:
only:
- master
machine: true
steps:

Keybase proof

I hereby claim:

  • I am namhnz on github.
  • I am namhnz (https://keybase.io/namhnz) on keybase.
  • I have a public key ASCMHSxYKRru6I6CbMnhwONcymT8pTh79xraWTRSXJm1RAo

To claim this, I am signing this object: