Skip to content

Instantly share code, notes, and snippets.

View anzfactory's full-sized avatar
:octocat:
Working from home

anz anzfactory

:octocat:
Working from home
View GitHub Profile
@tsubaki
tsubaki / DontDestroyParent.cs
Last active August 29, 2015 14:01
次のシーンまで破棄されないオブジェクトを登録する
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace UnityEngineExtra
{
public class DontDestroyParent : MonoBehaviour
{
#region UNITY_EVENT
@tsubaki
tsubaki / Main.cs
Last active August 29, 2015 14:12
ピクセルアート的なのをスクリプトベースで
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.Linq;
using System;
[RequireComponent(typeof(Canvas), typeof(CanvasScaler), typeof(RectTransform))]
public class Main : MonoBehaviour {
RectTransform[] layers; // 描画優先度のレイヤー
// Copyright (c) 2011 Bob Berkebile (pixelplacment)
// Please direct any bugs/comments/suggestions to http://pixelplacement.com
//
// 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:
//
using System.Linq;
using UnityEditor;
using UnityEngine;
public static class ExampleClass
{
private static readonly Color mDisabledColor = new Color( 1, 1, 1, 0.5f );
private const int WIDTH = 16;
private const int HEIGHT = 16;
@teppeihomma
teppeihomma / gist:3522079
Created August 30, 2012 03:42
glReadPixelsからBitmapへの画像取得
// ByteBufferに読み込み
ByteBuffer buffer = ByteBuffer.allocateDirect(width * height * 4);
gl10.glReadPixels(0, 0, width, height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, buffer);
// 上下逆なので、上下反転
byte[] tmp1 = new byte[width * 4];
byte[] tmp2 = new byte[width * 4];
int h = (int) height / 2;
for (int y = 0; y < h; y++) {
buffer.position(y * width * 4);
@ebaker355
ebaker355 / UIColor+AppleCrayons.h
Created October 8, 2012 15:06
UIColor+AppleCrayons
#import <UIKit/UIKit.h>
@interface UIColor (AppleCrayons)
+ (UIColor *)cantaloupeColor;
+ (UIColor *)honeydewColor;
+ (UIColor *)spindriftColor;
+ (UIColor *)skyColor;
+ (UIColor *)lavenderColor;
+ (UIColor *)carnationColor;
@paulduran
paulduran / select2-editor.js
Created November 18, 2014 06:13
Update of select2 editor for handsontable (compatible with 0.11.4). Original source at https://github.com/trebuchetty/Handsontable-select2-editor
/// select2 plugin
(function (Handsontable) {
"use strict";
var Select2Editor = Handsontable.editors.TextEditor.prototype.extend();
Select2Editor.prototype.prepare = function (td, row, col, prop, value, cellProperties) {
Handsontable.editors.TextEditor.prototype.prepare.apply(this, arguments);
@kobakei
kobakei / MainActivity.java
Created January 13, 2013 19:22
Android:YouTubeの動画URLを取得してMediaPlayerで再生するサンプル
/**
* This code is originally from here:
* http://stackoverflow.com/questions/7203047/code-for-download-video-from-youtube-on-java-android
*
* And some code about HTTP header is from here:
* http://xissy.github.com/dev/2012/09/28/get-a-youtube-mp4-file-link-which-can-be-played-iphone/
*/
package com.example.zzz;
import java.io.IOException;
double photoSize = 640;
// フィルターの設定
//// まずフィルターグループを作る。フィルターを一つにまとめることで、あとで画像をつくるときに全部のフィルターがかかった画像が得られる
self.filterGroup = [[GPUImageFilterGroup alloc] init];
//// 最初のフィルター便宜的に
GPUImageFilter *firstFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0, 0.125f, 1.0f, 0.75f)];
[self.filterGroup addFilter:firstFilter];
@cathandnya
cathandnya / gist:5552015
Created May 10, 2013 02:24
multipart posting for Tumblr on Android.
private static void addValue(String val, String key, OutputStream strm, String boundary) throws UnsupportedEncodingException, IOException {
strm.write(boundary.getBytes("UTF-8"));
strm.write("\r\n".getBytes("UTF-8"));
strm.write("Content-Disposition: form-data; name=\"".getBytes("UTF-8"));
strm.write(key.getBytes("UTF-8"));
strm.write("\"\r\n\r\n".getBytes("UTF-8"));
strm.write(val.getBytes("UTF-8"));
strm.write("\r\n".getBytes("UTF-8"));
}