Skip to content

Instantly share code, notes, and snippets.

View lamngockhuong's full-sized avatar
🍊
Working

Lâm Ngọc Khương lamngockhuong

🍊
Working
View GitHub Profile
@lamngockhuong
lamngockhuong / note.md
Last active December 30, 2017 16:31
[install font-awesome in laravel mix] #php #laravel #npm

Run command

npm install font-awesome --save

Then edit the resources/assets/saas/app.scss file and add at the top this line:

@import "~font-awesome/scss/font-awesome.scss";

Now you can do for example:

@lamngockhuong
lamngockhuong / note.md
Last active December 30, 2017 16:32
[regenerate key laravel] #php #laravel
@lamngockhuong
lamngockhuong / php-laravel-fix-issue-specified-key-was-too-long-error.md
Last active December 30, 2017 16:32
[Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes] Laravel uses the utf8mb4 character set by default, which includes support for storing "emojis" in the database. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually conf…

Index Lengths & MySQL / MariaDB

Laravel uses the utf8mb4 character set by default, which includes support for storing "emojis" in the database. If you are running a version of MySQL older than the 5.7.7 release or MariaDB older than the 10.2.2 release, you may need to manually configure the default string length generated by migrations in order for MySQL to create indexes for them. You may configure this by calling the Schema::defaultStringLength method within your AppServiceProvider

[Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

[PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

@lamngockhuong
lamngockhuong / set-ip.ps1
Last active April 11, 2024 05:00
[Configure IP Address using PowerShell (on Windows)] #cmd #powershell #windows
# Edit by: Ngoc Khuong ([email protected])
# Website: https://ngockhuong.com
########################## Network Information ##########################
param (
[string]$Name = "Wi-Fi", # Ethernet / Wi-Fi
[string]$Type = "DHCP", # Static / DHCP
[IPAddress]$IP = "192.168.1.2",
[string] $CIDR = 24, # This means subnet mask = 255.255.255.0,
@lamngockhuong
lamngockhuong / active-menu.md
Last active December 8, 2022 12:38
[Active in front-end (active menu)] #javascript #html #java #jsp #servlet

Ví dụ dụ có đoạn menu html:

<div class="banner-links">
	<ul>
		<li id="index"><a href="index.jsp">Những người bạn</a></li>
		<li id="video"><a href="video.jsp">Video hành trình</a></li>
		<li id="lienhe"><a href="lien-he.jsp">Liên hệ</a></li>
		<div class="clearfix"></div>
	</ul>
</div>
@lamngockhuong
lamngockhuong / UploadController.java
Last active December 13, 2017 03:43
[Controller to upload single file in JSP/Servlet] - https://ngockhuong.com #jsp #servlet
import java.io.File;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
@lamngockhuong
lamngockhuong / Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?
Last active December 13, 2017 03:44
[Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?] #android
The Android Studio website has recently (I think) provided some advice what kind of messages to expect from different log levels that may be useful along with Kurtis' answer:
Verbose - Show all log messages (the default).
Debug - Show debug log messages that are useful during development only, as well as the message levels lower in this list.
Info - Show expected log messages for regular usage, as well as the message levels lower in this list.
Warn - Show possible issues that are not yet errors, as well as the message levels lower in this list.
Error - Show issues that have caused errors, as well as the message level lower in this list.
Assert - Show issues that the developer expects should never happen.
@lamngockhuong
lamngockhuong / kenhit-tabbed-toc-skin-sitemap.css
Last active December 30, 2017 16:32
[Tạo sitemap cho blogspot] #css #html #blogspot
/* Skin for Blogger Tabbed Layout TOC */
#tabbed-toc {
margin:0 auto;
background-color:#224C19;
-webkit-box-shadow:0 1px 3px rgba(0,0,0,.4);
-moz-box-shadow:0 1px 3px rgba(0,0,0,.4);
box-shadow:0 1px 3px rgba(0,0,0,.4);
overflow:hidden;
position:relative;
@lamngockhuong
lamngockhuong / tabbed-toc-sitemap.js
Last active December 30, 2017 16:32
[Tạo sitemap cho blogspot] #html #js
/**
* Blogger Tabbed Style Table of Content Widget by Taufik Nurrohman
* Free for change but keep the original attribution.
* URL: https://plus.google.com/108949996304093815163/about
* TEMPLATES: &lt;div id="tabbed-toc"&gt;&lt;span class="loading"&gt;Loading...&lt;/span&gt;&lt;/div&gt;&lt;script type="text/javascript"&gt;var tabbedTOC = {blogUrl:"http://latitudu.blogspot.com", containerId: "tabbed-toc", activeTab: 1};&lt;/script&gt;&lt;script type="text/javascript" src="js/tabbed-toc.js"&gt;&lt;/script&gt;
*/
var tabbedTOC_defaults = {
blogUrl: "http://www.kênhit.vn", // Blog URL
containerId: "tabbed-toc", // Container ID
@lamngockhuong
lamngockhuong / ajax.md
Last active July 28, 2019 16:34
[Ajax JQuery] #ajax #js
<script>		
  $.ajax({
    url: 'URL',
    type: '',
    cache: false,
    data: {
    //Dữ liệu gửi đi
    },
 success: function(data){