Skip to content

Instantly share code, notes, and snippets.

View lj3lj3's full-sized avatar
💭
PEACE

Daryl Liu lj3lj3

💭
PEACE
View GitHub Profile
@WenLiangTseng
WenLiangTseng / get_basename.php
Created October 27, 2013 07:45
解決檔案上傳時,PHP的basename函數不支援中文的方法
<?php
//php自帶的basename函數不支持中文,下面這個方法是最簡單的實現。
function get_basename($filename){
return preg_replace('/^.+[\\\\\\/]/', '', $filename);
}
@petehouston
petehouston / .env.local.php
Last active February 19, 2024 10:50
[Laravel 4.2] The environment dotfile configuration
<?php
//file: /.env.local.php
// return the configuration for the 'local' environment
return array(
'db_host' => '127.0.0.1',
'db_name' => 'DB_NAME', // specify database name
'db_user' => 'DB_USER', // specify database username
'db_pass' => 'DB_PASS', // specify database password
);
@laverboy
laverboy / LogUse.php
Last active June 4, 2024 06:56
A simple, static, logging singleton class
<?php
Log::info("something really interesting happened", ['extra' => 'information', 'about' => 'anything' ]);
@mxlje
mxlje / recursive.go
Created June 29, 2017 14:13
Golang html/template recursive rendering partial
type Thing struct {
Text string
Things []Thing
}
func RootHandler(rw http.ResponseWriter, req *http.Request) {
tmpl, err := template.New("root").Parse(`
<html>
{{ define "message" }}
<li>{{ .Text }}
@pteich
pteich / main.go
Last active May 30, 2024 02:57
Example for using go's sync.errgroup together with signal detection signal.NotifyContext to stop all running goroutines
package main
import (
"context"
"errors"
"fmt"
"os/signal"
"syscall"
"time"
@miguelmota
miguelmota / remove_tuxera.sh
Last active August 31, 2024 12:26
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs