Skip to content

Instantly share code, notes, and snippets.

View taeold's full-sized avatar

Daniel Lee taeold

  • San Fransico, CA
View GitHub Profile
@taeold
taeold / friendly-chat.css
Created October 4, 2020 12:14
friendlychat css
html, body {
font-family: 'Roboto', 'Helvetica', sans-serif;
}
main, #messages-card {
height: 100%;
padding-bottom: 0;
}
#messages-card-container {
height: calc(100% - 35px);
padding-bottom: 0;
var dom = Bloop.dom;
var Box = Bloop.createClass({
getInitialState: function() {
return { number: 0 };
},
updateNumber: function() {
this.state.number++;
},
@taeold
taeold / just-in.case.clj
Created January 12, 2017 19:30
for me of course
(for [c clusters
:let [cluster-by-years (apply map vector c)]]
(for [cluster-year cluster-by-years
:let [cluster-year (remove nil? cluster-year)]]
;; median function here
(apply + cluster-year)))
@taeold
taeold / buzzfizzbuzz.clj
Created October 5, 2016 00:06
BuzzFizzBuzz
(def fib-primes
;; There is a good chance that there are infinitely many prime numbers.
;; We only concern ourselves with fibonacci prime that can be
;; expressed in 64-bit integer values.
;; source: http://oeis.org/A005478
#{2 3 5 13 89 233 1597 28657 514229 433494437 2971215073 99194853094755497})
(defn fizz-buzz-fizz
"Generates first n Fibonacci number where
@taeold
taeold / 303-range-sum-query-immutable.py
Created September 15, 2016 16:17
303. Range Sum Query - Immutable
class NumArray(object):
def __init__(self, nums):
"""
initialize your data structure here.
:type nums: List[int]
"""
self.sums = [0]
sum = 0
for i, n in enumerate(nums):
sum += n
@taeold
taeold / 96-unique-binary-search-trees.py
Created September 14, 2016 00:10
96. Unique Binary Search Trees
class Solution(object):
def numTrees(self, n):
"""
:type n: int
:rtype: int
"""
if n < 2:
return 1
dp = [0] * (n+1)
@taeold
taeold / 332-reconstruct-itinerary.py
Created September 13, 2016 17:58
332. Reconstruct Itinerary
class Solution(object):
def findItinerary(self, tickets):
"""
:type tickets: List[List[str]]
:rtype: List[str]
"""
adjs = {}
for start, end in tickets:
if start in adjs:
@taeold
taeold / 160-intersection-of-two-linked-lists.py
Created September 12, 2016 23:33
160. Intersection of Two Linked Lists
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
def list_len(head):
n = 0
while head:
head = head.next
@taeold
taeold / 263-ugly-number.py
Created September 12, 2016 06:37
263. Ugly Number
class Solution(object):
def isUgly(self, num):
"""
:type num: int
:rtype: bool
"""
if num == 0:
return False
uglies = [2,3,5]
for ugly in uglies:
@taeold
taeold / 263-ugly-number.py
Created September 12, 2016 06:37
263. Ugly Number
class Solution(object):
def isUgly(self, num):
"""
:type num: int
:rtype: bool
"""
if num == 0:
return False
uglies = [2,3,5]
for ugly in uglies: