A minimalist append-only key/value store written in Ruby.
c = Collection.new('example.db')
c.set('hello', 'world')
c.get('hello') # => "world"
# ========================================= | |
# A toy text editor written in CoffeeScript | |
# ========================================= | |
# | |
# Requires ncurses bindings for node.js: | |
# npm install ncurses | |
# | |
# Usage: | |
# coffee editor.coffee FILENAME | |
# |
require 'mongoid' | |
require 'sinatra' | |
require_relative 'resource' | |
class Example | |
include Mongoid::Document | |
field :name | |
field :created, :type => DateTime |
(function() { | |
if (typeof module !== 'undefined' && module.exports) { | |
module.exports = Promise; | |
} else { | |
this.Promise = Promise; | |
} | |
function Promise(context) { | |
this.context = context || this; |
var BaseView = Backbone.View.extend({ | |
close: function() { | |
this.closeSubviews(); | |
this.unbindFromAll(); | |
this.off(); | |
this.remove(); | |
if (this.onClose) this.onClose(); | |
}, |
Handlebars.registerHelper('eachobj', function(object, options) { | |
var buffer = ''; | |
var empty = true; | |
for (var key in object) { | |
buffer += options.fn({ key: key, value: object[key] }); | |
empty = false; | |
} | |
if (empty) { |
var express = require('express'); | |
var im = require('imagemagick'); | |
var nettle = require('nettle'); | |
var app = express.createServer(); | |
var store = nettle.store({ url: 'mongodb://localhost:27017/mydb' }); | |
// Create Nettle processor to resize image | |
var createProcessor = function(width) { | |
store.processor(width, function(buffer, callback) { |
<snippet> | |
<content><![CDATA[return ${1:callback} ${2:err} if ${2:err}?]]></content> | |
<tabTrigger>ifer</tabTrigger> | |
<scope>source.coffee</scope> | |
<description>ifer</description> | |
</snippet> |