Usage:
npm install nunjucks nunjucks-cjs
node precompile.js
node render.js
| <?php | |
| $db = new PDO('mysql:host=localhost;dbname=your_database_name', 'your_username', 'your_password'); | |
| $query = "INSERT INTO clients (name, email, phone) VALUES (:name, :email, :phone)"; | |
| $stmt = $db->prepare($query); | |
| $stmt->bindValue(':name', $args['input']['name']); | |
| $stmt->bindValue(':email', $args['input']['email']); | |
| $stmt->bindValue(':phone', $args['input']['phone']); | |
| $stmt->execute(); | |
| $clientId = $db->lastInsertId(); | |
| $query = "SELECT * FROM clients WHERE id = :id"; |
| import jhipster from "jhipster-core"; | |
| import url from "url"; | |
| import path from "path"; | |
| import util from "util"; | |
| import * as graphql from "graphql"; | |
| import { | |
| LocalDateTypeDefinition as GraphQLLocalDate | |
| } from "graphql-scalars"; | |
| const __dirname = url.fileURLToPath(new URL('./', import.meta.url)); |
| import React from "react"; | |
| import { htmlFragmentToReact } from "./html-to-element"; | |
| import { allowTag, parserModify } from "./html-post-parse-fns"; | |
| export default function Component(props) { | |
| return <div className="component-example"> | |
| {htmlFragmentToReact(postNode.html, null, React.createElement, allowTag, parserModify)} | |
| </div>; | |
| } |
| var strDec = require('string_decoder'); | |
| var StringDecoder = strDec.StringDecoder; | |
| var stream = require('stream'); | |
| var Transform = stream.Transform; | |
| var util = require('util'); | |
| function LineSplitter(options) { | |
| if (!(this instanceof LineSplitter)) { | |
| return new LineSplitter(options); | |
| } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>Canvas Rainbow</title> | |
| </head> | |
| <body> | |
| <canvas></canvas> | |
| <script src="index.js"></script> | |
| </body> |
Usage:
npm install nunjucks nunjucks-cjs
node precompile.js
node render.js
| var fs = require('fs'); | |
| var express = require('express'); | |
| var request = require('request'); | |
| var apiUrl = 'http://example.com'; // remote host | |
| var app = express(); | |
| // replace specific requests | |
| app.get('/Scripts/js.js', function(req, res, next) { |
| // please forgive the one letter variables, this is a gist | |
| // the setTimeout must be called sequentially, or else the | |
| // runtime will execute all of them at the same time, | |
| // giving the same value | |
| function random(m, cb) { | |
| var t = Date.now(); | |
| setTimeout(function() { | |
| cb(Date.now()-t); |
| (function() { | |
| var define = mmd.package('core').define; | |
| define('core/1', function(){/*...*/}); | |
| define('core/2', ['core/1'], function(){/*...*/}); | |
| })(); | |
| (function() { | |
| var define = mmd.package('lib1', ['core']).define; | |
| define('lib1/file-a', ['core/1'], function(){/*...*/}); | |
| define('lib1/file-b', ['core/2', 'lib1/file-a'], function(){/*...*/}); |
| var http = require('http') | |
| , fs = require('fs'); | |
| var save = fs.createWriteStream('save.txt') | |
| , server = http.createServer(function(req, resp) { | |
| resp.setHeader('Access-Control-Allow-Origin', '*'); | |
| var url = req.url; | |
| console.log(url); | |
| if ( '/exit' === url ) { | |
| resp.end('BYE'); |