Skip to content

Instantly share code, notes, and snippets.

Avatar

Patrick Detlefsen patrickdet

View GitHub Profile
@abinavseelan
abinavseelan / index.jsx
Created Mar 8, 2018
(Full) Github-style user suggestions using react-input-trigger
View index.jsx
import React, { Component } from 'react';
import { render } from 'react-dom';
import InputTrigger from 'react-input-trigger';
class App extends Component {
constructor() {
this.state = {
top: null,
left: null,
showSuggestor: false,
View sub_server.erl
-module(sub_server).
-behaviour(gen_server).
-export([start_link/0]).
%% gen_server callbacks
-export([init/1,
handle_call/3,
handle_cast/2,
@simonh1000
simonh1000 / DragTable.elm
Last active Jun 29, 2017
Draggable table
View DragTable.elm
module DragTable exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Json.Decode as Json exposing (Decoder, Value)
import Dict exposing (Dict)
import List as L exposing (drop, take)
import Tuple
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@yang-wei
yang-wei / destructuring.md
Last active May 4, 2022
Elm Destructuring (or Pattern Matching) cheatsheet
View destructuring.md

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !

Tuple

myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
View elm-binary-tree.elm
sum : Tree Int -> Int
sum tree =
case tree of
Empty -> 0
Node v left right ->
v + sum left + sum right
flatten : Tree a -> List a
flatten tree =
case tree of
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active Aug 20, 2019
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
View redux-devtools-separate-window.js
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@gaearon
gaearon / combining.js
Created Jun 3, 2015
Combining Stateless Stores
View combining.js
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
@staltz
staltz / introrx.md
Last active May 15, 2022
The introduction to Reactive Programming you've been missing
View introrx.md
@dustinlarimer
dustinlarimer / README.md
Last active Sep 11, 2018
Keen IO Geo Coordinates in a Google Map
View README.md