Skip to content

Instantly share code, notes, and snippets.

@wkentdag
wkentdag / wmcn-tumblr_12515
Created January 26, 2015 01:16
wmcn.tumblr.com @ 1/25/15
View wmcn-tumblr_12515
<!DOCTYPE html>
<html>
<head>
<!-- "wmcn" theme by will kent-daggett:
willkentdaggett@gmail.com
github.com/wkentdag
github.com/wkentdag/wmcn-tumblr/
View gist:32ac2e87bffeb30592f3

Study these screenshots:

https://innig.net/tmp/nr-screenshots/

Fork this gist (one fork per team).

Sketch out an object model for this application. Don't worry about view, network, database, etc.; your concern is only to represent the essential information of this application as classes and attributes. You can use the following attribute types:

  • numbers, strings, dates
  • other model classes
@wkentdag
wkentdag / gist:4efeb5381601306c82f8
Last active August 29, 2015 14:20
sup api from the command line
View gist:4efeb5381601306c82f8
Creating a new user:
curl -X POST 'http://localhost:3000/users' # development monde
curl -X POST 'http://localhost:3000/users' -d 'first_name=will&last_name=kd&phone=123456' # production mode
Creating a new status:
curl -X POST 'http://localhost:3000/status' -d 'fake_owner_id=1' # development mode
curl -X POST 'http://localhost:3000/status' -d 'owner_id=6&longitude=666&latitude=111' # production mode
Granting a user permission to view a status:
curl -X POST 'http://localhost:3000/status/:id/viewers' -d 'user_id=6' # :id = valid status id
@wkentdag
wkentdag / gist:fa95151af79a7daaea7c
Created May 6, 2015 23:19
populating db in production mode
View gist:fa95151af79a7daaea7c
# Make a user
curl -X POST 'http://localhost:3000/users' -d 'first_name=Will&last_name=Test&phone=123456789'
# Make a status
curl -X POST 'http://localhost:3000/status' -d 'owner_id=1&longitude=100&latitude=100&duration=30'
# the above fields are all required. to add viewing permissions to users OTHER than the owner, add:
'&selectedFriends[]=2&selectedFriends[]=5' # etc
# and to add a 160char-max message, add:
'&message="hey there im awesome"'
View company.server.model.js
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
NoteSchema = require('./note'),
LoanSchema = require('./loan'),
Loan = mongoose.model('Loan'),
util = require('util'),
View participation.server.model.js
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
Company = mongoose.model('Company'),
Loan = mongoose.model('Loan');
@wkentdag
wkentdag / index.md
Last active August 16, 2016 18:51 — forked from jescalan/index.md
Differences between jade and the spike-standards stack
View index.md

Spike v0.11.0 Migration Guide

In this release of spike, we switch posthtml for reshape. Reshape is a complete rewrite of posthtml by the static-dev team with several significant differences:

  • It returns a function by default, so that its results can be used as client-side templates
  • It has a much more clear and robust error reporting system, reporting errors that include the line/col in the original source, and exposing a code snippet to show where it came from
  • It has more clearly written documentation, more thorough tests, consistent code style, and 100% coverage on all core modules

However, as a consequence of this move, the jade plugin is no longer available. The jade plugin was always a hack, and had several crippling caveats. In addition, jade does not fit well with reshape's philosophy of breaking functionality down into small modules. As such, we have replaced ja

@wkentdag
wkentdag / index.jade
Created August 16, 2016 20:53
side-by-side comparison of a simple index page in jade and sugarML. from https://github.com/wkentdag/pow
View index.jade
extends layout
block content
main
section
- var post = locals.data.headlines[0]
#hero(style=bg)
a(href=post.perma)
h1= post.title
img(src= post.image)
.hero-overlay
View relevant wordpress tags.js
let relevant = ['ID', 'author', 'date', 'modified', 'title', 'URL', 'content', 'excerpt', 'slug', 'status', 'type', 'comment_count', 'featured_image', 'tags', 'categories', 'attachments']
return Object.keys(post).filter(prop => relevant.includes(prop)).map(prop => {
switch (prop) {
case 'foo':
break
default:
console.log(prop)
@wkentdag
wkentdag / childpx-snip.md
Created October 2, 2016 00:48
good way to call child processes inside a node script
View childpx-snip.md

elegantly call child processes within node

const node = require('when/node')
const {exec} = require('child_process')
const tplTestPath = path.join(__dirname, 'example')

function npmInstall (dir) {
  return node.call(exec, 'npm install', { cwd: dir })
}