Skip to content

Instantly share code, notes, and snippets.

@ches
ches / follow_observer_spec.rb
Last active November 29, 2018 01:34
Example of testing Rails observers in isolation for cross-cutting concerns
require 'spec_helper'
# Bustle is a pubsub system used for activity streams:
# https://github.com/fredwu/bustle
#
# Here when a person follows another (or a discussion, for instance), the observer wires
# up pubsub between them for future activity notifications. The Follow model knows nothing
# about the implementation choices for the pubsub system.
describe FollowObserver do
subject { FollowObserver.instance }
@radamant
radamant / haml_converter.rb
Created July 19, 2010 14:16
Simple haml-sass conversion for jekyll
module Jekyll
require 'haml'
class HamlConverter < Converter
safe true
priority :low
def matches(ext)
ext =~ /haml/i
end
# RSpec
require 'spec/expectations'
# Webrat
require 'webrat'
require 'test/unit/assertions'
World(Test::Unit::Assertions)
Webrat.configure do |config|
@docwhat
docwhat / Gemfile
Created October 6, 2012 03:36
Example of cross-platform Guard support gems
group :tools do
gem "guard"
gem "guard-bundler"
gem "guard-rspec"
#For detecting changes in the filesystem
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
#For displaying notices
@voodootikigod
voodootikigod / seriallogger.js
Created January 3, 2012 15:16
Log all output from a serial port connection to a log file.
/*
Simple example that takes a command line provided serial port destination and routes the output to a file of the same name with .log appended to the port name.
usage: node logger.js /dev/tty.usbserial <baudrate>
*/
var SerialPort = require("serialport");
var fs = require("fs");
var port = process.argv[2];
@biilmann
biilmann / README
Created November 8, 2011 14:37
Webpop storage module
The Basic Key/Value Store
-------------------------
Extensions now have access to a simple key/value store. To use it require the "storage" module:
var storage = require("storage");
// put an object in the store
storage.put("my-key", {title: "An object", text: "You can store any normal js object in the store});
@biilmann
biilmann / README.md
Created October 27, 2011 00:04
Webpop Calendar Extension

Calendar Extension

This is a simple calendar extension using Webpop's search API to list events.

To use the extension create a Section with entries enabled and configure the entries to have a "date" field.

Add calendar.js to your extensions folder and set the calendar section to use this extension.

In the template used to display the calendar section, you can list all future events like this:

Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');
var sys = require('sys'),
YUI = require("yui3").YUI;
YUI({
filter: 'debug',
_logExclude: {
'attribute': true,
'base': true,
'get': true,
'loader': true,
javascript:(function(){x%20=%20open().document;$(".views-field-title a").each(%20function()%20{%20x.write('[' + $(this).attr('href').replace(/\/node\//, '#') + '] : ' + $(this).text()+'<br%20/>')%20})})()