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 | |
attr_accessor :next, :value | |
def initialize(value) | |
@value = value | |
end | |
end | |
class LinkedList | |
attr_accessor :tail, :head |
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
module ScoreRound | |
SCORES = {"2"=>2, "3"=>3, "4"=>4, "5"=>5, "6"=>6, "7"=>7, "8"=>8, "9"=>9, "10"=>10, "J"=>11, "Q"=>12, "K"=>13, "A"=>14} | |
def high_card(hand) | |
hand.max_by do |card| | |
p card.rank | |
SCORES[card.rank] | |
end | |
end | |
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
# Imagine I wish to buy 5 btc. Iterate over order_book ask price and amounts. fullfill order, return lowest possible cost | |
order_book = {asks:[{price:2, amount:1, id:'id'},{price:2, amount:4, id:'id'}], bids:{}} | |
user_amount = 5 | |
# 1000 btc for $2.5/each | |
def get_asks(order_book, user_amount) | |
asks = order_book[:asks] | |
returned_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
require 'matrix' | |
width = 6 | |
height = 5 | |
number_of_mines = 25 | |
def generate_board(width, height, number_of_mines) | |
two_d_array = Array.new(height) {Array.new(width, 0)} | |
height_index_max = height | |
width_index_max = width | |
placed_mines = 0 |
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
# removes the second column ( I think the index is it ) | |
cut -f 1,3- jz.tsv > x.tsv |
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
import React, { Component } from 'react'; | |
import { AppRegistry, Text, TextInput, View, TouchableHighlight } from 'react-native'; | |
import craigslist from 'node-craigslist' | |
// The following line, substituted for the import statement above produces the same result: | |
// var craigslist = require('node-craigslist') | |
var client = new craigslist.Client({ | |
city : 'seattle' | |
}); |
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
sudo -u postgres /usr/bin/pg_dump whiteboard_api | gzip -c > /tmp/whiteboard_pre_RDAT-121.dump.gz |
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
<html> | |
<title>Data Science</title> | |
<head> | |
<link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'> | |
<style> | |
.home { | |
display: -webkit-box; |
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
{ | |
"screening": "7.1", | |
"date": 1476908234241, | |
"uid": "UID-16-0003", | |
"linkage_matrix": [[2, 3, 0.06571365, 2], | |
[0, 10, 0.07951425, 2], | |
[5, 6, 0.09405724, 2], | |
[11, 13, 0.10182075, 3], | |
[1, 12, 0.12900146, 3], | |
[14, 15, 0.13498948, 5], |
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
{ | |
"screening": 8, | |
"date": 1476908234241, | |
"uid": "UID-16-0003", | |
"linkage_matrix": [[2, 3, 0.06571365, 2], | |
[0, 10, 0.07951425, 2], | |
[5, 6, 0.09405724, 2], | |
[11, 13, 0.10182075, 3], | |
[1, 12, 0.12900146, 3], | |
[14, 15, 0.13498948, 5], |