_ _ _ _____ _ _
/\ | | | | | | / ____| | | | |
/ \ _ _| |_ ___ ___ ___ _ __ ___ _ __ | | ___| |_ ___ | (___ ___ __ _ _ __ ___| |__ | |__ __ _ _ __
/ /\ \| | | | __/ _ \ / __/ _ \| '_ ` _ \| '_ \| |/ _ \ __/ _ \ \___ \ / _ \/ _` | '__/ __| '_ \| '_ \ / _` | '__|
/ ____ \ |_| | || (_) | (_| (_) | | | | | | |_) | | __/ || __/ ____) | __/ (_| | | | (__| | | | |_) | (_| | |
/_/ \_\__,_|\__\___/ \___\___/|_| |_| |_| .__/|_|\___|\__\___| |_____/ \___|\__,_|_| \___|_| |_|_.__/ \__,_|_|
| |
|_|
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 Player | |
def play_turn(warrior) | |
advance = Advance.new(warrior) | |
attack = Attack.new(warrior) | |
rest = Rest.new(warrior) | |
actions = [rest, advance, attack] | |
actions.each do |action| | |
if action.possible? | |
action.go! | |
break |
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 Die | |
def initialize | |
roll | |
end | |
def roll | |
@value = rand(1..6) | |
end |
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
/ ===================================== | |
/ Hero Image | |
/ ===================================== | |
%table{ height: "400px", align:"center", {{ page.top-level-table}}, {{ page.table-reset }} } | |
%tr | |
%td{ bgcolor: "#4D4237", height: "410px", style: "background-image: url('/images/example.jpg'); background-repeat: no-repeat; color: {{ page.c-title }}; {{ page.img-typeset }}; padding-top: 20px", valign:"top", align:"center"} | |
Time to take another look. | |
/ [if gte mso 9] | |
%v:rect(xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f" style="width:650px; height:410px") |
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
%table | |
%tr | |
%td{ width: "90px"} | |
%img{src: "/images/example.png"} | |
%td{valign:"top", style: "padding-top: 20px "} | |
%a{style: "text-decoration: underline; font-weight: bold;"} V-neck T-shirt | |
%br | |
Salmon | |
%br | |
Item #45670 |
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
/ ===================================== | |
/ Hero Image | |
/ ===================================== | |
%table{ height: "400px", align:"center", {{ page.top-level-table}}, {{ page.table-reset }} } | |
%tr | |
%td{ bgcolor: "#4D4237", height: "410px", style: "background-image: url('images/example.jpg'); background-repeat: no-repeat; color: {{ page.c-title }}; {{ page.img-typeset }}; padding-top: 20px", valign:"top", align:"center"} | |
Take a closer look | |
/ [if gte mso 9] | |
%v:rect(xmlns:v="urn:schemas-microsoft-com:vml" fill="t" stroke="f" style="width:650px; height:410px") | |
%v:fill(type="frame" src="images/example.jpg" color="#7bceeb") |
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
def sort_string(string) | |
word_hash = {} | |
new_word = "" | |
string.split(" ").each do |word| | |
word_hash[word] = word.length | |
end | |
numbers = word_hash.values.sort | |
first_num = numbers.first | |
new_word << word_hash.key(first_num) | |
numbers.delete(first_num) |
Connecting data with visuals is a core concept of D3 that leaves many confused. In this tutorial I will demystify the process and show you how easy it is to get going with a data backed visualization. With a solid grasp of Javascript, you should be able to follow along and get started on your own D3 projects as well! For curious minds, I will be using this method chain to explain how D3 works.
d3.selectAll(someExistingElement)
.data(someData)
.enter()
.append(someNonExistentElement)
Just a side note, I'll be making a lot of references to Rick and Morty in this post, and particularly to meseeks, so if you don't know what they are or what I'm on about watch this video to get up to speed.
#Smart people to listen to
- Bret Victor
- Jafar Husain
- André Staltz
- Addy Osmani
- Giant veggie salad
- Shawarma/Hummus Bowl
OlderNewer