This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# web proxy for a neo4j database, using Heroku but could be easily modified for anything else | |
# this code is a modified version of the code found here https://github.com/akollegger/nosql-now/blob/master/web.rb | |
# the main changes are... | |
# - authentication required for modification, although viewing is allowed without authentication (auth can be added by calling protected! in the get method) | |
# - the domain returned in the data is replaced with the proxy domain instead of being removed which was causing errors in the java jersey library | |
# - modified post routing, this wasn't catching all POST requests | |
require 'sinatra' | |
require 'rest-client' | |
require 'json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Steps to get Raspberry Pi running with Mopidy and Spotify | |
1. Raspian Wheezy Installation | |
2. Install Python tools following these instructions | |
(had to run most of it as sudo): | |
http://raspberry.io/wiki/how-to-get-python-on-your-raspberrypi/ | |
3. Install Spotify libspotify | |
https://developer.spotify.com/technologies/libspotify/#download | |
4. Install Mopidy following these directions: | |
http://docs.mopidy.com/en/latest/installation/raspberrypi/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<form onsubmit="return saveText()"> | |
<label for="name">Name</label><br> | |
<input id="name" /><br> | |
<label for="desc">Description</label><br> | |
<input id="desc" /><br> | |
<input type="submit" value="Save" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :generate do | |
desc 'Generate a timestamped, empty Sequel migration.' | |
task :migration, :name do |_, args| | |
if args[:name].nil? | |
puts 'You must specify a migration name (e.g. rake generate:migration[create_events])!' | |
exit false | |
end | |
content = "Sequel.migration do\n up do\n \n end\n\n down do\n \n end\nend\n" | |
timestamp = Time.now.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lock '3.5.0' | |
set :application, 'your-app' | |
set :repo_url, 'https://github.com/your/app' | |
set :deploy_to, '/home/deploy/apps/your-app/' | |
namespace :deploy do | |
after :updated, :build do | |
on roles(:web) do | |
execute "cd '#{release_path}' && shards install" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: redis-cli publish message.achannel hello | |
require 'sinatra' | |
require 'redis' | |
conns = Hash.new {|h, k| h[k] = [] } | |
Thread.abort_on_exception = true | |
get '/' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var React = require("react"), Dom = React.DOM; | |
var LogOutButton = require('./src/logout'); | |
var events = require('api/events'); | |
var Main = React.createClass({ | |
// this mixin provides this.emitLogout, and if we set onLogout it'll be called when "logout" is emitted | |
mixins: [events.mixinFor("logout")], | |
getInitialState: function(){ | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: sidekiq beta | |
# Required-Start: $syslog $remote_fs | |
# Required-Stop: $syslog $remote_fs | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: sidekiq beta - asynchronous rails |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this to look for broken links in your app. | |
# crawls the development server http://localhost:3000 | |
# Suggestion: Also check to make sure that intentional 404s | |
# are handled gracefully by app. | |
task :crawl => :environment do | |
require 'anemone' | |
root = 'http://localhost:3000' | |
options = {:discard_page_bodies => true, :verbose => true} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ImageProxyController | |
def show | |
image = open(params[:url]) {|f| f.read } | |
send_data image, type: "image/jpeg", disposition: 'inline' | |
end | |
end |