Skip to content

Instantly share code, notes, and snippets.

View masahiko-nitanda's full-sized avatar

Masahiko Nitanda masahiko-nitanda

View GitHub Profile
@masahiko-nitanda
masahiko-nitanda / RedirectHyphenDomains.go
Created October 6, 2023 16:40
Go+Revel example for redirecting hyphenated domains to non-hyphenated ones.
package controllers
import (
"github.com/revel/revel"
"strings"
)
type App struct {
*revel.Controller
}
@masahiko-nitanda
masahiko-nitanda / query_user_by_name.go
Created August 20, 2023 11:54
This Gist is a Go code snippet using GORM to query the "users" table for the first user with the name "Alice". The code uses the Table method to specify the table and performs a search based on the name field.
db.Table("users").Where("name = ?", "Alice").First(&user)
@masahiko-nitanda
masahiko-nitanda / user_query_example.go
Created August 20, 2023 11:50
This Gist is a Go code snippet using GORM to query for a user with a specific name (in this case, "Alice"). The User struct embeds gorm.Model, allowing for automatic management of created_at, updated_at, and deleted_at fields in CRUD operations.
type User struct {
gorm.Model
Name string
}
db.Model(&User{}).Where("name = ?", "Alice").First(&user)
@masahiko-nitanda
masahiko-nitanda / AddressableNameReplacer.cs
Last active August 17, 2023 02:11
Script for replacing Addressables' addressable names using regular expressions in Unity. This script helps you quickly update addressable names across your project, making management and maintenance easier.
// Feelcerca Game Lib - Editor.AssetUtil.AddressableNameReplacer
// Copyright (c) 2023 Feelcerca Inc.
// support@feelcerca.com
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.AddressableAssets;
using UnityEditor.AddressableAssets.Settings;
using UnityEngine;
@masahiko-nitanda
masahiko-nitanda / LICENSE
Created August 16, 2023 20:09
This license applies to all public gists https://gist.github.com/masahiko-nitanda
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in