Skip to content

Instantly share code, notes, and snippets.

Kenta Murata mrkn

View GitHub Profile
View gist:20322
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/dir.h>
int
main(int argc, char** argv)
{
View gist:20330
/* gcc -framework Foundation -framework AppKit -o file_wo_kesu file_wo_kesu.m */
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
#import <AppKit/NSOpenPanel.h>
View measure_lexical_with_test.rb
module Measure
class Unit
class << self
def unit_name
return nil
end
alias __inspect__ inspect
def inspect
if unit_name
View gist:27437
require 'rubygems'
require 'kagemusha'
musha = Kagemusha.new(Time)
musha.defs(:now) { self.local(1984, 5, 11) }
musha.def(:+) {|other| other }
def foo
puts "enter foo"
p Time.now
View tig.rb.diff
--- net-irc/examples/tig.rb 2008-10-30 00:15:47.000000000 -0400
+++ tig.rb 2008-11-30 08:48:29.000000000 -0500
@@ -471,10 +471,16 @@
post server_name, RPL_ENDOFWHO, @nick, channel
when @groups.key?(channel)
@groups[channel].each do |name|
- f = @friends.find {|i| i["screen_name"] == name }
- user = nick = f["screen_name"]
- host = serv = api_base.host
- real = f["name"]
@mrkn
mrkn / port-scheduler.rb
Created Dec 16, 2008
scheduling port installation
View port-scheduler.rb
require 'readline'
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
View ffmpeg_ipod_touch.rb
mp3 = false
input = ARGV.shift
while input =~ /^-/
case input
when /^-mp3/
mp3 = true
end
input = ARGV.shift
end
View isbn_amazon_redirector.rb
#! /usr/bin/ruby -Ku
# To rewrite URL, the following may be written in .htaccess:
#
# RewriteEngine On
# RewriteBase ^/path/to
# RewriteRule ^([\dX]+) /path/to/?$1 [L,R]
def isbn10_check_digit(common)
d = common.split(//)
c = (11 - (2..10).inject(0) {|a, x| a + x*d[10-x].to_i} % 11) % 11
View port_universalize.rb
def active_version_variants(x, installed)
/@[^+]+/.match(installed[x].keys.select{|var| installed[x][var] }[0])
return [$&, $' ? $'.scan(/\+[^+]+/) : []]
end
def active_variants(x, installed)
return active_version_variants(x, installed)[1]
end
def active_deps(x, installed)
View gist:45004
JSAI-MLの皆様
(重複してお受け取りの際はご容赦ください)
高間@首都大です.
第14回WI2研究会の発表申込期限が明日(1/9)までとなっておりますので,
再度ご案内します.
今回,特別講演として,島根ご在住のまつもとゆきひろ氏をお招きし,
日本発のオブジェクト指向スクリプト言語である「Ruby」の開発に関する
You can’t perform that action at this time.