Skip to content

Instantly share code, notes, and snippets.

Jonathan del Strother jdelStrother

Block or report user

Report or block jdelStrother

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jdelStrother
jdelStrother / README.md
Created May 27, 2019 — forked from surma/README.md
webpack-emscripten-wasm
View README.md

Minimal example making webpack and wasm/Emscripten work together.

Build instructions:

  • Clone this gist
  • npm install
  • npm start
  • Open http://localhost:8080
  • Look at console
View foo.js
watchFor("[data-react-class='Uploader']", function() {
import(/* webpackChunkName: "uploader" */ "components/uploader").then(
module => {
exposeComponents({ Uploader: module.default });
}
);
});
watchFor("[data-react-class='AudioEditor']", function() {
import(/* webpackChunkName: "AudioEditor" */ "components/audio_editor").then(
View foo.el
(defun magit-log-trace-definition-hacks (orig-func &rest args)
(if (called-interactively-p 'any)
(let ((file (or (magit-file-relative-name) (user-error "Buffer isn't visiting a file")))
(fn (replace-regexp-in-string "^.*[#.:]+" "" (which-function)))
(ref (or magit-buffer-refname (magit-get-current-branch) "HEAD")))
(message "%s" fn)
(apply orig-func (list file fn ref)))
(apply orig-func args)
))
(advice-add 'magit-log-trace-definition :around #'magit-log-trace-definition-hacks)
View foo.diff
--- a/deploy/nginx.standard.conf
+++ b/deploy/nginx.standard.conf
@@ -20,7 +20,7 @@ location @503 {
# Render the nice Audioboo 500 page, if required.
-error_page 500 504 = /500.html;
+error_page 500 504 /500.html;
error_page 502 /502.html;
View sample.js
/***/ "03A+":
/*!********************************************!*\
!*** ./node_modules/lodash/isArguments.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var baseIsArguments = __webpack_require__(/*! ./_baseIsArguments */ "JTzB"),
isObjectLike = __webpack_require__(/*! ./isObjectLike */ "ExA7");
View foo.diff
diff --git a/spec/features/indices/channel_index_spec.rb b/spec/features/indices/channel_index_spec.rb
index 4f1bc6c6d6..2b01215980 100644
--- a/spec/features/indices/channel_index_spec.rb
+++ b/spec/features/indices/channel_index_spec.rb
@@ -65,8 +65,12 @@
end
specify "marking a channel for deletion removes it from the index" do
+ clip = channel.audio_clips.sudo_make
expect(Channel.search(nil, retry_stale: false)).to include(channel)
View input.rb
def flatten_to_form_value_pairs(params)
params.to_query.split("&").map { |component| component.split("=").map { |s| Rack::Utils.unescape(s) } }
end
params = {post: {title: "foo", category_ids: [1,2,3]}}
flatten_to_form_value_pairs(params)
View input.rb
def hidden_field_tags(params)
# flatten out nested hashes into simple key-value pairs
flat_params = params.to_query.split("&").map { |component| component.split("=").map { |s| Rack::Utils.unescape(s) } }
safe_join flat_params.map { |k, v| hidden_field_tag(k, v, id: nil) }
end
params = {post: {title: "foo", category_ids: [1,2,3]}}
hidden_field_tags(params)
View Dockerfile
FROM ruby:2.4
# Versions: https://pypi.python.org/pypi/awscli#downloads
ENV AWS_CLI_VERSION 1.11.178
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python-dev build-essential groff less && \
curl -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
View capybara_helper.rb
Capybara.register_driver :chrome do |app|
require 'selenium-webdriver'
client = Selenium::WebDriver::Remote::Http::Default.new
opts = {
chrome_options: {
# Canary has a couple of benefits right now - eg screenshots actually work.
binary: "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
args: %w[headless]
}
}
You can’t perform that action at this time.