読者はwebpackerのREADMEを読んでないと仮定。
- redux
- flowtype
- eslint
- reducerのテスト
function snakeCaseKeys(obj) { | |
const tr = obj => _.transform(obj, (result, value, key) => { | |
result[_.snakeCase(key)] = _.isPlainObject(value) ? tr(value) : value | |
}); | |
return tr(obj); | |
} | |
function camelCaseKeys(obj) { | |
const tr = obj => _.transform(obj, (result, value, key) => { | |
result[_.camelCase(key)] = _.isPlainObject(value) ? tr(value) : value |
-- this can be compiled | |
neverText : Html Never | |
neverText = text "never dispatch message" | |
-- this can not be compiled | |
htmlNever : Html msg -> Html Never | |
htmlNever elem = elem |
<html> | |
<head> | |
<style> | |
.parent { | |
width: 300px; | |
height: 300px; | |
background: black; | |
padding: 100px; | |
} | |
.draggable { |
module App exposing (..) | |
import Html exposing (Html, div, text, program) | |
-- MODEL | |
type alias Model = | |
String |
module Hello exposing (..) | |
import Html exposing (text) | |
import List exposing (take, drop, head) | |
indexOf : a -> List a -> Int | |
indexOf target list = | |
let | |
f target n list = |
// Aはpropsで装飾用のコンポーネントを受け取りたい | |
// ただし、装飾用のコンポーネントが必要とするpropsについては関知したくない | |
function A(props) { | |
const Decorator = props.decorator; | |
return ( | |
<div> | |
<Decorator {...props.decoratorProps}>TEST</Decorator> | |
</div> | |
); | |
} |
// Aはpropsで装飾用のコンポーネントを受け取りたい | |
// ただし、装飾用のコンポーネントが必要とするpropsについては関知したくない | |
function A(props) { | |
const Decorator = props.decorator; | |
return ( | |
<div> | |
<Decorator>TEST</Decorator> | |
</div> | |
); | |
} |
// gcc hello_opengl.c -o hello_opengl -lglfw -framework OpenGL | |
#include <GLFW/glfw3.h> | |
int main(void) | |
{ | |
GLFWwindow* window; | |
/* Initialize the library */ | |
if (!glfwInit()) | |
return -1; |