[based on a true story]
So. Your friend's about to teach you how to make a website. Great!
You make a file, and you save it as 'index.html'. Why it's called 'index' isn't really explained to you, but whatever.
You type the following.
hello world| #!/bin/bash | |
| rm -rf dist && mkdir dist | |
| npx babel src --out-dir dist --ignore node_modules | |
| cp src/package.json dist | |
| cd dist && yarn install --production --modules-folder node_modules |
| class ExampleForm extends React.Component<Props> { | |
| render() { | |
| return ( | |
| <View> | |
| <TextInput name={'email'} /> | |
| </View> | |
| ); | |
| } | |
| } |
[based on a true story]
So. Your friend's about to teach you how to make a website. Great!
You make a file, and you save it as 'index.html'. Why it's called 'index' isn't really explained to you, but whatever.
You type the following.
hello world| const repl = require(‘repl’) | |
| const server = repl.start({ /* your config options */ }) | |
| // synchronous methods are fine, here. you don't want to run a REPL on any middleware that | |
| // handles user requests, anyway. | |
| fs.statSync('.node_repl_history') | |
| // load command history from a file called .node_repl history in the current directory | |
| fs.readFileSync('.node_repl_history') | |
| .split(‘\n’) |
| import Relay from 'real-react-relay'; | |
| export class Mutation extends Relay.Mutation { | |
| _resolveProps(props) { | |
| this.props = props; | |
| } | |
| } | |
| export class MockStore { | |
| reset() { |
| primary: | |
| image: mongo:3.0 | |
| volumes: | |
| - ./p:/data | |
| ports: | |
| - "27017:27017" | |
| # Our current version of docker-compose doesn't allow extra_hosts which would be the best way | |
| # to add curcular dependency container links in this case. We cant upgrade docker-compose | |
| # without upgrading docker to 1.7, and we can't do that without upgrading the kernel on our | |
| # CentOS VM's. As such we are using the hostname hask below to allow primary and secondary |
A Pen by Mike North on CodePen.
| var http = require('http'); | |
| var router = require('routes')(); | |
| var Busboy = require('busboy'); | |
| var AWS = require('aws-sdk'); | |
| var inspect = require('util').inspect; | |
| var port = 5000; | |
| // Define s3-upload-stream with S3 credentials. | |
| var s3Stream = require('s3-upload-stream')(new AWS.S3({ | |
| accessKeyId: '', |
Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.