This file contains hidden or 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 Task | |
attr_accessor :name | |
attr_accessor :assigned_to_user_id | |
attr_accessor :due_on | |
def save | |
Storer.store(self) | |
end | |
end |
This file contains hidden or 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
scan 'patient-2-nvp', COLUMNS => ['d:subtype', 'd:ehrSystemIdQualifier'], LIMIT => 10 } | |
import org.apache.hadoop.hbase.filter.CompareFilter | |
import org.apache.hadoop.hbase.filter.SingleColumnValueFilter | |
import org.apache.hadoop.hbase.filter.SubstringComparator | |
import org.apache.hadoop.hbase.util.Bytes | |
scan 'patient-2-nvp', { COLUMNS => ['d:ehrSystemIdQualifier'], LIMIT => 2000, FILTER => SingleColumnValueFilter.new(Bytes.toBytes('d'), Bytes.toBytes('ehrSystemIdQualifier'), CompareFilter::CompareOp.valueOf('EQUAL'), SubstringComparator.new('MEDS_HX_REVIEW')) } | |
scan 'patient-2-nvp', { COLUMNS => ['d:ehrSystemIdQualifier'], LIMIT => 20, FILTER => SingleColumnValueFilter.new(Bytes.toBytes('d'), Bytes.toBytes('provIds'), CompareFilter::CompareOp.valueOf('NOT_EQUAL'), BinaryComparator.new(Bytes.toBytes(''))) } |
This file contains hidden or 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
triangle = [] | |
File.open("data.txt").each do |line| | |
to_num = line.split.map(&:to_i) | |
triangle << to_num | |
end | |
def reduce_last_row(triangle) | |
row_index = triangle.size - 2 | |
triangle[row_index].each_with_index do |value,col_index| | |
left = triangle[row_index+1][col_index] |
This file contains hidden or 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
triangle = [] | |
File.open("data.txt").each do |line| | |
triangle << line.split | |
end | |
def calc_values(row, value, triangle, results, current_path=0) | |
if triangle.size == (row + 1) | |
results << current_path + triangle[row][value].to_i | |
else | |
calc_values(row + 1, value, triangle, results, current_path + triangle[row][value].to_i) |
This file contains hidden or 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
function find_roku { | |
for i in $(arp -a | awk '{print $2}' | sed "s/[(|)]//g"); do | |
curl $i:8060 &>/dev/null | |
if [[ "$?" == "0" ]]; then | |
echo $i | |
export ROKU_IP=$i | |
fi | |
done | |
} |
This file contains hidden or 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
for i in $(arp -a | awk '{print $2}' | sed "s/[(|)]//g"); do curl $i:8060 &>/dev/null; if [[ "$?" == "0" ]]; then echo $i; fi; done |
This file contains hidden or 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use LWP; | |
use Mojo::DOM; | |
my $browser = LWP::UserAgent->new; | |
my $url = "http://cleveland.craigslist.org/bik/"; | |
my $response = $browser->get( $url ); |
This file contains hidden or 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> | |
<body> | |
<div id="output"></div> | |
<script> | |
var number = ''; | |
for(var i=1; i<=1000000;i++){ | |
number = number + i; | |
} | |
var answer = number[0] * number[9] * number[99] * number[999] * number[9999] * number[99999] * number[999999]; | |
document.getElementById("output").innerHTML = answer; |
This file contains hidden or 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
#!/usr/bin/env ruby | |
require 'prime' | |
require 'mathn' | |
def shifts(arr) | |
res = [] | |
tmp = arr.dup | |
(0..arr.length-1).each do |a| | |
tmp << tmp.shift | |
res << tmp.dup |
This file contains hidden or 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
#!/usr/bin/env ruby | |
total = 0 | |
(3..100000).each do |num| | |
res = num.to_s.chars.map { |d| d.to_i > 0 ? d.to_i.downto(1).inject(:*) : 1 }.inject(:+) | |
total += num if res == num | |
end | |
p total |