Skip to content

Instantly share code, notes, and snippets.

View ucay's full-sized avatar
💪
Let's Rock n Roll

Ulumuddin Cahyadi Yunus ucay

💪
Let's Rock n Roll
View GitHub Profile
@ucay
ucay / Controller.php
Last active March 27, 2018 01:53
Symfony 3 Query for family tree ( https://github.com/ErikGartner/dTree )
public function treeAction(Request $request, $id)
{
$tree= $this->get('app.query.tree');
$data = json_encode( $tree->getTreeData($id) );
return new Response($data, 200);
}
@ucay
ucay / hitung_kpr.js
Created November 10, 2016 05:09
[Javascript Function] Hitung KPR
function pmt(rate_per_period, number_of_payments, present_value, future_value, type){
if(rate_per_period != 0.0){
// Interest rate exists
var q = Math.pow(1 + rate_per_period, number_of_payments);
return -(rate_per_period * (future_value + (q * present_value))) / ((-1 + q) * (1 + rate_per_period * (type)));
} else if(number_of_payments != 0.0){
// No interest rate, but number of payments exists
return -(future_value + present_value) / number_of_payments;
}
@ucay
ucay / couchcms-securefile-empty.php
Created January 20, 2016 14:24
CouchCMS - Empty Secure File Handler
<cms:pages masterpage='index.php'>
<!-- set default value for prevent using last variable in loop -->
<cms:set has_foto='0' 'global' />
<cms:show_securefile 'foto'>
<img src="<cms:cloak_url link=file_id />" alt="Image" /> <!-- show image -->
<cms:set has_foto='1' 'global' /> <!-- set variable image are not empty -->
</cms:show_securefile>
@ucay
ucay / couchcms-pages-grouping.php
Created January 20, 2016 14:06
CouchCMS Pages - Grouping every x post
<!-- Grouping every 4 posts -->
<cms:set fields='4' />
<!-- check index if the first in a row [ (index-1) modulus 4 == 0 ] -->
<cms:set temp="<cms:sub k_count '1' />" />
<cms:set first_in_row="<cms:mod temp fields />" />
<cms:if first_in_row == '0' >
<div class="row">
</cms:if>