Skip to content

Instantly share code, notes, and snippets.

View dtothefp's full-sized avatar

David Fox-Powell dtothefp

  • Flexport
  • United States
View GitHub Profile
// HOC and context
// provide context with HOC
import App from './components/App';
import ProvideContext from './containers/ProvideContext';
const transportationTypes = [
'armored car',
'fire engine',
'golf cart',
const transportationList = (
<ul>
<li>Armored Car</li>
<li className="active">Hyperloop</li>
</ul>
);
ReactDOM.render(
transportationList,
document.getElementById(‘app’)
git ls-remote https://github.com/docker/compose | grep refs/tag | grep -o "[0-9]\.[0-9]\{1,2\}\.[0-9]\{1,2\}$" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1

Bubble Sort

  • good for nearly sorted lists
  • look at consecutive pairs
  • passes over entire list
    • everytime do a pass, the largest card in first pair not in correct position will be moved into correct position
  • each pass one card is guaranteed to be moved to correct position

Variables

  • $0 - The name of the Bash script.
  • $1 - $9 - The first 9 arguments to the Bash script. (As mentioned above.)
  • $# - How many arguments were passed to the Bash script.
  • $@ - All the arguments supplied to the Bash script.
  • $* - All the arguments supplied to the Bash script seperated by the IFS.
  • $? - The exit status of the most recently run process.
  • $$ - The process ID of the current script.
  • $USER - The username of the user running the script.
  • $HOSTNAME - The hostname of the machine the script is running on.
[{
"_id": "58c761f1364d84385f960739",
"sn_number": "",
"w_number": "w0001",
"stage": "Busbar Welding",
"status": "WIP",
"type": "Dev",
"active": true,
"url": "string",
"__v": 0,
import React, {createClass} from 'react';
import {assign} from 'lodash';
import hoistNonReactStatics from 'hoist-non-react-statics';
function createComponent(Component, dataBindings) {
const displayName = `ProvideContextComponent(${Component.displayName || Component.name})`;
const ProvideContextComponent = createClass({
displayName,
docker images
docker search <name*>
docker inspect <image_name>
docker pull <name:tag,name,id>
docker ps # what is running
docker ps -a # what containers ran in the past
docker run -it # interactive, terminal
docker run -d # run in background
docker run -d <some_cmd> -e <some_script> # execute
docker attach <container_name> # attach to process of running container
<script>
window.Promise || document.write('<script src="https://unpkg.com/es6-promise@3.2.1/dist/es6-promise.min.js"><\/script>');
window.fetch || document.write('<script src="https://unpkg.com/whatwg-fetch@1.0.0/fetch.js"|script src="https://unpkg.com/whatwg-fetch@1.0.0/fetch.js"><\/script>');
</script>
const urls = `/home/anti-depressants/xanax
/home/heart/lipitor
/home/heart/atorvastatin
/home/heart/aspirin
/drugs/nasal/flonase
/drugs/topical
/drugs/routes/oral/tablets
/drugs/routes/nasal/flonase`;
const parseUrl = (url) => {