Skip to content

Instantly share code, notes, and snippets.

View naoyashiga's full-sized avatar

Naoya naoyashiga

View GitHub Profile
@naoyashiga
naoyashiga / SampleViewController.swift
Created August 1, 2015 06:15
rootViewControllerのときだけNavigationBarを非表示にさせる ref: http://qiita.com/naoyashiga/items/c1dc03a60df085321fe3
override func viewWillDisappear(animated: Bool) {
navigationController?.setNavigationBarHidden(true, animated: true)
}
override func viewWillAppear(animated: Bool) {
navigationController?.setNavigationBarHidden(false, animated: true)
}
@naoyashiga
naoyashiga / UIButton+Animation.swift
Created August 18, 2015 23:14
Implicit and Explicit Bounce Animation Button
extension UIButton {
func playImplicitBounceAnimation() {
let bounceAnimation = CAKeyframeAnimation(keyPath: "transform.scale")
bounceAnimation.values = [1.0 ,1.4, 0.9, 1.15, 0.95, 1.02, 1.0]
bounceAnimation.duration = NSTimeInterval(0.5)
bounceAnimation.calculationMode = kCAAnimationCubic
layer.addAnimation(bounceAnimation, forKey: "bounceAnimation")
}
@naoyashiga
naoyashiga / BaseParticleWithVector.pde
Last active August 29, 2015 14:28
Trigonometric function(三角関数) ~ Interactive Coding workshop at Tokyo ~
class BaseParticleWithVector implements BaseParticleWithVectorInterface {
PVector location;
PVector velocity;
float scalarVelocity;
float r;
BaseParticleWithVector() {
location = new PVector(random(width), random(height));
velocity = new PVector(0, 0);
@naoyashiga
naoyashiga / file0.swift
Last active October 4, 2015 14:39
[Swift]省略記法で$0.0と$0.1を使う例 ref: http://qiita.com/naoyashiga/items/4f06692c2c9a652f36ba
let array = ["カレー","ラーメン","ハンバーグ"]
array.enumerate().forEach { (index, element) in
print("index:\(index) element:\(element)")
}
//省略記法
array.enumerate().forEach {
print("index:\($0.0) element:\($0.1)")
}
@naoyashiga
naoyashiga / BaseParticleWithVector.pde
Created November 2, 2015 08:42
Grid Display Processing
class BaseParticleWithVector implements BaseParticleWithVectorInterface {
PVector location;
PVector velocity;
float scalarVelocity;
float r;
BaseParticleWithVector() {
location = new PVector(random(width), random(height));
velocity = new PVector(0, 0);
@naoyashiga
naoyashiga / gulpfile.js
Last active December 22, 2015 12:42
Bootstrap + Gulp + Jade Setting
var gulp = require('gulp'),

sass = require('gulp-ruby-sass')

notify = require("gulp-notify")

bower = require('gulp-bower'),
jade = require('gulp-jade'),
webserver = require('gulp-webserver');
var config = {

 sassPath: './resources/sass',

 jadePath: './resources/jade',
@naoyashiga
naoyashiga / BaseParticleWithVector.pde
Created February 23, 2016 14:13
Interactive coding勉強会 Easing
class BaseParticleWithVector implements BaseParticleWithVectorInterface {
PVector location;
PVector velocity;
float scalarVelocity;
float r;
BaseParticleWithVector() {
location = new PVector(random(width), random(height));
velocity = new PVector(0, 0);
@naoyashiga
naoyashiga / gulpfile.js
Created February 24, 2016 11:19
MyFirst p5.js env
var gulp = require('gulp'),

sass = require('gulp-ruby-sass')

notify = require("gulp-notify")

webserver = require('gulp-webserver');
gulp.task('server', function() {
gulp.src('./')
.pipe(webserver({
@naoyashiga
naoyashiga / mnist_tensorboard.py
Last active March 6, 2016 02:36
MNISTをTensorboardに表示する
# -*- coding: utf-8 -*-
import input_data
import tensorflow as tf
# prameters
learning_rate = 0.01
training_epochs = 1000
def main():
@naoyashiga
naoyashiga / GenerateText.py
Created March 17, 2016 03:56
TextGeneratorをPython3系で動かす
# -*- coding: utf-8 -*-
u"""
マルコフ連鎖を用いて適当な文章を自動生成するファイル
"""
import os.path
import sqlite3
import random