Skip to content

Instantly share code, notes, and snippets.

View meganemura's full-sized avatar
👓
Edit status

meganemura meganemura

👓
Edit status
View GitHub Profile
@ali-ehmed
ali-ehmed / platform_graphql_client.rb
Last active March 14, 2022 15:39
RSpec - Stub Graphql Client Adapter
require 'graphql/client'
require 'graphql/client/http'
module PlatformGraphqlClient
# Configure GraphQL endpoint using the basic HTTP network adapter.
HTTP = GraphQL::Client::HTTP.new('http://localhost:3001/api/graphql') do
# def headers(context)
# # Optionally set any HTTP headers
# { "Access-Token": "user-access-token" }
# end
@stepney141
stepney141 / BookmarkAPI_en.md
Last active April 4, 2023 01:45
(DEPRECATED) Twitter Undocumented Endpoints for Bookmark
@kule
kule / mini_rspec.rb
Created September 11, 2018 09:37
Simplified example of how rspec works
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'colorize'
end
class MatcherInterface
def initialize(some_object)
@some_object = some_object
@dansteele
dansteele / create_review_app_subdomain.rake
Last active September 15, 2022 23:45
Use a sub-subdomain on Heroku review apps with DNSimple. Run this task from your app.json in your postdeploy script.
namespace :staging do
desc 'create subdomain DNS record for Heroku review app'
task :publish_dns do
require 'dnsimple'
require 'platform-api'
STAGING_DOMAIN = 'mystagingdomain.com'.freeze
DNSIMPLE_ACCOUNT_ID = .freeze
heroku_app_name = ENV['HEROKU_APP_NAME']
subdomain = heroku_app_name.match(/.*(pr-\d+)/).captures.first
@joker1007
joker1007 / ginzarb_21.md
Last active April 14, 2021 06:41
Ginza.rb 21回の発表資料。rails_adminのつらみとオススメgem達。

rails_adminのつらみとオススメGemについて

rails_adminのつらみ

カスタマイズできるようで出来ない

レコード件数が一定以上になると使えない機能

  • ダッシュボード
  • 何も考えずに各モデルをカウントするのでレコード件数増えるとえらいことになる。
@sorah
sorah / a.sh
Created October 17, 2014 05:20
Homebrew relink if necessary
#!/bin/bash
for keg in /usr/local/Library/LinkedKegs/*; do
kegname="$(basename $keg)"
dir="$(find $keg/ -maxdepth 1 -type d | grep '\/\(sbin\|bin\|etc\|var\|lib\|include\|libexec\|share\)$' | head -n1)"
[ -z "${dir}" ] && continue
testee="$(find $dir -type f | head -n1 | sed -e "s|${keg}||")"
[ -f /usr/local/$testee ] || (echo $keg && brew unlink $kegname; brew link --force $kegname)
done
@everpeace
everpeace / Why People Want Microservices.md
Last active November 8, 2022 10:37
マイクロサービス化が進む背景について考えてみた

マイクロサービス化が進む背景について考えてみた

最近マイクロサービスって流行ってますよね。バズってると言ってもいいくらい。

個人的には、「マイクロサービスって結局何なの?」とか、「SOAと何が違うわけ?」とかいう議論は苦手です。

でも「なんでみんなマイクロサービスで作りたいのか?なんでマイクロサービスで作られるサービスが多いのか?」にはすごく興味があるんです。

僕は今、シリコンバレーにある日系SIerの小さな子会社で駐在員をやっていますが、このエリアに居ると、とにかく最近、

「サービス全体が、独立した小さなサービスの集合で構成されるようになってきている」

# config/routes.rb
resources :documents do
scope module: 'documents' do
resources :versions do
post :restore, on: :member
end
resource :lock
end
end
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

#!/usr/bin/env ruby
# Usage: rake -P | rake-prereqs-dot | dotty -
# Convert the output of `rake -P/--prereqs`
# ("Display the tasks and dependencies, then exit.")
# to a graphviz graph
# Sample input
# -8<-