Skip to content

Instantly share code, notes, and snippets.

View tdchien's full-sized avatar
🛴
Working hard

Chien Tran tdchien

🛴
Working hard
View GitHub Profile
@spitfire05
spitfire05 / config.nu
Last active January 29, 2024 04:22
Nushell git aliases
def git_current_branch () {
git branch --show-current | str trim -c "\n"
}
alias s = git status -sb
alias g = git
alias ga = git add
alias gaa = git add --all
alias gapa = git add --patch
alias gau = git add --update
@son0nline
son0nline / VietNamChar.js
Created April 12, 2021 03:30
js: bỏ dấu Tiếng Việt
function removeVietnameseChar(str, bRPunctuations) {
// Bỏ các khoảng trắng liền nhau
str = str.replace(/ + /g, " ");
str = str.trim();
// Bỏ dấu tiếng Việt
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
@HighwayStar
HighwayStar / buffer_fix.c
Last active February 10, 2022 08:18
xiaomi fix buffer issue (see line 83) in com.qti.chi.override.so
int __fastcall sub_81A44(int a1)
{
int v1; // ST84_4@4
int v2; // ST14_4@5
int v3; // ST10_4@5
int v4; // ST0C_4@5
int v5; // ST08_4@5
int v6; // ST00_4@5
int v7; // ST6C_4@7
int v8; // ST18_4@7
@rakeshsoni18
rakeshsoni18 / How to Load Custom Helper Function Globally?
Created November 19, 2019 19:27
How to Load Custom Helper Function Globally?
Using Composer to Autoload Files
First one is pretty easy and straightforward. Simply go to composer.json file located in your Laravel project and you will see autoload key. Composer has a files key (an array of file paths that you want to autoload) that you can use in your autoload key. It will look like this:
"autoload": {
"files": [
"app/Helpers/Helper.php"
],
"classmap": [
"database/seeds",
"database/factories"
@Billz95
Billz95 / .php_cs.dist
Last active January 15, 2024 02:58
A Customised fixer for PHP-CS-Fixer to use `prettier`'s php plugin to pre-process the code before getting analysed by other fixers. This would enable `php-cs-fixer` to take advantage of `prettier`'s ability of managing long line.
<?php
require_once __DIR__.'/relative/path/to/PrettierPHPFixer/File';
return PhpCsFixer\Config::create()
->registerCustomFixers([
(new PrettierPHPFixer()),
])
->setRules([
'Prettier/php' => true,
@cprakashagr
cprakashagr / LICENCE SUBLIME TEXT
Last active May 1, 2024 10:50
Sublime Text 3 Serial key build is 3143
## Sublime Text 3 Serial key build is 3103
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
B085E65E 2F5F5360 8489D422 FB8FC1AA
@deividaspetraitis
deividaspetraitis / lumen-filesystem.md
Created October 19, 2017 09:36
Lumen flysystem ( filesystem ) integration

Lumen flysystem integration

By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:

  1. composer require league/flysystem
  2. Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation document_root/config
  3. Bind filesystem to IoC for example in document_root/bootstrap/app.php by adding this code lines:

`` $app->singleton('filesystem', function ($app) {

@DiederikvandenB
DiederikvandenB / nuxt.config.js
Created October 16, 2017 10:21
NuxtJS Sentry Module
module.exports = {
/* ... */
modules: [
['~/modules/sentry', {
public_key: '',
private_key: '',
project_id: '',
}],
],
/* ... */
@firatkucuk
firatkucuk / delete-slack-messages.js
Last active May 1, 2024 04:17
Deletes slack public/private channel messages, private chat messages and channel thread replies.
#!/usr/bin/env node
// Channel ID is on the the browser URL.: https://mycompany.slack.com/messages/MYCHANNELID/
// Pass it as a parameter: node ./delete-slack-messages.js CHANNEL_ID
// CONFIGURATION #######################################################################################################
const token = 'SLACK TOKEN';
// Legacy tokens are no more supported.
// Please create an app or use an existing Slack App
@derekmd
derekmd / Optional.php
Last active October 17, 2021 10:25
Laravel global helper function `optional()`
<?php
namespace App\Support;
class Optional
{
/**
* The target being transformed.
* Use _ prefix to avoid namespace conflict on __get()
*