Skip to content

Instantly share code, notes, and snippets.

View medhiwidjaja's full-sized avatar

Medhi Widjaja medhiwidjaja

  • Marak
View GitHub Profile

Keybase proof

I hereby claim:

  • I am medhiwidjaja on github.
  • I am medhiw (https://keybase.io/medhiw) on keybase.
  • I have a public key ASALTNQoqFGLbV2uw_nKcjTQdAcV1Hgs8V2SbZ5RQguWZQo

To claim this, I am signing this object:

@medhiwidjaja
medhiwidjaja / jquery.slider-ext.js
Created October 1, 2020 05:16
This is an extension to jQuery UI slider with new range option called "zero-based". I created this because I need to create sliders with values that range from negative to positive. Initially the value will default to 0 and the marker will be set at the middle "0" position.
/*
* jQuery UI Slider Range extension 0.5
* Author: Medhi Widjaja
* Extended to include new range option "zero-based"
* Licensed under the terms of the MIT and GPL-2.0 license
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*
*/
@medhiwidjaja
medhiwidjaja / tree_ext.rb
Last active August 29, 2015 13:55
An extension of mongoid-tree gem that I used in implementing Decision Tree for the Foreplot.com. Optimisation to speed up access to and execution of block on each leaf nodes in a tree. Results in orders of magnitude in speed improvement.
# Copyright (c) 2012 Medhi Widjaja
## This is an extension of Mongoid::Tree module in mongoid-tree gem
module Mongoid
module TreeExt
##
# Returns an Array containing all leaves of this document. It's cheaper than leaves method.
# Caution: Can't be chained, since it returns Array instead of Mongoid Criteria object
# Copyright (c) 2012 Medhi Widjaja
module AnalysisMethods
module Ahp
module PairwiseComparable
class PairwiseComparison
include Mongoid::Document
field :id1, type: Moped::BSON::ObjectId
field :id2, type: Moped::BSON::ObjectId
@medhiwidjaja
medhiwidjaja / ahp.rb
Last active August 29, 2015 13:55
AnalysisMethods::Ahp module
# Copyright (c) 2012 Medhi Widjaja
require 'matrix'
# require 'analysis_methods/pairwise_comparison.rb'
# require 'analysis_methods/pairwise_rank_comparison.rb'
# Ahp Module contains the classes for modeling and calculating decision hierarchy using the AHP
# (Analytic Hierarchy Process) method.
# For background theory, see http://en.wikipedia.org/wiki/Analytic_hierarchy_process
#
@medhiwidjaja
medhiwidjaja / magiq.rb
Created January 31, 2014 01:28
AnalysisMethods::Magiq module.
# Copyright (c) 2012 Medhi Widjaja
# Magiq Module contains the classes for modeling and calculating rank scores using MAGIQ method
#
# For background theory of Multi-Attribute Global Inference of Quality (MAGIQ), see the article by
# Dr. James McCaffrey
# http://msdn.microsoft.com/en-us/magazine/cc300812.aspx
#
# MAGIQ method uses Rank Order Centroid to determine rank scores, this module implements 3 more
# methods to calculate to rank scores: Rank Sum, Rank Reciprocal, and Rank Exponential
@medhiwidjaja
medhiwidjaja / rank_comparable.rb
Created January 31, 2014 01:26
AnalysisMethods::Magiq::RankComparable module. Used be Magiq module. The OrdinalComparison object is embedded in the MongoDB document of the object that uses the Magiq module.
# Copyright (c) 2012 Medhi Widjaja
module AnalysisMethods
module Magiq
module RankComparable
class OrdinalComparison
include Mongoid::Document
field :id1, type: Moped::BSON::ObjectId
field :title, type: String