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
// This is actually a nodejs script using string templates to demonstrate feasibility | |
// The potential use case for something like this is dynamically generating react | |
// element at run time while only supported a small subset of valid HTML elements. | |
// A full-blown HTML parser is also much larger and complex. | |
const supportedTags = [ | |
{ | |
tag: 'sup', | |
regex: /<sup>[^<>].*?<\/sup>/, | |
createReactElement: content => `<sup>${content}</sup>`, |
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
for k in `git branch | sed s/^..//`; do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset" $k --`\\t"$k";done | sort |
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
// This file doesn't go through babel or webpack transformation. | |
// Make sure the syntax and sources this file requires are compatible with the current node version you are running | |
// See https://github.com/zeit/next.js/issues/1245 for discussions on Universal Webpack or universal Babel | |
const { createServer } = require('http') | |
const express = require('express') | |
const { parse } = require('url') | |
const next = require('next') | |
const path = require('path'); | |
const dev = process.env.NODE_ENV !== 'production' |
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
# Find a string within a string and return the found index | |
# Found index will be -1 if string not found | |
def substring(strToSearch, strToFind): | |
totalLength = len(strToSearch) | |
findLength = len(strToFind) | |
for idx in range(0, totalLength): | |
if (strToSearch[idx:idx + findLength] == strToFind): | |
return idx |
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
"""Implement a function recursively to get the desired | |
Fibonacci sequence value. | |
Your code should have the same input/output as the | |
iterative code in the instructions.""" | |
prev1 = 0 | |
prev2 = 1 | |
count = 0 | |
def recursive(prev1, prev2, count, terminal): |
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
"""Implement quick sort in Python. | |
Input a list. | |
Output a sorted list.""" | |
def sort_slice(list_slice): | |
# pivot location always starts on the right | |
end_idx = len(list_slice) - 1 | |
pivot_idx = end_idx | |
# compare location always starts on the left | |
compare_idx = 0 | |
while(True): |
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 OpacityAnimation from './OpacityAnimation.jsx'; | |
const Example = ({ showBox }) => ( | |
<OpacityAnimation> | |
{showBox | |
? <div | |
key="Example" | |
style={{ | |
backgroundColor: 'red', | |
height: '30px', |
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
/* placeholder for named import */ | |
.opacityTransition {}; | |
.opacityTransition-appear { | |
opacity: 0; | |
} | |
.opacityTransition-appear.opacityTransition-appear-active { | |
opacity: 1; | |
/* autoprefix transition as needed */ |
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 from 'react'; | |
import css from './OpacityAnimation.css'; | |
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; | |
const OpacityAnimation = ({ children }) => ( | |
<ReactCSSTransitionGroup | |
transitionName={css.opacityTransition} | |
transitionAppear | |
transitionEnter | |
transitionLeave |
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
/** | |
* This file provides type definitions for use with the Flow type checker. | |
* | |
* An important caveat when using these definitions is that the types for | |
* `Collection.Keyed`, `Collection.Indexed`, `Seq.Keyed`, and so on are stubs. | |
* When referring to those types, you can get the proper definitions by | |
* importing the types `KeyedCollection`, `IndexedCollection`, `KeyedSeq`, etc. | |
* For example, | |
* | |
* import { Seq } from 'immutable' |
NewerOlder