A proof of concept of having Sinatra like routes inside your controllers.
Since the router is gone, feel free to remove config/routes.rb
.
Then add the file below to lib/action_controller/inline_routes.rb
inside your app.
import nltk | |
text = """Barack Hussein Obama II (born August 4, 1961) is the 44th and current President of the United States. He is the first African American to hold the office. Obama previously served as a United States Senator from Illinois, from January 2005 until he resigned after his election to the presidency in November 2008.""" | |
sentences = nltk.sent_tokenize(text) | |
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences] | |
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokenized_sentences] | |
chunked_sentences = nltk.batch_ne_chunk(tagged_sentences, binary=True) | |
def extract_entity_names(t): |
# This script just get the latest tracks of your friends on Last.fm and recommends those more popular. | |
# It's all based on a conversation between @mort, @rochgs, @littlemove and me (mainly by @mort) | |
# INSTRUCTIONS | |
# 1. Install lastfm gem: https://github.com/youpy/ruby-lastfm/ | |
# gem install lastfm | |
# 2. Get a Last.fm API Key on http://www.lastfm.es/api | |
require 'lastfm' |
# ======================================================= | |
# Importing and searching RSS with ElasticSearch and Tire | |
# ======================================================= | |
# | |
# This script downloads, parses and indexes Stackoverflow RSS feed with ElasticSearch | |
# via the [Tire](https://github.com/karmi/tire) Rubygem. | |
# | |
# Requirements | |
# ------------ | |
# |
# | |
# Simple Rails Template | |
# | |
# e.g: rails new myapp -d mysql -m http://.../simple-rails-template.rb | |
# | |
# Enjoy ! | |
# | |
# ~ @rgaidot | |
# |
# Activate in a modular Sinatra app: | |
# | |
# register Sinatra::Memcacher | |
# set :memcacher_enabled, true | |
# set :memcacher_expiry, 86400 | |
# Cache an action: | |
# | |
# get '/' do | |
# cache "index" do |
(($) -> | |
$.instagramPictures = (el, options) -> | |
base = this | |
base.$el = $(el) | |
base.el = el | |
base.photos = {} | |
base.$el.data "instagramPictures", base | |
base.init = -> | |
base.options = $.extend({}, $.instagramPictures.defaultOptions, options) | |
alert "The jQuery Instagram plugin need an access token" if typeof (base.options.accessToken) is "undefined" or base.options.accessToken is null |
#!/bin/bash | |
# cpustatus | |
# | |
# Prints the current state of the CPU like temperature, voltage and speed. | |
# The temperature is reported in degrees Celsius (C) while | |
# the CPU speed is calculated in megahertz (MHz). | |
function convert_to_MHz { | |
let value=$1/1000 | |
echo "$value" |
source :rubygems | |
gem "actionpack", "~> 4.0" | |
gem "railties", "~> 4.0" | |
gem "tzinfo" | |
gem "thin" |
#!/bin/bash | |
kill -9 `ps ax | grep "$1" | awk '{print $1}'` &2>/dev/null | |
echo "byebye $1 :-)" |