Skip to content

Instantly share code, notes, and snippets.

View naichilab's full-sized avatar
🐮
Enjoy making games

naichi naichilab

🐮
Enjoy making games
View GitHub Profile
using UnityEngine;
using System.Collections;
namespace naichilab
{
public class CameraSizeInitializer : MonoBehaviour
{
public const float PixelToUnits = 1f;
// ゲーム内解像度
@naichilab
naichilab / EncryptedPlayerPrefs.cs
Last active July 19, 2018 06:34
Unity用、暗号化PlayerPrefs
using UnityEngine;
/// <summary>
/// 暗号化PlayerPrefs
/// </summary>
public static class EncryptedPlayerPrefs
{
public static void SaveInt(string key, int value)
{
@naichilab
naichilab / ncmbtest.cs
Created June 9, 2016 17:51
NCMBでunion all的なことができないか試した
//欲しいデータ
//SQLで書くとこんなかんじ。これをNCMBで再現したい。
//select level,time from TestClass where level = 2 order by time desc limit 3
//union all
//select level,time from TestClass where level = 3 order by time desc limit 3
//union all
//select level,time from TestClass where level = 4 order by time desc limit 3
//union all
//select level,time from TestClass where level = 5 order by time desc limit 3
//union all
@naichilab
naichilab / InsertTime.vbs
Created May 18, 2016 02:26
Insert time for sakura editor
dim col
col = Editor.ExpandParameter( "$x" )
if col = 1 then
'未入力の行
'現在時刻とタブの記入
Editor.InsertTime
Editor.InsText vbTab
elseif col = 6 then
'同マクロで時刻を入力した直後
@naichilab
naichilab / InsertDate.vbs
Created May 18, 2016 02:25
InsertDate for sakura editor
Editor.InsertDate
Option Explicit
Const DEBUG_MODE As Boolean = False
Sub 図に枠線をつける()
'このマクロは「行内」画像にしか作用しません。
Const THEME_COLOR As Integer = wdThemeColorBackground2
Const TINT_AND_SHADE As Long = 0
@naichilab
naichilab / ExcelToPDF.bas
Created February 19, 2016 10:50
MSExcel、MSWordの文書をショートカットキー一発でPDF出力
Attribute VB_Name = "PDF"
Option Explicit
Sub SaveToPDF()
Attribute SaveToPDF.VB_ProcData.VB_Invoke_Func = " \n14"
Dim saveTo As String
saveTo = GetDesktopDir() & Format(Now(), "yyyyMMdd_hhmmss") & ".pdf"
ActiveWorkbook.ExportAsFixedFormat _
Type:=xlTypePDF _
@naichilab
naichilab / controller_spec.rb
Created January 21, 2016 11:37
その場でヘルパーメソッドを定義する方法
context '有効なパラメータの場合' do
def create_user
post :create, user: attributes_for(:user)
end
it 'リクエストは302 リダイレクトとなること' do
create_user
expect(response.status).to eq 302
end
it 'データベースに新しいユーザーが登録されること' do
expect{
@naichilab
naichilab / controller_spec.rb
Last active January 21, 2016 11:40
ラムダ式で定義しておいて、callで呼び出す方法
context '有効なパラメータの場合' do
let(:create_user) { -> { post :create, user: attributes_for(:user) } }
it 'リクエストは302 リダイレクトとなること' do
create_user.call
expect(response.status).to eq 302
end
it 'データベースに新しいユーザーが登録されること' do
expect{
create_user.call
}.to change(User, :count).by(1)
@naichilab
naichilab / controller_spec.rb
Created January 21, 2016 11:34
exampleをまとめる方法
context '有効なパラメータの場合' do
before do
@user = attributes_for(:user)
end
it '正しく登録されること' do
expect{
post :create, user: @user
}.to change(User, :count).by(1)
expect(response.status).to eq 302
expect(response).to redirect_to root_path