Skip to content

Instantly share code, notes, and snippets.

Docker

What is Docker?

Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.

More info here: https://www.docker.com/whatisdocker

@update = (collection, query, field, update) ->
# Set up this object to pass in to the mongo update method.
$set = {}
# Create the $set object for mongo's update method by passing
# the doc's 'field' to the 'update' argument.
$set[field] = _.compose(update, _.reduce) field.split('.')
, (memo, accessor) -> memo[accessor] # Get field from the doc.
, collection.findOne(query)
this.update = function(collection, query, field, update) {
// Set up this object to pass in to the mongo update method.
$set = {};
// Create the $set object for mongo's update method by passing
// the doc's 'field' to the 'update' argument.
$set[field] = _.compose(update, _.reduce)(field.split('.')
, function(memo, accessor) {
return memo[accessor] // Get field from the doc.
}, collection.findOne(query));
ptext = ptext.replace(/`([^`]*)`/g, "<code>$1</code>")
.replace(/\*\*([^\*]*)\*\*/g, "<strong>$1</strong>")
.replace(/\*([^\*]*)\*/g, "<em>$1</em>")
.replace(/_([^_]*)_/g, '<span class="underline">$1</span>')
.replace(/#(\d*[a-zA-Z_]+)/g, '<a href="/channels/$1">#$1</a>')
regexps = [
regexp: /`([^`]*)`/g
flag: 'code'
,
regexp: /\*\*([^\*]*)\*\*/g
flag: 'bold'
,
regexp: /\*([^\*]*)\*/g
flag: 'em'
,
regexps =
code: regex.code
url: regex.url
channel: regex.channel
parse = (str) ->
strings = [{text: str}]
for name, regexp of regexps
for string, i in strings
if not string.token? and matches = string.text.match regexp
do -> do factorial = (n = 5) ->
if n <= 1 then 1 else n * factorial(n-1)
joinToPrev : ->
prev = messages.findOne
createdAt:
$gt: @createdAt
prev.from is @from and not a prev.mention
@knubie
knubie / gist:5227b77846bc260da79b
Last active August 29, 2015 14:04
Partial application
# Without partial application.
ajax.get('url', (data) ->
map data, (item) ->
replace item, /_/g, '-'
# With partial application.
ajax.get('url', map(replace(/_/, '-')))
#========================================

Instructions for new locale-specific additions.

Locale users can activate/deactivate vodkas for their locale.

- Got to vodkas on the main navigation.
- Click on the blue edit button next to the vodka you want to edit.
- Scroll to the bottom and change the "Activated for Locale" option to activate/deactivate.

--

Locale users can activate/deactivate cocktails for their locale.