Enable JavaScript to use search. / 検索を使用するには JavaScript を有効にしてください。
Posts
Sun, January 20, 2013
1 min read
[Ruby on Rails] ArgumentError (invalid byte sequence in US-ASCII)
Fixing `ArgumentError (invalid byte sequence in US-ASCII)` in Rails by adding `# encoding: utf-8` to the file header.
read more →
[MySQL] Getting stuck with reserved words - ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxx' at line 1
MySQL threw ERROR 1064 on a query because the column name primary is a reserved word.
[Node.js] Sanitize and validate with node-validator
A quick pointer to node-validator, a handy Node.js package for sanitizing and validating input.
Thu, January 17, 2013
[Ruby] Introduction to state_machine
Reference links for getting started with state_machine, a Ruby gem for managing object state transitions.
Tue, January 15, 2013
[Sublime Text 2] Customizing tab switching command with Ctrl+Tab
A small Sublime Text 2 keybinding tweak that switches `Ctrl+Tab` to walk tabs in order instead of by MRU.
[JavaScript][jQuery] Checking for the existence of DOM elements
Six ways to check DOM element existence in JavaScript and jQuery, ranked by execution speed.
Sat, January 12, 2013
2 min read
[Facebook] Handling Revoked Permissions - 失効権限の取り扱い
A quick reference from Facebook's Handling Revoked Permissions doc on dealing with declined or revoked scopes.
Thu, January 10, 2013
[Ruby on Rails] How to change title for each page
Per-page title and meta tags in Rails using content_for and yield, with ERB and Haml examples.
Sat, January 5, 2013
[MongoDB] Display all records with find().forEach(printjson) or .toArray()
Two ways around mongo shell's 'has more' cutoff: .forEach(printjson) and .toArray().
Sat, December 29, 2012
[Chrome] Chrome extension 'jsoff' that can turn off JavaScript with one click
A quick pointer to 'jsoff', a Chrome extension for toggling JavaScript on and off with one click.
Tue, December 25, 2012
[Ruby] Use 'sunspot' for full-text search engine Solr
Reference links for the sunspot gem, which connects Rails apps to the Solr full-text search engine, including RSpec testing tips.
Mon, December 24, 2012
[Linux] About Memory Management
A quick reference note on Linux memory management and memory leak detection.
Sat, December 22, 2012
Image compression sites and tools summary
A short roundup of JPEGmini for JPEG, TinyPNG for PNG, and ImageOptim for the Mac.
JsDoc Toolkit Introduction
Intro notes on JsDoc Toolkit — reference sites, Homebrew install, and templates.
[WordPress] Steps to add a 'Send with LINE' button to WPTouch
Adding a 'Send with LINE' share button to WPTouch, and making it open in a new tab.
Fri, December 21, 2012
[Ruby] For file uploads, use 'CarrierWave'
Notes on the CarrierWave gem for file uploads in Rails, plus how to test uploads with RSpec.
Thu, December 20, 2012
[Ruby on Rails] How to limit default actions with 'only' while adding custom actions
Restrict Rails `resources` with `only:` and still add a custom collection action like `search`.
Wed, December 19, 2012
[Ruby on Rails] How to use acts_as_list
Reference links for using acts_as_list with jQuery UI Sortable in Rails.
[Ruby] Development HTTP Server 'Pow' by 37signals
Using 37signals' Pow — a zero-config Rack dev server for macOS — with Rails and Sinatra apps.
[Ruby on Rails] Converting line breaks to br tags
A custom Rails helper for converting line breaks to br tags, without the p tags that simple_format inserts.
Summary of Google Chrome Developer Tools Introduction Articles
A short link roundup of introductory articles for Google Chrome Developer Tools.
Tue, December 18, 2012
[Ruby on Rails] How to get the current URL (including parameters)
Getting the current URL with url_for(params) in Rails 3, plus adding and removing query parameters.
Haml Tips
Handy Haml tips: conditional class names and repeating ul/li output with in_groups_of.
Mon, December 17, 2012
[Capistrano] Recipe for executing rake tasks
A Capistrano recipe for invoking rake tasks on a remote server, with a namespace-collision workaround.
Sat, December 15, 2012
[Node.js] How to resolve Error: Cannot find module 'express'
Fixing Node.js Cannot find module 'express' by reinstalling dependencies with npm install -d.
Thu, December 13, 2012
[RSpec] Various ways to use Devise in test code
Rails + RSpec notes on testing Devise-protected controllers by stubbing current_user in a before block.
[Node.js] gyp ERR! configure error Error: EACCES, mkdir '/Users/name/.node-gyp'
Working around node-gyp's EACCES mkdir '/Users/name/.node-gyp' error with mkdir and chmod.
[Mac] Steps to install GMP with Homebrew
Install GMP, the arbitrary precision arithmetic library, on macOS with a single `brew install gmp`.
[Mac] Steps to install ImageMagick with Homebrew
A quick note on installing ImageMagick on macOS with a single Homebrew command.
[Mac] Installing MongoDB with Homebrew
Installing MongoDB with Homebrew on macOS and setting it up as a launchd auto-start service.
Wed, December 12, 2012
[Ruby on Rails] How to use helper methods in controllers and models
How to call Rails helper methods from controllers and models by including ActionView::Helpers.
[Ruby on Rails] How to use arel_table
Reference links for learning how to use Rails' arel_table.
Tue, December 11, 2012
[Ruby on Rails] Use blank? or present? instead of nil? to check model attributes
Use blank? or present? instead of nil? when checking Rails model attributes.
[Ruby] Differences between count, size, and length
A link roundup on the differences between count, size, and length in Ruby.
Mon, December 10, 2012
[Ruby] RSpec Beginner Articles Summary
A curated list of beginner references for RSpec, grouped by topic (views, requests, syntax, config).
Sun, December 9, 2012
[cURL] GET/POST/PUT/DELETE
A short memo on using cURL's -X option to send GET / POST / PUT / DELETE requests.
[PHP] How to Use Excel_Reviser
Reference links for working with the Excel_Reviser PHP library, which even supports PHP 4.
[SEO] Website Performance Measurement Service "WebPageTest"
A quick introduction to the WebPageTest website performance measurement service.
[PHP][APC] Warning: require_once(): Unable to allocate memory for pool.
Silencing the APC Unable to allocate memory for pool warning by setting apc.mmap_file_mask=/dev/zero.
[Windows] How to use 'Junction' - a symbolic link-like feature
A quick reference memo on using Junction on Windows 7 as a Linux-style symbolic link.
[JavaScript] How to Fix Sidebar Parts with jQuery When Scrolling
Link collection of reference articles for fixing a sidebar in place while scrolling with JavaScript or jQuery.
Thu, December 6, 2012
[RSpec] Differences between stub and mock
A link roundup of references that helped me get stubs vs. mocks straight in RSpec.
[Ruby on Rails] Overriding Devise's current_user method
Overriding Devise's current_user with alias_method to always include the user's Role.
Wed, December 5, 2012
[Ruby][FactoryGirl] Could not find a valid mapping for #<User
A record of running into the "Could not find a valid mapping for User" error with FactoryGirl and Devise.
[Ruby][RVM] mysql2.bundle: [BUG] Segmentation fault
Fixing a mysql2.bundle segmentation fault after recreating an RVM gemset by updating RVM to head.
[Rails][FactoryGirl] Error: Factory already registered: xxx
A short note on the "Factory already registered: xxx" error raised by FactoryGirl.
Tue, December 4, 2012
[Ruby] Convenient gem 'faker' for creating sample data
A short memo of reference links for 'faker', a Ruby gem that makes test and sample data generation easy.
[Ruby on Rails] How to create many-to-many relationship tables
Reference links for setting up many-to-many relationship tables in Ruby on Rails.
[Ruby on Rails] How to use seed-fu for easy seed data addition and management
Using the seed-fu gem to manage Rails seed data under `db/fixtures/`, with a CSV import example.
[Ruby] 'will_paginate' for adding pagination functionality
will_paginate helper options and localizing its labels through a locale YAML file.