Skip to content

Instantly share code, notes, and snippets.

@uasi
uasi / curl_easy.inko
Last active August 17, 2023 16:02
curl_easy.inko
import std.stdio.STDOUT
import extern 'c'
fn extern fopen(path: Pointer[UInt8], mode: Pointer[UInt8]) -> Pointer[UInt8]
import extern 'curl'
fn extern curl_easy_init -> Pointer[UInt8]
fn extern curl_easy_setopt(handle: Pointer[UInt8], option: Int32, ...) -> Int32
fn extern curl_easy_perform(handle: Pointer[UInt8]) -> Int32
fn extern curl_easy_cleanup(handle: Pointer[UInt8])
@uasi
uasi / pbtail.rkt
Created March 1, 2021 05:15
pbtail.rkt
#!/usr/bin/env racket
#lang racket
(require racket/base)
(require racket/port)
(require racket/system)
(define (pbpaste)
(with-output-to-string
@uasi
uasi / MyWebViewController.m
Last active January 27, 2016 08:08
WebView からサンドボックス内のローカルファイルを読み込もうとするリクエストを書き換えるやつ
@interface MyWebViewController : NSObject
@property IBOutlet WebView *webView; // nib 内の WebView に接続済みということで
@end
@implementation MyWebViewController <WebResourceLoadDelegate>
- (void)awakeFromNib {
// WebView にデリゲートを接続
self.webView.resourceLoadDelegate = self;
}
@uasi
uasi / macro_expansion_steps.exs
Last active August 29, 2015 14:22
Elixir で Plug.Builder 相当の DSL を再実装してマクロの展開順を追ってみた
### start from here ###
defmodule MyApp do
use MyPlugBuilder
plug :hello
plug :world, good: :morning
end
### expand `use MyPluginBuilder` macro ↓ ###
@uasi
uasi / file0.txt
Last active August 29, 2015 14:19
ブランチの最終更新日時を一覧にする git branch-activity 書いた ref: http://qiita.com/uasi/items/430f9403ac9b437c0499
usage: git branch-activity [-r | -a] [-R] [--no-color]
@uasi
uasi / ghq-foreach.sh
Created April 14, 2015 06:09
ghq で管理している各リポジトリでコマンドを実行する ghq-foreach 書いた ref: http://qiita.com/uasi/items/610ef5745fc35745fd54
#!/bin/bash
#
# ghq-foreach - executes git subcmd or shell cmd for each repo managed by ghq
#
EXEC=
QUIET=
say() {
@uasi
uasi / set_lang_locale.bash
Last active August 29, 2015 14:18
Language and Locale Settings
defaults write com.adobe.Flash AppleLanguages -array ja
defaults write com.adobe.Flash AppleLocale ja_JP
@uasi
uasi / defer.rs
Last active May 12, 2017 11:25
"defer" in Rust (virtually useless)
// rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
#![feature(unboxed_closures)]
#![feature(unsafe_destructor)]
macro_rules! defer {
($($body:stmt);* ;) => {
let __deferred = Deferred::new(|| { $($body);* ; });
}
}
@uasi
uasi / html51.md
Last active August 29, 2015 14:08

1.4歴史 第5段落

2003年に、ウェブフォームの次世代として位置づけられた技術であるXFormsの公表は、HTMLの代替を見つけることよりも、進化するHTML自身に再び関心を巻き起こした。 この関心は、ウェブ技術が(RSSや後のAtomのような)新しい技術に限られていたXMLの展開というよりむしろ、(HTMLのような)実際に展開された技術の置換から生まれた。

原文

In 2003, the publication of XForms, a technology which was positioned as the next generation of Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements for it. This interest was borne from the realization that XML's deployment as a Web technology was limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for existing deployed technologies (like HTML).

私案

@uasi
uasi / git-prune-branches.sh
Created October 24, 2014 05:19
git prune-branches
#!/bin/sh
#
# git-prune-branches - prune merged branches
#
# Configurations:
# .git/protected-branches - one-line regex matching the names of the branches to be protected.
#
if [ "`git branch | grep '^\*'`" != "* master" ]; then