Skip to content

Instantly share code, notes, and snippets.

View JuanitoFatas's full-sized avatar
🍔

Juanito Fatas JuanitoFatas

🍔
View GitHub Profile
@JuanitoFatas
JuanitoFatas / murmur.txt
Created June 23, 2014 09:57
MURMUR drinks
MURMUR
======
飲料
---
### 水果木耳露
冰糖木耳露
@JuanitoFatas
JuanitoFatas / attr_reader.html
Created June 21, 2014 03:35
Yard attr_reader rendered incorrect
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#compare-instance_method" title="#compare (instance method)">- (Object) <strong>compare</strong> </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc">
<div class="inline">
<p>class Benchmark::IPS::Job.</p>
@JuanitoFatas
JuanitoFatas / 15781
Last active August 29, 2015 14:02
source of changes in 15781
Setting Up the WEBrick SSL Server on LocalHost
==============================================
With WEBrick as the default development server, one cannot just configure Rails
to enable SSL, because WEBrick must be invoked with SSL support turned on. This
means that modifying `config.ru` is necessary.
WEBrick is a Rack-based server. The `config.ru` file is used by Rack-based
servers to start the application.
-### Setting Up the WEBrick SSL Server on LocalHost
+Setting Up the WEBrick SSL Server on LocalHost
+==============================================
-With WEBrick as the default development server, one cannot just configure Rails to enable SSL, because WEBrick must be invoked with SSL support turned on. This means that modifying `config.ru` is necessary.
+With WEBrick as the default development server, one cannot just configure Rails
+to enable SSL, because WEBrick must be invoked with SSL support turned on. This
+means that modifying `config.ru` is necessary.
-WEBrick is a Rack-based server. The `config.ru` file is used by Rack-based servers to start the application.
@JuanitoFatas
JuanitoFatas / 15258.rb
Created June 12, 2014 13:25
Rails 15258 issue gist
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@JuanitoFatas
JuanitoFatas / Add-test-for-15258.patch
Last active August 29, 2015 14:02
rails issue 15258
From ebb192badba2f0bf4ec476dc8c3c9ea95dbb6b00 Mon Sep 17 00:00:00 2001
From: Juanito Fatas <katehuang0320@gmail.com>
Date: Thu, 12 Jun 2014 21:15:03 +0800
Subject: [PATCH] Add test for #15258.
---
activerecord/test/cases/relations_test.rb | 8 ++++++++
activerecord/test/models/comment.rb | 4 ++++
activerecord/test/models/post.rb | 16 ++++++++++++++++
3 files changed, 28 insertions(+)
@JuanitoFatas
JuanitoFatas / edge-rails-app.md
Last active August 29, 2015 14:02
Create Edge Rails application

Clone rails/rails repo.

cd into it, ruby install.rb LATEST_VERSION to install edge rails.

Use this installed rails executeable to generate new project but with --skip-bundle option:

rails new app --skip-bundle.

cd to newly generated app, change the rails line and add arel:

@JuanitoFatas
JuanitoFatas / activerecord-14841.rb
Created April 23, 2014 03:25
Active Record no_touching should bypass after_touch callback. rails/rails #14841
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
require 'active_record'
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :users do |t|
t.timestamps
end
create_table :activities do |t|
t.integer :user_id
@JuanitoFatas
JuanitoFatas / gist:9951004
Created April 3, 2014 09:03
stty raw -echo
raw (-raw) If set, change the modes of the terminal so that no input or
output processing is performed. If unset, change the modes
of the terminal to some reasonable state that performs input
and output processing. Note that since the terminal driver
no longer has a single RAW bit, it is not possible to intuit
what flags were set prior to setting raw. This means that
unsetting raw may not put back all the setting that were pre-
viously in effect. To set the terminal into a raw state and
then accurately restore it, the following shell code is rec-
ommended: