Skip to content

Instantly share code, notes, and snippets.

Daniel G. Taylor danielgtaylor

Block or report user

Report or block danielgtaylor

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
@danielgtaylor
danielgtaylor / example.apib
Created Nov 5, 2015
API Blueprint error attributes example for Aglio
View example.apib
FORMAT: 1A
# Example API
This is an example showing error information like Stripe does.
## Errors
Errors returned by this API take the following format:
```json
{
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active Feb 4, 2019
Moving to ES6 from CoffeeScript
View gist:0b60c2ed1f069f118562

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@danielgtaylor
danielgtaylor / credentials.py
Created Mar 10, 2015
Credential Resolver Proposal
View credentials.py
def create_credential_resolver(session):
"""Create a default credential resolver.
This creates a pre-configured credential resolver
that includes the default lookup chain for
credentials.
"""
profile_name = session.get_config_variable('profile') or 'default'
credential_file = session.get_config_variable('credentials_file')
View git diff
diff --git a/tests/unit/resources/test_factory.py b/tests/unit/resources/test_factory.py
index 544ee61..2ef49c3 100644
--- a/tests/unit/resources/test_factory.py
+++ b/tests/unit/resources/test_factory.py
@@ -41,7 +41,7 @@ class TestResourceFactory(BaseTestCase):
self.factory.create_class('test')
self.assertTrue(self.factory.load_from_definition.called,
- 'Class was not loaded from definition')
+ 'Class was not loaded from definition')
@danielgtaylor
danielgtaylor / example.html
Last active May 17, 2019
Userbadges.com Example
View example.html
<div class="profile">
<img src="/images/profile.jpg"/>
<h1>John Smith</h1>
Writer &amp; Reviewer<br/>Registered 1 Jan 2013
<h2>Awards:</h2>
<div class="userbadges" data-service="demo" data-user="jsmith"></div>
</div>
@danielgtaylor
danielgtaylor / 01-recipe.js
Last active Dec 17, 2015
Brauhaus.js examples
View 01-recipe.js
// Create a new recipe
var recipe = new Brauhaus.Recipe({
name: 'Daniel\'s Doppelbock',
description: '...',
author: 'Daniel G. Taylor'
batchSize: 20.0,
boilSize: 10.0
});
@danielgtaylor
danielgtaylor / index.html
Created May 13, 2013
Brauhaus.js getting started in the web browser
View index.html
<html>
<head>
<title>Brauhaus.js Test</title>
</head>
<body>
<p>
Let's make some beer!
</p>
<script type="text/javascript" src="/scripts/brauhaus.min.js"></script>
<script type="text/javascript">
@danielgtaylor
danielgtaylor / mash-example.coffee
Created May 1, 2013
Brauhaus.js mashing example
View mash-example.coffee
Brauhaus = require 'brauhaus'
# Create a new recipe
recipe = new Brauhaus.Recipe
name: 'My new recipe'
batchSize: 20.0
# Add some grain to be mashed
recipe.add 'fermentable',
name: 'Pale malt'
@danielgtaylor
danielgtaylor / gist:5065626
Last active Dec 14, 2015
Calculating gravities, color, IBU, alcohol by volume, and calories for a beer recipe.
View gist:5065626
<script type="text/javascript" src="/scripts/brauhaus.min.js"></script>
<script type="text/javascript">
// Create a recipe
var r = new Brauhaus.Recipe({
name: 'My test brew',
description: 'A new test beer using Brauhaus.js!',
batchSize: 20.0,
boilSize: 10.0
});
@danielgtaylor
danielgtaylor / gist:3955072
Created Oct 25, 2012
Example httpie call for Malt.io API
View gist:3955072
$ http https://maltioweb.appspot.com/_ah/api/maltio/v1/recipes limit==1 order==LIKES
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: Tue, 30 Oct 2012 18:34:17 GMT
ETag: "8xJp6-t04hAv0QlZ8diuygX5EF8/R4Slr4GR8josHmd2u6O0ZhjkW6g"
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Pragma: no-cache
Server: GSE
Transfer-Encoding: chunked
You can’t perform that action at this time.