Skip to content

Instantly share code, notes, and snippets.

@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active March 12, 2025 04:26
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

@glen-cheney
glen-cheney / encoding-video.md
Last active November 24, 2024 10:09
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@AndrewRayCode
AndrewRayCode / gist:caef6fc3991823fced0f
Last active August 29, 2015 14:20
NodeJS convert CSV to JSON object with headers
var csv = require('csv');
csv.parse(fs.readFileSync('./csv_with_headers.csv'), function(err, data) {
// Store the headers row
var headers = data[0];
// Remove the headers row
data.shift();
var objects = _.map(data, function(csvRow) {
@sebmarkbage
sebmarkbage / Enhance.js
Last active February 10, 2025 06:23
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import random
from time import time
from py2neo import Graph, GraphError
@BYK
BYK / tld_python.sh
Last active August 29, 2015 14:03
Fetch the most current list of TLDs and create a Python module from them
echo 'TLDS = (' > $1 &&
curl -f -sS https://data.iana.org/TLD/tlds-alpha-by-domain.txt -L |
awk '{print tolower($0)}' |
grep '^[[:alnum:]\-]\{1,63\}$' | sed 's/^.*$/"&",/g' >> $1 &&
echo ')' >> $1
@staltz
staltz / introrx.md
Last active April 29, 2025 08:33
The introduction to Reactive Programming you've been missing
@evianzhow
evianzhow / custom_generate.sh
Last active August 29, 2015 14:02
bestroutetb for iptables on OpenWRT
#!/bin/bash
# For Linix users, just iptables.shadow under root
# For OpenWRT users, copy iptables.shadow to /etc/firewall.user
# For OpenWRT users, remember to change OUTPUT to PREROUTING in iptables.footer
./generate.sh route_table > analysis_result
node minifier.js|node formatter.js --profile=custom --format="iptables -t nat -A SHADOWSOCKS -d %prefix/%mask -j %gw" --netgw RETURN --vpngw ACCEPT > iptables.rules
@jsomers
jsomers / websters-kindle.mdown
Created May 19, 2014 01:42
How to make the Webster's 1913 your default Kindle dictionary

How to make the Webster's 1913 your default Kindle dictionary

  1. Download a Kindle-compatible version of the dictionary here. Unzip the .rar archive.

  2. Get the "Send to Kindle" program on your computer. Here's the link for the Mac.

  3. Right-click your recently downloaded (unzipped) dictionary file, and click the "Send to Kindle" menu item. It will arrive on your Kindle shortly.

  4. Once the dictionary has arrived, go to your settings -- on my newish paperwhite, it's at Home > Settings > Device Options > Language and Dictionaries > Dictionaries > English. Choose the Webster's 1913.