Skip to content

Instantly share code, notes, and snippets.

View zxzsaga's full-sized avatar
🎯
Focusing

Cielmer zxzsaga

🎯
Focusing
  • Freelancer
  • China
View GitHub Profile
public class FBXMeshExtractor {
private static string progressTitle = "Extracting Meshes";
private static string fbxExtension = ".fbx";
private static string objExtension = ".obj";
private static string targetExtension = ".asset";
[MenuItem("Assets/Extract Meshes", validate = true)]
private static bool ExtractMeshesMenuItemValidate() {
for (int i = 0; i < Selection.objects.Length; i++) {
@zxzsaga
zxzsaga / CIUtility.cs
Last active April 11, 2019 08:20
Unity CI Utility.
using System;
using System.Collections.Generic;
using UnityEditor;
public class CIUtility {
private static string buildDir = "Build/CatsAndDogs";
public static void Build_iOS() {
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.iOS, BuildTarget.iOS);
@zxzsaga
zxzsaga / LoadImage.cs
Last active March 29, 2019 05:11
Load png or jpg file in Unity.
/// <summary>
/// Load png or jpg file.
/// </summary>
public static Texture2D LoadImage(string filePath) {
if (!File.Exists(filePath)) {
return null;
}
Texture2D tex = new Texture2D(1, 1);
byte[] fileData = File.ReadAllBytes(filePath);
tex.LoadImage(fileData);
@zxzsaga
zxzsaga / RenderTexture2PNGUtility.cs
Created January 17, 2019 07:52
RenderTexture output PNG.
using System.IO;
using UnityEngine;
using UnityEditor;
public static class RenderTexture2PNGUtility {
[MenuItem("Assets/RenderTexture2PNG", true)]
private static bool RenderTexture2PNGValidation() {
return Selection.activeObject is RenderTexture;
}
using System.IO;
using UnityEngine;
using UnityEditor;
public class TexturePackUtility : ScriptableObject {
public Texture2D[] alphaTextures;
public string outputPath = "Assets/Textures/Topography/Topography.png";
public Material material;
public string vectorPrefix = "_Rect";
@zxzsaga
zxzsaga / apiDoc.md
Last active February 22, 2016 08:54

apiDoc

api 文档生成工具

安装

npm install apidoc -g

运行示例

apidoc -i app/controllers/ -o apidoc/ -t mytemplate/

以上用法将会对app/controllders/下的所有文件生成 api 文档,输出目录为apidoc/, 使用mytemplate/下的模板。

@zxzsaga
zxzsaga / Math.round10.js
Last active August 29, 2015 14:19
十进制调整
// Closure
(function() {
/**
* Decimal adjustment of a number.
*
* @param {String} type The type of adjustment.
* @param {Number} value The number.
* @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).
* @returns {Number} The adjusted value.
*/
@zxzsaga
zxzsaga / Capistrano.md
Last active April 27, 2021 07:48
Capistrano 使用

使用版本为 capistrano 3.3.5 , Capistrano 安装方法自行 Google.

项目中初始化 Capistrano

cap install

会生成如下目录文件:

├── Capfile   
├── config   
│   ├── deploy   
@zxzsaga
zxzsaga / JavaScript Style Guide.md
Last active August 29, 2015 14:07
JavaScript style guide

变量名,多变量定义

var adminUser = 'fool';
var value = 27;

类名

function BankAccount() {
    // codes
}
@zxzsaga
zxzsaga / JavaScript - The Good Parts.md
Last active August 29, 2015 14:07
<JavaScript - The Good Parts> reading notes

建议

  • 避免使用/* */注释,而用//注释替代它。
  • 最小化使用全局变量的一个方法是在你的应用中只创建唯一一个全局变量,把多个全局变量整理到一个名字空间下。
  • 在函数体的顶部声明函数中可能用到的所有变量。

评论

  • JavaScript 中最好的特性就是它对函数的实现。

语言特性

  • 函数的arguments并不是一个真正的数组,它有length属性,但缺少所有的数组方法。