Skip to content

Instantly share code, notes, and snippets.

@gengar
gengar / fcontrol.rkt
Created Jul 7, 2020
fcontrol/runってこういう理解でOK?
View fcontrol.rkt
#lang racket
(require racket/control)
(define (call-with-run thunk proc)
(call/prompt thunk
(default-continuation-prompt-tag)
proc))
(define-syntax run
(syntax-rules ()
@gengar
gengar / function-try-block.el
Created May 26, 2020
c++-modeがfunction-try-blockのインデントでおかしいのをadviceで修正する試み
View function-try-block.el
;; c-beginning-of-statement-1 は function-try-block のとき、
;; (1) メンバ初期化があれば、最初のメンバ初期化の先頭
;; (2) さもなくば、 try の先頭
;; まで point が動く。try の先頭位置から再び c-beginning-of-statement-1 すると期待する場所へ動く。
(defun my:c-beginning-of-statement-1 (orig &rest args)
(let* ((ret (apply orig args))
(try-pos (and (eq 'c++-mode major-mode)
(save-excursion
(or (and (looking-at-p "try")
(point))
View pp.hpp
#define PP_AUX_STR(s) #s
#define PP_STR(s) PP_AUX_STR(s)
#define PP_AUX_CAT(x, y) x ## y
#define PP_CAT(x, y) PP_AUX_CAT(x, y)
#define PP_ARG_HEAD(arg, ...) arg
#define PP_ARG_TAIL(arg, ...) __VA_ARGS__
#define PP_AUX_ARG_GET_0(a0, ...) a0
@gengar
gengar / c-grammar.scm.patch
Last active Oct 3, 2019
c-wrapperがMojave+Xcode11で動かなかったので
View c-grammar.scm.patch
--- c-grammar.scm.orig 2019-10-04 00:07:42.000000000 +0900
+++ c-grammar.scm 2019-10-03 22:17:39.000000000 +0900
@@ -19,7 +19,7 @@
XOR_ASSIGN OR_ASSIGN TYPENAME
TYPEDEF EXTERN STATIC AUTO REGISTER INLINE RESTRICT
- SIGNED UNSIGNED CONST VOLATILE
+ SIGNED UNSIGNED CONST VOLATILE NULLABLE NONNULL
STRUCT UNION ENUM ELLIPSIS RANGE
View puyopContestManager.user.js
// ==UserScript==
// @name puyopContestManager
// @namespace https://twitter.com/kaki_puyo
// @description ぷよパークの3DSぷよ通対戦会の登録を補助する
// @include http://www.puyop.com/Contest
// @version 0.1.0
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// ==/UserScript==
View macro-error.scm
(use util.match)
(use gauche.record)
(define-syntax m
(er-macro-transformer
(^ (form r c)
(match form
((_ name)
`(,(r 'define-record-type)
,(r name)
View ref.scm
(define ~/default
(case-lambda
((obj index default)
(ref obj index default))
((obj index i x . xs)
(apply ~/default
(ref obj index)
i x xs))))
(define-syntax ~~
View Lexer.hs
{-# LANGUAGE FlexibleContexts #-}
module Lexer ( tokenize, token, tokenEq, tokenChar, tokenString
, BaseToken, BaseLexer, BaseParser
) where
import Control.Applicative
import Control.Monad.Identity
import Text.Parsec hiding (token)
import qualified Text.Parsec as Parsec (token)
View js2-mode.diff
diff --git a/js2-mode.el b/js2-mode.el
index 62a9da4..ec261e7 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -3302,7 +3302,9 @@ Note that a let declaration such as let x=6, y=7 is a `js2-var-decl-node'."
(defun js2-print-let-node (n i)
(insert (js2-make-pad i) "let (")
- (js2-print-ast (js2-let-node-vars n) 0)
+ (let ((p (point)))
View hello.scm
(display "Hello, Gist!\n")