Skip to content

Instantly share code, notes, and snippets.

View evanxg852000's full-sized avatar
πŸ’­
Awesomeness πŸ‘Œ

Evance Soumaoro evanxg852000

πŸ’­
Awesomeness πŸ‘Œ
View GitHub Profile
/*
Actually the code was correct but the component needs you to do all the dirty work
data splitting for pagination
data ordering and filtering
I had to look at their mock data exemple to understand
ping us if you still need ...
*/
//https://github.com/OneWayTech/vue2-datatable/blob/master/examples/src/_mockData/index.js

Build Your Own LISP

I had fun building my own LISP (Slow Loris). The project was extremely easy to get off the ground, because there a ton of resources to do just this. I thought it might be handy to have a little links round-up, based on my research.

In Python

There are already several good projects out there on writing your own LISP in Python.

Peter Norvig's LisPy

const Micro = require('./micro')
const app = new Micro({
env: 'prod',
templates: './templates',
port: 3535
})
app.router.all('/', (req, res) => {
res.end('Micro ...')
const Micro = require('./micro')
const app = new Micro({
env: 'prod',
templates: './templates',
port: 3535
})
app.router.all('/', (req, res) => {
res.end(JSON.stringify({name: 'Micro', version: 'x.y.z'}))
})
app.route((router) => {
router.get('/template', (req, res) => {
let data = {title: 'Home', test:true, items: ['Evan', 'John', 'Jane']}
res.render('index.html', data)
})
// routing with optional parameter
router.get('/hello/:name?', (req, res) => {
let name = req.params['name'] || 'world'
const http = require('http')
const Router = require('./router')
const Templater = require('./templater')
class Micro {
constructor(config = {}){}
boot(callback){}
constructor(config = {}){
const defaultConfig = {
env: 'dev',
port: 3000,
templates: './templates'
}
this.config = Object.assign(defaultConfig, config)
this._httpServer = http.createServer(this._handleRequest.bind(this))
this.router = new Router()
boot(callback){
this._httpServer.listen(this.config.port, (err) => {
if(callback && typeof(callback) === 'function'){
callback(err)
}
if (err) {
return console.log('Micro was not able to start correctly', err)
}
console.log(`Micro server is listening on ${this.config.port}`)
})