Skip to content

Instantly share code, notes, and snippets.

View dym_demo.rb
#!/usr/bin/env ruby
versions = (3..7).map{ |minor| "2.#{minor}" }
versions.each do |version|
cmd = <<~HERE
$stdout.write "defined?(DidYouMean) == "
$stdout.write defined?(DidYouMean).inspect
$stdout.write "\\n"
$stdout.write "defined?(DidYouMean::Levenshtein) == "
@austinpray
austinpray / out.txt
Created Jul 9, 2020
parse props from structured loggin
View out.txt
{"query"=>"can contain spaces", "span"=>"1h"}
{"query"=>"can contain spaces", "span"=>"1h"}
{"query"=>"can contain spaces", "span"=>"1h"}
{"query"=>"can contain spaces", "span"=>"1h"}
{"query"=>"can contain spaces"}
{"query"=>"can contain spaces"}
{"query"=>"can contain spaces"}
{"span"=>"1h"}
{"span"=>"1h"}
{"span"=>"1h"}
View gist:5544f10ffdb28991cd8a72ecca09ac82
Balanced B (B-tier stupid and horny)
VS
Balanced C (C-tier stupid and horny)
#### Balanced B (B-tier stupid and horny)
Nature | Value | Stat | Value
------ | --- | ---- | ---
**stupid** | 4 | **HP** | 60
View gist:2179301c3f7b3fa8e1ac62bf22aa7911
This file has been truncated, but you can view the full file.
Balanced F (F-tier stupid and horny)
VS
Balanced S (S-tier stupid and horny)
#### Balanced F (F-tier stupid and horny)
Nature | Value | Stat | Value
------ | --- | ---- | ---
View composer.json
{
"repositories": [
{
"type": "package",
"package": {
"name": "zzzzz/no-trailing-comma",
"description": "Placeholder package for clean diffs in composer.json.",
"version": "1.0.0",
"type": "metapackage",
"license": "MIT",
@austinpray
austinpray / the-events-calendar-automatic-ticket-categories.php Automatically apply "tribe_events_cat" taxonomy terms to WooCommerce tickets when tickets are saved or updated.
View the-events-calendar-automatic-ticket-categories.php
<?php
// Apply product categories to newly created or saved tickets that match the The Events Calendar categories of the associated event
add_action('event_tickets_after_save_ticket', function ($event_id, $ticket, $raw_data, $classname) {
if (empty($ticket) || !isset($ticket->ID)) {
return;
}
// Apply the "event-tickets" category to add tickets so that all tickets have at least this category to start
wp_add_object_terms($ticket->ID, 'event-tickets', 'product_cat');
View perf.sh
#!/usr/bin/env bash
for i in 7.1 7.2 7.3;
do
docker run -v $(pwd):/app -w /app php:$i php test-cast.php
docker run -v $(pwd):/app -w /app php:$i php test-no-cast.php
done
@austinpray
austinpray / bad.jsx
Last active Sep 19, 2018
PostListing Refactor. I'm using .jsx filenames so I can get proper filenames in the gist use .js or typescript in your project
View bad.jsx
import React from 'react'
const PostListing = ({post}) => (
<article>
<h3>{post.frontmatter.title}</h3>
<span>{post.frontmatter.date}</span>
<p>{post.excerpt}</p>
</article>
)
@austinpray
austinpray / README.md
Last active Sep 8, 2018
react-icons reduced testcase: uglifyjs compatiblity
View README.md

react-icons/react-icons uglifyjs compat

ref https://github.com/react-icons/react-icons/issues/186

ref https://github.com/react-icons/react-icons/issues/182

  1. run ./test.js before.js and you get the contents of before.txt. Notice how uglify2 is failing. Older versions of webpack and many build tools use this.
View getter.js
const get = function (name) {
return (
`public String get ${name.charAt(0).toUpperCase()}${name.slice(1)}() {
\treturn this.${name};
}`
);
};
You can’t perform that action at this time.