Skip to content

Instantly share code, notes, and snippets.

@sunaot
sunaot / eigenclass.md
Last active July 4, 2019 02:32
class << self によるクラスメソッドの定義のイディオムの説明とその背景にある特異クラスのかんたんな解説

Ruby のコードを読んでいると

class Hoge
  class << self
    def hello
      puts 'hello'
    end
  end
end
@axross
axross / how_to_install_ruby2.0_and_rails4.0.2_with_rbenv.md
Last active August 13, 2021 16:24
rbenvを使用しており、Rubyの普段使っているバージョンが2.0系でない方へ

rbenvを使用しており、普段使っているRubyのバージョンが2.0系でない方へ

Railsチュートリアル(4.0版)では、Rubyのバージョンとして2.0系を用いており、動作確認をしたGemを用いています。
Gemの中にはバージョンごとに別のコードで実装されているものがありますので、Rubyのバージョンを2.0系に合わせることをおすすめします。

下記に、rbenv + ruby-buildでRubyをインストールしている方向けに、Ruby2.0系でRailsチュートリアルを進めるための方法を書いておきます。

インストール可能なバージョンの確認

@kotaroito
kotaroito / .my.cnf
Created January 6, 2014 08:40
.my.cnf - minimum
[mysql]
prompt='\\u@\\h[\\d]:\\c> '
@nghuuphuoc
nghuuphuoc / 1) Install
Last active September 4, 2023 09:29
Install Redis on Centos 6
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
@uupaa
uupaa / reveal.js pdf print out.md
Last active September 19, 2023 00:51
reveal.js で pdf 印刷

Chrome 上で reveal.js で作成したスライドを pdf 化する手順メモ

  • URL に ?print-pdf を追加する
  • CMD + P で印刷ダイアログを表示し、出力先を pdf に設定
  • 出力

出力された pdf を確認し、リンクが表示されていないなど表示がおかしい場合は以下の事を試す(ここからが本題)

reveal.js/out.html の document.write している行をコメントアウトし、css/print/pdf.css を直接追加。

@kaplan
kaplan / middleman_dev_approaches.md
Last active May 12, 2016 11:42
Local development setup approaches for Middleman with Pow or Apache with the Mac OS.

Middleman Local Dev Approaches

Update 03-03-2015
I've moved over to a new MacBookPro running 10.10.2. I think I'm going to leave POW off this machine. I've been trying to use more Vagrant VMs in general, but the Localhost is so fast for just getting something in the browser, especially when testing things out on the front end in the browser. One thing I'm noticing about the 2nd approach is that the build with a vhost works great, but just getting the .git setup was a little tricky. I had to make the main directory, the build directory and git init in each. Then, I added the remotes from the working (development) repository for the source and the staging server repo for the build. Looks like I might install Passenger on this new machine so that I can use a vhost for the source files. Otherwise I need to use the http://0.0.0.0:4567/ or http://localhost:4567/ which isn't a bad thing vs installing Passenger?

Udpate 03-03-2015
Wow, just installed Phusion Passenger in about 15min using the g

@victorlhlam
victorlhlam / gist:7019359
Last active August 5, 2019 13:44
Rails 3.1+ force_ssl & HSTS problem

Rails 3.1 introduced force_ssl. You can add config.force_ssl = true in application.rb.

By enabling force_ssl, Rails send a HSTS (HTTP Strict Transport Security) header which will expired in a year.

So if you enabled force_ssl once, even you change the config value to false later, the browser you used to open you app before will still remember this website (using domain to identify) require to use HTTPS, and redirect you to HTTPS connection automatically. You may use chrome://net-internals/#hsts to check the domain list in Google Chrome.

@plentz
plentz / nginx.conf
Last active May 27, 2025 10:32
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
NeoBundle 'Shougo/vimproc', {
\ 'build' : {
\ 'mac' : 'make -f make_mac.mak',
\ 'unix' : 'make -f make_unix.mak',
\ },
\ }
if has("lua")
NeoBundleLazy 'Shougo/neocomplete', { 'autoload' : {
\ 'insert' : 1,
[client]
default-character-set=utf8
socket=/usr/local/var/run/mysql.sock
#################################################
[mysqld]
socket=/usr/local/var/run/mysql.sock
skip-ssl
skip-name-resolve