Skip to content

Instantly share code, notes, and snippets.

Anthony Ettinger chovy

Block or report user

Report or block chovy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .about+license.md

A zoomable candlestick chart.

Copyright © 2015, Anil Nair - MIT License

View gist:72765a2f9b54f48c38ed3f785e6749b5
nvm install v10
npm i -g @vue/cli
vue create <project>
#nothing happens
View dabblet.css
#foo {
font-family: sans-serif;
width: 200px;
height: 200px;
background: #fff;
border: 1px solid #999;
border-radius: 5px;
position: relative;
}
View gist:3786219
//middleware
app.use(function(req, res, next){
if ( req.session.user ) {
req.session.logged_in = true;
}
res.locals.message = req.flash();
res.locals.session = req.session;
res.locals.q = req.body;
res.locals.err = false;
next();
View chat-controller.js
//usage
app.controller('ChatCtrl', ['socket', function(socket){
socket.on('chat:messages', function(data){
$log.log('chat:messages', data);
$scope.messages = data.messages;
});
}]);
View gist:a8ff32109b2b6f4cef0e
<form submit.delegate="onSubmit()">
<fieldset>
....
</fieldset>
<nav>
<button type="button" click.delegate="onDelete()">Delete</button>
<button>Submit</button>
</nav>
</form>
@chovy
chovy / controller.js
Created Jun 14, 2015
thinky hasAndBelongsToMany
View controller.js
ctrl.post = function *(next){
var data = this.request.body;
var tagIds = data.tags.map(tag => {
return tag.id;
});
delete data.tags;
var post = new Post(data);
View gist:47cff1321dab66ad7ec2
$ rethinkdb
Recursively removing directory /Users/username/projects/myapp/myapp-web/rethinkdb_data/tmp
Initializing directory /Users/username/projects/myapp/myapp-web/rethinkdb_data
Running rethinkdb 2.0.2 (CLANG 6.1.0 (clang-602.0.53))...
Running on Darwin 14.3.0 x86_64
Loading data from directory /Users/username/projects/myapp/myapp-web/rethinkdb_data
Listening for intracluster connections on port 29015
Listening for client driver connections on port 28015
Listening for administrative HTTP connections on port 8080
Listening on addresses: 127.0.0.1, ::1
@chovy
chovy / model.js
Created May 31, 2015
Thinky model definition
View model.js
var cfg = require('../../config');
var thinky = require('thinky')(cfg.db);
var type = thinky.type;
var r = thinky.r;
// Create a model - the table is automatically created
var Thing = thinky.createModel("Thing", {
id: type.string(),
title: type.string(),
createdAt: type.date().default(() => {
@chovy
chovy / webservice.js
Created May 21, 2015
Web service for aurelia.
View webservice.js
import {inject} from 'aurelia-framework';
import {Config} from '../config';
import {HttpClient} from 'aurelia-http-client';
@inject (Config, HttpClient)
export class WebService {
constructor (config, http) {
this.config = config;
this.http = http;
//this.http = http.configure(x => {
You can’t perform that action at this time.