Skip to content

Instantly share code, notes, and snippets.

@murayama
murayama / example.js
Last active July 24, 2019 06:40
asyncファンクションで例外が発生したら指定回数リトライする関数
retry(async (abort, num) => {
const res = fetch('https://xxxx').then(res => res.json());
if (condition) {
// 特定の条件の場合にリトライをしないで処理を抜ける場合はabortをコールする
abort(new Error('error message'));
}
}, {retryMax: 3, sleep: 300});
@murayama
murayama / file0.txt
Created October 15, 2014 01:57
rubyのrangeオブジェクトのinclude?とcover?の違い ref: http://qiita.com/murayama/items/bbd9237ccc88ceba49b1
october = (Time.new(2014,10,1)..Time.new(2014,10,31))
[alias]
logp = log -p
logs = log --stat
logone = log --pretty=oneline
#import <Foundation/Foundation.h>
@interface NSString (Additional)
- (NSString *)addMethod;
@end
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
@murayama
murayama / new_gist_file_0
Created March 11, 2014 05:19
vimでXMLを改行
:%s/<\/\(.\{-}\)>/<\/\1>^M/g
@murayama
murayama / new_gist_file_0
Created December 3, 2013 11:26
homebrewでvimインストール
brew install vim --override-system-vi --with-lua --with-ruby --with-python --with-python3
@murayama
murayama / sidekiq_push_client.php
Created October 22, 2013 08:46
rubyのsidekiqが処理するqueueをpushするPHPのクラス
<?php
namespace SidekiqPush;
/**
* rubyのsidekiqのphp版クライアント
*/
class Client {
private $redis;
private $namespace;
@murayama
murayama / deploy.rb
Created July 9, 2013 01:55
node.jsアプリケーションのcapistranoのdeployファイルの例
require 'capistrano_colors'
require 'capistrano'
require 'capistrano/ext/multistage'
set :application, "app_name"
set :repository, "repo path"
set :scm, "git"
set :branch, "master"
set :deploy_via, :copy