Skip to content

Instantly share code, notes, and snippets.

View stevieoj's full-sized avatar
🤔
Brainstorming

Stephen Onoja stevieoj

🤔
Brainstorming
View GitHub Profile
[email protected] /Users/stevie/Desktop/cinder-web
├─┬ @apollo/[email protected]
│ ├─┬ @graphql-typed-document-node/[email protected]
│ │ └── [email protected] deduped
│ ├─┬ @wry/[email protected]
│ │ └── [email protected] deduped
│ ├─┬ @wry/[email protected]
│ │ └── [email protected] deduped
│ ├─┬ @wry/[email protected]
│ │ └── [email protected] deduped
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
// Create a React HOC that abstracts the selection logic from
// https://codepen.io/anon/pen/vPXyOo
const withSelector = (ComposedComponent) => (
class extends React.Component {
state = { selected: false };
handleSelect = () => {
this.setState({ selected: !this.state.selected });
};
var k1 = {a: 1};
var k2 = {b: 2};
var map = new Map();
var wm = new WeakMap();
map.set(k1, 'k1');
wm.set(k2, 'k2');
k1 = null;
@stevieoj
stevieoj / retry.py
Last active September 19, 2017 19:07
#! Python
# github.com/stevieoj
# 1. Given an array of N integers, find maximum difference, where the index of the largest number is greater than
# the index of smallest number. If not find the next smallest number. If condition cannot be met return -1.
# Time complexity: O(n)
# Space Complexity: O(1)
def max_difference(xs):
import ctypes
# Dynamic Array
class DynamicArrays(object):
def __init__(self):
self.n = 0
self.capacity = 1
self.A = self.make_array(self.capacity)
// http://www.codewars.com/kata/515bb423de843ea99400000a/train/javascript
// TODO: complete this object/class
// The constructor takes in an array of items and a integer indicating how many
// items fit within a single page
function PaginationHelper(collection, itemsPerPage){
this.items = collection;
this.itemsPerPage = itemsPerPage;
}