Simple memcached module, derived from [gioext/sinatra-memcache][1], updated to use the 'memcached' gem.
Compatible with Sinatra 1.2
Activate in a modular Sinatra app:
register Sinatra::Memcacher| namespace :db do | |
| desc 'Open a MongoDB console with connection parameters for the current Rails.env' | |
| task :console => :environment do | |
| conn = Mongoid.master.connection | |
| opts = '' | |
| opts << ' --username ' << conn.username if conn.username rescue nil | |
| opts << ' --password ' << conn.password if conn.password rescue nil | |
| opts << ' --host ' << conn.host | |
| opts << ' --port ' << conn.port.to_s | |
| system "mongo #{opts} #{Mongoid.master.name}" |
| # .irbrc to log goodies like SQL/Mongo queries to $stdout if in Rails 3 console | |
| if defined?(Rails) && Rails.respond_to?(:logger) | |
| require 'logger' | |
| Rails.logger = Logger.new($stdout) | |
| if defined?(Mongoid) | |
| Mongoid.logger = Rails.logger | |
| end | |
| end |
| virtualenv --no-site-packages . | |
| source bin/activate | |
| bin/pip install Django psycopg2 django-sentry | |
| bin/pip freeze > requirements.txt | |
| bin/django-admin.py startproject mysite | |
| cat >.gitignore <<EOF | |
| bin/ | |
| include/ | |
| lib/ | |
| EOF |
| virtualenv --no-site-packages . | |
| source bin/activate | |
| bin/pip install Django psycopg2 django-sentry | |
| bin/pip freeze > requirements.txt | |
| bin/django-admin.py startproject mysite | |
| cat >.gitignore <<EOF | |
| bin/ | |
| include/ | |
| lib/ | |
| EOF |
| #!/bin/bash | |
| mkdir prancing_heroku | |
| cd prancing_heroku | |
| django-admin.py startproject prancing_heroku | |
| echo "Django==1.3" > requirements.txt | |
| echo "psycopg2" >> requirements.txt | |
| echo "web: prancing_heroku/run_heroku_run.sh" > Procfile |
| require 'rubygems' | |
| require 'sinatra' | |
| require 'net-ldap' | |
| require 'digest/sha1' | |
| require 'base64' | |
| require 'haml' | |
| LDAP_HOST = 'localhost' | |
| ADMIN_DN = 'cn=admin,dc=company,dc=com' |
| # 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 |
| // ==UserScript== | |
| // @name Show Full Domain on Hacker News posts | |
| // @description Sets full domain on hacker news posts. | |
| // @namespace http://userscripts.org/users/119115 | |
| // @include http://news.ycombinator.com/* | |
| // @include https://news.ycombinator.com/* | |
| // @match https://news.ycombinator.com/* | |
| // @match http://news.ycombinator.com/* | |
| // ==/UserScript== |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |