Skip to content

Instantly share code, notes, and snippets.

@kspeakman
kspeakman / Combinators.fs
Last active July 16, 2021 11:22
Idiomatic F# routing with ASP.NET Core
module Combinators
// These are basic combinators that work with ASP.NET HttpContext.
// Feel free to add your own.
//
// most of this adapted from Giraffe v0.1.0-alpha025
// https://github.com/dustinmoris/Giraffe/blob/v0.1.0-alpha025/src/Giraffe/HttpHandlers.fs
// Some combinators adapted from Suave
// https://github.com/SuaveIO/suave
// Both projects are Apache 2.0 Licensed
@omarjackman
omarjackman / clear-olark-cookies.js
Created November 6, 2015 04:49
Clear olark cookies
// Delete olark cookies so that you can start a new chat without waiting 45 minutes.
[ '_ok', '_okac', '_okbk', '_okdetect', '_okgid', '_okla', '_oklv' ].forEach( function( name ) {
document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
} );
window.location.reload();
@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@zxbodya
zxbodya / render-react-with-rxjs.md
Last active November 1, 2021 08:49
React with RxJS, reactive way :)

Observable React elements with RxJS

Note: if you want to skip history behind this, and just looking for final result see: rx-react-container

When I just started using RxJS with React, I was subscribing to observables in componentDidMount and disposing subscriptions at componentWillUnmount.

But, soon I realised that it is not fun to do all that subscriptions(that are just updating property in component state) manually, and written mixin for this...

Later I have rewritten it as "high order component" and added possibility to pass also obsarvers that will receive events from component.

@sebmarkbage
sebmarkbage / react-terminology.md
Last active January 9, 2023 22:47
React (Virtual) DOM Terminology
@jansegre
jansegre / script.lua
Last active February 10, 2020 23:48
Very basic luajit from Rust.
-- script.lua
-- Receives a table, returns the sum of its components.
io.write("The table the script received has:\n");
x = 0
for i = 1, #foo do
print(i, foo[i])
x = x + foo[i]
end
io.write("Returning data back to C\n");
return x
@evancz
evancz / Architecture.md
Last active December 21, 2022 14:28
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo
@lestrrat
lestrrat / mecab.go
Created March 10, 2014 05:00
俺俺 golang mecabバインディング(mecabで日本語をトークナイズするためのミニマルなヤツ)
package tokenizer
/*
#cgo CFLAGS: XXX CHANGE ME XXX
#cfo LDFALGS: XXX CHANGE ME XXX
#include <mecab.h>
struct mecab_t {}
*/
import "C"
import "errors"
@mrryanjohnston
mrryanjohnston / Dockerfile
Created March 9, 2014 01:38
Golang development environment using Docker
FROM ubuntu:13.10
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang
RUN mkdir /go
RUN export GOPATH=/go
ENV GOPATH /go
RUN export PATH=$PATH:$GOPATH/bin
@JensRantil
JensRantil / example.html
Last active December 16, 2015 17:19
Improvement of http://stackoverflow.com/a/14774995/260805 that handles generated title attribute on timeago tags.
<html ng-app="MyApplication">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script src="timeago-angular.js" type="text/javascript"></script>
<script src="my-app.js" type="text/javascript"></script>
</head>
<body>
<div ng-controller="myController">
<span class="time-ago" title="{{ myTime }}"></span>
</div>