Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
coffee!

Josh Taylor joshuataylor

💭
coffee!
View GitHub Profile
View gist:111870e15b83ce29761efc9ac1b5c69d
So you have setup your API to accept CORS requests on certain paths on your API using [cors_plug](https://github.com/mschae/cors_plug) or [corsica](https://github.com/whatyouhide/corsica) and you are wondering how you test this with ExUnit.
## Back to basics: Does the endpoint actually work?
Well the first thing to do is to check if your endpoint is actually working with CORS.
You can do this via cURL:
curl http://localhost:4000/api/posts -v -H "Origin: https://example.com"
View gist:721954bd410df4bb302c53667f0ea580
foreach (var item in items)
{
var message = new Foobar();
tasks.Add(context.Publish(message));
}
await Task.WhenAll(tasks).ConfigureAwait(false);
@joshuataylor
joshuataylor / app.js
Created Oct 23, 2017
Preact component to notify user when a change has been made, and on route change reload the page.
View app.js
import { h, Component } from 'preact';
import { Router } from 'preact-router';
import Header from './header';
import Home from '../routes/home';
import Profile from '../routes/profile';
import NotifyChange from "./NotifyChange/index";
// import Home from 'async!../routes/home';
// import Profile from 'async!../routes/profile';
View gist:a55e7dcb49838c0868227a2682a701ed
steps:
- checkout
- restore_cache:
keys:
- project-{{ checksum "mix.exs" }}-{{ checksum "mix.lock" }}
- run:
name: deps
command: MIX_ENV=test mix deps.get
- run:
name: compile test
View gist:60348be4921994e6f494db89aa110a53
def create(conn, %{"grant_type" => "password",
"username" => username,
"password" => password}) do
try do
user = User
|> where(username: ^username)
|> where(active: true)
|> Repo.one!
cond do
View controllers.application.js
import Ember from 'ember';
import AdultValidations from '../validations/adult';
import ChildValidations from '../validations/child';
import { reservedEmails } from '../validators/uniqueness';
import { schema } from '../models/user';
const { get } = Ember;
const { keys } = Object;
export default Ember.Controller.extend({
View gist:2babe6cf3ab8175661ad3374cbc62fb8
<html>
<style>
body {
background-color: #000;
}
h1 {
text-align: center;
color: #fff;
left: 0;
line-height: 200px;
View gist:b48deb6cc76c053164fba6ac6dce31f1
From 0b2c3c5507bd7b068cf827cee23bfe14fc4d616f Mon Sep 17 00:00:00 2001
Message-Id: <0b2c3c5507bd7b068cf827cee23bfe14fc4d616f.1461217761.git.joshuataylorx@gmail.com>
From: Josh Taylor <joshuataylorx@gmail.com>
Date: Thu, 21 Apr 2016 15:49:15 +1000
Subject: [PATCH] Add ability to merge remote composer configurations via http
---
README.md | 5 +-
src/Merge/ExtraPackage.php | 134 +++++++++++++--------
src/MergePlugin.php | 56 +++++++--
View keybase.md

Keybase proof

I hereby claim:

  • I am joshuataylor on github.
  • I am joshtaylor (https://keybase.io/joshtaylor) on keybase.
  • I have a public key ASATsm875vJ9BFeZk_xNAvxkovouvULF-TkIgOUnjsGxFQo

To claim this, I am signing this object:

View gist:160941123750659edd0a
# apt-get install blackfire-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
lsof php5-cli php5-common php5-json php5-readline psmisc
Suggested packages:
php-pear php5-user-cache
Recommended packages:
php7.0-cli php7.0-common
You can’t perform that action at this time.