most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat| sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime |
| # This file should be placed on the directory of ~/blog/config | |
| upstream unicorn { | |
| server unix:/tmp/unicorn.todo.socket fail_timeout=0; | |
| } | |
| server { | |
| listen 80 default; | |
| #server_name example.com; | |
| root /home/username/blog/public; |
| var initializeUploaderWithFiles = function (file_types) { | |
| var url = $('#fileupload').attr('action'), | |
| uploadButton = $('<button/>') | |
| .addClass('btn btn-primary') | |
| .prop('disabled', true) | |
| .text('Processing...') | |
| .on('click', function () { | |
| var $this = $(this), | |
| data = $this.data(); | |
| $this |
| # Usage: | |
| # In your (Application)Controller: | |
| # include Concerns::ForceNonSSL | |
| # force_non_ssl | |
| # | |
| # You can use the same options as with force_ssl. | |
| # See: http://api.rubyonrails.org/classes/ActionController/ForceSSL/ClassMethods.html#method-i-force_ssl | |
| # | |
| # Code based on: https://github.com/rails/rails/blob/ab08519b1aed46dbd4b3e13932bbaddfe42d8315/actionpack/lib/action_controller/metal/force_ssl.rb | |
| # |
| .custom-file-upload { | |
| width: 100%; | |
| position: relative; | |
| padding: 0px; | |
| } | |
| .custom-file-upload:before { | |
| content: 'Browse'; | |
| position: absolute; | |
| right: 0px; |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def filter(filtering_params = []) | |
| results = self.where(nil) | |
| filtering_params.each do |key, value| | |
| results = results.public_send(key, value) if value.present? | |
| end if filtering_params.any? | |
| results |
| module Exportable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def to_csv(options = {}) | |
| columns = options[:columns] || column_names | |
| CSV.generate do |csv| | |
| csv << columns | |
| all.each do |item| |
| module HasNoTable | |
| extend ActiveSupport::Concern | |
| include ActiveModel::Validations | |
| include ActiveModel::Conversion | |
| extend ActiveModel::Naming | |
| def initialize(attributes = {}) | |
| attributes.each do |name, value| | |
| send("#{name}=", value) |