Skip to content

Instantly share code, notes, and snippets.

Walter McGinnis walter

Block or report user

Report or block walter

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
View jenkins-set-up-script.sh
############################################################
# setup & build client #
############################################################
# install node
. $scriptDir/install-node.sh
if [ "$?" != "0" ]; then echo "node wasn't installed properly, try deleting the workspace and rerunning the build"; exit 1; fi;
# setup dependency managers
. $scriptDir/install-yarn.sh
if [ "$?" != "0" ]; then echo "yarn wasn't installed properly, try deleting the workspace and rerunning the build"; exit 1; fi;
## install dependencies
@walter
walter / ember-cli-update-output.txt
Created Oct 31, 2018
Error output of ember-cli-update
View ember-cli-update-output.txt
$ ember-cli-update --to "~3.4"
Cloning into bare repository '/var/folders/hg/klz90hy524v2m4prxvnnqvlw0000gn/T/tmp-29582kdN8hFA6I9KE/.git'...
Note: checking out '1bcb7a197e52ca01d1858de0346b789187a4b6c9'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
@walter
walter / ember-slack-bendemboski-async-gotchas.md
Created May 22, 2018
Reasoning around why you should be careful with native `async` functions within Ember app code
View ember-slack-bendemboski-async-gotchas.md

From @bendemboski Ember Community Slack -testing channel

link

... I'm pretty sure using native async/await in your application code is what's making you sad For two reasons -- one is that the code that runs after any await call will not be wrapped in a run loop because native promises aren't run loop aware, so anything after an await that uses the run loop, like calling .set on an Ember object, will trigger the auto-run assertion in tests

The other problem you're probably having is that your tests aren't waiting for any of the async behavior to happen Ember.run(() => service.create(name)) doesn't wait for any actual async behavior -- it just drains the run loop queues But your await calls will cause things to actually be async in the browser, and since your test isn't doing anything to wait for that behavior, it will end before all of your code has run So you could try

View custom-type.ex
defmodule Junk.SensibleDateTimeType do
use Timex
require Logger
@behaviour Ecto.Type
def type, do: :naive_datetime
def load(%NaiveDateTime{} = value), do: value
def load(_), do: :error
View adjust-alchemist.el
(defun alchemist-iex-project-run-phoenix-server ()
"Start an IEx process with mix 'iex -S mix phoenix.server' in the
context of an Elixir project.
Show the IEx buffer if an IEx process is already run."
(interactive)
(if (alchemist-project-p)
(let ((default-directory (alchemist-project-root)))
(pop-to-buffer (process-buffer (alchemist-iex-process " -S mix phoenix.server"))))
(message "No mix.exs file available. Please use `alchemist-iex-run' instead.")))
(define-key alchemist-mode-keymap (kbd "i s") 'alchemist-iex-project-run-phoenix-server)
View 1.txt
user_from_auth_spec.exs:124
** (MatchError) no match of right hand side value: %CubspotPhoenix.User{__meta__: #Ecto.Schema.Metadata<:loaded>, auth_provider_authorizations: #Ecto.Association.NotLoaded<association :auth_provider_authorizations is not loaded>, email: "fred@example.com", gender: nil, id: 360, inserted_at: #Ecto.DateTime<2016-06-16 03:54:10>, name: "Bob Dobbs", phone: nil, postcode: nil, preferred_name: "Bob", updated_at: #Ecto.DateTime<2016-06-16 03:54:10>}
spec/auth/user_from_auth_spec.exs:125: CubspotPhoenix.UserFromAuthSpec.example_returns_an_error_zwjlotmpskryghifabenxuqvcd/1
(espec) lib/espec/example_runner.ex:62: ESpec.ExampleRunner.try_run/3
(espec) lib/espec/example_runner.ex:39: ESpec.ExampleRunner.run_example/2
(elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
(elixir) lib/enum.ex:1088: Enum."-map/2-lists^map/1-0-"/2
(espec) lib/espec/runner.ex:71: ESpec.Runner.run_examples/1
(espec) lib/espec/runner.ex:44: ESpec.Runner.do_run/2
(espec) lib/espec
View user_from_auth_spec.exs
defmodule CubspotPhoenix.UserFromAuthSpec do
use ESpec.Phoenix, model: CubspotPhoenix.User
import Ecto.Query
import CubspotPhoenix.Factory
alias CubspotPhoenix.User
alias CubspotPhoenix.AuthProviderAuthorization
alias CubspotPhoenix.UserFromAuth
alias Ueberauth.Auth
View environment.js
if (environment !== 'production') {
ENV['contentSecurityPolicy'] = {
'default-src': "'none'",
'frame-src': "'self'",
'script-src': "'self' *.dev:35730 'unsafe-inline'",
'font-src': "'self' http://*.dev/",
'connect-src': "'self' ws://*.dev:35730/",
'img-src': "'self'",
'style-src': "'self'",
'media-src': "'self'"
@walter
walter / pow-ember-cli-setup-and-start
Created Apr 4, 2015
Pow port proxying with ember-cli server set up steps.
View pow-ember-cli-setup-and-start
cd [your_ember_cli_app_root_directory]
powder portmap 4201 # i increment from 4200 (ember-cli default port) for each app i develop
ember server -p 4201
View people-test.js
test('renderTemplate sets application.duringQuestionSteps to true',
function(assert) {
var route = this.subject(),
applicationController = route.controllerFor('application'),
didRender;
// http://discuss.emberjs.com/t/test-isolation-aka-how-wrong-am-i-doing-it/7162/2
route.render = function mockRender(route) {
didRender = true;
};
You can’t perform that action at this time.