Skip to content

Instantly share code, notes, and snippets.

@peter
peter / carrierwave-file-size-limit-example.rb
Created March 7, 2014 09:17
Checking and Limiting File Size of Uploaded Files with Carrierwave
# NOTE: There must be a better way to do this - help appreciated!
###############################################################
# uploaded_file.rb - utility class
###############################################################
class UploadedFile
def self.size(file)
uploaded?(file) ? file.size : nil
end
@shuntksh
shuntksh / file0.js
Last active March 31, 2017 13:49
WebpackってCSS周りのLoaderがいっぱいあって分かりにくいので整理してみる ref: http://qiita.com/shuntksh/items/bb5cbea40a343e2e791a
{
test: /\.css$/,
loader: "style-loader!css-loader?modules&importLoaders=1&camelCase!postcss-loader",
},
@nulltask
nulltask / 20140826.md
Last active September 13, 2020 09:08
Express / Socket.IO をスケールアウトしてみよう
@mala
mala / CVE-2019-5418_is_RCE.md
Last active February 7, 2021 04:25
Rails の CVE-2019-5418 は RCE (Remote code execution) です
@saboyutaka
saboyutaka / turbolinks_note.md
Last active October 5, 2022 08:45
Turbolinksを調べてみた
@yoshiki-0428
yoshiki-0428 / setup.sh
Last active March 3, 2023 13:59
Mac OSの初期化時に設定するshellです。1: Setup Mac 2: Brew install 3: Apple App install 4: Fish install
#!/bin/bash
# ================================================================================
# 【For Mac】MacOS.sh : Setup MacOS
# ================================================================================
if [ "$(uname)" != "Darwin" ] ; then
echo 'Not macOS!'
exit 1
@nobuoka
nobuoka / java-for-android-app.markdown
Last active May 14, 2023 14:47
Android アプリ開発勉強会のために書いた Java の入門文書

Android アプリ開発のための Java 入門

MEMO

  • declaration は 「宣言」 と訳しているが、「定義」 の方が適しているような気がしなくもない。
  • 「インスタンス」 と 「オブジェクト」 という言葉を使うことがあるが、本文書中ではどちらも同じ意味で使用している。
  • String オブジェクト」 という表現は、「String クラスのインスタンス」 を意味している。 (Java に限らず一般的な表現だと思う。)

はじめに

@DmZ
DmZ / pre-commit
Last active July 25, 2023 13:40
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@dduvnjak
dduvnjak / pre-commit
Last active September 26, 2023 00:29 — forked from DmZ/pre-commit
Git pre-commit hook to search for Amazon AWS API keys.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=5da2c1fe8f6458e32d11110e0ebdd915e472c6e0
fi
@syafiqfaiz
syafiqfaiz / how-to-copy-aws-rds-to-local.md
Last active February 21, 2024 06:00
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored