Skip to content

Instantly share code, notes, and snippets.

View jdx's full-sized avatar

jdx

View GitHub Profile
@jdx
jdx / dns.js
Last active April 8, 2016 04:20
'use strict';
let dns = require('dns');
setInterval(() => {
dns.lookup('api.heroku.com', err => {
if (err) console.error(`XXXXXXXXXXXXX\nERROR: ${err}\nXXXXXXXXXXXXXXX`);
else process.stdout.write('.');
});
}, 200);
@jdx
jdx / destructurin'.js
Last active April 30, 2016 01:57
JS ES6 Destructurin' with Regex
// node 6
let msg = "Merge pull request #222 from heroku/api-key-warning-whoami show warning if HEROKU_API_KEY is set"
let [, pr, branch, message] = msg.match(/Merge pull request (#\d+) from ([\S]+) (.*)/)
// node 5
let msg = "Merge pull request #222 from heroku/api-key-warning-whoami show warning if HEROKU_API_KEY is set"
let matches = msg.match(/Merge pull request (#\d+) from ([\S]+) (.*)/)
let pr = matches[1]
let branch = matches[2]
let messages = matches[3]

heroku apps

$ heroku apps
=== My Apps
ancient-headland-3338
angular-boilerplate
cli-build
dickey-xxx
dickeyxxx-simple-mean
$ heroku domains --app heroku-npm
=== heroku-npm Heroku Domain
heroku-npm.herokuapp.com
$ heroku domains --app heroku-npm
heroku-npm.herokuapp.com
app.get('/user/:id', function (req, res, next) {
db.get(req.params.id, function (err, user) {
if (err) return next(err);
res.json(user);
});
});
@jdx
jdx / app.js
Last active October 16, 2015 21:11
'use strict';
angular.module('app', []);
angular.module('app')
.controller('TodoCtrl', function ($scope, TodoSvc) {
$scope.todos = [{title: 'Get paper'}, {title:'Mail rent check'}];
$scope.refresh = function () {
TodoSvc.fetch()
@jdx
jdx / server.js
Last active October 15, 2015 21:14
'use strict';
let mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/todo');
let Todo = mongoose.model('Todo', {title: String});
let express = require('express');
let app = express();
@jdx
jdx / app.js
Last active October 16, 2015 21:10
'use strict';
angular.module('app', []);
angular.module('app')
.controller('TodoCtrl', function ($scope, TodoSvc) {
$scope.todos = [{title: 'Get paper'}, {title:'Mail rent check'}];
$scope.addTodo = function () {
TodoSvc.add($scope.newTodo)
'use strict';
let express = require('express');
let app = express();
app.get('/', function (req, res) {
// render out the angular bootstrap page
res.render('index.html.ejs');
});
@jdx
jdx / app.js
Last active October 15, 2015 21:08
'use strict';
angular.module('app', []);
angular.module('app')
.controller('TodoCtrl', function ($scope) {
$scope.todos = [{title: 'Get paper'}, {title: 'Mail rent check'}];
$scope.addTodo = function () {
$scope.todos.push($scope.newTodo);