View .elm
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onInput, onClick)
main =
Html.beginnerProgram { model = Model "" "", view = view, update = update }
type alias Model =
View Json.scala
// WARNING! totally untested, I have only compiled the code! :)
package json
import collection.immutable.Map
import scalaz.{\/, MonadPlus}
import scalaz.\/._
import scalaz.std.vector._
import scalaz.std.map._
import scalaz.std.list._
View .kt
package com.danneu.result
class State <T> (var target: T, var tip: String? = null) {
override fun toString() = "[State tip=$tip]"
}
typealias ResultState <T> = Result<State<T>, String>
View main.kt
package com.danneu.msgpack
import org.msgpack.core.MessagePack
import org.msgpack.core.MessagePacker
import org.msgpack.core.MessageUnpacker
import org.msgpack.value.ValueType
import java.math.BigInteger
// DEMO: Encode <-> Decode roundtrip
View photo.scr
MZPˇˇ∏@∫¥ Õ!∏LÕ!êêThis program must be run under Win32
$7PEL^B*‡éÅ "Ï/@@† ù
@pÜ! @|: #¿^∞CODEà " `DATAî@&@¿BSSE `8¿.idataÜ!p"8@¿.tls†Z¿.rdata∞Z@P.reloc^¿`\@P.rsrc@| ~º@Pp @P
View Result.kt
package com.danneu.result
// These were moved into extension functions since they violated `out` constraint
// when implemented as instance methods.
/**
* Result.ok(42).getOrElse(-1) == 42
* Result.err("failure").getOrElse(-1) == -1
*/
fun <V, E> Result<V, E>.getOrElse(default: V): V = when (this) {
View middleware.js
'use strict'
// 3rd
const uuid = require('uuid')
const debug = require('debug')('app:middleware:track')
// 1st
const db = require('../db')
const {isValidUuid, futureDate} = require('../belt')
module.exports = ({cookieKey = 't', interval = 5000} = {}) => {
debug('initializing track middleware')
View 1-schema.sql
CREATE TABLE users (
id bigserial PRIMARY KEY,
uname text NOT NULL,
created_at timestamptz NOT NULL DEFAULT NOW()
);
-- A hit is inserted for every authenticated page view
CREATE TABLE hits (
id bigserial PRIMARY KEY,
user_id int NOT NULL REFERENCES users(id) ON DELETE CASCADE,
View SecondaryClipboard.js
var SecondaryClipboard = {
cut: function(editorState: EditorState): EditorState {
var content = editorState.getCurrentContent();
var selection = editorState.getSelection();
var targetRange: ?SelectionState = null;
if (selection.isCollapsed()) {
var anchorKey = selection.getAnchorKey();
var block = content.getBlockForKey(anchorKey);
var blockEnd = block.getLength();
View insertBlock.js
import {
EditorState,
ContentBlock,
genKey
} from 'draft-js'
// Inserts a new block before the current block and selects it
export function insertBlockBefore (editorState, newBlock) {
return injectBlock(true, editorState, newBlock)