Skip to content

Instantly share code, notes, and snippets.

View stakira's full-sized avatar

StAkira stakira

  • San Francisco, CA
View GitHub Profile
import Foundation
extension UIViewController {
func st_setNavigationBarTheme() {
if let nav = self.navigationController?.navigationBar {
// Colors
nav.translucent = false
nav.barTintColor = UIColor.whiteColor() // themeColor
nav.titleTextAttributes = [
@stakira
stakira / index.js
Created December 12, 2017 01:11
Use fontmin to create compact merged font from KaiGenGothic font
var Fontmin = require('fontmin');
var concat = require('fontmin-concat');
// var fontmin = new Fontmin()
// .src('otfs/*.otf')
// .use(Fontmin.otf2ttf())
// .dest('ttfs');
@stakira
stakira / .bashrc
Created February 14, 2018 23:38
git shortcuts
alias gits="git status"
alias gitf="git fetch --prune"
alias gitfm="git fetch --prune && git fetch origin master:master"
alias git-repush="git fetch --prune && git rebase origin/master && git push origin HEAD -f"
alias gitp="git push origin `git symbolic-ref -q HEAD`"
alias gitpf="git push origin `git symbolic-ref -q HEAD` -f"
alias gitrs="git reset --hard && git clean -f -d"
alias gitrb="git reset --hard && git rebase origin/master"
@stakira
stakira / AnySettings.cs
Created March 1, 2018 19:13
Unity settings loader for build pipeline
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;
namespace AnySettings
{
[InitializeOnLoad]
@stakira
stakira / shiftjis.txt
Created December 12, 2017 01:09
Shift-JIS Kanji Table
Shift-JIS Kanji Table
81 3f |   、 。 , . ・ : ; ? ! ゛ ゜ ´ ` ¨
81 4f | ^  ̄ _ ヽ ヾ ゝ ゞ 〃 仝 々 〆 〇 ー ― ‐ /
81 5f | \ ~ ∥ | … ‥ ‘ ’ “ ” ( ) 〔 〕 [ ]
81 6f | { } 〈 〉 《 》 「 」 『 』 【 】 + - ± ×
81 80 | ÷ = ≠ < > ≦ ≧ ∞ ∴ ♂ ♀ ° ′ ″ ℃ ¥
81 90 | $ ¢ £ % # & * @ § ☆ ★ ○ ● ◎ ◇
81 9e | ◆ □ ■ △ ▲ ▽ ▼ ※ 〒 → ← ↑ ↓ 〓
81 ae | ∈ ∋ ⊆ ⊇ ⊂ ⊃
@stakira
stakira / gfm_table.css
Last active April 6, 2019 02:56
GFM table
body {
text-size-adjust: 100%;
color: #333;
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;
}
@stakira
stakira / Singleton.cs
Last active January 14, 2021 21:20 — forked from vasyaPP/gist:6d88aee67ae6361c0a47e469894528c8
Unity MonoBehaviour Singleton
using System;
using UnityEngine;
namespace FarFarEast
{
/// <summary>
/// Inherit from this base class to create a singleton.
/// e.g. public class MyClassName : Singleton<MyClassName> {}
/// </summary>
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
@stakira
stakira / luajit_mat2d.c
Last active September 26, 2021 12:08
LuaJIT FFI 2D matrix with continuously allocated data array.
#include <cinttypes>
extern "C" {
__declspec(dllexport) void array_to_mat2d_byte(unsigned char* data, unsigned char** mat, size_t w, size_t h) {
for (size_t i = 0; i < w; ++i) {
mat[i] = data + h * i;
}
}
// Gradually changes a value towards a desired goal over time.
public static float SmoothDamp(float current, float target, ref float currentVelocity, float smoothTime, [uei.DefaultValue("Mathf.Infinity")] float maxSpeed, [uei.DefaultValue("Time.deltaTime")] float deltaTime)
{
// Based on Game Programming Gems 4 Chapter 1.10
smoothTime = Mathf.Max(0.0001F, smoothTime);
float omega = 2F / smoothTime;
float x = omega * deltaTime;
float exp = 1F / (1F + x + 0.48F * x * x + 0.235F * x * x * x);
@stakira
stakira / KanjiText.cs
Created March 12, 2018 23:21
Text with Proper Best Fit with Line Wrap for Kanji in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace KanjiText
{
public class KanjiText : Text
{
public bool isKanji;