This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# fooが頭に無いbarをファイルに出力する | |
reg = /(?<!foo)bar/ | |
array = ["foo","bar","baz"] | |
file_name = "./hoge.txt" | |
f = File.open file_name,"a+" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# fooが頭に無いbarをファイルに出力する 2 | |
array = ["foo","bar","baz"] | |
file_name = "./hoge.txt" | |
f = File.open file_name,"a+" | |
array.each do |head| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# fooが頭に無いbarをファイルに出力する 1.2 | |
array = ["foo","bar","baz","hoge"] | |
reg = /(?<!foo)bar/ | |
file_name = "./hoge.txt" | |
f = File.open file_name,"a+" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# fooが頭に無いbarをファイルに出力する 2.2 | |
array = ["foo","bar","baz","hoge"] | |
file_name = "./hoge.txt" | |
f = File.open file_name,"a+" | |
array.each do |head| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# shell script option test | |
a=0 | |
b=0 | |
while getopts ab opt | |
do | |
case ${opt} in | |
a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def prime? num | |
return 0 if num == 1 | |
(num-1).downto(2) do |n| | |
return 0 if num.modulo(n) == 0 | |
end | |
return 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (hoge a b c) | |
(define (square x) (* x x)) | |
(define (minimum x y) (if (< x y) x y)) | |
(- | |
(+ (square a) (square b) (square c)) | |
(square (minimum a (minimum b c))))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (A x y) | |
(cond ((= y 0) 0) | |
((= x 0) (* 2 y)) | |
((= y 1) 2) | |
(else (A (- x 1) | |
(A x (- y 1)))))) | |
(A 1 10) | |
(A 2 4) | |
(A 3 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = gets.chomp | |
config.consumer_secret = gets.chomp | |
config.oauth_token = gets.chomp | |
config.oauth_token_secret = gets.chomp | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int test(void){ | |
int n = 2; | |
n = ++n; | |
printf("%d\n",n); // 3 | |
return 0; | |
} | |
int hoge(void){ |
OlderNewer