Skip to content

Instantly share code, notes, and snippets.

View j-hannes's full-sized avatar
💭
hello world

Johannes Erber j-hannes

💭
hello world
View GitHub Profile
@j-hannes
j-hannes / index.html
Last active May 21, 2016 20:23
for redux counter
<!doctype html>
<html>
<head>
<title>simple react+redux counter</title>
</head>
<body>
<div id="app"></div>
<script src="bundle.js"></script>
</body>
</html>
@j-hannes
j-hannes / app.js
Last active May 22, 2016 16:10
redux counter in es6
import React from 'react'
import ReactDOM from 'react-dom'
import { createStore } from 'redux'
const INCREMENT = 'INCREMENT'
const DECREMENT = 'DECREMENT'
const reducer = (state = 0, action) => {
switch (action.type) {
case INCREMENT:
@j-hannes
j-hannes / Counter.elm
Last active May 21, 2016 20:47
Update application state
update action state =
case action of
Increment ->
state + 1
Decrement ->
state - 1
@j-hannes
j-hannes / Main.elm
Last active May 15, 2016 17:03
Post 2 Version A
module Main exposing (..)
import Html exposing (button, div, span, text)
import Html.Events exposing (onClick)
type Action
= Increment
| Decrement
main =
@j-hannes
j-hannes / index.html
Last active May 14, 2016 10:57
HTML to include Main.elm
<!doctype html>
<html>
<head>
<title>my first elm app</title>
</head>
<body>
<div id="app"></div>
<script src="app.js"></script>
<script>
@j-hannes
j-hannes / Main.elm
Last active October 4, 2016 13:13
Hello world example from elm-lang.org
module Main exposing (..)
import Html exposing (Html, span, text)
import Html.Attributes exposing (class)
main : Html a
main =
span [ class "welcome-message" ] [ text "Hello, World!" ]
@j-hannes
j-hannes / server2.js
Created March 23, 2016 11:04
Request github in batches of 30
const fetch = require('isomorphic-fetch')
const R = require('ramda')
const url = 'https://api.github.com/search/repositories?q=+language:javascript'
const listOccurences = names => {
const occurences = {}
names.forEach(name => {
if (name in occurences) {
occurences[name] = occurences[name] + 1
@j-hannes
j-hannes / server.js
Last active March 23, 2016 10:03
Ask github for logins of most recent repositories
const fetch = require('isomorphic-fetch')
const async = require('async')
const range = require('ramda').range
const url = 'https://api.github.com/search/repositories?q=+language:javascript'
const listOccurences = names => {
const occurences = {}
names.forEach(name => {
if (name in occurences) {