Skip to content

Instantly share code, notes, and snippets.

View DivineGod's full-sized avatar
🙀
computers! computers everywhere!

Ando “Thor” Nando DivineGod

🙀
computers! computers everywhere!
View GitHub Profile

Keybase proof

I hereby claim:

  • I am divinegod on github.
  • I am divinegod (https://keybase.io/divinegod) on keybase.
  • I have a public key whose fingerprint is FF3B 85F1 5FED 1BBE 4DE2 DAE7 4436 2922 E568 02FA

To claim this, I am signing this object:

@DivineGod
DivineGod / index.js
Last active August 29, 2015 14:14
requirebin sketch
var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var _ = require('underscore');
// 1: Create a function that declares what the DOM should look like
function render(count) {
var els = _(count).times(function(n) { return h('li', {}, [String(n), 'this has<html><b> in it']); });
return h('div', {}, _.shuffle(els));
@DivineGod
DivineGod / ngram.py
Last active September 4, 2015 22:35
#!/usr/bin/env python3
import re
split_regex = re.compile(r'\W').split
def ngram_word(n, text):
"""Returns n-grams from text as a list of strings
>>> ngram_word(3, 'Hello, world! rejoice and be happy')
['hello world rejoice', 'world rejoice and', 'rejoice and be', 'and be happy']
@DivineGod
DivineGod / inflate.py
Last active December 23, 2015 23:59
Convert a flat dict into an object
def kwargs_to_obj(**kwargs):
""" Return an object populated from a kwargs dict.
Useful for mapping html form post request to python object.
>>> kwargs_to_obj(**{'horse.age':23, 'horse.color': 'bleu', 'horse.legs[]': 'fl,fr,rl,rr'})
{'horse': {'color': 'bleu', 'age': 23, 'legs': ['fl', 'fr', 'rl', 'rr']}}
"""
result = {}
for k, v in kwargs.items():
name_path = k.split('.')
@DivineGod
DivineGod / index.js
Created June 7, 2016 06:37
npmlog@3 reduced test
var Logger = require('npmlog')
var express = require('express')
var app = express()
app.get('/', function(req, res) {
res.send('Hello')
})
console.log('starting server')