Skip to content

Instantly share code, notes, and snippets.

View danielgtaylor's full-sized avatar

Daniel G. Taylor danielgtaylor

  • iStreamPlanet
  • Seattle, WA
View GitHub Profile
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

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 / main.go
Created December 14, 2023 05:52
Huma v2 manual doc
package main
import (
"encoding/json"
"fmt"
"net/http"
"reflect"
"github.com/danielgtaylor/huma/v2"
"github.com/go-chi/chi/v5"
@danielgtaylor
danielgtaylor / example.html
Last active May 17, 2019 08:10
Userbadges.com Example
<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 December 17, 2015 06:59
Brauhaus.js examples
// 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 16:05
Brauhaus.js getting started in the web browser
<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 15:50
Brauhaus.js mashing example
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 December 14, 2015 09:29
Calculating gravities, color, IBU, alcohol by volume, and calories for a beer recipe.
<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 / example.apib
Created November 5, 2015 18:54
API Blueprint error attributes example for Aglio
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:3955072
Created October 25, 2012 20:03
Example httpie call for Malt.io API
$ 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
@danielgtaylor
danielgtaylor / gist:3764319
Created September 21, 2012 22:36
Malt.io Recipe Widget Width Example
<div class="maltio-recipe" data-recipe="monk-s-tripel" data-user="danielgtaylor" data-width="500"></div>