Skip to content

Instantly share code, notes, and snippets.

View mickamy's full-sized avatar

Tetsuro Mikami mickamy

View GitHub Profile
@mickamy
mickamy / lambda-basic-auth.js
Created October 20, 2018 05:56 — forked from lmakarov/lambda-basic-auth.js
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@mickamy
mickamy / UIImageFixedOrientationExtension.swift
Created December 6, 2019 08:50 — forked from schickling/UIImageFixedOrientationExtension.swift
Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == UIImageOrientation.Up {
return self
}
var transform: CGAffineTransform = CGAffineTransformIdentity
@mickamy
mickamy / fix_ios_11_simulator_runtime_xcode_11.sh
Created March 9, 2020 08:41 — forked from liamnichols/fix_ios_11_simulator_runtime_xcode_11.sh
Fix for missing libswiftXCTest.dylib when trying to run Unit Tests in Xcode 11.1 on an iOS 11 simulator
sudo mkdir /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 11.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift
sudo ln -s /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 11.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/Swift/libswiftXCTest.dylib /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 11.4.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift
@mickamy
mickamy / gorm.go
Created August 11, 2024 04:10
custom gorm logger
package logger
import (
"context"
"errors"
"fmt"
"log"
"os"
"runtime"
"strconv"