Skip to content

Instantly share code, notes, and snippets.

env := GZEnvironment empty.
env source:
'
Glyph <: (w:Real, s:Real)
Word <: (w:Real, s:Real, n:Real)
Point <: (x:Real, y:Real)
MakeWords : Glyph >> Word
W = (0, 0, 0):Word
∀ G
-- Running Fibonacci numbers
import FRP.Reactive ( Event, atTimes, scanlE )
import FRP.Reactive.LegacyAdapters ( adaptE )
import Control.Applicative ( (<$>) )
fibs :: Event a -> Event (Integer, Integer)
fibs e = scanlE (\(n0, n1) _ -> (n1, n0 + n1)) (0, 1) e
main :: IO ()
-- コンパイル方法
-- $ ghc -o dos2unix dos2unix.hs
import System.IO (openTempFile, hClose, hPutStr)
import System.Directory (renameFile)
import System.Environment (getArgs)
-- DOS -> UNIX 改行変換。変換後元のファイルを書き換えます。
dos2unix :: String -> IO ()
dos2unix input = do src <- readFile input -- ファイルの中身をごそっと読み込むと Haskell がちょっとずつ処理してくれる。
let dst = filter (/= '\r') src -- src の中から CR 削除して dst へ
@propella
propella / shm.c
Last active February 8, 2024 01:54
Wayland shm example
/*
* Wayland shm example
* Based on https://jan.newmarch.name/Wayland/SharedMemory/
* Build: cc -o shm shm.c -lwayland-client
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wayland-client.h>
@propella
propella / triangle_simple.c
Last active July 16, 2024 00:32
A simple Wayland EGL program to show a triangle
/*
* A simple Wayland EGL program to show a triangle
*
* cc -o triangle_simple triangle_simple.c -lwayland-client -lwayland-egl -lEGL -lGLESv2
*/
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <assert.h>
#include <string.h>
<a href="https://qiita.com/propella/items/7b05ad222cd3c0b86a24">D3.js https://d3js.org/ の勉強</a>
<div>
<div class="num">One</div>
<div class="num">Two</div>
<div class="num">Three</div>
<div class="num">Four</div>
</div>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script>
@propella
propella / sticky.yaml
Last active September 6, 2018 08:41
Kubernetes persistence demo
# sticky.yaml
apiVersion: v1
kind: Service
metadata:
name: sticky
labels:
app: sticky
spec:
type: LoadBalancer
@propella
propella / index.html
Created November 21, 2018 05:23
Vue sample
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<div>Template: {{ message }}</div>
<div v-bind:title="title">Please hover</div>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.