Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Yuichi Tateno (secon) hotchpotch

🌴
On vacation
View GitHub Profile
View gist:696
#!ruby -Ku
class << (_ = × = 来週も見てくださいね! = 'ひだまりスケッチ×365 ')
def / x=/_/x
sub! /(.*)/, ''; print $1
self
end
def < x=/_/x
print open(caller.first.split(':').first).read.split(/\s/)[-2..-1].join(' ')
end
View autopagerize_for_haiku.user.js
// ==UserScript==
// @name Autopagerize for haiku
// @namespace http://rails2u.com/
// @include http://h.hatena.ne.jp/*
// @include http://h.hatena.com/*
// ==/UserScript==
var THRESHOLD = 800;
var w = unsafeWindow;
View fizzbuzz.swift
extension Int {
func fizzbuzz() -> String {
switch (self % 3 == 0, self % 5 == 0) {
case (true, false):
return "Fizz"
case (false, true):
return "Buzz"
case (true, true):
return "FizzBuzz"
default:
View ibook_copy_clean.rb
#!/usr/bin/ruby
# encoding: UTF-8
if `pbpaste`.match(/“(.*?)”/m)
target = $1.chomp
require 'open3'
puts target
Open3.popen3( 'pbcopy' ) {|input, _, _| input << target }
end
View gist:2539
@-moz-document domain("github.com") {
.userbox {
position: absolute;
right: 10px;
}
}
View foo.rb
def foo
puts 'hello world'
end
foo
View .irbrc
begin
require 'rubygems'
require 'readline/history/restore/auto_save'
Readline::History::Restore::AutoSave.scriptname
#require 'active_support'
rescue Exception
end
module Kernel
def r(arg)
View reinstall_ruby_ext.sh
TARGET_EXT=readline; cd ~/.rbenv/sources; for x in *; do cd ~/.rbenv/sources/${x}/ruby-${x}; pwd; rm -vf .ext/*/$TARGET_EXT.bundle ext/$TARGET_EXT/Makefile ext/$TARGET_EXT/*.o; make install-ext; done
View test_class_test.vim
if exists("g:perl_test_class_test")
finish
endif
let g:perl_test_class_test = 1
function! s:PerlTestClassMethodRun()
let re = '\vsub\s+(\w+)\s*:\s*Test'
let line = search(re, 'bn')
if line
@hotchpotch
hotchpotch / file0.txt
Last active Aug 29, 2015
A/D コンバータの MCP3002, MCP3208 を raspberry pi 上の Ruby から扱う ref: http://qiita.com/hotchpotch/items/5c47ae210a7a8e9fd6d1
View file0.txt
require 'spi_mcp'
mcp = MCP3208.new
val = mcp.channel(0)
puts val # 0 ~ 4095