Skip to content

Instantly share code, notes, and snippets.

@kriswill
kriswill / passport.js
Created February 3, 2015 21:13
Passport model
/**
* Passport Model
*
* The Passport model handles associating authenticators with users. An authen-
* ticator can be either local (password) or third-party (provider). A single
* user can have multiple passports, allowing them to connect and use several
* third-party strategies in optional conjunction with a password.
*/
var bcrypt = require('bcrypt')

A small sampling of external projects initially built for Ember use but designed to be used standalone:

@mphasize
mphasize / beforeCreate.js
Created March 2, 2015 10:10
Sails-beforeCreate-Policy
/**
* beforeCreate
*
* @module :: Policy
* @description :: Simple policy to inject the user creating a record into the records values.
* Assumes req.user && req.user.id to be set when a user is logged in.
* @docs :: http://sailsjs.org/#!documentation/policies
*
*/
@mikermcneil
mikermcneil / outcome-oriented-programming.md
Last active July 13, 2017 14:34
Outcome Oriented Programming - Software as a plan

Outcome-Oriented Programming

Mike McNeil, Aug 2014

Humans are not very good at planning. We have no problem running scenarios, thinking through possibilities, and pondering "what if?" questions. I might plan to not eat my cousin's birthday cake before she gets home, for instance. If I'm very serious, I might write down my commitment; or if I'm unsure about the pros and cons, use some organizational tool like a T-chart.

But when it comes to making a decision in the moment, all bets are off. The cake is a goner.

Predictive Analysis vs. Process Design

Below, I've included a figure containing a decision tree diagram.

@denolfe
denolfe / Remove-alt-tab-animation-from-elementary-os-freya.md
Last active September 19, 2017 13:21
Remove Alt-Tab animation from Elementary OS Freya

Remove Alt-Tab animation from Elementary OS Freya

Install custom build of Gala

sudo apt-get install bzr 

bzr branch lp:~gala-dev/gala/no-depth-alt-tab

sudo apt-get build-dep gala 
const jest = require('jest-cli');
const fs = require('fs-extra');
const nodePath = require('path');
const outputDir = process.env.TEST_UNDECLARED_OUTPUTS_DIR;
const cwd = process.cwd();
const getSnapshotPath = (testResult) => {
const filePath = nodePath.relative(cwd, testResult.testFilePath);
load(":providers.bzl", "TypeScriptModuleInfo")
def _test_sources_aspect_impl(target, ctx):
result = depset()
if hasattr(ctx.rule.attr, "tags") and "NODE_MODULE_MARKER" in ctx.rule.attr.tags:
return struct(node_test_sources=result)
if hasattr(ctx.rule.attr, "deps"):
load("//packages/bazel/rules_common:defs.bzl",
"module_mappings_runtime_aspect",
"collect_node_modules_aspect",
"sources_aspect",
"test_sources_aspect",
"short_path_to_manifest_path",
"get_ci")
load("//packages/bazel/rules_nodejs/internal/node:node.bzl", "nodejs_binary_impl",
"NODE_EXECUTABLE_OUTPUTS", "BASE_NODE_EXECUTABLE_ATTRS", "NODE_TOOLCHAINS")
load("@io_bazel_rules_go//go:def.bzl", "go_path")
load("@io_bazel_rules_go//go/private:providers.bzl", "GoLibrary", "GoPath")
_MOCKGEN_TOOL = "@com_github_golang_mock//mockgen"
def _gomock_sh_impl(ctx):
go_toolchain = ctx.toolchains["@io_bazel_rules_go//go:toolchain"]
gopath = "$(pwd)/" + ctx.var["BINDIR"] + "/" + ctx.attr.gopath_dep[GoPath].gopath
@rsff
rsff / ssh_agent_start.fish
Last active March 14, 2019 08:56 — forked from schaary/ssh_agent_start.fish
ssh agent for fish
#this script can never fail
#i use it in the fish_config
#call it with start_agent
setenv SSH_ENV $HOME/.ssh/environment
function start_agent
if [ -n "$SSH_AGENT_PID" ]
ps -ef | grep $SSH_AGENT_PID | grep ssh-agent > /dev/null