Skip to content

Instantly share code, notes, and snippets.

Thaina Yu Thaina

Block or report user

Report or block Thaina

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 keybindings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "tab",
"command": "-acceptSelectedSuggestion",
"when": "editorTextFocus && suggestWidgetVisible"
}
]
@Thaina
Thaina / ObjectProxyOperator.tt
Last active Sep 3, 2019
T4 file for generate common operator on C# object
View ObjectProxyOperator.tt
<#@ output extension=".cs" #>
class ObjectProxyOperator
{
<#
{
var types = new[]{ "sbyte","byte","short","ushort","int","uint","long","ulong","float","double","decimal" };
foreach(var pair in new System.Collections.Generic.Dictionary<string,string>() { ["Add"] = "+",["Subtract"] = "-",["Multiply"] = "*",["Divide"] = "/",["Mod"] = "%" })
{
var func = pair.Key;
var op = pair.Value;
View JsonProtoBufBridge.cs
using System;
using System.Linq;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Google.Protobuf;
using Google.Protobuf.Collections;
View LineLogin.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View couchdb generic update handler.js
function (doc,req) {
if(!req.id)
return [null,{ message : "Support only PUT with id" }];
if(!doc)
doc = { "_id":req.id };
var data = JSON.parse(req.body);
delete data._id;
delete data.id;
@Thaina
Thaina / bitbucket-pipelines.yml
Created Jul 31, 2016
Bitbucket Pipeline publish to AWS Lambda with version
View bitbucket-pipelines.yml
image: python:3.5.1
pipelines:
default:
- step:
script: # Modify the commands below to build and test your repository.
- apt-get update
- apt-get install -y zip
- zip -r $BITBUCKET_REPO_SLUG".zip" *
- pip install awscli
View PromiseFaceBook.js
var resolved = false;
var resolving;
/* global FB */
var fbResolver = new Promise((resolve,reject) => {
if(resolved)
return resolve();
resolving = resolve;
});
@Thaina
Thaina / MiniJSON.cs
Created Jun 29, 2016 — forked from darktable/MiniJSON.cs
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
View MiniJSON.cs
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
View bitbucket.gs
/** @param {string} id
* @param {string} secret */
function BitBucket(id, secret){
this.auth = AccessToken(id, secret);
this.Commit = function(repo,branch,message,files){
return Commit(repo,branch,message,files,this.auth.access_token);
}
}
/** @param {string} id
View CubicSolver.latex
p_0(1 - t)^3 + 3p_1t(1 - t)^2 + 3p_2t^2(1 - t) + p_3t^3
\\
p_0(1 - 3t + 3t^2 - t^3)
+ 3p_1(t - 2t^2 + t^3)
+ 3p_2(t^2 - t^3)
+ p_3t^3
\\
t^3(p_3 - 3p_2 + 3p_1 - p_0)
+ t^23(p_2 - 2p_1 + p_0)
+ t3(p_1 - p_0) + p_0
You can’t perform that action at this time.