Skip to content

Instantly share code, notes, and snippets.

@intabulas
intabulas / gist:9510965
Created March 12, 2014 16:41
Timestamped Logging with Martini - Until I make a PR
// version of Martini classic, butthe logs are timestamped
func Vesper() *martini.ClassicMartini {
r := martini.NewRouter()
m := martini.New()
m.Map(log.New(os.Stdout, "[martini] ", log.LstdFlags))
m.Use(martini.Logger())
m.Use(martini.Recovery())
m.Use(martini.Static("public"))
m.MapTo(r, (*martini.Routes)(nil))
m.Action(r.Handle)
@intabulas
intabulas / model.js
Last active January 11, 2016 18:33
Nodal find_by example
/**
* Finds a model with a provided column value, otherwise returns a notFound error.
* @param {object} A single key object that contains the model column name and value you're looking for
* @param {function({Error} err, {Nodal.Model} model)} callback The callback to execute upon completion
*/
static find_by(findObject, callback) {
return new Composer(this)
.where(queryObject)
.end((err, models) => {
module.exports = (function() {
"use strict";
const Nodal = require('nodal');
const fs = require('fs');
const async = require('async');
const inflect = require('i')();
class GenerateSeedTask {

Thoughts on Developing with Nodal

As I was starting to put together an all encompasing example app with data, I encountered things that I think new developers might stumble on and (hopefully not) possibly be turned off by.

Some of my thoughts are specifc to an application vs api nodal app and I will try to indicate as such

NOTE: A living gist which each item its own markdown file

@intabulas
intabulas / tasks.md
Last active January 22, 2016 23:23
Rethinking Tasks
  • Issue: keithwhor/nodal#75

  • Branch: https://github.com/intabulas/nodal/tree/0_6_0-RefactorTasks

  • ✅ Right now we have ScheduledTask and Task with ScheduledTask being different in name only. I propose we drop ScheduledTask and just have Nodal.Task that can be scheduled or run one off

  • ✅ Add flags to nodal new g:task to take optional schedule information

  • ✅ Flag could be like nodal new g:task --schedule:5m. Maybe support s, m, h, d and w for durations. This would add to ./schedulers/main.js`

  • ✅ Add (like with router) /* generator: begin tasks */ and * generator: end tasks */ to ./schedulers/main.js so that we can automatically add them when g:task is run with scheduler info

@intabulas
intabulas / cloudSettings
Last active March 8, 2018 16:15
Visual Studio Code Sync Settings GIST
{"lastUpload":"2018-03-08T16:15:11.705Z","extensionVersion":"v2.9.0"}
@intabulas
intabulas / deploy.md
Last active June 3, 2023 01:10
Deploying SurrealDB to Fly.io

These are the rough steps for getting a surrealdb instance running on fly.io and connecting to it. This is heavily based off of steps posted in the surrealdb discord by rvdende. View Origional Post.

These steps work just fine for the hobby (pay as you go) plan.

HEADS UP By default this will create an instance on a single shared cpu with 256m memory. This is pretty darn small to do anything but experiment, but its free. You can scale your instance to something more useable by visiting the https://fly.io/apps/<appname>/scale. Obviously scaling to larger instances will incur higher costs, please refer to fly.io pricing

Installing fly.io client

source: fly.io docs