Skip to content

Instantly share code, notes, and snippets.

Avatar

Kent Safranski ksafranski

View GitHub Profile
View flatDeep.js
/**
* Function for converting arbitrarily nested arrays into a single, flat array
* @param {Array} arr
* @returns {Array}
*/
function flatDeep (arr) {
if (!Array.isArray(arr)) throw new Error('Expected type `Array`')
return arr.reduce((acc, el) => acc.concat(Array.isArray(el) ? flatDeep(el) : el), [])
}
View Dockerfile
FROM mhart/alpine-node:8.9
# Dependencies
RUN apk --no-cache add --virtual builds-deps build-base python vim
# Specify pgweb version
ENV PGWEB_VERSION=0.9.12 \
PGWEB_USER=pgweb \
PGWEB_DIR=/app/pgweb
View 34-in-resolution.sh
#!/bin/sh
sudo xrandr --newmode "2560x1080_60.00" 230.00 2560 2720 2992 3424 1080 1083 1093 1120 -hsync +vsync
sudo xrandr --addmode HDMI-1 "2560x1080_60.00"
View TodoListModel.js
import { observable, computed, action } from 'mobx'
import TodoModel from './TodoModel'
export default class TodoListModel {
@observable todos = []
constructor () {
try {
this.todos = JSON.parse(window.localStorage.getItem('todos'))
View Git-Intro.md

Using Git

This document is a quick-start dive into using Git for version control, branching, and collaborative work on projects. It is intended to be a primer on core concepts. For more information, see the Git Docs.

Authentication

The best way to use Git + Github (or any Git hosting) is via SSH. To do this you need an SSH Key (Mac/Linux):

ssh-keygen
@ksafranski
ksafranski / README.md
Last active Sep 25, 2017
Slecret - Slack Secret
View README.md

Slecret

Add a Slash command to easily share secrets on Slack.

Setup

There are three components to using this Webtask

1. Create Redis Instance on RedisLabs

View test.md

hello

Click to expand whatever
View indexed.js
/* global: indexedDB, IDBKeyRange */
// index.js
// Provides easy interaction with indexedDB
// ---
// Part of the Riggr SPA framework <https://github.com/Fluidbyte/Riggr> and released
// under the MIT license. This notice must remain intact.
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
View websocket-only.js
// Client-side
io.connect({
forceNew: true,
transports: [ 'websocket' ]
});
// Server-side
var io = require('socket.io');
var app = require('express')();
var server = require('http').createServer(app);
@ksafranski
ksafranski / setup.sh
Last active Feb 3, 2016
Environement Setup
View setup.sh
#!/bin/bash
# Run update
apt-get update
wait
# Install build-essentials
apt-get --yes --force-yes install build-essential
wait