Skip to content

Instantly share code, notes, and snippets.

@jbruni
jbruni / schema.graphql
Created March 17, 2019 06:35
Apollo GraphQL fullstack tutorial Schema
type Query {
launches(
pageSize: Int
after: String
): LaunchConnection!
launch(id: ID!): Launch
me: User
}
type Mutation {
bookTrips(launchIds: [ID]!): TripUpdateResponse!
@jbruni
jbruni / basic-math.js
Last active September 25, 2018 22:07
Math functions suitable for monetary calculations
/**
* Basic Arithmetic
*/
const bind = Function.prototype.bind,
liberate = bind.bind(Function.prototype.call),
reduce = liberate(Array.prototype.reduce),
slice = liberate(Array.prototype.slice);
function multiplier(x) {
@jbruni
jbruni / digestFetch.js
Created May 22, 2018 01:17
Digest Authentication for perry-mitchell/webdav-client
/**
* Provide digestFetch function
*/
const crypto = require('crypto');
const nodeFetch = require('node-fetch');
const mergeOptions = require('merge-options');
const cnonceSize = 32;
const nonceRaw = 'abcdef0123456789';
@jbruni
jbruni / Observers-ReadOnly.php
Created January 31, 2017 12:38
Laravel Read Only Model Trait
<?php
namespace app\Observers;
use Illuminate\Database\Eloquent\Model;
class ReadOnly
{
/**
* Listen to the Model creating event.
@jbruni
jbruni / promise-helper.js
Created January 17, 2017 05:47
Resolve/Reject Promises externally
let contexts = {}
function getContext(key) {
if (typeof contexts[key] === 'undefined') {
contexts[key] = { promise: null, resolve: null, reject: null }
}
return contexts[key]
}
function getPromise(key) {
@jbruni
jbruni / v-click-outside.js
Created December 14, 2016 02:25
v-click-outside directive
/**
* v-click-outside directive
*/
import Vue from 'vue'
import $ from 'jquery'
let elements = []
Vue.directive('click-outside', {
@jbruni
jbruni / yarn-install.log
Created November 14, 2016 23:36
Yarn install log
yarn install v0.17.0
info No lockfile found.
[1/4] Resolving packages...
warning gulp-browserify > browserify > glob > minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning gulp-browserify > through2 > xtend > object-keys@0.4.0:
[2/4] Fetching packages...
warning fsevents@1.0.15: The platform "linux" is incompatible with this module.
@jbruni
jbruni / getFlattenedIntegers.js
Created October 5, 2016 19:16
J Bruni's "getFlattenedIntegers"
/*** Running CodePen available at http://codepen.io/anon/pen/VKyAVw ***/
/**
* Flatten an array of arbitrarily
* nested arrays of integers into
* a flat array of integers.
*/
function getFlattenedIntegers(integers) {
var result = []
@jbruni
jbruni / ui-bootstrap-tpls-0.13.0-jbruni.min.js
Created March 19, 2015 08:01
Angular UI Bootstrap with popover-template (merged to 9a26b368038967ee049fc60e8490a2beebe4648a)
/*
* angular-ui-bootstrap
* http://angular-ui.github.io/bootstrap/
* Version: 0.13.0-SNAPSHOT - 2015-03-19
* License: MIT
*/
angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.bindHtml","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dateparser","ui.bootstrap.position","ui.bootstrap.datepicker","ui.bootstrap.dropdown","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.timepicker","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/datepicker/datepicker.html","template/datepicker/day.html","template/datepicker/month.html","template/datepicker/popup.html","template/datepick
@jbruni
jbruni / complete_nitrous_session.log
Created June 4, 2014 21:56
Meteor deploy seems to behave differently according to submain length
_ _ _ _ ___ ___
| \ | (_) |_ _ __ ___ _ _ ___ |_ _/ _ \
| \| | | __| __/ _ \| | | / __| | | | | | Welcome!
| |\ | | |_| | | (_) | |_| \__ \_ | | |_| | Get help → help.nitrous.io
|_| \_|_|\__|_| \___/ \__,_|___(_)___\___/