Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
😐

Kaz jugyo

💭
😐
  • MUA inc.
  • New York
View GitHub Profile
View UserDidTakeScreenshot.swift
let mainQueue = OperationQueue.main
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIApplicationUserDidTakeScreenshot, object: nil, queue: mainQueue) { _ in
action()
}
View vs-code-key-bindings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+t",
"command": "workbench.action.quickOpen"
},
{
"key": "ctrl+cmd+left",
"command": "workbench.action.navigateBack"
},
@jugyo
jugyo / Makefile
Last active Apr 11, 2018
Makefile for go
View Makefile
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
BINARY_NAME=mybinary
BINARY_LINUX=$(BINARY_NAME)_linux
all: test build
build:
View runtime.go
package main
import (
"fmt"
"runtime"
)
func main() {
fmt.Println(runtime.GOOS)
fmt.Println(runtime.GOARCH)
@jugyo
jugyo / Foo.js
Created Feb 27, 2018
React functional component with withStyles
View Foo.js
// <Foo onClick={this.handleClick} />
const Foo = withStyles((theme) => ({
foo: {
color: 'red',
},
}))((props) => {
const { classes, onClick } = props
return (
<div onClick={onClick} className={classes.foo}>
@jugyo
jugyo / time_ext.rb
Created Feb 3, 2018
Time#milliseconds
View time_ext.rb
class Time
unless Time.method_defined?(:milliseconds)
def milliseconds
(to_f * 1000).to_i
end
end
end
@jugyo
jugyo / index.js
Last active Nov 26, 2020
An example to send email with Cloud Pub Sub and Cloud Functions #Rails
View index.js
const sendEmail = require('./sendEmail').sendEmail;
/**
* Deplooyment:
*
* $ gcloud beta functions deploy sendEmail --trigger-topic sendEmail
*
*/
/**
@jugyo
jugyo / Main.js
Last active Jul 19, 2019
Model class with PouchDB
View Main.js
export default class User extends Model {
static className = 'User'
}
await User._put({id: 1, name: 'Jugyo'})
await User.get(1) // {className: "User", id: 1, name: "Jugyo", _id: "User-1", _rev: "1-b2d6c93292974cd1b14a786f7576ec53"}
View MobxExample.js
import React, { Component } from 'react';
import { observer } from 'mobx-react';
import mobx from 'mobx';
import Button from 'material-ui/Button';
import { LinearProgress } from 'material-ui/Progress';
import Api from '../Api'
// Strict mode enforces that all state modifications are done by an action.
mobx.useStrict(true);
@jugyo
jugyo / abstract_mysql_adapter_patch_for_spatial_index.rb
Created Dec 7, 2017
A patch for Rails 5 to use MySQL spatial index
View abstract_mysql_adapter_patch_for_spatial_index.rb
require "active_record/connection_adapters/abstract_mysql_adapter"
# NOTE: Set SRID 0 as same as mysql's default
silence_warnings do
GeoRuby::SimpleFeatures::DEFAULT_SRID = 0
end
module ActiveRecord
module Type
class Spatial < Value