Skip to content

Instantly share code, notes, and snippets.

```
## uninstall
brew uninstall --force postgresql
rm -rf /usr/local/var/postgres
## install
brew install postgresql
## log
tail -f /usr/local/var/log/postgres.log
@kunihiko-sugiura
kunihiko-sugiura / rspec_tips.rb
Last active December 15, 2019 07:18
rspec tips
```
it '特定メソッドのパラメータ検証' do
allow(TestCaller).to receive(:test_func) do |tenant, setting|
expect(tenant).to eq 'test'
expect(setting.id).to eq 111
end
worker = described_class.new
worker.perform(tenant1.name)

loop

for i in {1..10} ; do <something command> ; done
@kunihiko-sugiura
kunihiko-sugiura / js_tips.js
Last active January 3, 2019 12:21
js tips
```js
const { items: stateItems } = state;
console.log(+'1') // -> 1
```
@kunihiko-sugiura
kunihiko-sugiura / git.md
Last active December 21, 2018 03:30
git tips

直前のコミットの状態に戻す

$ git reset --hard HEAD

stash

diff

git diff stash@{0}
@kunihiko-sugiura
kunihiko-sugiura / rails-tips.rb
Last active February 3, 2019 11:23
rails-tips
## Memory leaks check
```
require 'objspace'
puts "Before: #{ObjectSpace.memsize_of_all * 0.001 * 0.001} MB"
puts "After: #{ObjectSpace.memsize_of_all * 0.001 * 0.001} MB"
```
## Active Record
## hash rename
```
data = { name: 'name' }
data["rename"] = data.delete("name")
```
@kunihiko-sugiura
kunihiko-sugiura / rails-commands.md
Last active September 20, 2021 06:06
rails-commands

Rails Setup

rbenv

install version

rbenv install -v 2.4.2

rehash

rbenv rehash
@kunihiko-sugiura
kunihiko-sugiura / parallax-tweenmax.html
Last active September 3, 2018 12:01
parallax tweenMax
<!doctype html>
<html lang="ja">
<head>
<style type="text/css">
body {
height: 200vh;
}
.way-point {
content: '';
display: block;