Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| # Author: Pieter Noordhuis | |
| # Description: Simple demo to showcase Redis PubSub with EventMachine | |
| # | |
| # Update 7 Oct 2010: | |
| # - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
| # the WebSocket protocol implementation in the cramp gem does not work | |
| # well with Chrome's (newer) WebSocket implementation. | |
| # | |
| # Requirements: | |
| # - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
| require 'sinatra' | |
| # Set the version of the API being run here | |
| # | |
| MAJOR_VERSION = 1 | |
| MINOR_VERSION = 0 | |
| helpers do | |
| def version_compatible?(nums) | |
| return MAJOR_VERSION == nums[0].to_i && MINOR_VERSION >= nums[1].to_i |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
| Version 2, December 2004 | |
| Copyright (C) 2011 Mathieu 'p01' Henri - http://www.p01.org/releases/ | |
| Everyone is permitted to copy and distribute verbatim or modified | |
| copies of this license document, and changing it is allowed as long | |
| as the name is changed. | |
| DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
| module Where | |
| class <<self | |
| attr_accessor :editor | |
| def is_proc(proc) | |
| source_location(proc) | |
| end | |
| def is_method(klass, method_name) | |
| source_location(klass.method(method_name)) |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| # config/initializers/active_model_serializers.rb | |
| Mongoid::Document.send(:include, ActiveModel::SerializerSupport) | |
| Mongoid::Criteria.delegate(:active_model_serializer, :to => :to_a) |
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
| require "predictionio" | |
| if (ARGV[0].nil? || ARGV[1].nil?) | |
| abort("Usage: import_ml.rb <app key> <movie lens data file>") | |
| end | |
| client = PredictionIO::Client.new(ARGV[0], | |
| 50, | |
| "http://localhost:5586") |
| #include <iostream> | |
| #ifdef __linux__ | |
| #include <SDL2/SDL.h> | |
| #elif defined(_WIN32) | |
| #include <SDL.h> | |
| #endif | |
| const int WIN_WIDTH = 640; | |
| const int WIN_HEIGHT = 480; |
| # factories | |
| class CategoryFactory(factory.alchemy.SQLAlchemyModelFactory): | |
| class Meta: | |
| model = models.Category | |
| sqlalchemy_session = db.session | |
| sqlalchemy_session_persistence = 'commit' | |
| name = factory.Sequence(lambda n: u'Category %d' % n) | |
| class CompanyFactory(factory.alchemy.SQLAlchemyModelFactory): |