Skip to content

Instantly share code, notes, and snippets.

Kiyoshi Murata 13k

View GitHub Profile
@13k
13k / home_page.go
Last active Jan 18, 2019
Flutter in Go (https://divan.github.io/posts/flutter_go) - Functional options approach
View home_page.go
func (m *MyHomePage) Build(ctx BuildContext) Widget {
return NewScaffold(
ScaffoldWithAppBar(
NewAppBar(
AppBarWithTitle(
NewTitle(
TitleWithText(NewText(TextWithText("My home page"))),
),
),
),
View example_app.rb
# Documentation: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# http://www.rubydoc.info/github/Homebrew/brew/master/Formula
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class ExampleApp < Formula
desc ""
homepage ""
url "http://example.com/example_app-1.0.tar.gz"
version "1.0"
sha256 ""
@13k
13k / foundation.go
Last active Apr 2, 2019
Accessing Foundation Framework from Go with cgo
View foundation.go
// How to build: "CC=clang go build"
package main
import (
"fmt"
"net/url"
"strconv"
"unsafe"
)
View gvm_auto.sh
# Based on chruby's auto feature
# https://github.com/postmodern/chruby/blob/bfd78880fbbbf13635e1f97f83225c6a03ca6e89/share/chruby/auto.sh
function gvm_auto() {
local dir="$PWD/" version
until [[ -z "$dir" ]]; do
dir="${dir%/*}"
if { read -r version <"$dir/.go-version"; } 2>/dev/null || [[ -n "$version" ]]; then
@13k
13k / automount_nfs_osx.md
Created Dec 17, 2014
Automount NFS exports in OSX
View automount_nfs_osx.md

Linux server

Install NFS.

Add to /etc/exports:

<export_path>   <network>/24(rw,nohide,insecure,no_subtree_check,sync,all_squash,anonuid=1000,anongid=1000)
View 127.0.0.1.txt
$ curl 127.0.0.1:9200
{
"status" : 200,
"name" : "Stonewall",
"version" : {
"number" : "1.3.4",
"build_hash" : "a70f3ccb52200f8f2c87e9c370c6597448eb3e45",
"build_timestamp" : "2014-09-30T09:07:17Z",
"build_snapshot" : false,
"lucene_version" : "4.9"
View bm-sym-str.rb
require "benchmark/ips"
state1 = :initial
state2 = "initial"
Benchmark.ips do |x|
x.report("<Symbol> => (<String>, <Symbol>)") do
case state1
when "initial", :initial
a = 1
View mappings.rb
class Target
class_attribute :index_mappings
class << self
def mappings(*args, &block)
self.index_mappings ||= { options: {}, mappings: {} }
mappings = nil
options = nil
@13k
13k / fragment_cache.rb
Created Apr 3, 2014
fragment cache fetch/expire
View fragment_cache.rb
ActionController::Base.new.read_fragment('key')
ActionController::Base.new.expire_fragment('key')
View gist:7682366
FATAL -- : error adding listener addr=
/Users/k/.rbenv/versions/1.9.3-p429/lib/ruby/gems/1.9.1/gems/unicorn-4.6.2/lib/unicorn/socket_helper.rb:200:in `server_cast': undefined method `getsockname' for nil:NilClass (NoMethodError)
You can’t perform that action at this time.