Skip to content

Instantly share code, notes, and snippets.

View erithair's full-sized avatar

Zhouyou erithair

  • China
View GitHub Profile
@erithair
erithair / sidekiq.config
Created February 4, 2016 07:56 — forked from ssaunier/sidekiq.config
Running Sidekiq on AWS Elastic Beanstalk (Put that file in `.ebextensions` folder)
# Sidekiq interaction and startup script
commands:
create_post_dir:
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh":
mode: "000755"
owner: root
group: root
@erithair
erithair / un-submodule.sh
Last active January 6, 2016 04:18
un-submodule a git submodule
# from http://stackoverflow.com/questions/1759587/un-submodule-a-git-submodule/16162228#16162228
mv yoursubmodule yoursubmodule_tmp
git submodule deinit yoursubmodule
git rm yoursubmodule
mv yoursubmodule_tmp yoursubmodule
rm -rf yoursubmodule/.git yoursubmodule/.gitignore
git add yoursubmodule
@erithair
erithair / google_pagespeed_insights.rb
Created November 27, 2015 03:41
Google PageSpeed Insights API
require 'httparty'
# Google PageSpeed Insights Doc: https://developers.google.com/speed/docs/insights/v2/getting-started
class PageSpeed
include HTTParty
base_uri 'https://www.googleapis.com'
def analyze(url, options = {})
self.class.get('/pagespeedonline/v2/runPagespeed', query: options.merge(url: url))
end
@erithair
erithair / rails_admin_error_trace
Created October 14, 2015 02:47
rails_admin crash error trace
I, [2015-10-14T01:53:49.409981 #27094] INFO -- : Started GET "/admin" for 199.48.228.111 at 2015-10-14 01:53:49 +0000
I, [2015-10-14T01:53:49.414945 #27094] INFO -- : Processing by RailsAdmin::MainController#dashboard as HTML
I, [2015-10-14T01:53:49.417216 #27094] INFO -- : Completed 500 Internal Server Error in 2ms
ArgumentError (wrong number of arguments (0 for 1..3)):
facets (3.0.0) lib/core/facets/kernel/with.rb:16:in `instance_eval'
facets (3.0.0) lib/core/facets/kernel/with.rb:16:in `with'
rails_admin (0.7.0) app/controllers/rails_admin/main_controller.rb:18:in `dashboard'
actionpack (4.2.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.0) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
<% flash.each do |type, message| %>
<div class="alert <%= alert_class_for(type) %> alert-dismissible fade in">
<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<%= message %>
</div>
<% end %>
@erithair
erithair / vimtutor_summary
Created April 23, 2015 11:50
vimtutor summary
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lesson 1 SUMMARY
1. The cursor is moved using either the arrow keys or the hjkl keys.
h (left) j (down) k (up) l (right)
2. To start Vim from the shell prompt type: vim FILENAME <ENTER>
3. To exit Vim type: <ESC> :q! <ENTER> to trash all changes.