Skip to content

Instantly share code, notes, and snippets.

View jm2242's full-sized avatar

Jonathan Mares jm2242

View GitHub Profile
@jm2242
jm2242 / column-header.jsx
Last active February 20, 2018 20:20
Contents of Column Header Component
render() { // render method of component
//...
<div className="column-icons">
{ canHideColumns && renderHideColumnsTrigger() }
{ canSort && renderSortingIndicator() } // shows the sort icon
{ canSearch && renderSearchTrigger() } // shows the filter icon
{ canRemoveColumns && <RemoveColumnButton /> }
{ canAddColumns && <AddColumnButton }
</div>
//...
@jm2242
jm2242 / latency.txt
Created December 8, 2017 21:10 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
#!/bin/python
import sys
def isCavity(grid, coordinate):
(r, c) = coordinate
value = grid[r][c]
maxRow = len(grid) - 1
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
def number_needed(a, b):
dictA = {}
dictB = {}
for c in a:
if c in dictA:
dictA[c] += 1
else:
dictA[c] = 1
for c in b:
@jm2242
jm2242 / 0_reuse_code.js
Created May 21, 2016 22:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console