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 | |
| # |
| (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> |
| // Include { env: 'development' } in your RequireJS config | |
| // When building (with r.js) set the value to 'production' or just omit it entirely | |
| // | |
| // Assuming the following directory structure: | |
| // - config/ | |
| // - development.js | |
| // - production.js | |
| // | |
| // Load the appropriate file based on the current env: | |
| // |
| alias redis-start="launchctl start io.redis.redis-server" | |
| alias redis-stop="launchctl stop io.redis.redis-server" | |
| alias redis-status="launchctl list | grep io.redis.redis-server" |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.js"></script> | |
| <script src="http://underscorejs.org/underscore.js"></script> | |
| <script src="http://backbonejs.org/backbone.js"></script> | |
| <script src="wings.js"></script> | |
| <script> |