Skip to content

Instantly share code, notes, and snippets.

View matsukaz's full-sized avatar

Masakazu Matsushita matsukaz

View GitHub Profile
@matsukaz
matsukaz / file0.sh
Created June 3, 2013 01:46
symlinkで複数モジュールの管理を楽に ref: http://qiita.com/items/25740c8680d5a26e42b5
npm install -g symlink
@matsukaz
matsukaz / file0.js
Created June 26, 2013 17:08
Viewに登録したイベントが複数回呼ばれてしまう場合の対処 ref: http://qiita.com/matsukaz/items/8145f362a601176ae88f
var AView = Backbone.View.extend({
el: $("#main"),
events: {
"click button#btn1": "onBtn1Click"
}
...
});
var BView = Backbone.View.extend({
el: $("#main"),
events: {
@matsukaz
matsukaz / proguard-project.txt
Last active June 12, 2019 02:16
proguard-project.txt
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
@matsukaz
matsukaz / .gitignore
Last active September 5, 2018 02:12 — forked from BennettSmith/.gitignore
Google Protobuf v2.6.0 Build Script for iOS
protobuf
protobuf-2.6.0
protobuf-2.6.1
protobuf-master
@matsukaz
matsukaz / gist:e5876ca34716794c0dfb
Created March 22, 2016 16:25
xcodeのバージョンアップ時にプラグインを再度有効化する方法
XCODE_UUID=`defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID`
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist | xargs -IFILE defaults write FILE DVTPlugInCompatibilityUUIDs -array-add ${XCODE_UUID}
@matsukaz
matsukaz / annotations.rb
Last active August 10, 2021 08:16
Rubyでアノテーションを実装 / Implementing java-like annotations in ruby
module Annotations
@@__last_annotation__ = nil
def annotations(meth=nil)
return @@__annotations__[meth] if meth
@@__annotations__
end
private
@matsukaz
matsukaz / s3-bucket-listing.js
Created December 15, 2016 08:27
s3-bucket-listing.js
// see) https://github.com/rufuspollock/s3-bucket-listing
if (typeof S3BL_IGNORE_PATH == 'undefined' || S3BL_IGNORE_PATH!=true) {
var S3BL_IGNORE_PATH = false;
}
if (typeof BUCKET_URL == 'undefined') {
var BUCKET_URL = location.protocol + '//' + location.hostname;
}
### Keybase proof
I hereby claim:
* I am matsukaz on github.
* I am matsukaz (https://keybase.io/matsukaz) on keybase.
* I have a public key ASCBEp_cERws8a9bgyJk6TWOlgQlpLEPq8atcv--G9Ynwwo
To claim this, I am signing this object:
@matsukaz
matsukaz / application.rb
Last active October 22, 2024 06:09
Rails connection management to handle Amazon Aurora's failover
module xxx
class Application < Rails::Application
#(中略)
config.middleware.swap ActiveRecord::ConnectionAdapters::ConnectionManagement,
'ActiveRecord::ConnectionAdapters::ReconnectOnErrorManagement'
end
end
@matsukaz
matsukaz / 01.README.md
Last active September 27, 2021 11:07
Find a geolocation of an IP address in BigQuery

This query is to find geolocation of an IP address including latitude, longitude, city and country.

Legacy SQL doesn't support range conditions such as BETWEEN when using JOIN, so we need to filter data by WHERE. This means if IP address does not match any of the data inside geolite_city_bq_b2b, records will not be able to receive.

Use Standard SQL if you want to receive records no matter you succeed to find geolocation or not.

Please refer to the following post for more detail.

https://cloudplatform.googleblog.com/2014/03/geoip-geolocation-with-google-bigquery.html