(from Understanding Nginx Server and Location Block Selection Algorithms - https://goo.gl/YyzshP)
server {
Vue.component('coupon', { | |
props: ['code'], | |
template: ` | |
<input type="text" | |
:value="code" | |
@input="updateCode($event.target.value)" | |
ref="input"> | |
`, |
let webpack = require('webpack'); | |
let path = require('path'); | |
module.exports = { | |
entry: { | |
app: './resources/assets/js/app.js', | |
vendor: ['vue', 'axios'] | |
}, | |
output: { |
# GIT heart FZF | |
# ------------- | |
is_in_git_repo() { | |
git rev-parse HEAD > /dev/null 2>&1 | |
} | |
fzf-down() { | |
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@" | |
} |
<<APP>> change this variables |
module ActiveRecordExtension | |
extend ActiveSupport::Concern | |
module ClassMethods | |
# Simple left join taking advantage of existing Rails & Arel code | |
def left_joins(*args) | |
inner_joins = self.joins(*args).arel.join_sources | |
left_joins = inner_joins.map do |join| | |
Arel::Nodes::OuterJoin.new(join.left, join.right) | |
end |
(from Understanding Nginx Server and Location Block Selection Algorithms - https://goo.gl/YyzshP)
server {
//events - a super-basic Javascript (publish subscribe) pattern | |
var events = { | |
events: {}, | |
on: function (eventName, fn) { | |
this.events[eventName] = this.events[eventName] || []; | |
this.events[eventName].push(fn); | |
}, | |
off: function(eventName, fn) { | |
if (this.events[eventName]) { |
Nice answer on stackoverflow to the question of when to use one or the other content-types for POSTing data, viz. application/x-www-form-urlencoded
and multipart/form-data
.
“The moral of the story is, if you have binary (non-alphanumeric) data (or a significantly sized payload) to transmit, use multipart/form-data
. Otherwise, use application/x-www-form-urlencoded
.”
Matt Bridges' answer in full:
The MIME types you mention are the two Content-Type
headers for HTTP POST requests that user-agents (browsers) must support. The purpose of both of those types of requests is to send a list of name/value pairs to the server. Depending on the type and amount of data being transmitted, one of the methods will be more efficient than the other. To understand why, you have to look at what each is doing
# Require this file in spec_helper.rb to show which cassettes are not being used | |
# after the test suite has run. Then you can decide if you want to delete them. | |
require 'vcr' | |
require 'set' | |
USED_CASSETTES = Set.new | |
module CassetteReporter | |
def insert_cassette(name, options = {}) | |
USED_CASSETTES << VCR::Cassette.new(name, options).file |