Skip to content

Instantly share code, notes, and snippets.

View walter's full-sized avatar

Walter McGinnis walter

View GitHub Profile
############################################################
# 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 October 31, 2018 21:01
Error output of ember-cli-update
$ 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 21:25
Reasoning around why you should be careful with native `async` functions within Ember app code

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

@walter
walter / proof-of-concept-stuff.md
Last active March 23, 2018 16:18
Example third party widget stuff with Ember.js and ember-cli

Page calling third party widget:

<html>
  <head>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>
  </head>
  <body>
    <script class="at-widget-loader" src="proof/widget.js" type="text/javascript" async></script>
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
(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)
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
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
(setq-default tab-width 2)
@walter
walter / mybot.conf
Created August 13, 2013 02:13
Upstart script for a Hubot IRC Logger
description "mybot Hubot IRC bot"
# Subscribe to these upstart events
# This will make Hubot start on system boot
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]
# Path to Hubot installation
env HUBOT_DIR='/home/botuser/bots/mybot/'
env HUBOT='runbot.sh'