This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# method base | |
def clean_emoji(str='') | |
str=str.force_encoding('utf-8').encode | |
arr_regex=[/[\u{1f600}-\u{1f64f}]/,/[\u{2702}-\u{27b0}]/,/[\u{1f680}-\u{1f6ff}]/,/[\u{24C2}-\u{1F251}]/,/[\u{1f300}-\u{1f5ff}]/] | |
arr_regex.each do |regex| | |
str = str.gsub regex, '' | |
end | |
return str | |
end | |
# sample |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential | |
apt-get -y install git-core | |
# Install rbenv | |
git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
# Add rbenv to the path: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
unless Rails.application.config.consider_all_requests_local | |
#rescue_from Exception, with: :render_500 | |
rescue_from ActionController::RoutingError, with: :render_canvas_404 | |
rescue_from ActionController::UnknownController, with: :render_404 | |
rescue_from AbstractController::ActionNotFound, with: :render_404 | |
rescue_from ActiveRecord::RecordNotFound, with: :render_404 | |
rescue_from ActiveResource::ForbiddenAccess, with: :render_403 | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "webrick" | |
=begin | |
WEBrick is a Ruby library that makes it easy to build an HTTP server with Ruby. | |
It comes with most installations of Ruby by default (it’s part of the standard library), | |
so you can usually create a basic web/HTTP server with only several lines of code. | |
The following code creates a generic WEBrick server on the local machine on port 1234, |