Skip to content

Instantly share code, notes, and snippets.

@thatmarvin
thatmarvin / machine.js
Created November 25, 2020 03:14
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
angular.module("ui.bootstrap", ["ui.bootstrap.tpls", "ui.bootstrap.position","ui.bootstrap.tooltip","ui.bootstrap.popover"]);
angular.module("ui.bootstrap.tpls", ["template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html"]);
angular.module('ui.bootstrap.position', [])
/**
* A set of utility methods that can be use to retrieve position of DOM elements.
* It is meant to be used where we need to absolute-position DOM elements in
* relation to other, existing elements (this is the case for tooltips, popovers,
* typeahead suggestions etc.).
*/
module.exports = function (grunt) {
grunt.initConfig({
stylus: {
compile: {
options: {
compress: true,
use: [ require('bootstrap.stylus') ]
},
files: [{
expand: true,
@thatmarvin
thatmarvin / setter-test.js
Created April 19, 2013 22:17
Setter isn't invoked when value === null
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert');
mongoose.connect('mongodb://localhost/test');
var OrderSchema = new Schema({
total: {
type: Number,
var Q = require('q');
require('should');
require('mocha-as-promised')();
// This pretends to be the API client
function get(url) {
var deferred = Q.defer();
if (url === '/1') {
deferred.resolve([
'use strict';
var express = require('express')
, app = module.exports = express.createServer();
// Configuration
app.configure(function () {
app.use(app.router);
});
@thatmarvin
thatmarvin / postageapp.js
Created February 21, 2013 22:43
Demonstrating HTTP 500 response from PostageApp
/*
Remember to fill in your API key.
usage: node postageapp.js email@example.com
*/
var apiKey = 'FILL IN YOUR API KEY HERE',
postageapp = require('postageapp')(apiKey),
recipient = process.argv[2];
@thatmarvin
thatmarvin / gist:3023815
Created June 30, 2012 13:49
Gnarly Node.js Balanced Payments client
/*
Usage:
// In app.js
var balanced = require('./this-file.js');
balanced.configure({
secret: '...',
marketplaceUri: '...'
});
@thatmarvin
thatmarvin / gist:2204602
Created March 26, 2012 11:50
Mongoose does not populate virtuals? :(
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var UserSchema = new Schema({
name: {
first: {
type: String
},
last: {
type: String
@thatmarvin
thatmarvin / overcastfm-keyboard-shortcuts.user.js
Last active September 16, 2015 08:26
Overcast.fm Keyboard Shortcuts
// ==UserScript==
// @name Overcast.fm Keyboard Shortcuts
// @namespace http://your.homepage/
// @version 0.2
// @description Space bar to play/pause, left/right arrow to seek forward/backward.
// @author @thatmarvin
// @match https://overcast.fm/+*
// @grant none
// ==/UserScript==