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
// from https://github.com/github/fetch/blob/master/fetch.js | |
// detecting the existince of fetch() and only patching if it is absent | |
var global = | |
(typeof globalThis !== 'undefined' && globalThis) || | |
(typeof self !== 'undefined' && self) || | |
(typeof global !== 'undefined' && global) || | |
{} |
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
SELECT DATE_ADD('2020-05-18', INTERVAL 12 MONTH) > NOW() |
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
SELECT c.name, | |
MAX(CASE detail WHEN 'good' THEN quantity ELSE 0 END) AS good, | |
MAX(CASE detail WHEN 'ok' THEN quantity ELSE 0 END) AS ok, | |
MAX(CASE detail WHEN 'bad' THEN quantity ELSE 0 END) AS bad | |
FROM | |
( | |
SELECT name, detail, count(*) as quantity | |
FROM products p | |
JOIN details d ON p.id = d.product_id | |
GROUP BY name, detail |
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
require 'rails_helper' | |
RSpec.describe '/oauth/', type: :request do | |
let(:application) { create(:doorkeeper_application, confidential: false) } | |
let(:user) { create(:user, email: '[email protected]', password: "PASSWORD") } | |
let(:valid_params) do | |
{ | |
username: user.email, | |
password: "PASSWORD", | |
grant_type: 'password', |
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
# run with | |
# ruby tools/demo-option-parser.rb --skip-download | |
# or | |
# bundle exec rails runner tools/demo-option-parser.rb --skip-download | |
require 'optparse' # not needed for rails runner | |
skip = nil | |
p ARGV # ["--skip-download"] |
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
/* for use as a user style, for example in a browser extension like Stylus for Google Chrome */ | |
#hot-network-questions { | |
display: none | |
} |
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
SELECT timeline_items.* FROM ( | |
# Query 1 | |
SELECT lead_alerts.id AS id, lead_alerts.action AS body, users.first_name AS first_name, users.last_name AS last_name, lead_alerts.due_on AS date, "lead_alerts" AS model | |
FROM `lead_alerts` LEFT OUTER JOIN `users` ON `users`.`id` = `lead_alerts`.`author_id` | |
WHERE `lead_alerts`.`lead_id` = 1 | |
UNION ALL | |
# Query 2 | |
SELECT completed_lead_alerts.id AS id, lead_alerts.action AS body, users.first_name AS first_name, users.last_name AS last_name, completed_lead_alerts.completed_on AS date, "completed_lead_alerts" AS model |
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
traverseAllChildren.js:143 Uncaught TypeError: Cannot convert a Symbol value to a string | |
at String (<anonymous>) | |
at traverseAllChildrenImpl (traverseAllChildren.js:143) | |
at traverseAllChildrenImpl (traverseAllChildren.js:93) | |
at traverseAllChildren (traverseAllChildren.js:172) | |
at Object.instantiateChildren (ReactChildReconciler.js:70) | |
at ReactDOMComponent._reconcilerInstantiateChildren (ReactMultiChild.js:185) | |
at ReactDOMComponent.mountChildren (ReactMultiChild.js:224) | |
at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:703) | |
at ReactDOMComponent.mountComponent (ReactDOMComponent.js:522) |
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
ENV["RAILS_ENV"] ||= 'test' | |
require 'spec_helper' | |
# ... | |
RSpec.configure do |config| | |
# Can help you spot problems with system time, timezones and time travel, | |
# especially if multiple specs interact with each other | |
# Check this doc for the difference between ::now and ::current : | |
# http://api.rubyonrails.org/classes/ActiveSupport/Testing/TimeHelpers.html#method-i-travel_to | |
config.around(:each) do |example| | |
puts "Time.now: #{Time.now}" |
NewerOlder