This file contains hidden or 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 'system_helper' | |
RSpec.describe 'Something', type: :system do | |
it 'receives an event', :with_stripe_events do | |
make_request_at_stripe | |
wait_for_stripe_event { |e| e.type == 'charge.succeeded' } | |
expect(...) | |
end | |
end |
This file contains hidden or 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 this in config/application.rb after require "action_controller/railtie" | |
module ActionController | |
module Renderers | |
remove :json | |
remove :js | |
remove :xml | |
add :json do |json, options| | |
json = json.to_json(options) unless json.kind_of?(String) |
This file contains hidden or 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
function main() { | |
console.log("tick"); | |
// Find the header signifying current timeline mode | |
const title = document.querySelector( | |
'[data-testid="primaryColumn"] h2[role="heading"]' | |
); | |
// If it isn't loaded yet, try again in 0.5 secs | |
if (!title) { |
This file contains hidden or 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
# frozen_string_literal: true | |
class VideoUrlParser | |
VideoMatch = Struct.new(:type, :video_id, :matches) | |
def initialize(url) | |
@url = url | |
@match = match_url | |
@type = @match.type | |
@video_id = @match.video_id |
This file contains hidden or 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
Metrics/BlockLength: | |
Exclude: | |
- "spec/**/*_spec.rb" | |
Rails/Delegate: | |
Enabled: false | |
Rails/HasAndBelongsToMany: | |
Enabled: false |
This file contains hidden or 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
Verifying my Blockstack ID is secured with the address 17Wp7UfqKqy6JsjRF5w2yHi2jaZBMQcZt8 https://explorer.blockstack.org/address/17Wp7UfqKqy6JsjRF5w2yHi2jaZBMQcZt8 |
This file contains hidden or 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
/* globals fetch */ | |
require('isomorphic-fetch') | |
const { parse } = require('url') | |
const { send } = require('micro') | |
module.exports = async (req, res) => { | |
const { query } = parse(req.url) | |
res.setHeader('Access-Control-Allow-Origin', '*') | |
res.setHeader('Content-Type', 'application/json') |
This file contains hidden or 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
import { Component } from 'react' | |
import { Provider, connect } from 'react-redux' | |
import { reducer, initStore } from './store' | |
export default function Connected (...args) { | |
return function (Comp) { | |
return class StoreComponent extends Component { | |
static getInitialProps ({ req }) { | |
const isServer = !!req | |
const store = initStore(reducer, undefined, isServer) |
This file contains hidden or 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 'ostruct' | |
# Make little bundles of variables using Let {} | |
# | |
# example: | |
# things = Let { | |
# self.posts = Post.all | |
# self.comments = Comment.where(post: posts) | |
# } | |
# |
This file contains hidden or 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
import React, { Component, PropTypes } from 'react' | |
import { connect } from 'react-redux' | |
/* ACTIONS */ | |
export const ADD = 'something_clever/ADD' | |
export function add () { | |
return { type: ADD } | |
} |