Skip to content

Instantly share code, notes, and snippets.

View ghalimi's full-sized avatar

Ismael Ghalimi ghalimi

View GitHub Profile
@ghalimi
ghalimi / form.json
Last active December 22, 2015 23:09
Form Definition Schema
{
"copyright": "© Sutoiku, Inc. 2013",
"stc_schema": {
"title": "Form Definition Schema",
"type": "object",
"properties": {
"stc_default_tab": {
"stc_datatype": "stc_identifier",
"stc_name": "Default tab",
"stc_description": "Default tab displayed by the form.",
@ghalimi
ghalimi / category.json
Last active December 22, 2015 14:38
Category Options Schema
{
"copyright": "© Sutoiku, Inc. 2013",
"title": "Category Options Schema",
"type": "object",
"properties": {
"stc_categories": {
"stc_datatype": "stc_json",
"stc_name": "Categories",
"stc_description": "Set of categories defined by the field.",
"stc_required": true,
@ghalimi
ghalimi / relationship.json
Last active December 22, 2015 14:38
Relationship Options Schema
{
"copyright": "© Sutoiku, Inc. 2013",
"title": "Relationship Options Schema",
"type": "object",
"properties": {
"stc_target_object": {
"stc_datatype": "stc_relationship",
"stc_name": "Target object",
"stc_description": "Target objet for the relationship.",
"stc_required": true,
@ghalimi
ghalimi / terms.html
Last active December 15, 2015 03:58
STOIC Terms of Service
<p><strong>Last updated:</strong> March 19, 2013.</p>
<p>These Terms of Service ("Terms") govern your access to and use of STOIC ("STOIC", "we" or "our") websites, services, and applications (collectively the "Service"). Your access to and use of the Service is conditioned on your acceptance of and compliance with these Terms. These Terms apply to all visitors, users and others who access or use the Service.</p>
<h3>Your Use of the Service</h3>
<p>By accessing or using the Service you agree to be bound by these Terms. If you are using the Services on behalf of an organization or entity ("Organization"), then you are agreeing to these Terms on behalf of that Organization and you represent and warrant that you have the authority to bind the Organization to these Terms. In that case, "you" and "your" refers to you and that Organization.</p>
<p>You may use the Service only if you can form a binding contract with STOIC, and only in compliance with these Terms and all applicable local, state, national, and internat
@ghalimi
ghalimi / XNPV.js
Created January 30, 2013 02:15
XNPV Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function XNPV(rate, values, dates) {
var result = 0;
for (var i = 0; i < values.length; i++) {
result += values[i] / Math.pow(1 + rate, moment(dates[i]).diff(moment(dates[0]), 'days') / 365);
}
return result;
}
@ghalimi
ghalimi / XIRR.js
Created January 30, 2013 01:11
XIRR Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
// Some algorithms have been ported from Apache OpenOffice:
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
@ghalimi
ghalimi / TBILLYIELD.js
Created January 29, 2013 01:48
TBILLYIELD Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function TBILLYIELD(settlement, maturity, price) {
// Return error if either date is invalid
if (!moment(settlement).isValid() || !moment(maturity).isValid()) return '#VALUE!';
// Return error if price is lower than or equal to zero
if (price <= 0) return '#NUM!';
// Return error if settlement is greater than maturity
@ghalimi
ghalimi / TBILLEQ.js
Created January 29, 2013 00:22
TBILLEQ Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function TBILLEQ(settlement, maturity, discount) {
// Return error if either date is invalid
if (!moment(settlement).isValid() || !moment(maturity).isValid()) return '#VALUE!';
// Return error if discount is lower than or equal to zero
if (discount <= 0) return '#NUM!';
// Return error if settlement is greater than maturity
@ghalimi
ghalimi / SYD.js
Created January 27, 2013 18:51
SYD Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function SYD(cost, salvage, life, period) {
// Return error if any of the parameters is not a number
if (isNaN(cost) || isNaN(salvage) || isNaN(life) || isNaN(period)) return '#VALUE!';
// Return error if life equal to 0 (zero)
if (life === 0) return '#NUM!';
// Return error if period is lower than 1 or greater than life
@ghalimi
ghalimi / SLN.js
Created January 27, 2013 18:33
SLN Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function SLN(cost, salvage, life) {
// Return error if any of the parameters is not a number
if (isNaN(cost) || isNaN(salvage) || isNaN(life)) return '#VALUE!';
// Return error if life equal to 0 (zero)
if (life === 0) return '#NUM!';
// Return straight-line depreciation