gem install rails
rails new my_app -T
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
#!bash | |
# | |
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
# RSpec matcher to spec delegations. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:month).to(:created_at) } | |
# it { should delegate(:year).to(:created_at) } | |
# end |
#encoding: UTF-8 | |
require 'rubygems' | |
require 'sinatra' | |
require 'erb' | |
require 'pp' | |
class Sinatra::Request | |
def pjax? | |
env['HTTP_X_PJAX'] || self['_pjax'] |
var FormView = Backbone.View.extend({ | |
el: '#form', | |
events: { | |
// Fired automatically when a file-type input is detected with a | |
// non-blank value. You can use this hook to implement a handler that | |
// will deal with those non-blank file inputs. Returning false will | |
// disallow standard form submission. | |
'ajax:aborted:file' : 'ajaxAbortedFile', |
# 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 |
linus@Newton:~$ redis-cli | |
redis 127.0.0.1:6379> publish /updates.foo "hello there!" | |
(integer) 1 | |
redis 127.0.0.1:6379> |
<!DOCTYPE html> | |
<html> | |
<body> | |
<script src="phonegap-1.0.0.js"></script> | |
<script> | |
function uploadPhoto(imageURI) { | |
function win(r) { |
RSpec::Matchers.define :validate_inclusion_of do |field, list| | |
match do |actual| | |
list.each do |i| | |
actual.should allow_value(i).for(field) | |
end | |
end | |
end |