Skip to content

Instantly share code, notes, and snippets.

View nijikokun's full-sized avatar
🍀
working

Niji nijikokun

🍀
working
  • Product Manager
  • San Diego, California
View GitHub Profile

Keybase proof

I hereby claim:

  • I am nijikokun on github.
  • I am nijikokun (https://keybase.io/nijikokun) on keybase.
  • I have a public key ASCN-6Z1Pj0Sf1qT1UObCD2O0PBGWGwS_O63onOGS4F7nQo

To claim this, I am signing this object:

@nijikokun
nijikokun / about.md
Last active December 22, 2016 01:20
Update / Remove users in Customer.io from CSV files using Node.js

Updating Customer.io using CSVs

Ever wanted to update a Customer.io environment using a CSV that you have, maybe acquired from an event, or exported?

Now you can.

Usage

You can obtain your Customer.io credentials on the integration page.

@nijikokun
nijikokun / about.md
Last active October 7, 2016 01:01
Easily install Kong dependencies for building source on OS X / macOS

I wrote this after having built Kong from scratch and having to remove / reverse engineer some brew packages.

Note this will remove your current environment and build a new one.

Note #2 This does not install OpenSSL, I used brew to install it instead.

@nijikokun
nijikokun / index.js
Created August 5, 2016 01:52
requirebin sketch
var store = require('store')
var page = require('page')
var m = require('mithril')
var containers = []
var internalState = []
var xstore = {
set: function(key, val, exp) {
store.set(key, { val:val, exp:exp, time:new Date().getTime() })
},
@nijikokun
nijikokun / doc.md
Last active August 21, 2023 08:00
Building Javascript Frontend / Backend Applications

Document for the best design choices you can make for your software.

Terminology

  • DDD - [Domain Driven Design][ddd-wikipedia]
  • FF or FTF - Function First Design, or File-type First Design is structuring your application by it's function before the files such as a directory named components containing all component files.

File Structure

Structuring applications is hard, here are a few resources to help.

@nijikokun
nijikokun / pify.js
Created June 24, 2016 01:15
< 35 line promisify that works in browsers and node.js
function pify (method, context) {
var resolver, rejector
var error, success
var done = false
var promise = {
then: function (a) {
if (!done && success != null) done = true, a(success); else resolver = a
return { catch: promise.catch }
},
@nijikokun
nijikokun / commands.md
Last active May 6, 2016 20:33
Collection of useful devops commands / bash commands

Download files over a Socks Proxy

$ scp -i <pem_key> -o ProxyCommand="nc -x localhost:<proxy_port> %h %p" <ec2_user>@<private_ip>:<file_path> <local_path>

Dump MongoDB and Create TAR File

$ mongodump --db  --out ./dump
@nijikokun
nijikokun / module.js
Last active March 10, 2016 01:20
Segment IO Native Node.js Library
var https = require('https')
function check (body, callback) {
if (typeof body === 'function') {
callback = body
body = null
}
body = body || {}
callback = callback || function () {}
@nijikokun
nijikokun / about.md
Last active January 26, 2016 23:11
NPM V3 read-package-tree cache POC

Extremely quick POC caching for NPM v3

Warning

This file is a proof-of-concept, and is not at all a reliable patch. This simply tests whether it would be faster (for HDD / CPU) to cache all package.json lookups in the read-package-tree module versus reloading every time.

From my findings it goes for me personally on a project with (80 modules) from 20 minutes to 3 seconds

Notes

@nijikokun
nijikokun / jsonToMarkdownTable.js
Last active August 29, 2018 12:11
JSON to Markdown Table
function jsonToMarkdownTable (array, columns) {
var cols = columns
? columns.split(",")
: Object.keys(array[0])
var table = ""
table += cols.join(" | ")
table += "\r\n"
table += cols.map(function () {