Skip to content

Instantly share code, notes, and snippets.

@ynkdir
ynkdir / weeknum.js
Created December 25, 2015 09:20
weeknum.js
// うるう年
Date.prototype.isLeapYear = function() {
var y = this.getFullYear();
return (y % 4 == 0 && y % 100 != 0) || (y % 400 == 0);
};
// 年間積算日
Date.prototype.getDayOfYear = function() {
var days1 = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
var days2 = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]
@ynkdir
ynkdir / figure1.png
Last active December 24, 2015 03:42
vim calendar generator
figure1.png
@ynkdir
ynkdir / dassword.go
Created November 3, 2015 11:10
dassword
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"log"
)
func main() {
@ynkdir
ynkdir / patiencediff.go
Last active September 9, 2015 09:20
patiencedif.go
package main
// Patience Diff Advantages
// http://bramcohen.livejournal.com/73318.html
//
// Patience Diff, a brief summary
// http://alfedenzo.livejournal.com/170301.html
//
// 1. Match the first lines of both if they're identical, then match the
// second, third, etc. until a pair doesn't match.
@ynkdir
ynkdir / test_scrollwindowex.c
Last active September 5, 2015 14:07
ScrollWindowEx() does not scroll out text occationally.
#include <windows.h>
#include <stdio.h>
#include <string.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
HWND hwnd;
MSG msg;
WNDCLASSEX cls;
@ynkdir
ynkdir / abcdiff.cpp
Last active August 29, 2015 14:27
abcdiff(仮)
// cl /Idtl abcdiff.cpp
// https://github.com/cubicdaiya/dtl
#include <dtl/dtl.hpp>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
diff --git a/src/ops.c b/src/ops.c
index 62d88a7..7fda2c7 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -5407,6 +5407,8 @@ do_addsub(command, Prenum1, g_cmd)
int did_change = FALSE;
pos_T t = curwin->w_cursor;
int maxlen = 0;
+ pos_T startpos;
+ pos_T endpos;
@ynkdir
ynkdir / ctrlshiftkey.c
Last active August 29, 2015 14:27
vim ctrl-shift-b
// cl /LD ctrlshiftkey.c user32.lib
#include <windows.h>
#ifdef _MSC_VER
# define EXPORT __declspec(dllexport)
# else
# define EXPORT
#endif
@ynkdir
ynkdir / taiyosha_comic.ps1
Last active November 14, 2022 23:26
太洋社 (http://taiyosha.co.jp/) のコミック発売予定一覧を取得して CSV を出力する
# 太洋社 (http://taiyosha.co.jp/) のコミック発売予定一覧を取得する
#
# to get csv:
# taiyosha_comic.ps1 | ConvertTo-CSV
function ToUTF8($s) {
return [Text.Encoding]::UTF8.GetString([Text.Encoding]::GetEncoding("ISO-8859-1").GetBytes($s))
}
function GetTable($url) {
@ynkdir
ynkdir / win32.mak
Created July 31, 2015 21:05
win32.mak
# Win32.Mak - Win32 application master NMAKE definitions file for the
# Microsoft Windows SDK programming samples
# Copyright (C) Microsoft Corporation
# -------------------------------------------------------------------------
# This files should be included at the top of all MAKEFILEs as follows:
# !include <Win32.Mak>
# -------------------------------------------------------------------------
#
# Define APPVER = [ 4.0 | 5.0 | 5.01 | 5.02 | 6.0 | 6.1] prior to including win32.mak to get
# build time checking for version dependencies and to mark the executable