Skip to content

Instantly share code, notes, and snippets.

const { utils } = require('react-docgen');
const { default: resolveHOC } = require('react-docgen/dist/utils/resolveHOC');
const {
default: resolveToModule,
} = require('react-docgen/dist/utils/resolveToModule');
module.exports = ({ moduleName = 'styled-components' } = {}) => {
const isStyledExpression = (tagPath, t) =>
(t.CallExpression.check(tagPath.node) &&
tagPath.get('callee').node.name === 'styled') ||
@arika
arika / rails_erb_syntax_check.rb
Last active December 18, 2020 10:16
Rails(Action View) ERB template syntax checker
require 'action_view'
require 'ruby-beautify'
require 'ripper'
require 'tmpdir'
require 'fileutils'
require 'optparse'
def check_syntax(path, options = {})
erb = content(path)
code = ruby_code(erb)
@dherman
dherman / loop-controls.js
Created January 13, 2012 22:50
using loop controls from within block lambdas
Mailbox.prototype.extractContents = function(contacts) {
let messages = this.messages;
loop:
for (let i = 0, n = messages.length; i < n; i++) {
messages[i].headers.forEach { |header|
if (header.isSpam())
continue loop; // the label is not strictly necessary here
let addresses = header.extractAddresses();
addresses.forEach { |addr|