Skip to content

Instantly share code, notes, and snippets.

Hajime Sueyoshi haazime

  • Tokyo
View GitHub Profile
View index.html
<!doctype html>
<title>About programming languages</title>
<style type="text/css">
body {
padding: 0rem 1.5rem;
background-color: #E1F9B4;
h1, h2 {
haazime / eratos.rb
Created Apr 24, 2016
Sieve of Eratosthenes
View eratos.rb
def compute(number)
sieve((2..number).to_a, [], Math.sqrt(number))
def sieve(list, primes, stopper)
return primes + list if list.first >= stopper
primes << list.shift
list.reject! { |n| n % primes.last == 0 }
sieve(list, primes, stopper)
View _application_bar.html.erb
<div class="navbar-fixed">
<div class="container">
<div class="nav-wrapper">
<a href="#" data-activates="slide-out" class="button-collapse show-on-large">
<i class="mdi-navigation-menu"></i>
<a href="#" class="brand-logo">Bubble Task</a>
View _navigation.html.erb
<div class="container">
<div class="nav-wrapper">
<a href="#" class="brand-logo"><i class="material-icons left">hdr_weak</i>Bubble Task</a>
<a href="#" data-activates="mobile-demo" class="button-collapse"><i class="material-icons">menu</i></a>
<ul class="side-nav" id="mobile-demo">
<li><a href="sass.html">Sass</a></li>
<li><a href="badges.html">Components</a></li>
<li><a href="collapsible.html">Javascript</a></li>
<li><a href="mobile.html">Mobile</a></li>
haazime / Gemfile
Last active Nov 8, 2015
Rails + Bootstrap Material Design
View Gemfile
gem 'bootstrap-sass'
source '' do
gem 'rails-assets-bootstrap-material-design'
use Rack::Static,
urls: ["/js", "/css"],
root: "public"
run ->(env) {
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
View app.rb
require 'bundler/setup'
require 'active_record'
require 'action_controller/railtie'
require 'action_view/railtie'
# ActiveRecord::Config
ActiveRecord::Base.configurations = {'development' => {:adapter => 'sqlite3', :database => ':memory:'}}
ActiveRecord::Base.establish_connection :development
haazime / regexp_union.rb
Created Aug 18, 2014
配列をもとに正規表現オブジェクトをつくる ref:
View regexp_union.rb
words = %w(foo bar baz)
regexp = Regexp.union(words)
haazime / i_f.go
Created Aug 12, 2014
Goのインタフェースとその実装、およびstructへの埋め込み ref:
View i_f.go
package main
import "fmt"
// 料理を作るI/F
type Cooker interface {
Cook() string
// 塗るI/F
haazime / header_spec.rb
Created Jul 18, 2014
serverspec header in test-kitchen
View header_spec.rb
require 'serverspec'
include Serverspec::Helper::Exec
include Serverspec::Helper::DetectOS
RSpec.configure do |c|
c.before :all do
c.path = '/sbin:/usr/sbin'
You can’t perform that action at this time.