Skip to content

Instantly share code, notes, and snippets.

View lj3lj3's full-sized avatar
💭
PEACE

Daryl Liu lj3lj3

💭
PEACE
View GitHub Profile
@miguelmota
miguelmota / remove_tuxera.sh
Last active April 3, 2024 08:41
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
@pteich
pteich / main.go
Last active March 25, 2024 21:50
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"
@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 }}
@laverboy
laverboy / LogUse.php
Last active March 5, 2024 22:29
A simple, static, logging singleton class
<?php
Log::info("something really interesting happened", ['extra' => 'information', 'about' => 'anything' ]);
@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
);
@WenLiangTseng
WenLiangTseng / get_basename.php
Created October 27, 2013 07:45
解決檔案上傳時,PHP的basename函數不支援中文的方法
<?php
//php自帶的basename函數不支持中文,下面這個方法是最簡單的實現。
function get_basename($filename){
return preg_replace('/^.+[\\\\\\/]/', '', $filename);
}