Skip to content

Instantly share code, notes, and snippets.

View tanishiking's full-sized avatar
🎓

Rikito Taniguchi tanishiking

🎓
View GitHub Profile
# -*- coding: utf-8 -*-
class ManagerCreator(object):
u"""プリパラマイマネ問題検証用スクリプト"""
color = [u'赤', u'橙', u'黄', u'緑', u'水', u'青', u'紫']
animal = [u'熊', u'兎', u'鳥', u'鼠', u'猫']
def get_manager(self, name):
uni_code_point = ord(name)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.files.uploadedfile import SimpleUploadedFile
from StringIO import StringIO
from PIL import Image
<?php
function mygenerator() {
yield 0;
yield 1;
yield 2;
yield 3;
}
$g = mygenerator();
<?php
function fib_gen() {
list($a, $b) = [0, 1];
while(true) {
yield $a;
list($a, $b) = [$b, $a+$b];
}
}
DROP TABLE IF EXISTS result;
DROP TABLE IF EXISTS student;
DROP TABLE IF EXISTS subject;
CREATE TABLE student(
student_id INT NOT NULL,
name VARCHAR(256) NOT NULL,
prefecture VARCHAR(256) NOT NULL,
age INT NOT NULL,
PRIMARY KEY(student_id)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
def f(x):
return x**3 + 2*x**2 + 10*x - 20
def df(x):
return 3*x**2 + 4*x + 10
<?php
function take($num, $iterable) {
$i = 0;
foreach($iterable as $key => $val) {
if($i >= $num) {
break;
} else{
$i++;
yield $key => $val;
.hearty .icon-favorite:before {
content: "\1f363";
}
.hearty .is-favorite .icon-favorite:before {
content: "\1f37a";
}
object MyGenerator {
def main(args: Array[String]) = {
val g = myGenerator()
println(g()) // 1
println(g()) // 2
println(g()) // 3
}
private[this] def myGenerator(): (() => Int) = {
object MyStream {
def main(args: Array[String]): Unit = {
range(1, 10).take(10).print
}
private[this] def range(start: Int, end: Int): Stream[Int] = {
if(start >= end) {
Stream.empty
} else {