Skip to content

Instantly share code, notes, and snippets.

@sch
sch / dabblet.css
Created April 11, 2019 14:57
Untitled
.container {
text-shadow: 0.1em 0.1em pink;
}
.larger {
font-size: 30px;
}
.large-shadow {
font-size: 30px;
@sch
sch / server.ts
Created March 14, 2019 13:41
Handling routes with a function instead of middleware
import * as express from "express";
const server = express();
server.get("/posts", withAuthenticatedUser(function(req, res, user) {
const posts = getPostsForUser(user);
res.json(posts);
}));
@sch
sch / Main.elm
Last active January 30, 2019 16:35
Minimum Elm boilerplate
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, text)
import Html.Events exposing (onClick)
type alias Model =
{ count : Int }
@sch
sch / README.md
Last active September 30, 2018 15:21
Elm as an NPM dependency

Sometimes you may want to have more than one version of Elm installed on your computer.

It could be that you're in the process of upgrading multiple projects, and you'd like to have one in 0.18 and another in 0.19. It could be you want to pin your version of Elm to something specific so you can be sure all the members of your team are using the same one. It could be you're relying on lots of Elm-related tooling, and you want to make sure you have the right combination for a specific project.

One option is to piggy-back on top of the [Node Package Manager][npm], and explicitly declare which version of Elm you'd like to use. The elm binary is wrapped up as a node module with a bit of metadata:

$ npm info elm@latest

[email protected] | BSD-3-Clause | deps: 1 | versions: 33

Keybase proof

I hereby claim:

  • I am sch on github.
  • I am schaedle (https://keybase.io/schaedle) on keybase.
  • I have a public key ASBSgEE6xKGv4W9Ds7EPdZN6LnICezwpCxWiYPw7Wan6kgo

To claim this, I am signing this object:

@sch
sch / namespace.clj
Last active October 25, 2015 16:23
Clojure namespace wishlist
(ns om-tutorial.core
(:require [goog.dom :as gdom]
[om.next :as om :refer-macros [defui]]
[om.dom :as dom]
[cljs.pprint]))
;; simple maps do it better:
(ns om-tutorial.core
(:require [goog.dom {:alias gdom}]
@sch
sch / quix.txt
Created May 8, 2011 01:40
quix
bit javascript:var%20e=document.createElement('script');e.setAttribute('language','javascript');e.setAttribute('src','http://bit.ly/bookmarklet/load.js');document.body.appendChild(e);void(0); Make a bit.ly link
cal javascript:var%20s;if(window.getSelection){s=window.getSelection();}else{s=document.selection.createRange().text;}var%20t=prompt('Please%20enter%20a%20description%20for%20the%20event',s);if(t){void(window.open(encodeURI('http://www.google.com/calendar/event?ctext='+t+'&action=TEMPLATE&pprop=HowCreated%3AQUICKADD'),'gcal'));}else{void(s);} Add event to Google Calendar
eye javascript:void(window.open('http://tineye.com/search?pluginver=bookmark_1.0&url='%20+%20encodeURIComponent(document.URL))); TinyEye: Where's this image from?
gsub javascript:var%20b=document.body;if(b){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/subscribe-bookmarklet.js');void(b.appendChild(z));}else{location='http://www.google.com/reader/vie