Skip to content

Instantly share code, notes, and snippets.

Avatar

non117 non117

  • Kyoto
View GitHub Profile
@non117
non117 / mendako.js
Last active Dec 4, 2020
めんだこが降ります
View mendako.js
w = () => window.innerWidth * 0.95
h = () => window.innerHeight * 0.95
r = Math.random
men = () => {
base = "https://media.handon.club/custom_emojis/images/000/"
if(r() > 0.01) {
return `${base}008/726/original/mendako_anime.png`
} else {
p = r()
if(p > 0.67) {
View c4-xlarge_cpuminer-multi.log
[2017-12-13 14:46:05] Starting Stratum on stratum+tcp://jp.lapool.me:3014
[2017-12-13 14:46:05] 4 miner threads started, using 'yescrypt' algorithm.
[2017-12-13 14:46:08] Stratum difficulty set to 0.5 (0.00001)
[2017-12-13 14:46:10] CPU #2: 0.42 kH/s
[2017-12-13 14:46:10] accepted: 1/1 (diff 0.000), 0.42 kH/s yes!
[2017-12-13 14:46:10] CPU #1: 0.42 kH/s
[2017-12-13 14:46:10] CPU #0: 0.42 kH/s
[2017-12-13 14:46:10] CPU #3: 0.42 kH/s
[2017-12-13 14:46:20] CPU #3: 0.42 kH/s
[2017-12-13 14:46:20] accepted: 2/2 (diff 0.000), 1.67 kH/s yes!
@non117
non117 / Task.js
Last active Mar 30, 2017
redux design models
View Task.js
import { PropTypes } from 'react';
import { Record } from 'immutable';
import { recordOf } from 'react-immutable-proptypes';
const TaskRecord = new Record({
id: undefined,
name: '',
deadline: undefined,
checked: false,
});
@non117
non117 / TaskItem.jsx
Last active Mar 26, 2017
redux design components
View TaskItem.jsx
import React, { PropTypes } from 'react';
import { Task } from '../../models';
export default class TaskItem extends React.PureComponent {
static propTypes = {
task: Task.PropTypes.isRequired,
}
static contextTypes = {
changeInputTarget: PropTypes.func,
checkTask: PropTypes.func,
@non117
non117 / Todo.js
Created Mar 25, 2017
redux design ducks
View Todo.js
import { createAction, handleActions } from 'redux-actions';
import { takeEvery } from 'redux-saga';
import { call, put } from 'redux-saga/effects';
import { TodoState } from '../models';
const CREATE_TASK = 'CREATE_TASK';
const UPDATE_TASK = 'UPDATE_TASK';
const CHECK_TASK = 'CHECK_TASK';
const SUBMIT_TASK = 'SUBMIT_TASK';
const CHANGE_INPUT = 'CHANGE_INPUT';
@non117
non117 / frontModel.md
Last active Dec 14, 2016
fluxでのmodelのデータ構造について
View frontModel.md

背景

  • リストでチェックボックスのついてるやつをReact + Fluxでつくる
  • このときのjsレイヤのデータ構造をどうするか

問題

  • 単純にリストにするとアクションを適用するオブジェクトを選ぶのにfilterしないといけないのでは?

こんなAction

{
View OCRClient.swift
//
// OCRClient.swift
// ReceiptManager
//
// Created by non on 2016/10/10.
// Copyright © 2016年 non. All rights reserved.
//
import Foundation
import Alamofire
@non117
non117 / snipet.md
Last active Feb 21, 2016
golangお勉強
View snipet.md

ifのよくあるパターン

break, continue, goto, returnで抜ける

f, err := os.Open(name)
if err != nil {
    return err
}
d, err := f.Stat()
if err != nil {
    return err
@non117
non117 / inotify_daemon.py
Created Dec 18, 2013
python inotify daemon
View inotify_daemon.py
import multiprocessing
import os
import time
from functools import partial
import pyinotify
def is_alive(pid):
try:
os.kill(pid, 0)
@non117
non117 / suicide.py
Created Dec 18, 2013
親が死んだら自殺する子.py
View suicide.py
import multiprocessing
import os
import time
def is_alive(pid):
try:
os.kill(pid, 0)
except OSError:
return False
else: