Skip to content

Instantly share code, notes, and snippets.

View shortdiv's full-sized avatar
🚧
Always a WIP

Divya shortdiv

🚧
Always a WIP
  • us-central1
View GitHub Profile
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
@shortdiv
shortdiv / yahtzee
Last active August 29, 2015 14:02
Yahtzee Kata
class Die
def initialize
roll
end
def roll
@value = rand(1..6)
end
/ =====================================
/ 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")
@shortdiv
shortdiv / email
Created August 25, 2014 01:05
Haml Include Indents
%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
/ =====================================
/ 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")
@shortdiv
shortdiv / sort_sentence
Created October 30, 2014 20:14
The most complicated possible way of sorting a sentence by word length
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)
@shortdiv
shortdiv / autocomplete-docs.md
Last active December 30, 2015 07:49
Search with autocomplete
                _                                  _      _          _____                     _     _                
     /\        | |                                | |    | |        / ____|                   | |   | |               
    /  \  _   _| |_ ___   ___ ___  _ __ ___  _ __ | | ___| |_ ___  | (___   ___  __ _ _ __ ___| |__ | |__   __ _ _ __ 
   / /\ \| | | | __/ _ \ / __/ _ \| '_ ` _ \| '_ \| |/ _ \ __/ _ \  \___ \ / _ \/ _` | '__/ __| '_ \| '_ \ / _` | '__|
  / ____ \ |_| | || (_) | (_| (_) | | | | | | |_) | |  __/ ||  __/  ____) |  __/ (_| | | | (__| | | | |_) | (_| | |   
 /_/    \_\__,_|\__\___/ \___\___/|_| |_| |_| .__/|_|\___|\__\___| |_____/ \___|\__,_|_|  \___|_| |_|_.__/ \__,_|_|   
                                            | |                                                                       
                                            |_|                                                                     

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.

@shortdiv
shortdiv / techTalks.md
Last active September 21, 2016 20:31
List of talks and smart people to listen to and topics to explore