Skip to content

Instantly share code, notes, and snippets.

View ne-sachirou's full-sized avatar

さっちゃん ne-sachirou

View GitHub Profile
@ne-sachirou
ne-sachirou / count_words.js
Created August 8, 2011 12:29
CouchDB _design/manage.count_words View
{
"_id": "_design/manage",
"language": "javascript",
"views": {
"count_words": {
"map": function(doc) {
var wordslist = [
['suki', '好', 'すき', 'スキ', 'スキ'],
['kirai', '嫌', 'きらい', 'キライ', 'キライ'],
['chiga', '違', 'ちが', 'チガ', 'チガ', 'ちげ', 'チゲ', 'チゲ']
@ne-sachirou
ne-sachirou / dropStartsSame.js
Created August 12, 2011 18:10
お題:文字列を先頭から見て同じところまで除去
// http://d.hatena.ne.jp/fumokmm/20110812/1313138407
function dropStartsSame(/* ... */) {
var i = j = length_i = length_j = 0,
args = [],
flag = true;
for (i = 0, length_i = arguments.length; i < length_i; i += 1) { args[i] = arguments[i]; }
for (i = 0, length_i = arguments[0].length; i < length_i; i += 1) {
for (j = 1, length_j = arguments.length; j < length_j; j += 1) {
@ne-sachirou
ne-sachirou / cl11_08.c
Created August 30, 2011 11:29
Draw Magic Square on the Console.
/*
* (C)2011 ne_Sachirou http://c4se.tk/profile/ne.html
* Draw Magic Square on the Console.
*
* site: https://gist.github.com/1180700
* license: Public Domain
*
* Usage:
* Just compile and exec.
* gcc -o cl11_08 cl11_08.c # on gcc
@ne-sachirou
ne-sachirou / favottane.js
Created October 1, 2011 11:09
ふぁぼったね! improved #AzureaScript
/**
* @fileOverview Improving http://azurea.info/ja/wiki/index.php?Scripts%2FFavottane.js
*/
/*
* ==Usege
* When you faved, this script automatically post a reply.
* Set Reply Text to rep_text[] (String).
* If you want to reply to limitted users, set user names to rep_users[] (String or RegExp).
*/
@ne-sachirou
ne-sachirou / .zshrc
Created November 11, 2011 05:32
Rakefile generate_sinatra_project
function generate_sinatra_project(){
rake -f /home/ne_Sachirou/default.rake generate_sinatra_project\[$1\]
}
@ne-sachirou
ne-sachirou / solve.html
Created November 25, 2011 13:33
Puzzle solver example on Ruby.
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>puzzle</title>
</head>
<body>
<div id="puzzle">
<input type="button" class="puzzlebutton" value="0" />
<input type="button" class="puzzlebutton" value="1" />
@ne-sachirou
ne-sachirou / replyAll.js
Created April 15, 2012 13:50
replyAll.js #AzureaScript
/**
* @fileOverview ちゅーんさま用。Azureaのreply all。
* 自作の[ES5.js https://gist.github.com/1018954 ]を使いました。
* 昔のAzureaVimでは、簡易templeteエンジン組んでこんな[ https://github.com/ne-sachirou/AzureaVim/blob/azvm1/src/plugins/reply.js ]風に書いてました。master blanchにはrelpy pluginはありません。
* 因みにAzureaVimは、AzureaのAPI変更に追随していないのでもう動きません。
*/
if (!Array.prototype.indexOf) {
/**
* @param val Object
@ne-sachirou
ne-sachirou / ExecuteNonQuery.aspx.cs
Created July 6, 2012 03:39
ASP.NET C# and MySQL example
using System;
using MySql.Data.MySqlClient;
namespace insert
{
public class User
{
public string ID;
public string Name;
public string Pass;
@ne-sachirou
ne-sachirou / trim_psd.py
Created February 16, 2013 22:23
Trim Photoshop files and save them into PNG files, on GIMP Python-Fu. (part of a project at Ranyuen)
"""Trim Photoshop files and save them into PNG files, on GIMP Python-Fu.
author: ne_Sachirou <[email protected]>
date: 2013/02/12
license: Public Domain
GIMP 2.8.0, Python 2.7.2
For syntax check, ``python -m py_compile trim_psd.py``.
"""
import platform
@ne-sachirou
ne-sachirou / which.bat
Last active December 15, 2015 08:18
*nix `which` command on Windows (need Ruby).
@echo off
rem setlocal
rem for %%t in (%1) do echo,%%~$path:t
rem for %%e in (%pathext%) do (
rem for %%t in (%1%%e) do echo,%%~$path:t
rem )
rem endlocal
ruby -x %~f0 %*
@goto end