This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

This Is A Custom Widget

This Sliding Bar can be switched on or off in theme options, and can take any widget you throw at it or even fill it with your custom HTML Code. Its perfect for grabbing the attention of your viewers. Choose between 1, 2, 3 or 4 columns, set the background color, widget divider color, activate transparency, a top border or fully disable it on desktop and mobile.

Underscore.js – cheat sheet

Home/Javascript/Underscore.js – cheat sheet
var jossWhedon = {
    age: 49,
    occupations: 
["writer", "director", "producer", "composer", "actor"], shows: [ { title: "Dollhouse", femaleLead: true, characters: [ { name: "Echo", role: "doll" }, { name: "Topher", role: "mad scientist" }] }, { title: "Dr. Horrible's Sing-Along Blog", characters: [ { name: "Billy", role: "mad scientist" }, { name: "Penny", role: "love interest"}] }, { title: "Buffy the Vampire Slayer", femaleLead: true, characters: [ { name: "Buffy", role: "slayer" }, { name: "Angel", role: "love interest" }] }, { title: "Firefly", characters: [ { name: "Mal", role: "captain" }, { name: "Kaylee", role: "mechanic" }] }]};
.pluck(jossWhedon.shows, "title"); 
=> ["Dollhouse", "Dr. Horrible's Sing-Along Blog", "Buffy the Vampire Slayer", "Firefly"]
var show = _.findWhere(jossWhedon.shows, {title: “Firefly”});
=> {title: "Firefly", characters: Array[2]
_.reduce(jossWhedon.shows, function(memo, show) { 
    return memo.concat(show.characters); }, []); 
=>[{ name: "Echo", role: "doll" }, { name: "Topher", ... }, { name: "Billy", ...}, ...]
_.countBy(_.flatten(_.pluck(jossWhedon.shows, "characters")), "role"); 
=> {doll: 1, mad scientist: 2, love interest: 2, slayer: 1, captain: 1, mechanic: 1}
_.pluck(_.filter(jossWhedon.shows, function(show) { 
    return show.femaleLead; }), "title"); 
=> ["Dollhouse", "Buffy the Vampire Slayer"]
var Scores = [95, 82, 98, 78, 65];
var hasPassed = _(Scores).all(function (value){return value>50; });
console.log(hasPassed);
// true
By | 2017-03-23T21:32:21+00:00 March 12th, 2015|Javascript|Comments Off on Underscore.js – cheat sheet

Share This Story, Choose Your Platform!

About the Author: