Skip to content

Instantly share code, notes, and snippets.

View kymmt90's full-sized avatar

Kōhei Yamamoto kymmt90

View GitHub Profile
import java.io.File;
import java.io.IOException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Jackson {
public static void main(String[] args) {
try {
ObjectMapper mapper = new ObjectMapper();
import java.io.File;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
public class Books {
public static void main(String[] args) throws Exception {
@kymmt90
kymmt90 / Cask
Created March 30, 2015 13:20
Cask sample
(source gnu)
(source melpa)
(depends-on "redo+")
(depends-on "migemo")
(depends-on "auto-complete")
(depends-on "yasnippet")
(depends-on "helm")
@kymmt90
kymmt90 / get_access_token.rb
Created September 22, 2015 04:37
Get Hatena OAuth access token from Ruby
#!/usr/bin/env ruby
# coding: utf-8
# The MIT License (MIT)
# Copyright (c) 2015 Kohei Yamamoto
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
module HookMethod
def hook_method(hook, *methods)
methods.each do |method|
orig = "#{method}_without_logging".to_sym
if instance_methods.include?(orig)
raise NameError, "#{orig} isn't a unique name"
end
alias_method orig, method
@kymmt90
kymmt90 / dokaku.rb
Created July 10, 2016 09:58
Yokohama.rb #70 どう書く
class Walker
Position = Struct.new(:x, :y)
MAP = [['a', 'b', 'c', 'd'], ['e', 'f', 'g', 'h'], ['i', 'j', 'k', 'l'], ['m', 'n', 'o', 'p']]
def initialize(tiles)
@current = Position.new(1, 0)
@previous = nil
@from = nil
@tiles = tiles.split('/').map { |l| l.split('') }
end
@kymmt90
kymmt90 / my_permutation.rb
Last active August 12, 2016 14:04
Ruby で順列
def my_permutation(sequence, r = nil)
r = sequence.size if r.nil? || sequence.size < r
result = []
enumerate(sequence, r, [], result)
result
end
def enumerate(sequence, r, one_enumeration, result)
if one_enumeration.size == r
result << one_enumeration.dup
@kymmt90
kymmt90 / file.txt
Created October 5, 2016 07:11
curl から POST した gist
curl の気持ちになって gist を POST
@kymmt90
kymmt90 / .eslintrc
Created October 16, 2016 14:51
.eslintrc
{
"env": {
"node" : true,
"browser" : true,
"es6": true
},
"ecmaFeatures" : {
"jsx": true,
},
"plugins": [
@kymmt90
kymmt90 / kymmt_recipe.rb
Created July 24, 2016 11:50
2016-07-24 時点の kymmt.com 用 Itamae レシピ
include_recipe 'selinux::disabled'
package 'epel-release'
package 'gcc'
package 'gcc-c++'
package 'git'
package 'libyaml-devel'
package 'nginx'
package 'openssl-devel'
package 'postgresql-contrib'