Skip to content

Instantly share code, notes, and snippets.

View metasansana's full-sized avatar
🕺
Wine on a buffer.

Lasana Murray metasansana

🕺
Wine on a buffer.
View GitHub Profile
@metasansana
metasansana / install_mongodb.sh
Last active February 28, 2023 16:59
Installs and starts mongodb on a github runner for tests.
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl daemon-reload
sudo systemctl start mongod
@metasansana
metasansana / debounce.js
Created September 2, 2017 22:32
Quick JavaScript/Typescript debounce function.
const debounce = (f, delay) => {
let timer = null;
return a=> {
if(!timer) {
timer = setTimeout(a=>f(a), delay);
}else{
@metasansana
metasansana / potoo.ts
Last active May 18, 2017 10:47
Attempt at actor model in typescript.
import { match } from 'afpl/lib/control/Match';
import { Suspend, Return, liftF } from 'afpl/lib/monad/Free';
import { Maybe, fromAny } from 'afpl/lib/monad/Maybe';
import { IO, safeIO, wrapIO } from 'afpl/lib/monad/IO';
import { Free } from 'afpl/lib/monad/Free';
import { Functor } from 'afpl/lib/data/Functor';
import { identity, compose } from 'afpl/lib/util';
import { SharedBuffer } from 'afpl/lib/async/SharedBuffer';
/**

browserify for webpack users

There's been a strange explosion in misinformation about browserify recently, particularly in comparisons to webpack.

Generally speaking, most of this confusion stems from how webpack is more willing to pull features into its core to ease discoverability while browserify is more likely to push features out to userland instead.

I think that longer-term, separability has more benefits from a maintenance and

@metasansana
metasansana / gist:c2e242ff3b4d298a3a45
Last active August 29, 2015 14:14
Generic Form as directive with controller
var app = angular.module('myApp', []);
app.directive('contactGeneric', function () {
return {
restrict: 'E',
templateUrl: 'contactGeneric.html',
bindToController: true,
controllerAs: 'contactGeneric',
controller: ['$http', function ($http) {
@metasansana
metasansana / gist:9e6c3339b9679575c768
Last active August 29, 2015 14:14
Generic Form as directive.
var app = angular.module('myApp', []);
app.directive('contactGeneric', function() {
return {
restrict: 'E',
templateUrl: 'contactGeneric.html'
};
});
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Contact</legend>
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Name</label>
<div class="col-md-4">
<input id="textinput" name="textinput" placeholder="placeholder" class="form-control input-md" type="text">
module.exports = {
name: 'patientForm',
controls: [{
type: 'text',
name: 'name[first]',
label: {
id: 'name[first]',
name: 'Name'
},
@metasansana
metasansana / testing-your-http-server
Created December 31, 2014 15:21
Running a multiple functional tests for a http.Server app.
var http = require('http');
var q = require('q');
require('must');
var server;
var sockets = [];
beforeEach(function(done) {
server = http.createServer();
server.listen(8000, done);
@metasansana
metasansana / testing-your-keystone
Last active August 29, 2015 14:12
Running a multiple functional tests for a keystone app.
var q = require('q');
require('must');
var keystone;
var sockets = [];
beforeEach(function(done) {
require.cache = {};
keystone = require('keystone');