Skip to content

Instantly share code, notes, and snippets.

@pospi
pospi / keybase.md
Created April 14, 2020 03:49
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 September 14, 2017 23:24
Detects old Slack channels for archival / cleanup
/.env
/node_modules

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 October 22, 2016 01:45
Sets up NPM module linkage when using private modules from your own registry (using Yarn instead of NPM)
#!/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 August 4, 2016 05:31
Curryable function to load `r.table` objects for horizon.io collections
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 June 2, 2016 00:10
nodejs module system hack to add a module's include paths to global include paths.
// 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 October 10, 2016 06:34
Sets up NPM module linkage when using private modules from your own registry
#!/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 March 21, 2015 01:23
A basket init script for a LEMP server
#!/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 November 22, 2015 02:17
Watch all DOM and jQuery events active on a page and log when they fire
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 January 13, 2015 01:09
TweenLite slideToggle behaviour using scrollHeight attribute for height calculation
/**
* 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)
{