workflow:
$ rails g model NameOfModel
invoke active_record
create db/migrate/YYYYMMDDHHMMSS_create_name_of_models.rb| import express from "express"; | |
| import request from "request"; | |
| import async from "async"; | |
| import archiver from "archiver"; | |
| const app = express(); | |
| const port = 3003; | |
| app.get("/", async (req, res) => { | |
| console.time("zip"); |
| import genanki | |
| my_model = genanki.Model( | |
| 1380120064, | |
| 'Example', | |
| fields=[ | |
| {'name': 'Object'}, | |
| {'name': 'Image'}, | |
| ], | |
| templates=[ |
| /// <reference path="angular.d.ts" /> | |
| /// <reference path="angular-resource.d.ts" /> | |
| interface IEmployee extends ng.resource.IResource<IEmployee> | |
| { | |
| id: number; | |
| firstName : string; | |
| lastName : string; | |
| } | |
| interface IEmployeeResource extends ng.resource.IResourceClass<IEmployee> |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| function defaultDict(default_) { | |
| return new Proxy({}, { | |
| get: function(target, name, receiver) { | |
| // iterator and next are two JS1.7 things Firefox looks for when you | |
| // log an object to the console. pretty sure it's a bug that they trigger | |
| // the get trap. | |
| if (!(name in target) && !(name == '__iterator__'|| name == 'next')) { | |
| target[name] = default_(); | |
| } | |
| return target[name]; |
(The below text is licensed with CC0, which means that if you want to use or translate it, that is OK by me.)
Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry. ☺
Locally, I'm at this commit:
$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <[email protected]>
Date: Sun Apr 15 16:35:03 2012 +0200
| /** | |
| Code copyright Dustin Diaz and Ross Harmes, Pro JavaScript Design Patterns. | |
| **/ | |
| // Constructor. | |
| var Interface = function (name, methods) { | |
| if (arguments.length != 2) { | |
| throw new Error("Interface constructor called with " + arguments.length + "arguments, but expected exactly 2."); | |
| } | |
| this.name = name; |