Skip to content

Instantly share code, notes, and snippets.

View patrickdet's full-sized avatar

Patrick Detlefsen patrickdet

View GitHub Profile
@abinavseelan
abinavseelan / index.jsx
Created March 8, 2018 19:13
(Full) Github-style user suggestions using react-input-trigger
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,
-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 June 29, 2017 12:53
Draggable table
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

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 February 20, 2024 04:40
Elm Destructuring (or Pattern Matching) cheatsheet

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"))
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 August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// 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 June 3, 2015 18:03
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
@staltz
staltz / introrx.md
Last active March 29, 2024 06:13
The introduction to Reactive Programming you've been missing
@dustinlarimer
dustinlarimer / README.md
Last active September 11, 2018 01:38
Keen IO Geo Coordinates in a Google Map