Skip to content

Instantly share code, notes, and snippets.

Avatar
🐇
ʕ ◔ϖ◔ʔ < I'm a Rubyist.

Masayuki Izumi izumin5210

🐇
ʕ ◔ϖ◔ʔ < I'm a Rubyist.
View GitHub Profile
@izumin5210
izumin5210 / Gruntfile.coffee
Created Apr 6, 2014
Code for KOSEN 勉強会 #1 〜 先どり! 最近流行りの“アレ” 〜(http://codeforkosen.doorkeeper.jp/events/9585 )のライブコーディングで使ったGruntfileです.
View Gruntfile.coffee
module.exports = (grunt) ->
require('load-grunt-tasks')(grunt)
grunt.initConfig
coffee:
compile:
files: [
expand: true
cwd: 'src/coffeescripts'
src: ['**/*.coffee']
@izumin5210
izumin5210 / class_setter.coffee
Created Apr 20, 2014
【AngularJS】hover/active時にクラスを追加するdirective
View class_setter.coffee
app = angular.module 'MyApplication'
CLS_HOVER_DEFAULT = "hover"
CLS_ACTIVE_DEFAULT = "active"
app.directive 'clsHover', ->
restrict: 'A'
link: (scope, element, attrs, ctrl) ->
clsHover = attrs.clsHover || CLS_HOVER_DEFAULT
View Activity.java
package ${PACKAGE_NAME};
import android.app.Activity;
import android.os.Bundle;
#parse("File Header.java")
public class ${NAME} extends Activity {
public static final String TAG = ${NAME}.class.getSimpleName();
public void onCreate(Bundle savedInstanceState) {
View multiparameter_attribute_assignment.rb
# app/models/concerns/multiparameter_attribute_assignment.rb
module MultiparameterAttributeAssignment
include ActiveModel::ForbiddenAttributesProtection
def initialize(params = {})
assign_attributes(params)
end
def assign_attributes(new_attributes)
View mynumber_validator.rb
class MyNumberValidator
def validate(num)
# write your code here...
end
end
@izumin5210
izumin5210 / answer.md
Created Dec 17, 2015
mynumber_validator_answer.md
View answer.md

Check Digit of MyNumber

How to calculate the check digit of mynumber

\begin{align*} d &= 11 - \Biggl( \sum^{11}{n=1} P_n \times Q_n \Biggr) \bmod 11 \ & \text{ただし,$\Biggl( \sum^{11}{n=1} P_n \times Q_n \Biggr) \bmod 11 \leq 1$の場合は$d=0$} \ P_n &= \text{ 個人番号を構成する検査用数字以外の十一桁の番号の最下位の桁を1桁目としたときの$n$桁目の数字} \ Q_n &= \begin{cases}

@izumin5210
izumin5210 / tab.html
Created Apr 20, 2014
【AngularJS】タブでコンテンツ切り替えするやつ
View tab.html
<div class="tab-pane" ng-show="active" ng-transclude>
</div>
View config.json
{
"src": {
"styles": {
"dir": "source/assets/styles",
"entries": [
"style.scss"
],
"include-paths": [
"node_modules/font-awesome/scss",
"node_modules/normalize.css"
@izumin5210
izumin5210 / zundoko.rb
Last active Apr 23, 2016
ズンドコペアプロのライブコーディングで書いたやつ
View zundoko.rb
# 詰めると1行(68文字)
# s="";(print c=%w(ズン ドコ).sample;s+=c)until s[/(ズン){4}ド/];puts"キ・ヨ・シ!”
# きれいに書くとこんなかんじ
dic = %w(ズン ドコ)
msg = ""
# 「ズンドコが完成していない」間はループが回る
View atoi_sample.cpp
#include <iostream>
#include <string>
int main()
{
const std::string id = "#3";
std::cout << "id // => " << id << std::endl;
std::cout << "id[0] // => " << id[0] << std::endl;
std::cout << "id.c_str() // => " << id.c_str() << std::endl;
std::cout << "(id.c_str() + 1) // => " << (id.c_str() + 1) << std::endl;