Skip to content

Instantly share code, notes, and snippets.

View saihoooooooo's full-sized avatar
♨️
noop

shinya.saiho saihoooooooo

♨️
noop
View GitHub Profile
@saihoooooooo
saihoooooooo / recursiveProxy.js
Created June 6, 2019 02:50
jsの再帰Proxy
function tracePropAccess(obj, setMethod, path) {
path = path || [];
return new Proxy(obj, {
get: function(target, propKey, receiver) {
var temp = Reflect.get(target, propKey, receiver);
if (temp && typeof temp === 'object') {
return tracePropAccess(temp, setMethod, path.concat(propKey));
} else {
return temp;
}
@saihoooooooo
saihoooooooo / kinesis_ikken.sh
Last active August 18, 2016 07:49
kinesis-cliで指定したシーケンスを一件だけ取得
#!/bin/bash
PROGNAME=$(basename $0)
usage() {
echo "Usage: $PROGNAME <stream-name> <sequence-number> [<shard-id>] [--region <region>] [--profile <profile>]"
exit 1
}
REGION=
PROFILE=
@saihoooooooo
saihoooooooo / hoge.coffee
Last active April 27, 2016 08:47
hubot-slack-enter
robot.enter (msg) ->
if msg.message.user.room is 'general'
msg.send 'TODO'
# enterReplies = ['Hi', 'Target Acquired', 'Firing', 'Hello friend.', 'Gotcha', 'I see you']
# leaveReplies = ['Are you still there?', 'Target lost', 'Searching']
#
# module.exports = (robot) ->
# robot.enter (res) ->
# res.send res.random enterReplies
@saihoooooooo
saihoooooooo / .cVimrc
Created January 27, 2016 06:29
cVim (chromeVim)
let scrollstep = 300
set smoothscroll
let scrollduration = 200
map <C-n> :nexttab<CR>
map y yankDocumentUrl
map d closeTab
map u lastClosedTab
map <C-f> scrollFullPageDown
map <C-b> scrollFullPageUp
@saihoooooooo
saihoooooooo / hello.js
Created January 22, 2016 08:59
jquery.matchHeight.js in meteor
Template.hello.onRendered(function() {
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js", function() {
$(function() {
$('.mhhh').matchHeight();
});
});
});
@saihoooooooo
saihoooooooo / update.mongo
Last active January 22, 2016 05:41
mongo update in document in array
db.rooms.insert({_id: 1234567890, members: [{name: "hoge", age: 20}, {name: "fuga", age: 21}]})
db.rooms.update({_id: 1234567890}, {$set: {"members.0.name": "piyo", "members.0.age": 18, "members.1.name": "rodorigesu", "members.1.age": 46}})
@saihoooooooo
saihoooooooo / gulpfile.js
Last active January 8, 2016 10:03
gulp-sass test
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var path = require('path');
gulp.task('sass', function () {
gulp.src('./sass/**/*.scss')
.pipe(sourcemaps.init())
@saihoooooooo
saihoooooooo / hoge.coffee
Last active December 18, 2015 13:19
generator test
Promise = require 'bluebird'
im = Promise.promisifyAll require 'imagemagick'
input = './img/bb.png'
resize = './img/resize.png'
crop = './img/crop.png'
exec = ->
ext = yield im.identifyAsync ['-format', '%m', input]
console.log ext.toLowerCase()
// 値引率の計算
// 値引き額(定価 - 値引き後の金額(存在しない場合は定価)) / 定価 * 100
fl=product(div(sub(price, if(exists(price_discount), price_discount, price)), price), 100)
// カテゴリAだったらseqの降順、それ以外はseqの昇順でソート
sort=if(exists(query({!v='category:A'})), product(seq, -1), product(seq, 1)) asc
@saihoooooooo
saihoooooooo / springdataContext.xml
Created December 16, 2014 08:44
Spring data jpaでのhibernateの設定
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/data/jpa