CoffeeScript code using underscore to sum a value inside an object array recursively
A Pen by Pedro Matos on CodePen.
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using WebGrease.Css.Extensions; | |
namespace App_Code | |
{ |
CoffeeScript code using underscore to sum a value inside an object array recursively
A Pen by Pedro Matos on CodePen.
### | |
Coffeescript test to sum a total value in an object hierarchy | |
### | |
class PropostaFormViewRule | |
constructor: (_) -> | |
@_ = _ | |
sum: (obj, key) -> | |
# Remove nulls to avoid NaN/undefined sum |
(function () { | |
'use strict'; | |
var module = angular.module('modalHelper', []); | |
module.factory('modalTemplateFath', [ | |
function () { | |
return { | |
module: function (fileName) { |
class ActionHandler | |
parent: null | |
handle: (action) -> | |
return null | |
class AlertHandler extends ActionHandler | |
class ConfirmHandler extends ActionHandler | |
class ChangeStateHandler extends ActionHandler | |
class RedirectHandler extends ActionHandler | |
class ValidationHandler extends ActionHandler | |
class ModalHandler extends ActionHandler |
interface ISliderDirectiveScope { | |
readonly count; | |
register(sliderItem: ISliderItemDirectiveScope); | |
deregister(sliderItem: ISliderItemDirectiveScope); | |
next(): ISliderItemDirectiveScope; | |
prev(): ISliderItemDirectiveScope; | |
selectedItem(): ISliderItemDirectiveScope; |
@import (reference) "../bootstrap-less/bootstrap.less"; | |
@import "../bootstrap-less/mixins/grid.less"; | |
@max-amount-columns: 12; | |
.custom-col(@sizeCateg, @col-index: @max-amount-columns, @column-val: @max-amount-columns) when (@col-index > 0) { | |
(~".col-@{sizeCateg}-@{col-index}") { | |
& when (@sizeCateg = 'xs'){ |
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3. | |
// | |
// This is a hack to fill the gap between 480 and 760 pixels - a missing range | |
// in the bootstrap responsive grid structure. Use these classes to style pages | |
// on cellphones when they transition from portrait to landscape. | |
// | |
// NOTE: Here I use SASS instead of LESS for styling. To convert to LESS | |
// replace '$screen' with '@screen' and '$grid' with '@grid'. | |
// | |
// See https://github.com/twbs/bootstrap/issues/10203 for more info. |
import kotlin.* | |
import kotlin.jvm.* | |
import java.util.* | |
import java.lang.* | |
import java.time.* | |
import java.time.temporal.* | |
/** | |
* We declare a package-level function main which returns Unit and takes | |
* an Array of strings as a parameter. Note that semicolons are optional. |
function isElementInViewport (rect) { | |
return ( | |
rect.top >= 0 && | |
rect.left >= 0 && | |
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ | |
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ | |
) | |
} |