Update: As package.elm-lang.org IP address has been changed and is not blocked anymore as far as I know, these proxies have been disabled. If you still need them, add a comment describing why.
Here is how to use the proxies:
Two options:
import Html exposing (text) | |
type NodeF v a | |
= Empty v | |
| Elem (List a) | |
nodeMap : (a -> b) -> NodeF v a -> NodeF v b | |
nodeMap f node = | |
case node of | |
Empty v -> Empty v |
Update: As package.elm-lang.org IP address has been changed and is not blocked anymore as far as I know, these proxies have been disabled. If you still need them, add a comment describing why.
Here is how to use the proxies:
Two options:
open Webapi.Dom; | |
open Webapi.Canvas.Canvas2d; | |
open Webapi.Canvas.CanvasElement; | |
[@bs.set] external setWidth: (Dom.element, int) => unit = "width"; | |
[@bs.set] external setHeight: (Dom.element, int) => unit = "height"; | |
type point = (float, float); | |
type shape('s, 'a) = { |
const path = require('path'); | |
class DependencyGraphPlugin { | |
apply(compiler) { | |
compiler.hooks.emit.tap("DependencyGraphPlugin", (compilation) => { | |
let deps = []; | |
compilation.modules.forEach(m => { | |
// console.log(m) | |
const file = path.relative('', m.resource) |
code: https://github.com/zmts/supra-api-nodejs
Одной из болезней Node.js комьюнити это отсутствие каких либо крупных фреймворков, действительно крупных уровня Symphony/Django/RoR/Spring. Что является причиной все ещё достаточно юного возраста данной технологии. И каждый кузнец кует как умеет ну или как в интернетах посоветовали. Собственно это моя попытка выковать некий свой подход к построению Node.js приложений.
// FP Lenses | |
const lens = get => set => ({ get, set }); | |
const view = lens => obj => lens.get(obj); | |
const set = lens => val => obj => lens.set(val)(obj); | |
const over = lens => fn => obj => set(lens)(fn(view(lens)(obj)))(obj); | |
const lensProp = key => lens(prop(key))(assoc(key)); |
{ | |
"scripts": { | |
"build": "npm run build:es2015 && npm run build:esm && npm run build:cjs && npm run build:umd && npm run build:umd:min", | |
"build:es2015": "tsc --module es2015 --target es2015 --outDir dist/es2015", | |
"build:esm": "tsc --module es2015 --target es5 --outDir dist/esm", | |
"build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs", | |
"build:umd": "rollup dist/esm/index.js --format umd --name YourLibrary --sourceMap --output dist/umd/yourlibrary.js", | |
"build:umd:min": "cd dist/umd && uglifyjs --compress --mangle --source-map --screw-ie8 --comments --o yourlibrary.min.js -- yourlibrary.js && gzip yourlibrary.min.js -c > yourlibrary.min.js.gz", | |
} | |
} |
import express from 'express' | |
import { createRest } from 'createrest' | |
import { createRestExpress } from 'createrest-express' | |
import { AuthController } from 'controllers' | |
const app = express() | |
const routes = createRest(r => { | |
r.resources('auth', AuthController, { methodNames: { create: 'login' } }) |
'use strict'; | |
////////////////////////////////// | |
// How to use? | |
// 1. Create `sequelize-schema-file-generator.js` in your app root | |
// 2. Make sure you've ran the `sequelize init` before (It should create `config`,`seeders`,`migrations` folders). | |
// 3. Update `DATABASE_DSN` below to match your connection string (works with any database adapter that Sequelize supports) | |
// 4. Run it with `node sequelize-schema-file-generator.js` | |
// 5. Review the generated migrations inside of the `migrations` folder. | |
////////////////////////////////// |
// README and npm module https://www.npmjs.com/package/date-template | |
/** | |
*@function | |
*@name dateTemplate | |
*@param {string} format - ~Y~ ~M~ ~Dw~ ~D~ ~h~ ~m~ ~s~ ~mm~ | |
*@param {number} oldDate - milliseconds time OR Date object | |
*@param {function} middleware - Change the date type | |
*/ | |
const dateTemplate = function( format, oldDate, middleware ){ | |
let date = oldDate ? new Date(oldDate) : new Date(); |