Skip to content

Instantly share code, notes, and snippets.

View tzzzoz's full-sized avatar

bc.yu tzzzoz

View GitHub Profile
@tzzzoz
tzzzoz / example_activejob.rb
Created November 30, 2018 12:43 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@tzzzoz
tzzzoz / Ethereum_private_network.md
Created June 26, 2018 03:16 — forked from 0mkara/Ethereum_private_network.md
Ethereum private network configuration guide.

Create your own Ethereum private network

Introduction

Used nodes:

Linux raspberrypi 4.9.41-v7+ #1023 SMP Tue Aug 8 16:00:15 BST 2017 armv7l GNU/Linux
Linux localhost.localdomain 4.14.5-200.fc26.x86_64 #1 SMP Mon Dec 11 16:29:08 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
@tzzzoz
tzzzoz / git pre-commit
Created February 6, 2018 13:03
Git pre-commit hook
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
bundle
# Set hooks.ignore_rubocop to true if you want to skip the linter
# Checking rubocop presence in Gemfile
if grep -e '^[^#]*rubocop' Gemfile > /dev/null
@tzzzoz
tzzzoz / 电影推荐.md
Last active January 7, 2018 06:42
电影推荐

剧情

  • 许三观
  • 辩护人
  • 暗杀
  • 大空头
  • 瑞士军刀男
  • 危楼愚夫
  • 一个叫欧维的男人决定去死
  • 飞越疯人院 (1975)
  • 十二怒汉 (1957)
@tzzzoz
tzzzoz / use-dnsmasq-with-nginx.md
Last active April 10, 2017 09:35
Use Dnsmasq with Nginx as Proxy

This gist is about how to setup your computer as a DNS server, and with a running Nginx server, you can proxy all requests from a mobile app to the web application running in your docker container.

Config DNSMasq

Install DNSMasq

$ brew install dnsmasq

Keybase proof

I hereby claim:

  • I am tzzzoz on github.
  • I am tzzzoz (https://keybase.io/tzzzoz) on keybase.
  • I have a public key ASB8IOVvWrmG-CoRPtDiQWfFyoTcSTKggzIcq4AVn2yQTAo

To claim this, I am signing this object:

@tzzzoz
tzzzoz / monkey patch: to_bool
Last active July 19, 2016 09:12
money patch: to_bool
class String
def to_bool
return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)
return false if self == false || self.blank? || self =~ (/^(false|f|no|n|0)$/i)
raise ArgumentError.new("invalid value for Boolean: \"#{self}\"")
end
end
class Fixnum
def to_bool