Skip to content

Instantly share code, notes, and snippets.

これはドワンゴ Advent Calendar 2018 12/24の記事です。

プログラミング研修教材

ドワンゴを含むカドカワグループでは、エンジニア職以外の社員に簡単なプログラミングを学ぶ機会を提供しています。その教材やカリキュラムの作成と講義をわれわれ技術コミュニケーション室で担当しています。

プログラミング未経験のみなさんにコードを書いて問題を解決する、ということを教えるのはとても有意義だが難しい仕事でした。ソフトウェアエンジニアという仕事を長く続けていると、プログラミングに関する多くのことを自明として片付けてしまい、初学者にわかりやすくかつウソのない説明をするのはなかなか困難です。先日ご恵贈いただいた「かんたんRuby」という本の書評でもその難しさについて触れました。

このようなミッションに取り組む方がいたら、少しでも参考になればと思い公開します。

create table sales (
sold_at datetime,
product_name text,
product_color text,
customer_gender text,
customer_age integer,
customer_prefecture integer
);
insert into sales values ('2017-02-17 11:20:30', 'Cupcake', 'green', 'male', 35, 28);
@kwappa
kwappa / dark-laptop-theme.el
Created June 24, 2012 00:00
dark-laptop for Emacs24
;;; dark-laptop-theme.el --- dark-laptop
(deftheme dark-laptop
"dark-laptop")
(custom-theme-set-faces 'dark-laptop
'(default ((t (:stipple nil :background "black" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "apple" :family "Monaco"))))
'(bold ((t (:weight bold))))
'(italic ((t (:slant italic))))
'(bold-italic ((t (:slant italic :weight bold))))
@kwappa
kwappa / Guardfile
Created June 21, 2012 05:36
guard-rspec, guard-spork, guard-livereload を使うための最低限のGuardfileをメモっておく
# https://github.com/guard/guard-rspec
guard 'rspec', :version => 2, :all_after_pass => false, :all_on_start => false, :cli => '--color --format nested --fail-fast --drb' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
# https://github.com/guard/guard-spork
guard 'spork', :rspec_env => { 'PADRINO_ENV' => 'test' } do
watch('Gemfile')
@kwappa
kwappa / mb_width.rb
Created June 19, 2012 06:13
マルチバイト文字まじりの文字列を等幅フォントで表示するために文字数を数える
# -*- coding: utf-8 -*-
require 'rspec'
class String
def mb_width
self.split('').inject(0) { |r, c| c =~ /^[ -~。-゚]*$/ ? r += 1 : r += 2 ; r }
end
end
describe String do
@kwappa
kwappa / comp_gacha_oneliner.rb
Created May 10, 2012 11:14
コンプガチャをシミュレートしてみよう
r = Array.new(12).fill(0) ; while (r.include?(0)) do r[rand(r.count)] += 1 ; end ; puts "#{r.count}個のガチャをコンプするために #{r.inject(:+)}回抽選しました。"
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
file_name = ARGV[0]
if !file_name || !File.exists?(file_name)
puts "file not found."
exit
end
File.open(file_name) { |f|
@kwappa
kwappa / emacs.rb
Created July 26, 2011 09:09
emacs 23.3a formula for homebrew with Xcode4.1 / Lion / --cocoa
require 'formula'
class Emacs < Formula
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.3a.tar.bz2'
md5 'f2cf8dc6f28f8ae59bc695b4ddda339c'
homepage 'http://www.gnu.org/software/emacs/'
skip_clean :all
if ARGV.include? "--use-git-head"
@kwappa
kwappa / emacs.rb
Created March 9, 2011 07:25
emacs 23.2 formula for homebrew with `fix-shiftmodifier-with-ime.patch`
require 'formula'
class Emacs <Formula
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.2.tar.bz2'
md5 '057a0379f2f6b85fb114d8c723c79ce2'
homepage 'http://www.gnu.org/software/emacs/'
if ARGV.include? "--use-git-head"
head 'git://repo.or.cz/emacs.git'
else
require 'formula'
<<-COMMENTS
This is the Homebrew formula for Python.
Versions
--------
This formula is currently tracking version 2.6.x.