Skip to content

Instantly share code, notes, and snippets.

View ngs's full-sized avatar
🎣
Fly Fishing

Atsushi NAGASE ngs

🎣
Fly Fishing
View GitHub Profile
<?php
// php -S localhost:8012
$strUrl = "https://coincheck.com/api/ec/buttons";
$intNonce = time();
$strCallbackUrl = "https://requestb.in/1kscq6s1";
$arrQuery = array("button" => array(
"name" => "注文 #123",
"currency" => "JPY",
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install graphviz libxml2 rbenv rbenv-gemset redis ruby-build v8 libevent imagemagick@6 mysql
brew tap homebrew/services
brew services run mysql
brew services run redis
rbenv install 2.4.0
rbenv rehash
@ngs
ngs / pay.rb
Last active July 8, 2017 15:17
#!/usr/bin/env ruby
require 'payjp'
require 'pry'
Payjp.api_key = ENV.fetch('PAYJP_API_KEY', nil)
card = Payjp::Token.create(
card: {
number: '4242424242424242',
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"size" : "20x20",
@IBAction func showPicker(_ sender: Any) {
guard
let button = sender as? UIButton,
let label = view.viewWithTag(button.tag + 100) as? UILabel,
let title = label.text
else { return }
let message = "\n\n\n\n\n\n\n\n\n"
let av = UIAlertController(title: title, message: message, preferredStyle: .alert)
let done = UIAlertAction(title: "Done", style: .default) { _ in
av.dismiss(animated: true, completion: nil)
find source/images -type f -name '*.jpg' -exec sh -c 'S=$(git status -s {} | cut -f1); [[ $S == \ M\ * ]] || echo {}' \;
export V=v1.0.0
git checkout $V && git tag -d $V && git push origin :refs/tags/$V && GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag -sa $V -m"$V"
#!/bin/bash
base_dir=`pwd`
curl -Lo mecab-0.996.tar.gz 'https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE'
tar zxfv mecab-0.996.tar.gz
cd mecab-0.996
./configure --enable-utf8-only
make
make check
@ngs
ngs / sample.sql
Last active March 22, 2017 06:03
Find similar records by tags
CREATE TABLE "article_tags" ("article_id" INTEGER NOT NULL REFERENCES "articles" ("id"), "tag_name" VARCHAR NOT NULL REFERENCES "tags" ("name"));
CREATE TABLE "articles" ("id" INTEGER PRIMARY KEY, "title" VARCHAR);
CREATE TABLE "tags" ("name" VARCHAR PRIMARY KEY NOT NULL UNIQUE);
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ1' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ2' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ3' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ4' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ5' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ6' );
INSERT INTO "article_tags" ( "article_id","tag_name" ) VALUES ( '10','タグ7' );
datamap = map();
datamap.put("module", "Accounts");
respMap = zoho.crm.invokeConnector(("crm.get"), datamap);
respText = respMap.get("response");
data2map = respText.getJSON("data").toJSONList().get(0);
createdTime = data2map.getJSON("Created_Time").toList("+");
offsetPositive = 1;
offsetHour = 0;
if (createdTime.size() == 1) {
createdTime = createdTime.get(createdTime.size() - 1).toList("-");