Skip to content

Instantly share code, notes, and snippets.

🙀
:D

Shinji Nakamatsu snaka

🙀
:D
Block or report user

Report or block snaka

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6a07b0991b66dc1c0622ca05d02d6052
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 指数関数と対数関数"
]
},
{
@snaka
snaka / s3upload_signature_v2.rb
Last active Apr 6, 2016
POST file to s3 with signature ver.2
View s3upload_signature_v2.rb
#
# POST with signature v2
#
require "base64"
require "openssl"
require "digest/sha1"
aws_secret_key = ENV["AWS_SECRET_ACCESS_KEY"]
aws_access_key_id = ENV["AWS_ACCESS_KEY_ID"]
s3_bucket = "mybucket"
@snaka
snaka / s3upload_signature_v4.rb
Last active Apr 6, 2016
Upload file to S3 with signature ver. 4
View s3upload_signature_v4.rb
#
# POST with signature v4
#
require "base64"
require "openssl"
require "digest/sha1"
require "time"
aws_access_key_id = ENV["AWS_ACCESS_KEY_ID"]
aws_secret_key = ENV["AWS_SECRET_ACCESS_KEY"]
@snaka
snaka / zundoko.l
Created Mar 24, 2016
lex(flex)でズンドコキヨシ
View zundoko.l
%option noyywrap
%{
int zun = 0;
%}
%state ZUN
%state FILLED
%%
<INITIAL>ズン { ECHO; BEGIN ZUN; zun = 1; }
<ZUN>ズン {
ECHO;
@snaka
snaka / shiiba.js
Last active Jan 27, 2016
Qiitaの投稿アクティビティをGitHubのように表示するヤツ ref: http://qiita.com/snaka/items/7f4e5653496689077ce5
View shiiba.js
/*
フォームの入力内容を元にAPIに問い合わせ
*/
$("#form").on("submit", function(e) {
$("#btn-submit").prop("disabled", true);
var user_id = $("#user_id").val()
$.ajax({
type: "GET",
url: "http://qiita.com/api/v2/users/" + user_id + "/items?page=1&per_page=100",
success: onSucceed
@snaka
snaka / siiba.js
Created Jan 26, 2016
Qiitaへの投稿アクティビティをGithubのように表示
View siiba.js
/*
フォームの入力内容を元にAPIに問い合わせ
*/
$("#form").on("submit", function(e) {
$("#btn-submit").prop("disabled", true);
var user_id = $("#user_id").val()
$.ajax({
type: "GET",
url: "http://qiita.com/api/v2/users/" + user_id + "/items?page=1&per_page=100",
success: onSucceed
@snaka
snaka / sample.cs
Last active Aug 29, 2015
3Dのオブジェクトの表示位置に2DのUIオブジェクト追随させる ref: http://qiita.com/snaka/items/de1e86e62c447ea4971f
View sample.cs
GameObject obj3d; // 3Dオブジェクト
GameObject obj2d; // 2Dオブジェクト
Camera perspCamera; // 3Dオブジェクトを写すカメラ
Camera orthoCamera; // 2Dオブジェクトを写すカメラ
// 3Dオブジェクトのワールド座標から、Perspective カメラのビューポート座標を求める
var viewPortPos = perspCamera.WorldToViewPortPoint(obj3d.transform.position);
// 上記ビューポート座標を Orthographic カメラのワールド座標に逆変換する
View AppConfig.cs
public class AppConfig<T> where T: IConvertible {
string key;
T defaultValue;
public AppConfig(string key, T defaultValue) {
this.key = key;
this.defaultValue = defaultValue;
if (!typeof(T).Equals (typeof(Int32)) &&
@snaka
snaka / file0.txt
Created Jul 30, 2014
実行時にシェーダを差し替える ref: http://qiita.com/snaka/items/f7065604ce7306282821
View file0.txt
// change shader
var defaultShader = Shader.Find ("Sprites/Default");
var renderers = ((GameObject)instance).GetComponentsInChildren<SpriteRenderer>();
foreach (var r in renderers) {
r.material.shader = defaultShader;
}
@snaka
snaka / SourceFileEncodingChecker.cs
Created Jul 30, 2014
ソースコード修正時にファイルエンコーディングがBOM付きUTF-8かどうかをチェックする ref: http://qiita.com/snaka/items/ae01990b147570fa0e75
View SourceFileEncodingChecker.cs
using UnityEditor;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.IO;
public class SourceFileEcodingChecker : AssetPostprocessor {
static Regex m_SourceFilePattern;
You can’t perform that action at this time.