Python Reference
Python Basics: Data Science ![]() |
importing data ![]() |
python 3 (pt 1 of 2) ![]() |
python 3 (pt 2 of 2) ![]() |
#!/bin/bash | |
TEMPDIR=`mktemp -d` | |
ESLINTRC=$TEMPDIR/.eslintrc | |
COMMAND="eslint --color -c $ESLINTRC --rule 'import/no-unresolved: 0' --rule 'import/no-duplicates: 0' --rule 'import/export: 0'" | |
git show HEAD:.eslintrc > $ESLINTRC | |
echo "### Ensure changes follow our code style... ####" | |
# See https://www.kernel.org/pub/software/scm/git/docs/githooks.html#pre-receive |
window.__MemoryTest__ = { | |
proto:[], | |
concat:[], | |
creat:[], | |
newFn:[], | |
factory:[] | |
}; | |
function proto(){return new Foo()} | |
function concat(){return Object.assign({},baseObj)} |
// This is a file from an experiment in hyper-decoupled, hyper-composable React architecture. | |
// | |
// A lot of it will seem really odd unless you're familiar with Higher Order Components/Functions. | |
// | |
// Some highlights: | |
// - Every component is a single semantic HTML element composed together with behaviors, | |
// attributes, styles, content, data, etc. | |
// - Every component is exported for reuse. | |
// - Any component may make any other(s) its child(ren), in any order. | |
// - Components get their data from graphql and redux state, so are usually standalone. |
// HOC designed around enabling components to consistently work with user's mental state, rather than just program state. | |
// storing this here for reference... | |
import React from 'react'; // so jsx parsing works | |
import {withProps,withReducer,mapProps,setPropTypes,branch} from 'recompose'; | |
import {ifElse} from 'ramda'; | |
import { | |
spread, rest, pick, isString, compose, pipe, uniq, startCase, get, map, values, flatten, sortBy, | |
filter, identity, keys, without, omit, transform as transformFP | |
} from 'lodash/fp'; |
# from toolz.functoolz import curry,partial,compose,flip,pipe as datapipe | |
#logic | |
def cond(predicateFnMatrix): | |
def condInner(*args): | |
for (predicate,fn) in predicateFnMatrix: | |
if predicate(*args): | |
return fn(*args) | |
return condInner |
https://docs.google.com/spreadsheets/d/1-2aTdkutAdywzBSHjpiK7zGMAczX_QW6euPczfyxa68/edit#gid=0 |
High level bash scripting cheatsheet https://devhints.io/bash
Reference for many shell commands http://www.grymoire.com/Unix/index.html
diff filea fileb
# ... file differences
javascript:((alert,$)=>{ | |
const story_template = '### Story\nAs a ___, I should be able to ___, so that ___.\n\n### Acceptance Criteria\n - [ ] __\n - [ ] __\n - [ ] __\n - [ ] Tests Written (TDD)\n - [ ] Code Written\n - [ ] Documentation Written in Relevant Readme\n\n### Depends On\n- NA\n\n### Relates To\n- NA'; | |
/*utility*/ | |
const poll = (interval=100,maxwait=1000)=>(predicate,msg)=>(new Promise((res,rej)=>{ | |
let waited = -1; | |
const t = setInterval(()=>{ | |
const passes = predicate(); | |
if(passes){clearInterval(t);res(passes);} | |
if((waited+=interval)>=maxwait) {clearInterval(t);rej(msg);} | |
},interval); |
// assumes create-react-app, and files served from src/ | |
T0: define time | |
file tree exists. Nothing imported. Static intra-file code graphs exist. | |
T1: JS run time starts. | |
index.js imports files: | |
Functions in imported files run: JS graphs updated. | |
Conceptual component graph exists. | |
T2: React run time starts | |
App Component runs. Virtual dom root exists. | |
loop: |