In your command-line run the following commands:
brew doctor
brew update
In your command-line run the following commands:
brew doctor
brew update
//----------------------------------*\ | |
// TRIGONOMETRY FUNCTIONS | |
//----------------------------------*/ | |
// # Trigonometry in CSS | |
// | |
// - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf | |
// - Useful if you don't want to use JS. | |
// - With CSS Variables. | |
// - `calc()` can't do power (x ^ y) so I used multiplication instead. |
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that | |
// does not support `nomodule` is probably not being used anywhere. The code below is left | |
// for posterity. | |
/** | |
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will | |
* load <script nomodule> anyway. This snippet solve this problem, but only for script | |
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script> | |
* | |
* Again: this will **not** prevent inline script, e.g.: |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
gem 'devise' | |
# ENV variable management | |
gem 'figaro' | |
# OmniAuth Authentication providers | |
gem 'omniauth-google-oauth2' | |
gem 'omniauth-facebook' | |
group :development, :test do |
You don't need Paperclip or Carrierwave or even an ActiveRecord model to manage file uploads in Rails if all you need to do is read the file in and extract data from it.
The Catalog class (referenced in the UploadController#create
method) knows how to read a JSON file, translate and extract the data therein, and create or modify Book and Product records in the surrounding application.
By using the FileUtils.cp
class method, we move the uploaded file into a known location at a known filename, so the Catalog (PORO) can do its work. The tempfile created by Rack during the upload is harvested as normal by garbage collection, but the copy we made is deleted manually after the parsing process is completed.
require 'monitor' | |
class IdWorker | |
attr_reader :worker_id, :datacenter_id, :reporter, :logger, :sequence, :last_timestamp | |
TWEPOCH = 1288834974657 | |
WORKER_ID_BITS = 5 | |
DATACENTER_ID_BITS = 5 | |
MAX_WORKER_ID = (1 << WORKER_ID_BITS) - 1 |
{ | |
"keys": ["tab"], | |
"command": "expand_abbreviation_by_tab", | |
// put comma-separated syntax selectors for which | |
// you want to expandEmmet abbreviations into "operand" key | |
// instead of SCOPE_SELECTOR. | |
// Examples: source.js, text.html - source | |
"context": [ | |
{ |
# this is a dirty implementation of logger that | |
# compiles AR queries with trace into /last_request_log.html | |
# the snippet is useful when optimizing performance of the endpoint | |
class QueryLogSubscriber < ActiveSupport::LogSubscriber | |
TRACE_LEVEL = :app | |
LINES = 5 | |
IGNORE_CACHED_QUERIES = false | |
def initialize |