Skip to content

Instantly share code, notes, and snippets.

View tcnksm's full-sized avatar
☺️
Yo

Taichi Nakashima tcnksm

☺️
Yo
View GitHub Profile
@tcnksm
tcnksm / include1.go
Last active August 29, 2015 14:16
gore text-fixutures
package include1
import (
"fmt"
"runtime"
)
func hello() string {
return fmt.Sprintf("Hello from %s", runtime.GOOS)
}
type StringFlag []string
func (s *StringFlag) String() string {
return strings.Join(*s, ",")
}
func (s *StringFlag) Set(value string) error {
*s = append(*s, value)
return nil
}
@tcnksm
tcnksm / flag_slice.go
Created June 21, 2015 04:08
Flag slice
import "strings"
type StringFlag []string
func (s *StringFlag) String() string {
return strings.Join(*s, ",")
}
func (s *StringFlag) Set(value string) error {
FROM ubuntu
# Install basic packages
RUN apt-get update
RUN apt-get install -y build-essential wget curl git
RUN apt-get install -y zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev
RUN apt-get install -y sqlite3 libsqlite3-dev
RUN apt-get clean
# Install rbenv and ruby-build
package main
import (
"fmt"
"io/ioutil"
"os"
"testing"
)
func Test_chdir(t *testing.T) {
@tcnksm
tcnksm / sum_hash_values.rb
Created October 31, 2013 03:19
The sum of hash values by proc
hash = {a: 23, b: 24, c: 25}
puts hash.values.inject(&:+) == (23+24+25) # >> true
@tcnksm
tcnksm / chnage_table_name.rb
Created October 31, 2013 10:48
Change DB table name by ActiveRecord::Migration
class ChangeTableName < ActiveRecord::Migration
def self.up
rename_table :a_tables, :b_tables
end
def self.down
rename_table :b_tables, :a_tables
end
end
@tcnksm
tcnksm / add_index.rb
Created October 31, 2013 10:51
Add index by ActiveRecord::Migration
class Addindex < ActiveRecord::Migration
def self.up
add_index :a_table, :name
end
end
@tcnksm
tcnksm / create_table.rb
Created October 31, 2013 12:26
Create DB table by ActiveRecord::Migration
class CreateTable < ActiveRecord::Migration
def self.up
create_table :a_tables do |t|
t.column :name1, :integer, :null => false
t.column :name2, :text, :null => false
t.timestamps
end
end
def self.down
@tcnksm
tcnksm / index.html
Last active December 27, 2015 05:59
Responsive Vimeo container (e.g. iframe for Vimeo ) by scss
<div class="video-container">
<iframe src="http://player.vimeo.com/video/78074896" width="500" height="281" frameborder="0"></iframe>
</div>