Skip to content

Instantly share code, notes, and snippets.

View METACEO's full-sized avatar
👶
Father of four and always learning!

James Allen METACEO

👶
Father of four and always learning!
View GitHub Profile
@METACEO
METACEO / Array2Object.js
Created May 4, 2016 07:49
Array2Object: strictly return an object from an array of pairs.
function Array2Object(array){
var object = {}, len = array.length;
if(len % 2 !== 0) return object;
for(var index = 0; index < len; index++) object[array[index]] = array[++index];
return object;
@METACEO
METACEO / README.md
Last active July 1, 2016 19:11 — forked from plugnburn/README.md
XTF.js - DOM construction / templating / manipulation library in 24 lines of JS, 478 bytes minified

XTF.js

This extends the ultra-small, array-based templating library XT.js with functional manipulation abilities. This extension adds to xtf.js 6 lines of code and to xtf.min.js 155 minified bytes.

How to obtain

Download the minified version here or include it into your code:

let student = {
name: 'Alice',
major: 'Computer Science',
year: 2
};
// into...
class Student {
constructor(public name: string,
@METACEO
METACEO / index.js
Created October 27, 2020 04:27
index.js for aws-ec2 sites
const http = require('http');
let pageHits = 0;
const server = http.createServer((req, res) => {
switch (req.url) {
case '/api': {
res.setHeader("Content-Type", "application/json");
res.writeHead(200);
res.end(JSON.stringify({