Skip to content

Instantly share code, notes, and snippets.

show: function (req, res) {
// any negative consequences of doing this vs waiting for the request to complete and then rendering the view?
request('http://www.google.com');
res.view({
title: `Hello world`,
});
});
@otang
otang / week5.md
Created September 12, 2016 16:39

Event 1: Cindy Snatches

Workout

4 athletes on each team will complete:

AMRAP in 4 minutes:

'Cindy'

  • 5x Pullups
ChildComponent = React.createClass({
render: function() {
return (
<button onClick={this.props.onClick} />
);
@otang
otang / gist:b396d2bfcc4c2ea35380
Created November 21, 2014 05:20
ko_segment()
def word_segment(list, word)
matched = false
list.each do |segment|
matched = false
test = word.gsub(segment, '')
if word != test
matched = true
end
word = test
end
config = require 'config'
_ = require 'underscore'
module.exports = (sequelize, types) ->
Membership = sequelize.define 'Membership',
user_id: types.INTEGER
group_id: types.INTEGER
feedback_ups: types.INTEGER
feedback_downs: types.INTEGER
feedback_neutrals: types.INTEGER
query = db.Auction.find
where:
id: req.params.auction
include: [
db.User
db.Region
db.Section
{ model: db.Image, as: 'thumbnail' }
{ model: db.Image, as: 'image' }
# Seller and seller's membership info
config = require 'config'
_ = require 'underscore'
module.exports = (sequelize, types) ->
Membership = sequelize.define 'Membership',
user_id: types.INTEGER
group_id: types.INTEGER
feedback_ups: types.INTEGER
feedback_downs: types.INTEGER
feedback_neutrals: types.INTEGER
# Show
show: (req, res) ->
query = db.Auction.find
where:
id: req.params.auction
include: [
db.User
db.Region
db.Section
{model: db.Image, as: 'thumbnail'}
@otang
otang / gist:7253368
Created October 31, 2013 17:10
Change your terminal colour when SSH'ing, and change it back when done.
#!/bin/sh
tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Basic"; fi
osascript -e "tell application \"Terminal\" to set current settings of front window to settings set \"$NAME\""
}
tabc SSH # switch to theme with name
/usr/bin/ssh "$@" # run ssh
# Retrieves the root pages and their children (level 0 and level 1)
exports.getPages = (req, res) ->
getChildren = (page, callback) ->
models.Page.find({ parent_id: page._id }).sort({ name: 'asc' }).exec (err, children) ->
page.children = children || []
callback(null, page)
models.Page.find({ parent_id: null }).sort({ name: 'asc' }).exec (err, pages) ->
async.map pages, getChildren, (err, results) ->