Skip to content

Instantly share code, notes, and snippets.

View satoyuichi's full-sized avatar

Sato Yuichi satoyuichi

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char** argv );
int main( int argc, char** argv )
{
int pid;
printf( "Start main function.(%d)\n", __LINE__ );
@satoyuichi
satoyuichi / gist:8601043
Created January 24, 2014 16:42
与えられたコレクションの全ての並び順を出力する
#(1 2 3) permutationsDo: [:each | Transcript cr; show: each printString]
@satoyuichi
satoyuichi / blender_refresh_every_frame.py
Last active January 5, 2016 15:06
Blender で毎フレーム更新するようなコード
import bpy
import math
def my_handler(scene):
cf = bpy.context.scene.frame_current
r = (cf * 10)
bpy.context.object.rotation_euler[2] = math.radians(r)
bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1)
@satoyuichi
satoyuichi / str.js
Last active May 22, 2017 05:16
str の中身を一文字ずつ出力するプログラム
// str の中身を一文字ずつ出力するプログラムを書きなさい
// ex) h
// o
// g
// ...
// o
// ヒント) P57, P69, P92, P96
let str = 'hogepiyo';
@satoyuichi
satoyuichi / count_o.js
Created May 22, 2017 05:52
str から 'o'(オー) の個数を数えて出力するプログラム
// str から 'o'(オー) の個数を数えて出力するプログラムを書き Gist を使って #phh_2017_yuichi チャンネルで共有しなさい
// ex) 2 個
let str = 'hogepiyopiyo';
let count = 0;
for (let elem of str) {
if (elem === 'o') {
count++;
}
@satoyuichi
satoyuichi / ex_function.js
Last active May 25, 2017 07:53
関数の例
function outputString (/* 入力 */) {
let str = 'hogepiyo'; // 処理
return str; // 出力
}
// 'にゃん'の個数を指定出来るようにしなさい
// ex) outputStringAddNyan ('難しい', 2)
// '難しいにゃんにゃん'
function outputStringAddNyan (input, number) {
for (let i = 0; i < number; i++) {
@satoyuichi
satoyuichi / memo.js
Created May 24, 2017 05:55
説明してみました
// 目的:何かと何かを対応付けたい
// 理由:名前(あるていど何でも良い)をつけておくと便利
let x = 86;
// 目的:繰り返したい
// 理由:同じ処理を沢山書くのは大変
// 条件式
// 評価した結果 true か false になる式
while (条件式) {
@satoyuichi
satoyuichi / exam_0529_00.js
Last active May 29, 2017 05:08
x と y の値を交換するプログラム
let x = 3;
let y = 5;
@satoyuichi
satoyuichi / exam_0529_01.js
Created May 27, 2017 12:28
while 文への置き換え
for (var x = 4; x < 9; x++) {
console.log ('xの値は' + x);
}