Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am pospi on github.
  • I am pospi (https://keybase.io/pospi) on keybase.
  • I have a public key ASBxJoVjLhHN_8kL5a3J_EdAoEIQJM_yJ5Ho0Esk7e0giAo

To claim this, I am signing this object:

@pospi
pospi / .gitignore
Last active Sep 14, 2017
Detects old Slack channels for archival / cleanup
View .gitignore
/.env
/node_modules
View keybase.md

Keybase proof

I hereby claim:

  • I am pospi on github.
  • I am pospi (https://keybase.io/pospi) on keybase.
  • I have a public key whose fingerprint is 206C E2FF 7800 BCF2 5107 35A0 1874 6681 1287 C5D9

To claim this, I am signing this object:

@pospi
pospi / init-private-npm-modules-yarn.sh
Last active Oct 22, 2016
Sets up NPM module linkage when using private modules from your own registry (using Yarn instead of NPM)
View init-private-npm-modules-yarn.sh
#!/usr/bin/env bash
#
# Helper script to setup symlinks and modules for services integration during development
#
# @depends http://stedolan.github.io/jq/
# @depends https://yarnpkg.com/
#
# :WARNING:
# Your global npm packages must be installed for the current user in order for this script to work.
# If this is not the case, we recommend you nuke your global npm folder and replace with an nvm-managed
@pospi
pospi / get-hz-rdb-table.js
Created Aug 4, 2016
Curryable function to load `r.table` objects for horizon.io collections
View get-hz-rdb-table.js
const r = require('rethinkdb');
const { curry } = require('ramda');
module.exports = curry(function* (rdbConn, projectName, collectionName) {
const table = yield r.db(`${projectName}_internal`).table('collections').get(collectionName).getField('table').run(rdbConn);
return r.db(projectName).table(table);
});
@pospi
pospi / nodejs-global-module-includes.js
Last active Jun 2, 2016
nodejs module system hack to add a module's include paths to global include paths.
View nodejs-global-module-includes.js
// Usage: from your entrypoint script file or other 'global' module of interest:
// require('nodejs-global-module-includes')(module);
var Module = require('module');
export default function setModuleIncludePathGlobal(globalModule) {
var globalPaths = globalModule.paths;
var oldPathHandler = Module._nodeModulePaths;
Module._nodeModulePaths = function(from) {
@pospi
pospi / init-private-npm-modules.sh
Last active Oct 10, 2016
Sets up NPM module linkage when using private modules from your own registry
View init-private-npm-modules.sh
#!/usr/bin/env bash
#
# Helper script to setup symlinks and modules for services integration during development
#
# @depends http://stedolan.github.io/jq/
#
# :WARNING:
# Your global npm packages must be installed for the current user in order for this script to work.
# If this is not the case, we recommend you nuke your global npm folder and replace with an nvm-managed
# node install in your homedir, which will have the correct permissions for `npm link` to function.
@pospi
pospi / dev_server.sh
Created Mar 21, 2015
A basket init script for a LEMP server
View dev_server.sh
#!/bin/env bash
echo Setting up dev server
# Change these as you need:
declare HOSTNAME=my_host
declare DB_ROOT_PW=my_password
declare DB_NAME=my_dbname
declare NGINX_CONFIG=my_site
declare OPTIONAL_PACKAGES="sudo vim git"
@pospi
pospi / debug-fired-events.js
Last active Nov 22, 2015
Watch all DOM and jQuery events active on a page and log when they fire
View debug-fired-events.js
window.watchEvents = function() {
var eventIds = [
'click', 'mousedown', 'mouseup',
'touch', 'touchstart', 'touchend',
'focus', 'focusin', 'focusout', 'blur',
'mouseover', 'mouseout', 'mousemove', 'mouseenter', 'mouseleave', 'mousewheel',
'keypress', 'keydown', 'keyup',
'change',
'scroll', 'resize',
'submit', 'reset',
@pospi
pospi / slideToggle.js
Created Jan 13, 2015
TweenLite slideToggle behaviour using scrollHeight attribute for height calculation
View slideToggle.js
/**
* Prerequisites:
* element must be block-level & visible
* element must have height: 0
* element must have overflow: hidden
*
* Returns true if the element was shown, false if it was hidden
*/
function slideToggle(ul)
{