Skip to content

Instantly share code, notes, and snippets.

View orbitbot's full-sized avatar

Patrik Johnson orbitbot

  • Helsinki, Finland
View GitHub Profile
@orbitbot
orbitbot / mod.js
Created May 12, 2014 20:05
Mongoose 3.8.9 troubleshooting
var util = require('util');
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var _ = require('lodash');
var Q = require('q');
var accountSchema = Schema({
username: String,
contacts: [{
@orbitbot
orbitbot / index.html
Created October 23, 2014 21:43
Ace editor with http-link highlighting and click action, from http://jsbin.com/jehopaja/30/edit?html,output
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://ajaxorg.github.io/ace-builds/src/ace.js"></script>
<style>
#editor { position: absolute; top: 0; left: 0; right: 0; bottom: 0;}
.ace_link_marker {
position: absolute;
@orbitbot
orbitbot / .gitignore
Last active August 29, 2015 14:12
gulp-asset-transform issue
node_modules
dist
@orbitbot
orbitbot / .gitignore
Last active August 29, 2015 14:13
Asset-transform issue: Cannot have multiple sections with same template
node_modules
dist
@orbitbot
orbitbot / gulpfile.js
Created April 29, 2015 14:32
protractor issues
var paths = {
integration : 'test/integration/*.js'
};
gulp.task('server', function() {
browserSync({
server: {
baseDir: release ? 'release/' : 'develop/'
},
logConnections: true,
@orbitbot
orbitbot / gulpfile.js
Created May 8, 2015 11:17
node-proxy-middleware with browser
gulp.task('server', function() {
browserSync({
server: {
baseDir: 'source'
},
logConnections: true,
open: false
});
});
@orbitbot
orbitbot / cli.py
Created June 14, 2015 19:23
Default subcommands with Python Click command line parser
import click
class DefaultCmdGroup(click.Group):
def get_command(self, ctx, cmd_name):
click.echo(ctx.args)
cmd = click.Group.get_command(self, ctx, cmd_name)
if cmd is not None:
return cmd
else:
@orbitbot
orbitbot / index.html
Last active August 29, 2015 13:26
Extending angular $q promises example
<!DOCTYPE html>
<html ng-app="extension-demo">
<head>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.5/angular.min.js"></script>
</head>
<body ng-controller="demoCtrl">
<div>
{{ value }}
@orbitbot
orbitbot / index.html
Created October 22, 2015 20:35
embeddable browser console
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {