Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp| def clock_angles(time) | |
| hour, min = time.split(":").map(&:to_i) | |
| ans = ((hour * 30 + min * 0.5) - (min * 6)).abs | |
| [360 - ans, ans].min | |
| end |
Install rabbitmq first: http://www.rabbitmq.com/download.html
Or brew install rabbitmq on Mac
Start it up with rabbitmq-server
Install gems to talk to the message queue:
gem install bunny
gem install amqp| #!/usr/bin/env python | |
| from flask import Flask, jsonify, request, render_template, abort | |
| from text.blob import TextBlob | |
| from text.utils import strip_punc | |
| app = Flask(__name__) | |
| ##### TextBlob API ##### | |
| @app.route("/api/sentiment", methods=['POST']) | |
| def sentiment(): |
| def thing | |
| if !this && that == true | |
| if theother.count > 44 && yo.present? | |
| # do this thing!! | |
| end | |
| end | |
| end | |
| def thing_2 | |
| if (!this && that == true) and (theother.count > 44 && yo.present?) |
| class Numeric | |
| def to_grade | |
| case self | |
| when 97..100; grade = 'A+' | |
| when 94..96; grade = 'A' | |
| when 90..93; grade = 'A-' | |
| when 87..89; grade = 'B+' | |
| when 84..86; grade = 'B' | |
| when 80..83; grade = 'B-' | |
| when 77..79; grade = 'C+' |
| function hostReachable() { | |
| // Handle IE and more capable browsers | |
| var xhr = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" ); | |
| var status; | |
| // Open new request as a HEAD to the root hostname with a random param to bust the cache | |
| xhr.open( "HEAD", "//" + window.location.hostname + "/?rand=" + Math.floor((1 + Math.random()) * 0x10000), false ); | |
| // Issue request and handle response |
| # add this to your config.rb | |
| ready do | |
| wikitargets = Hash.new | |
| wikiwords = Hash.new | |
| sitemap.resources.select {|p| p.ext == ".html" }.each do |p| | |
| unless p.data['wikitag'].nil? | |
| wikitargets[p.data['wikitag']] = p.url | |
| end |
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' do |
| gem 'pg' | |
| group :development do | |
| gem 'ruby-debug' | |
| end | |
| gem 'rake', '~> 0.8.7' | |
| gem 'devise' | |
| gem 'oa-oauth', :require => 'omniauth/oauth' | |
| gem 'omniauth' | |
| gem 'haml' | |
| gem 'dynamic_form' |
| <!DOCTYPE HTML> | |
| <html> | |
| <head> | |
| <title>Device Orientation</title> | |
| </head> | |
| <body> | |
| <script src="http://d3js.org/d3.v2.js"></script> | |
| <script> |