Skip to content

Instantly share code, notes, and snippets.

Hajime Sueyoshi haazime

  • Tokyo
Block or report user

Report or block haazime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!doctype html>
<html>
<head>
<title>About programming languages</title>
<style type="text/css">
body {
padding: 0rem 1.5rem;
background-color: #E1F9B4;
}
h1, h2 {
@haazime
haazime / eratos.rb
Created Apr 24, 2016
Sieve of Eratosthenes
View eratos.rb
def compute(number)
sieve((2..number).to_a, [], Math.sqrt(number))
end
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)
end
View _application_bar.html.erb
<header>
<div class="navbar-fixed">
<nav>
<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>
<a href="#" class="brand-logo">Bubble Task</a>
</div>
View _navigation.html.erb
<nav>
<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
haazime / Gemfile
Last active Nov 8, 2015
Rails + Bootstrap Material Design
View Gemfile
gem 'bootstrap-sass'
source 'https://rails-assets.org' do
gem 'rails-assets-bootstrap-material-design'
end
View config.ru
use Rack::Static,
urls: ["/js", "/css"],
root: "public"
run ->(env) {
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
View app.rb
require 'bundler/setup'
Bundler.require
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
haazime / regexp_union.rb
Created Aug 18, 2014
配列をもとに正規表現オブジェクトをつくる ref: http://qiita.com/haazime/items/9b39af6708cc214b2651
View regexp_union.rb
words = %w(foo bar baz)
regexp = Regexp.union(words)
@haazime
haazime / i_f.go
Created Aug 12, 2014
Goのインタフェースとその実装、およびstructへの埋め込み ref: http://qiita.com/haazime/items/2cc00097215ee8828224
View i_f.go
package main
import "fmt"
// 料理を作るI/F
type Cooker interface {
Cook() string
}
// 塗るI/F
@haazime
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'
end
end
You can’t perform that action at this time.