This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class node: | |
def __init__(self, value): | |
self.value = value | |
self.left_child = None | |
self.right_child = None | |
def get(self): | |
return self.value | |
def set(self, value): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fractions import Fraction | |
a = float('1') / float('4') | |
b = '1/4'.split('/') | |
def series_sum(n): | |
if n == 0: | |
return "0.00" | |
else: | |
series = [Fraction(float(1) / float((3 * x) - 2)) for x in range(1, n+1)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public numeric function getTotalDiscountForOrder(required array orderProducts) { | |
var totalSavings = 0; | |
for (var product in arguments.orderProducts) { | |
totalSavings += calculateCouponDiscountForProduct(product) * product.quantity; | |
} | |
return totalSavings; | |
} | |
public array function addOrderProductsDiscountedPrice(required array orderProducts) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct function calculate(required string prodL) { | |
var totalSavings = 0.00; | |
var priceList = ""; | |
var BigDecimal = createObject("java", "java.math.BigDecimal"); | |
var nerismoProducts = model("nerismoProduct").findAll(where = "id IN (#arguments.prodL#)"); | |
var items = []; | |
var pArray = listToArray(arguments.prodL); | |
for (pid in pArray) { | |
var item = model("nerismoOrderItem").new(); | |
item["quantity"] = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public calc { | |
public double tax(double[] l, int year, double tax, string type) { | |
int l1 = l.Length, convT = (int)(tax * 100); | |
double s; | |
if(l1) {for(int i = 0; i = l.Length; ++i) {s+= (l[i] * convT)/100;}} | |
if(type == "marketing") { | |
sendTo("marketing", year); | |
} else if (type = "development") { | |
sendTo("development", year); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json = getPayload(); | |
courses = deserializeJson(json); //this returns an array of structs | |
for(course in courses) { | |
importClass(course); | |
} | |
function importClass(required struct course) { | |
queryObject = new query(datasource); | |
queryObject.addParam(name="fieldA", value=arguments.course["fieldA"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
json = getPayload(); | |
courses = deserializeJson(json); //this returns an array of structs | |
maxCourseId = getMaxId(); | |
courses.each(function(course, index)) { | |
importClass(course, maxCourseId + index); | |
} | |
function importClass(required struct course, required numeric index) { | |
queryObject = new query(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct = { | |
fieldA = "A", | |
fieldB = "B", | |
fieldC = "C" | |
}; | |
struct.each(function(key, value) { | |
writeOutput(key & " = " & value); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
structEach(struct, function(key, value) { | |
writeOutput(key & " = " & value); | |
}); | |
arrayEach(array, function(item, index) { | |
writeOutput(item & "at index: " & index); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array = ["car", "bike", "foot"]; | |
array.each(function(item, index) { | |
writeOutput(item & " at index: " & index); | |
}); |
NewerOlder