Skip to content

Instantly share code, notes, and snippets.

Jim Kang jimkang

Block or report user

Report or block jimkang

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 OGKeyPath.h
//
// OGKeyPath.h
//
// Created by Jim on 3/11/10.
//
// Copyright (c) 2010 Jim Kang/Phalange Software.
//
// 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
View OGColorTools.h
//
// OGColorTools.h
//
// Created by Jim on 1/25/10.
// Copyright (c) 2010 Jim Kang/Phalange Software.
//
// 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,
@jimkang
jimkang / UIVariableCellSizeGrid.cs
Created Dec 7, 2012
Subclass of NGUI's UIGrid that adds support for variable size cells. Update: Turns out it's mostly unnecessary; UITable does much of the same - DOH
View UIVariableCellSizeGrid.cs
using UnityEngine;
using System.Collections.Generic;
// This is a subclass of NGUI's UIGrid that supports cells of varying sizes,
// in addition to fixed sizes.
// http://ghostcrabworkshop.com
public class UIVariableCellSizeGrid : UIGrid
{
// If neither of these is set to true, spacing will be exactly as it
@jimkang
jimkang / ArrangeWidgetDepths.cs
Created Dec 15, 2012
Unity wizard script for projects using NGUI that lists all of the depths of all of the UIWidgets, arranged by UIPanel and atlas. You can then edit depths from it, but the idea is that it gives you a global sense of your widget/panel/atlas arrangement. Looks like this: http://cl.ly/image/3k3J2G0q1m1F
View ArrangeWidgetDepths.cs
// ArrangeWidgetDepths.cs
// Ghost Crab Workshop
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class ArrangeWidgetDepths : ScriptableWizard
View tp_to_html.pl
# Copyright (c) 2010 Jim Kang
# 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:
@jimkang
jimkang / copyBoard.js
Created Feb 25, 2013
copyBoard method for Meteor with problems.
View copyBoard.js
// The callback should take a error object and a boardId.
copyBoard: function(options) {
options = options || {};
if (!(typeof options.boardId === "string" && options.boardId.length)) {
throw new Meteor.Error(400, "Required parameter missing");
}
if (!options.callback) {
throw new Meteor.Error(400, "Required parameter missing");
}
if (! this.userId)
@jimkang
jimkang / todos.js
Last active Dec 16, 2015
Possible way of dealing with Meteor collections' insert() not calling the callback when offline. This is code modified from the todos example (http://meteor.com/examples/todos).
View todos.js
Template.todos.events(okCancelEvents(
'#new-todo',
{
ok: function (text, evt) {
function doAfterInsert(error, _id) {
console.log("I was counting on this _id:", _id);
}
var connected = Meteor.status().connected;
View README.md

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

Updated from mbostock's original gist to allow editing the coordinates in text fields.

@jimkang
jimkang / prepareOptions.js
Last active Dec 16, 2015
A function that makes sure an options object has a certain set of expected properties. If properties are missing or of the wrong type, they are set to the default values defined in propInfoDict.
View prepareOptions.js
// propInfoDict should have prop names as the keys, then arrays
// as values that contain the expected type and the default value.
// options should be the options dictionary.
// Example:
// options = prepareOptions(options, {
// someDictionary: ['object', null],
// aFunction: ['function', function(datum) {
// return datum;
// }],
@jimkang
jimkang / treegetting.js
Created Aug 6, 2013
Given a database that you want to retrieve from with async calls, and records in it that represent nodes of a tree (each of which has a 'children' array with containing ids of other node records), here's a way to walk that tree with callbacks. Saving this in case I later decide I need this, after all.
View treegetting.js
var levelup = require('level');
var _ = require('underscore');
var TreeGetter = function TreeGetter(db, rootNodeId, childDepth, done) {
this.treeGetState = {
db: db,
nodesToGet: 0,
nodesGot: 0,
errors: [],
depthLimit: childDepth,
You can’t perform that action at this time.