Skip to content

Instantly share code, notes, and snippets.

View maprangsoft's full-sized avatar
💭
i love programming

Maprangsoft Develoment maprangsoft

💭
i love programming
View GitHub Profile
@rajeshkumaravel
rajeshkumaravel / steps.md
Created December 7, 2023 13:38
Installing a Font in WSL (Windows Subsystem for Linux)

Installing a Font in WSL (Windows Subsystem for Linux)

To install a font in WSL, follow these steps:

  1. Check Font Location: Confirm that the font file (e.g., VictorMono.ttf) is located in a directory accessible from your WSL instance. You can copy the font file to your WSL home directory for simplicity.

  2. Install Font: You can use the fc-cache command to update the font cache in WSL and make the font available. Open a terminal in your WSL instance and run the following commands:

sudo cp /mnt/c/path/to/VictorMono.ttf /usr/local/share/fonts/

@mennwebs
mennwebs / th-address.json
Created November 20, 2023 02:16
Thai Address from Postal Code - JSON
This file has been truncated, but you can view the full file.
[
{
"zipCode": "10100",
"subDistrictList": [
{
"subDistrictId": "100801",
"districtId": "1008",
"provinceId": "10",
"subDistrictName": "ป้อมปราบ"
@gavvvr
gavvvr / README.md
Created July 8, 2022 19:26
Enabling mongo transactions using docker-compose

If you develop against of containerized mongo instance using the official Docker Mongo image and make attempt to use transactions, you will most probably face the following error:

com.mongodb.MongoCommandException: Command failed with error 20 (IllegalOperation): 'Transaction numbers are only allowed on a replica set member or mongos' on server localhost:28017. The full response is {"ok": 0.0, "errmsg": "Transaction numbers are only allowed on a replica set member or mongos", "code": 20, "codeName": "IllegalOperation"}

This single docker-compose.yaml will solve the problem by creating replica set out of single node.

@zapisnicar
zapisnicar / telegram_bot.md
Last active May 29, 2025 20:10
How to create Telegram bot and send messages to group

How to create Telegram Bot and send messages to your group

  1. Create Telegram bot:

    Search for user @BotFather in Telegram app. Type /help in BotFather chat and wait for the reply. Type in the chat:

    /newbot

or select /newbot command from Help text. Answer few setup questions:

@tomholford
tomholford / install_pg_gem.md
Last active May 28, 2025 08:40
Install postgresql gem `pg` on macOS

Installing pg gem on macOS

If you're trying to install the postgresql gem pg and it is failing with the following error message:

Installing pg 1.2.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: ~/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pg-1.2.3/ext
~/.rbenv/versions/3.0.0/bin/ruby -I ~/.rbenv/versions/3.0.0/lib/ruby/3.0.0 -r ./siteconf20210125-97201-pycpo.rb extconf.rb
@casperwilkes
casperwilkes / SoftDeletesTrait.php
Created March 2, 2020 16:06
Laravel override trait for soft deletes that recognizes the observer
<?php
/**
* Overrides original SoftDeletes::runSoftDelete method to include observer changes in `deleting` event.
* @see SoftDeletes
* @uses SoftDeletes::runSoftDelete()
*/
namespace App\Traits;
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active May 27, 2025 13:31
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@thangman22
thangman22 / pwa-prompt.js
Last active January 30, 2024 05:24
PWA Prompt
var deferredPrompt
// Event นี้จะเกิดขึ้นตอนที่ Banner จะโผล่ขึ้นมา
window.addEventListener('beforeinstallprompt', e => {
// บังคับไม่ให้ Banner ของ Browser ทำงาน
e.preventDefault();
// เก็บตัวแรก event ไว้ใช้ต่อ
deferredPrompt = e;
@nhatnx
nhatnx / is_equal_objects.js
Last active March 12, 2023 02:02
Compare 2 objects recursively (if don't want to use lowdash _isEqual)
// https://gomakethings.com/check-if-two-arrays-or-objects-are-equal-with-javascript/
var isEqual = function (value, other) {
// Get the value type
var type = Object.prototype.toString.call(value);
// If the two objects are not the same type, return false
if (type !== Object.prototype.toString.call(other)) return false;
// If items are not an object or array, return false

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write