Skip to content

Instantly share code, notes, and snippets.

View silkyland's full-sized avatar
💭
On time

Bundit Nuntates silkyland

💭
On time
View GitHub Profile
@silkyland
silkyland / strToThaiSlug.js
Last active January 20, 2024 19:15
Convert string to slug in Thai language for SEO Friendly in JavaScript
/**
* Translates a string to a Thai slug format.
* @param {string} inputString - The string to translate.
* @returns {string} The translated string.
*/
function toThaiSlug(inputString) {
// Replace spaces with hyphens
let slug = inputString.replace(/\s+/g, '-');
// Translate some characters to Thai
@silkyland
silkyland / fixnotify.txt
Last active November 28, 2023 16:06
A problem occurred configuring project ':app', Failed to notify project evaluation listener, javax/xml/bind/annotation/XmlSchema
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> javax/xml/bind/annotation/XmlSchema
--
If you got error like above that mean "You are using JDK higher than graddle need eg. You install JDK 9 it should be 8"
How to fix:
1) Remove JDK version 9 by
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
@silkyland
silkyland / How to resolve module error
Last active December 8, 2017 09:02
Error: bundling failed: UnableToResolveError: Unable to resolve module ....
error: bundling failed: UnableToResolveError: Unable to resolve module `inspector` from `/Users/.....`: Module does not exist in the module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.
@silkyland
silkyland / todolistmockup.js
Created June 28, 2018 16:07
Todo list mockup
import React, { Component } from "react";
class App extends Component {
render() {
return (
<div
style={{
borderColor: "#e12c6a",
borderWidth: 2,
borderStyle: "solid",
@silkyland
silkyland / CertStorageError.MD
Last active February 23, 2023 09:04
[Solved] CertStorageError: expected /etc/letsencrypt/live/example.com/cert.pem to be a symlink

[Solved] CertStorageError: expected /etc/letsencrypt/live/example.com/cert.pem to be a symlink

  rm -rf /etc/letsencrypt/live/{yourdomain.com}
  rm -rf /etc/archive/{yourdomain.com}
  rm -rf /etc/renewal/{yourdomain.com}

and

@silkyland
silkyland / AuthController.php
Last active February 20, 2021 11:57
Api Authentication
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
class AuthController extends Controller
@silkyland
silkyland / api.php
Created February 20, 2021 11:58
Api Auth Login, register, me, logout
<?php
use App\Http\Controllers\AuthController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
@silkyland
silkyland / UserController.php
Created February 20, 2021 12:18
UserController create, update, delete
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class UserController extends Controller
{
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use Illuminate\Http\Request;
class PostController extends Controller
{
public function apiIndex()
<?php
namespace App\Http\Controllers;
use App\Models\Category;
use Illuminate\Http\Request;
class CategoryController extends Controller
{
public function apiIndex()