Skip to content

Instantly share code, notes, and snippets.

View mattn's full-sized avatar
🍛
I love curry 🍛

mattn mattn

🍛
I love curry 🍛
View GitHub Profile
@mattn
mattn / create_union_enum.zig
Last active July 14, 2022 04:11 — forked from hnakamur/create_union_enum.zig
create union enum in Zig
const std = @import("std");
const expect = std.testing.expect;
const cell = struct {
v1: ?*Variant,
v2: ?*Variant,
};
const Variant = union(enum) {
int: i32,
@mattn
mattn / a.go
Created April 9, 2018 08:56 — forked from hyuki/a.go
os.Create, fmt.Fprintf
package main
import (
"bufio"
"fmt"
"log"
"os"
)
func main() {
scriptencoding utf-8
let url = 'http://www.tepco.co.jp'
let indexj = '/cc/press/index-j.html'
let res = webapi#http#get(url.indexj)
if res.header[0] != 'HTTP/1.1 200 OK'
echo 'Oops! Something wrong.'
endif
let data = iconv(res.content, 'utf-8', &encoding)
let dom = webapi#html#parse(data)
@mattn
mattn / sum.c
Created March 26, 2012 05:12 — forked from rummelonp/sum.c
変数は新たに宣言しない1から100までの整数の和を表示するプログラム
#include <stdio.h>
int main(int argc, char* argv[]) {
argc = 0;
argv[0] = 100;
while (argv[0] > 0) {
argc += argv[0];
argv[0] -= 1;
}
printf("%d\n", argc);
@mattn
mattn / dump.vim
Created December 6, 2011 13:18 — forked from ynkdir/dump.vim
google-calendar-holiday
scriptencoding utf-8
let s:calendar_list = [
\ ['Australian Holidays', 'en.australian#holiday@group.v.calendar.google.com'],
\ ['Austrian Holidays', 'en.austrian#holiday@group.v.calendar.google.com'],
\ ['Brazilian Holidays', 'en.brazilian#holiday@group.v.calendar.google.com'],
\ ['Canadian Holidays', 'en.canadian#holiday@group.v.calendar.google.com'],
\ ['China Holidays', 'en.china#holiday@group.v.calendar.google.com'],
\ ['Christian Holidays', 'en.christian#holiday@group.v.calendar.google.com'],
\ ['Danish Holidays', 'en.danish#holiday@group.v.calendar.google.com'],
@mattn
mattn / colorsel.vim
Created October 28, 2011 08:12 — forked from c9s/.vimrc
vim colorscheme selector
function! s:SelectColorScheme()
let files = sort(map(split(globpath(&rtp, 'colors/*.vim'), "\n"), 'fnamemodify(v:val, ":t:r")'))
silent 15vnew
call setline(1, files)
silent file `="SelectColorScheme"`
setlocal bufhidden=wipe buftype=nofile nonu nomodifiable cursorline
nnoremap <buffer> <silent> j j:<c-u>exe 'color' getline('.')<cr>
nnoremap <buffer> <silent> k k:<c-u>exe 'color' getline('.')<cr>
nnoremap <buffer> <silent> q :<c-u>close<cr>
endfunction
@mattn
mattn / .gitignore
Created September 6, 2011 07:29 — forked from sekimura/.gitignore
Facebook command-line client helper
.fb_access_token
.fbconsole.py
hello
// ==UserScript==
// @name Social count
// @namespace http://june29.jp/
// @include http://*
// @include https://*
// ==/UserScript==
(function() {
if (window.top != window.self) exit;