Skip to content

Instantly share code, notes, and snippets.

View jugyo's full-sized avatar
🏠
Working from home

Kaz jugyo

🏠
Working from home
  • The League
  • New Jersey
View GitHub Profile
@jugyo
jugyo / systemd-tmpfiles-clean.md
Last active September 26, 2018 16:08
Arch linux & systemd-tmpfiles-clean

/tmp on Arch Linux

Arch linux はメモリーの半分の容量のスペースを tmp ファイルシステムとして /tmp にマウントする。例えば8GBのメモリを積んでいたら /tmp の容量はデフォルトで 4GB になる。試しに手元の環境で df コマンドを実行すると以下のような情報が得られた:

# df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             3.9G     0  3.9G   0% /dev
run             3.9G  384K  3.9G   1% /run
/dev/sda 158G 8.0G 142G 6% /
let mainQueue = OperationQueue.main
NotificationCenter.default.addObserver(forName: NSNotification.Name.UIApplicationUserDidTakeScreenshot, object: nil, queue: mainQueue) { _ in
action()
}
@jugyo
jugyo / vs-code-key-bindings.json
Created April 27, 2018 02:55
VS Code key bindings
// 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 April 11, 2018 16:23
Makefile for go
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:
package main
import (
"fmt"
"runtime"
)
func main() {
fmt.Println(runtime.GOOS)
fmt.Println(runtime.GOARCH)
@jugyo
jugyo / Foo.js
Created February 27, 2018 17:13
React functional component with withStyles
// <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 February 3, 2018 15:09
Time#milliseconds
class Time
unless Time.method_defined?(:milliseconds)
def milliseconds
(to_f * 1000).to_i
end
end
end
@jugyo
jugyo / index.js
Last active November 26, 2020 04:34
An example to send email with Cloud Pub Sub and Cloud Functions #Rails
const sendEmail = require('./sendEmail').sendEmail;
/**
* Deplooyment:
*
* $ gcloud beta functions deploy sendEmail --trigger-topic sendEmail
*
*/
/**
@jugyo
jugyo / Main.js
Last active July 19, 2019 18:57
Model class with PouchDB
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"}
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);