Skip to content

Instantly share code, notes, and snippets.

View keroxp's full-sized avatar

Yusuke Sakurai keroxp

View GitHub Profile
@keroxp
keroxp / report.rb
Created June 27, 2012 12:23
素数かつフィボナッチ数を出力するプログラム
require "rubygems"
require "Monitor"
require "./fib.rb"
require "./prime.rb"
l = Monitor.new
h = {}
threadF = Thread.new do
Fib.calc { |f|
@keroxp
keroxp / prime.rb
Created June 27, 2012 12:24
素数を出力するプログラム
class Prime
def self.calc
primes = [2]
puts 2
i = 3
loop do
max = Math.sqrt(i).floor
primes.each do |p|
if p > max then
yield i
@keroxp
keroxp / fib.rb
Created June 27, 2012 12:25
フィボナッチ数を出力するプログラム
class Fib
def self.calc
fibs = [1,1]
loop do
yield fibs[0]
fibs.push fibs.shift + fibs[0]
end
end
end
@keroxp
keroxp / report2-2.js
Created June 27, 2012 12:27
自分の学籍番号を認識するプログラミング
(function(){
$(function(){
var __VARS__,
ID = $("#id").val(),
red = "#CD2525",
green = "#adff2f",
blue = "#1E90FF",
$input = $("#input1");
$input.on("keydown keyup",checkID).val(ID).css("backgroundColor",green);
@keroxp
keroxp / report2-3.js
Created June 27, 2012 12:29
自分の学籍番号と一文字違いの文字列を認識するプログラム
(function(){
$(function(){
var ID = $("#id").val(),
IDArray = [],
$input = $("#input2")
red = "#CD2525",
green = "#adff2f",
blue = "#1E90FF";
for(var i = 0 , max = ID.length ; i < max ; i++){
@keroxp
keroxp / dame.rb
Created July 22, 2012 10:32
プログラミングコンテストの問題
#ダメ解答
f = 1
s = 0
for i in 1..100 do
f *= i
end
n = f
@keroxp
keroxp / iosicon.rb
Created May 21, 2013 12:49
ひとつのファイルからiOSアプリのアイコンを全部作るRubyスクリプト tiny script for making ios app icons in all sizes #USAGE ruby iosicon.rb ICON_NAME
# coding:utf-8
require "rubygems"
require "RMagick"
if !ARGV[0]
STDERR.puts "missing argument"
exit
end
@keroxp
keroxp / iosimgresize.rb
Created May 21, 2013 12:52
フォルダ中の@2x画像をすべて縮小して非retina用画像にするスクリプト tiny script for resizing all reitna images in specified directory into non-retina images #USAGE ruby iosimgresize.rb DIR_NAME
# coding:utf-8
require "rubygems"
require "RMagick"
if !ARGV[0]
STDERR.puts "missing argument"
exit
end
@keroxp
keroxp / Grunt.md
Last active December 24, 2015 21:18

Grunt Memo

最高の夏合宿で教えてもらったNode.jsのタスクランナーGruntを使ってみた

What's Grunt?

Node.jsで作られたタスク自動化ツール

  • サーバーをたてる
  • 構文チェック
@keroxp
keroxp / Rakefile
Last active December 29, 2015 17:49
Rakefile for iOS CI build
import "farm.rake"
# デフォルトのタスクを記述
task :default => ["clean","build:all","test:all"]
# 必要があればプロジェクトとワークスペースのパス
# $PROJECT = "Hoge.xcodeproj"
# $WORKSPACE = "Hoge.workspace"
# デフォルトのビルドスキーム